diff --git a/README.md b/README.md index b993d8887a7dcf018133645c5bff36575ab5b48a..134c6019389716c591d70a6c5c647a7a987aa5e3 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -For license, see LICENSE.md file in each directory. +For per-module licenses, see LICENSE.md file in each directory. diff --git a/dumptruckman-busscript/.github/workflows/build.yml b/dumptruckman-busscript/.github/workflows/build.yml deleted file mode 100644 index 792441813156b84a978e30cf73e831493b72d936..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/.github/workflows/build.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Build - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - - name: Cache Maven packages - uses: actions/cache@v2 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - - name: Build with Maven - run: mvn --batch-mode --update-snapshots verify - - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: artifact - path: target/*.jar - - - name: Upload plugin - uses: actions/upload-artifact@v2 - with: - name: plugin - path: | - target/*.jar - !target/*-javadoc.jar - !target/*-sources.jar diff --git a/dumptruckman-busscript/.github/workflows/publish.yml b/dumptruckman-busscript/.github/workflows/publish.yml deleted file mode 100644 index d0e4a67f04dbdc95cbb3ff5aa975bbfcc5c6ac38..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/.github/workflows/publish.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Publish - -on: - push: - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - - name: Cache Maven packages - uses: actions/cache@v2 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - - name: Publish with Maven - run: mvn --batch-mode --update-snapshots deploy - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Publish javadoc - uses: crazy-max/ghaction-github-pages@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - target_branch: gh-pages - build_dir: target/apidocs - jekyll: false diff --git a/dumptruckman-busscript/.gitignore b/dumptruckman-busscript/.gitignore deleted file mode 100644 index 3fd14a37132f41fec626c6280c84916474879e4f..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/.gitignore +++ /dev/null @@ -1,44 +0,0 @@ -# Eclipse stuff -/.classpath -/.project -/.settings -/.checkstyle - -# netbeans -/nbproject - -# we use maven! -/build.xml - -# maven -/target - -# vim -.*.sw[a-p] - -# various other potential build files -/build -/bin -/dist -/manifest.mf - -/world - -# Mac filesystem dust -*.DS_Store - -# intellij -*.iml -*.ipr -*.iws -.idea/ - -# Fern's utils -uploadtoserver.sh - -# Testing files: -debug.log - -# Doxygen -/docs/html -debug.txt diff --git a/dumptruckman-busscript/LICENSE.txt b/dumptruckman-busscript/LICENSE.txt deleted file mode 100644 index 2b6f1b921c513805eb14c9f8c3b7f58e1d3fb92d..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/LICENSE.txt +++ /dev/null @@ -1,5 +0,0 @@ -Copyright (C) dumptruckman 2012 - -This Source Code Form is subject to the terms of the Mozilla Public -License, v. 2.0. If a copy of the MPL was not distributed with this -file, You can obtain one at http://mozilla.org/MPL/2.0/. \ No newline at end of file diff --git a/dumptruckman-busscript/README b/dumptruckman-busscript/README deleted file mode 100644 index 98655289fd0fa619ef03eb2614520660c3f7cd3b..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/README +++ /dev/null @@ -1 +0,0 @@ -Bukkit plugin/library that allows extensible javascript scripts to be run \ No newline at end of file diff --git a/dumptruckman-busscript/build.gradle b/dumptruckman-busscript/build.gradle deleted file mode 100644 index fe3e82299fcb302aec41edf1b3d3c6fc3e525aaf..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/build.gradle +++ /dev/null @@ -1,91 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - */ - -plugins { - id 'java' - id 'maven-publish' -} - -repositories { - mavenLocal() - maven { - url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots/') - } - - maven { - url = uri('http://repo.onarandombox.com/content/repositories/thirdparty/') - allowInsecureProtocol true - } - - maven { - url = uri('http://nexus.hc.to/content/repositories/pub_releases/') - allowInsecureProtocol true - } - - maven { - url = uri('https://repo.maven.apache.org/maven2/') - } -} - -dependencies { - testImplementation 'junit:junit:4.12' - implementation 'org.openjdk.nashorn:nashorn-core:15.3' - compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT' - compileOnly 'net.milkbowl.vault:VaultAPI:1.6' -} - -group = 'leigh' -version = '2.0.0-SNAPSHOT' -description = 'dumptruckman-busscript' -java.sourceCompatibility = JavaVersion.VERSION_1_8 - -java { - withSourcesJar() - withJavadocJar() -} - - -publishing { - publications { - mavenJava(MavenPublication) { - artifactId = 'dumptruckman-busscript' - from components.java - versionMapping { - usage('java-api') { - fromResolutionOf('runtimeClasspath') - } - usage('java-runtime') { - fromResolutionResult() - } - } - pom { - name = 'Busscript' - description = 'Busscript' - url = 'http://leigh-co.com' - licenses { - license { - name = 'COMMERCIAL' - url = 'http://leigh-co.com' - } - } - developers { - developer { - id = 'aleigh' - name = 'Alex Leigh' - email = 'a@leigh-co.com' - } - } - } - } - } - repositories { - maven { - url = "$buildDir/repos/dist" - } - } -} - -tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' -} diff --git a/dumptruckman-busscript/config/mv_checks.xml b/dumptruckman-busscript/config/mv_checks.xml deleted file mode 100644 index 357bd14106c7b34ade0d06033c1ef2436835b099..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/config/mv_checks.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/dumptruckman-busscript/gradle/wrapper/gradle-wrapper.jar b/dumptruckman-busscript/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index e708b1c023ec8b20f512888fe07c5bd3ff77bb8f..0000000000000000000000000000000000000000 Binary files a/dumptruckman-busscript/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/dumptruckman-busscript/gradle/wrapper/gradle-wrapper.properties b/dumptruckman-busscript/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 0f80bbf516ce01e19ca7d329ef8997f131030a91..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/dumptruckman-busscript/gradlew b/dumptruckman-busscript/gradlew deleted file mode 100755 index 4f906e0c811fc9e230eb44819f509cd0627f2600..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/gradlew +++ /dev/null @@ -1,185 +0,0 @@ -#!/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=`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/dumptruckman-busscript/gradlew.bat b/dumptruckman-busscript/gradlew.bat deleted file mode 100644 index 107acd32c4e687021ef32db511e8a206129b88ec..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@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/dumptruckman-busscript/settings.gradle b/dumptruckman-busscript/settings.gradle deleted file mode 100644 index 928c5f96f86f3f4e9beb8f2bef3680b2f65aee83..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/settings.gradle +++ /dev/null @@ -1,5 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - */ - -rootProject.name = 'buscript' diff --git a/dumptruckman-busscript/src/main/java/buscript/BukkitScriptExecutor.java b/dumptruckman-busscript/src/main/java/buscript/BukkitScriptExecutor.java deleted file mode 100644 index e4fceb5ec9d9379e215beab7af905c4909e757b9..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/src/main/java/buscript/BukkitScriptExecutor.java +++ /dev/null @@ -1,17 +0,0 @@ -package buscript; - -import org.bukkit.entity.Player; - -class BukkitScriptExecutor implements ScriptExecutor { - - private final Player player; - - public BukkitScriptExecutor(Player player) { - this.player = player; - } - - @Override - public void sendMessage(String message) { - player.sendMessage(message); - } -} diff --git a/dumptruckman-busscript/src/main/java/buscript/Buscript.java b/dumptruckman-busscript/src/main/java/buscript/Buscript.java deleted file mode 100644 index 9b32efe7a489af74bf905b2a173bec26a2e8b36c..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/src/main/java/buscript/Buscript.java +++ /dev/null @@ -1,334 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -package buscript; - -import net.milkbowl.vault.chat.Chat; -import net.milkbowl.vault.economy.Economy; -import net.milkbowl.vault.permission.Permission; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.EventPriority; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.bukkit.plugin.EventExecutor; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.RegisteredListener; -import org.bukkit.plugin.RegisteredServiceProvider; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class Buscript extends ScriptManager { - - private Plugin plugin; - - private Permission permissions; - private Economy economy; - private Chat chat; - - private File scriptFile; - private FileConfiguration scriptConfig; - - boolean runTasks = true; - Map>> delayedScripts = new HashMap>>(); - - /** - * Creates a new Buscript object, which is used to execute Javascript script files. - *

This object is not thread-safe so a new one should be created for each thread.

- *

This constructor will automatically assign the variable name "plugin" to your plugin for script purposes.

- * - * @param plugin The plugin implementing this library. - */ - public Buscript(Plugin plugin) { - this(plugin, "plugin"); - } - - /** - * Creates a new Buscript object, which is used to execute Javascript script files. - * - *

This object is not thread-safe so a new one should be created for each thread.

- * - * @param plugin The plugin implementing this library. - * @param pluginScriptName The name of the variable the plugin will be referenced as in scripts. - */ - public Buscript(Plugin plugin, String pluginScriptName) { - super(new File(plugin.getDataFolder(), "scripts"), plugin.getLogger()); - this.plugin = plugin; - - // Adds the current server instance as a script variable "server". - setScriptVariable("server", plugin.getServer()); - setScriptVariable(pluginScriptName, plugin); - - // Adds all the default Buscript global methods. - addScriptMethods(new DefaultFunctions(this)); - // Sets up permissions with vault. - setupVault(); - plugin.getServer().getPluginManager().registerEvents(new VaultListener(this), plugin); - // Initializes the delayed script data. - initData(); - // Starts up a task to check for scripts that need to run at a specific time. - ScriptTask scriptTask = new ScriptTask(this); - scriptTask.start(); - // Registers events with bukkit. - plugin.getServer().getPluginManager().registerEvents(new BuscriptListener(this), plugin); - } - - private void initData() { - scriptFile = new File(getScriptFolder(), "scripts.bin"); - scriptConfig = YamlConfiguration.loadConfiguration(scriptFile); - ConfigurationSection scripts = scriptConfig.getConfigurationSection("scripts"); - if (scripts != null) { - for (String player : scripts.getKeys(false)) { - List> playerScripts = new ArrayList>(); - delayedScripts.put(player, playerScripts); - for (Object scriptObj : scripts.getList(player)) { - if (scriptObj instanceof Map) { - Map scriptMap = (Map) scriptObj; - Map script = new HashMap(2); - for (Object keyObj : scriptMap.keySet()) { - if (keyObj.toString().equals("time")) { - try { - script.put(keyObj.toString(), Long.valueOf(scriptMap.get(keyObj).toString())); - } catch (NumberFormatException e) { - getPlugin().getLogger().warning("Script data error, time reset"); - script.put(keyObj.toString(), 0); - } - }/* else if (keyObj.toString().equals("replacements")) { - Object obj = scriptMap.get(keyObj); - System.out.println(obj); - }*/ else { - script.put(keyObj.toString(), scriptMap.get(keyObj)); - } - } - playerScripts.add(script); - } - } - } - } - } - - void setupVault() { - if (getPlugin().getServer().getPluginManager().getPlugin("Vault") == null) { - return; - } - RegisteredServiceProvider permissionProvider = getPlugin().getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class); - if (permissionProvider != null) { - permissions = permissionProvider.getProvider(); - } - RegisteredServiceProvider economyProvider = getPlugin().getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class); - if (economyProvider != null) { - economy = economyProvider.getProvider(); - } - RegisteredServiceProvider chatProvider = getPlugin().getServer().getServicesManager().getRegistration(net.milkbowl.vault.chat.Chat.class); - if (chatProvider != null) { - chat = chatProvider.getProvider(); - } - updateVaultInGlobalScope(); - } - - void disableVault() { - permissions = null; - economy = null; - chat = null; - updateVaultInGlobalScope(); - } - - private void updateVaultInGlobalScope() { - // Add vault to the script's global scope as variables. - setScriptVariable("permissions", permissions); - setScriptVariable("chat", chat); - setScriptVariable("economy", economy); - } - - void saveData() { - scriptConfig.set("scripts", delayedScripts); - try { - scriptConfig.save(scriptFile); - } catch (IOException e) { - plugin.getLogger().warning("Could not save script data: " + e.getMessage()); - } - } - - /** - * Retrieves the plugin that is implementing this library. - * - * @return The plugin implementing the Buscript library. - */ - public Plugin getPlugin() { - return plugin; - } - - /** - * Gets the Vault permission API if enabled. - * - * @return the Vault permission API or null if not enabled. - */ - public Permission getPermissions() { - return permissions; - } - - /** - * Gets the Vault economy API if enabled. - * - * @return the Vault economy API or null if not enabled. - */ - public Economy getEconomy() { - return economy; - } - - /** - * Gets the Vault chat API if enabled. - * - * @return the Vault chat API or null if not enabled. - */ - public Chat getChat() { - return chat; - } - - public Object executeScript(File scriptFile, Player executor) { - return super.executeScript(scriptFile, new BukkitScriptExecutor(executor)); - } - - public Object executeScript(File scriptFile, String target, Player executor) { - return super.executeScript(scriptFile, target, new BukkitScriptExecutor(executor)); - } - - public Object executeScript(String script, String source, Player executor) { - return super.executeScript(script, source, new BukkitScriptExecutor(executor)); - } - - public Object executeScript(String script, String source, String target, Player executor) { - return super.executeScript(script, source, target, new BukkitScriptExecutor(executor)); - } - - /** - * Schedules a script to be run at a later time as specified by delay with no specified target. - * - * @param scriptFile the file to execute. - * @param delay the delay for the script in milliseconds. - */ - public void scheduleScript(File scriptFile, long delay) { - scheduleScript(scriptFile, null, delay); - } - - /** - * Schedules a script to be run at a later time as specified by delay with the specified target. - * - * @param scriptFile the file to execute. - * @param target the target of the script which is used to replace the string '%t' and is added in the global scope - * as variable 'target' - * @param delay the delay for the script in milliseconds. - */ - public void scheduleScript(File scriptFile, String target, long delay) { - if (target == null) { - target = NULL; - } - List> playerScripts = delayedScripts.get(target); - if (playerScripts == null) { - playerScripts = new ArrayList>(); - delayedScripts.put(target, playerScripts); - } - Map script = new HashMap(2); - script.put("time", System.currentTimeMillis() + delay); - script.put("file", scriptFile.toString()); - List> replacements = new ArrayList>(stringReplacers.size()); - for (StringReplacer r : stringReplacers) { - Map replacement = new HashMap(2); - String regex = r.getRegexString(); - if (regex != null) { - replacement.put("regex", regex); - } - String replace = r.getReplacement(); - if (replace != null) { - replacement.put("replace", replace); - } - String var = r.getGlobalVarName(); - if (var != null) { - replacement.put("var", var); - } - replacements.add(replacement); - } - script.put("replacements", replacements); - script.put("metaData", new HashMap(metaData)); - playerScripts.add(script); - saveData(); - } - - /** - * This method will remove any scripts scheduled to be executed for the target. Null is a valid target. - * - * @param target The target to remove scheduled scripts for. - */ - public void clearScheduledScripts(String target) { - delayedScripts.remove(target); - saveData(); - } - - /** - * Binds a script to a Bukkit event. The script will be run when the event fires with a "event" variable available - * in the script. The script file will be loaded into a cache for optimal performance. - * - * @param eventClassName The fully realized class name of the Bukkit event. - * @param priorityString The priority for the event: LOWEST, LOW, NORMAL, HIGH, HIGHEST, MONITOR. - * @param scriptFile The file containing the script. - */ - public void registerEventScript(String eventClassName, String priorityString, File scriptFile) { - EventPriority priority = EventPriority.valueOf(priorityString.toUpperCase()); - if (priority == null) { - getPlugin().getLogger().warning(priorityString + " is not a valid EventPriority!"); - return; - } - Class eventClass; - try { - eventClass = Class.forName(eventClassName); - } catch (ClassNotFoundException e) { - getPlugin().getLogger().warning(e.getMessage()); - return; - } - if (!Event.class.isAssignableFrom(eventClass)) { - getPlugin().getLogger().warning("Class must extend " + Event.class); - return; - } - Method method; - try { - method = eventClass.getDeclaredMethod("getHandlerList"); - } catch (NoSuchMethodException ignore) { - getPlugin().getLogger().warning(eventClass.getName() + " cannot be listened for!"); - return; - } - if (method == null) { - getPlugin().getLogger().warning(eventClass.getName() + " cannot be listened for!"); - return; - } - HandlerList handlerList = null; - try { - method.setAccessible(true); - Object handlerListObj = method.invoke(null); - if (handlerListObj == null || !(handlerListObj instanceof HandlerList)) { - getPlugin().getLogger().warning(eventClass.getName() + " cannot be listened for!"); - return; - } - handlerList = (HandlerList) handlerListObj; - } catch (IllegalAccessException ignore) { - getPlugin().getLogger().warning(eventClass.getName() + " cannot be listened for!"); - return; - } catch (InvocationTargetException ignore) { - getPlugin().getLogger().warning(eventClass.getName() + " cannot be listened for!"); - return; - } - Listener listener = new DefaultListener(); - EventExecutor eventExecutor = new DefaultEventExecutor(this, scriptFile.toString()); - RegisteredListener registeredListener = new RegisteredListener(listener, eventExecutor, priority, getPlugin(), false); - handlerList.register(registeredListener); - } -} diff --git a/dumptruckman-busscript/src/main/java/buscript/BuscriptListener.java b/dumptruckman-busscript/src/main/java/buscript/BuscriptListener.java deleted file mode 100644 index c39cf46ec8aaae97cbbe0a1723c64925609861d4..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/src/main/java/buscript/BuscriptListener.java +++ /dev/null @@ -1,30 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -package buscript; - -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.server.PluginDisableEvent; - -public class BuscriptListener implements Listener { - - private Buscript buscript; - - public BuscriptListener(Buscript buscript) { - this.buscript = buscript; - } - /** - * Listens for the plugin implementing Buscript to be disabled so that Buscript can be shut down properly. - * Also listens for vault to be disabled so that buscript can unhook it's API. - * - * @param event event thrown when a plugin is disabled. - */ - @EventHandler - public void pluginDisable(PluginDisableEvent event) { - if (event.getPlugin().equals(buscript.getPlugin())) { - buscript.runTasks = false; - buscript.saveData(); - } - } -} diff --git a/dumptruckman-busscript/src/main/java/buscript/BuscriptPlugin.java b/dumptruckman-busscript/src/main/java/buscript/BuscriptPlugin.java deleted file mode 100644 index 905a066c1c1266bda938983b0e4d288e980a8e82..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/src/main/java/buscript/BuscriptPlugin.java +++ /dev/null @@ -1,103 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -package buscript; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - -import javax.script.ScriptEngineFactory; -import java.io.File; -import java.io.IOException; -import java.util.logging.Level; - -/** - * The main Plugin class which allows this script library to be run as a plugin and gives access to the command "run". - */ -public class BuscriptPlugin extends JavaPlugin { - public static final ScriptEngineFactory engineFactory; - private Buscript buscript; - - static { - final javax.script.ScriptEngineManager engineManager = new javax.script.ScriptEngineManager(); - engineFactory = new org.openjdk.nashorn.api.scripting.NashornScriptEngineFactory(); - engineManager.registerEngineName("Nashorn", engineFactory); - } - - @Override - public void onEnable() { - buscript = new Buscript(this); - - getLogger().log(Level.INFO, "Manually built script engine: {}", engineFactory); - - getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() { - @Override - public void run() { - getAPI().executeScript(getStartupScript()); - } - }); - } - - public ScriptEngineFactory getEngineFactory() { - return engineFactory; - } - - /** - * Retrieves the primary API for this plugin. The object this returns is where all of the good stuff happens. - * - * @return The buscript library API. - */ - public Buscript getAPI() { - return buscript; - } - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - if (label.equalsIgnoreCase("run")) { - if (args.length < 1) { - return false; - } - File scriptFile = new File(getAPI().getScriptFolder(), args[0]); - if (!scriptFile.exists()) { - sender.sendMessage("Script '" + scriptFile + "' does not exist!"); - return true; - } - Player player = null; - if (sender instanceof Player) { - player = (Player) sender; - } - if (args.length == 1) { - getAPI().executeScript(scriptFile, new BukkitScriptExecutor(player)); - return true; - } else if (args.length == 2) { - getAPI().executeScript(scriptFile, args[1], new BukkitScriptExecutor(player)); - return true; - } - } else if (label.equalsIgnoreCase("breload")) { - buscript.clearScriptCache(); - sender.sendMessage("Script cache cleared!"); - } - return false; - } - - private File getStartupScript() { - File scriptFile = new File(getDataFolder(), "startup-script.txt"); - if (!scriptFile.exists()) { - try { - this.saveResource("startup-script.txt", false); - if (!scriptFile.exists()) { - scriptFile.createNewFile(); - } - } catch (IOException e) { - getLogger().severe("Error creating startup script file: " + e.getMessage()); - getServer().getPluginManager().disablePlugin(this); - return null; - } catch (IllegalArgumentException e) { - getLogger().info("Start up script not found in jar."); - } - } - return scriptFile; - } -} diff --git a/dumptruckman-busscript/src/main/java/buscript/DefaultEventExecutor.java b/dumptruckman-busscript/src/main/java/buscript/DefaultEventExecutor.java deleted file mode 100644 index 44279cf5a76e5fa5084bd7dc238a7dd7c50ff601..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/src/main/java/buscript/DefaultEventExecutor.java +++ /dev/null @@ -1,24 +0,0 @@ -package buscript; - -import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.EventException; -import org.bukkit.event.Listener; -import org.bukkit.plugin.EventExecutor; - -class DefaultEventExecutor implements EventExecutor { - - Buscript buscript; - String scriptFile; - - DefaultEventExecutor(Buscript buscript, String scriptFile) { - this.buscript = buscript; - this.scriptFile = scriptFile; - } - - @Override - public void execute(Listener listener, Event event) throws EventException { - buscript.setScriptVariable("event", event); - buscript.executeScript(buscript.getCachedScript(scriptFile), event.getEventName(), null, (Player) null); - } -} diff --git a/dumptruckman-busscript/src/main/java/buscript/DefaultFunctions.java b/dumptruckman-busscript/src/main/java/buscript/DefaultFunctions.java deleted file mode 100644 index 9d10a49083d123b856c00f89f5b98df6d23ac13d..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/src/main/java/buscript/DefaultFunctions.java +++ /dev/null @@ -1,133 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -package buscript; - -import buscript.util.TimeTools; -import org.bukkit.entity.Player; - -import java.io.File; - -class DefaultFunctions { - - private Buscript buscript; - - DefaultFunctions(Buscript buscript) { - this.buscript = buscript; - } - - public void broadcast(String message) { - buscript.getPlugin().getServer().broadcastMessage(buscript.stringReplace(message)); - } - - public void broadcastPerm(String message, String permission) { - buscript.getPlugin().getServer().broadcast(buscript.stringReplace(message), permission); - } - - public void command(String command) { - buscript.getPlugin().getServer().dispatchCommand(buscript.getPlugin().getServer().getConsoleSender(), buscript.stringReplace(command)); - } - - public void commandSpoof(String name, String command) { - Player player = buscript.getPlugin().getServer().getPlayerExact(buscript.stringReplace(name)); - if (player != null) { - buscript.getPlugin().getServer().dispatchCommand(player, buscript.stringReplace(command)); - } - } - - public void message(String name, String message) { - Player player = buscript.getPlugin().getServer().getPlayerExact(buscript.stringReplace(name)); - if (player != null) { - player.sendMessage(buscript.stringReplace(message)); - } - } - - public boolean hasPerm(String name, String permission) { - Player player = buscript.getPlugin().getServer().getPlayerExact(buscript.stringReplace(name)); - return player != null && player.hasPermission(permission); - } - - public boolean hasPermOffline(String world, String player, String permission) { - if (buscript.getPermissions() != null) { - return buscript.getPermissions().has(world, buscript.stringReplace(player), permission); - } else { - throw new IllegalStateException("Vault must be installed to use hasPermOffline(world, player, perm)!"); - } - } - - public void addPerm(String world, String player, String permission) { - if (buscript.getPermissions() != null) { - buscript.getPermissions().playerAdd(world, buscript.stringReplace(player), permission); - } else { - throw new IllegalStateException("Vault must be installed to use addPerm(world, player, perm)!"); - } - } - - public void removePerm(String world, String player, String permission) { - if (buscript.getPermissions() != null) { - buscript.getPermissions().playerRemove(world, buscript.stringReplace(player), permission); - } else { - throw new IllegalStateException("Vault must be installed to use removePerm(world, player, perm)!"); - } - } - - public boolean hasMoney(String player, Double money) { - if (buscript.getEconomy() != null) { - return buscript.getEconomy().has(buscript.stringReplace(player), money); - } else { - throw new IllegalStateException("Vault must be installed to use hasMoney(player, money)!"); - } - } - - public boolean addMoney(String player, Double money) { - if (buscript.getEconomy() != null) { - return buscript.getEconomy().depositPlayer(buscript.stringReplace(player), money).transactionSuccess(); - } else { - throw new IllegalStateException("Vault must be installed to use addMoney(player, money)!"); - } - } - - public boolean removeMoney(String player, Double money) { - if (buscript.getEconomy() != null) { - return buscript.getEconomy().withdrawPlayer(buscript.stringReplace(player), money).transactionSuccess(); - } else { - throw new IllegalStateException("Vault must be installed to use removeMoney(player, money)!"); - } - } - - public boolean isOnline(String name) { - return buscript.getPlugin().getServer().getPlayerExact(buscript.stringReplace(name)) != null; - } - - public void run(String script) { - buscript.executeScript(new File(buscript.getScriptFolder(), buscript.stringReplace(script))); - } - - public void runTarget(String script, String target) { - buscript.executeScript(new File(buscript.getScriptFolder(), buscript.stringReplace(script)), - buscript.stringReplace(target)); - } - - public void runLater(String script, String delay) { - long d = TimeTools.fromShortForm(delay); - buscript.scheduleScript(new File(buscript.getScriptFolder(), buscript.stringReplace(script)), d * 1000); - } - - public void runLaterTarget(String script, String delay, String target) { - long d = TimeTools.fromShortForm(delay); - buscript.scheduleScript(new File(buscript.getScriptFolder(), buscript.stringReplace(script)), - buscript.stringReplace(target), d * 1000); - } - - public void clearScripts(String target) { - buscript.clearScheduledScripts(target); - } - - public String stringReplace(String string) { - return buscript.stringReplace(string); - } - - public void registerEvent(String event, String priority, String script) { - buscript.registerEventScript(event, priority, new File(buscript.getScriptFolder(), script)); - } -} diff --git a/dumptruckman-busscript/src/main/java/buscript/DefaultListener.java b/dumptruckman-busscript/src/main/java/buscript/DefaultListener.java deleted file mode 100644 index 8477dac479b592e44f6ecb1f2e9649c81d9d2435..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/src/main/java/buscript/DefaultListener.java +++ /dev/null @@ -1,6 +0,0 @@ -package buscript; - -import org.bukkit.event.Listener; - -class DefaultListener implements Listener { -} diff --git a/dumptruckman-busscript/src/main/java/buscript/FunctionNotFoundException.java b/dumptruckman-busscript/src/main/java/buscript/FunctionNotFoundException.java deleted file mode 100644 index eb17e5d20ca35e91bb4371341d282db00afc386c..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/src/main/java/buscript/FunctionNotFoundException.java +++ /dev/null @@ -1,12 +0,0 @@ -package buscript; - -public class FunctionNotFoundException extends Exception { - - public FunctionNotFoundException() { - this(""); - } - - public FunctionNotFoundException(String message) { - super(message); - } -} diff --git a/dumptruckman-busscript/src/main/java/buscript/ScriptExecutor.java b/dumptruckman-busscript/src/main/java/buscript/ScriptExecutor.java deleted file mode 100644 index 75ac914eb8209ca27d88a57e26109c540695fa16..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/src/main/java/buscript/ScriptExecutor.java +++ /dev/null @@ -1,6 +0,0 @@ -package buscript; - -public interface ScriptExecutor { - - void sendMessage(String message); -} diff --git a/dumptruckman-busscript/src/main/java/buscript/ScriptManager.java b/dumptruckman-busscript/src/main/java/buscript/ScriptManager.java deleted file mode 100644 index c21870fa78d32fc92f273aba8811653475094cf8..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/src/main/java/buscript/ScriptManager.java +++ /dev/null @@ -1,466 +0,0 @@ -package buscript; - -import buscript.util.FileTools; -import org.bukkit.ChatColor; - -import javax.script.Bindings; -import javax.script.Invocable; -import javax.script.ScriptContext; -import javax.script.ScriptEngine; -import javax.script.ScriptEngineManager; -import javax.script.ScriptException; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.io.Reader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; - -public class ScriptManager { - private final Logger logger; - public static final String NULL = "!!NULL"; - private ScriptEngine scriptEngine = BuscriptPlugin.engineFactory.getScriptEngine(); - private Invocable invocable = (Invocable) scriptEngine; - private ScriptContext defaultContext = scriptEngine.getContext(); - private Bindings engineBindings = defaultContext.getBindings(ScriptContext.ENGINE_SCOPE); - - Object globalObject; - Object objectConstructor; - - private String target = null; - - private File scriptFolder; - - private Map scriptCache = new HashMap(); - - private List> delayedReplacements = null; - - protected final List stringReplacers = new ArrayList(); - - protected Map metaData = new HashMap(); - - private static class TargetReplacer implements StringReplacer { - - private ScriptManager scriptManager; - - private TargetReplacer(ScriptManager scriptManager) { - this.scriptManager = scriptManager; - } - - @Override - public String getRegexString() { - return "%target%"; - } - - @Override - public String getReplacement() { - return scriptManager.getTarget(); - } - - @Override - public String getGlobalVarName() { - return "target"; - } - } - - protected ScriptManager(File scriptFolder, Logger logger) { - this.logger = logger; - registerStringReplacer(new TargetReplacer(this)); - // Create script folder in plugin's directory. - this.scriptFolder = scriptFolder; - if (!getScriptFolder().exists()) { - getScriptFolder().mkdirs(); - } - // Initialize the context with a global object. - try { - globalObject = scriptEngine.eval("this"); - objectConstructor = scriptEngine.eval("Object"); - } catch (ScriptException e) { - throw new RuntimeException(e); - } - - // Adds the current server instance as a script variable "server". - engineBindings.put("metaData", metaData); - engineBindings.put("NULL", NULL); - } - - protected Logger getLogger() { - return logger; - } - - /** - * Retrieves the global scope object for this Buscript execution environment. Equivalent to the global this object - * in JS. - * - * @return The global scope object for this Buscript execution environment. - */ - public Object getGlobalScope() { - return globalObject; - } - - /** - * Gets the current script target. This may return null if the script is not set to execute on a target. - * This only updates immediately preceding a script's execution. - * - * @return The current script target or null. - */ - public String getTarget() { - return target; - } - - /** - * Returns the folder that all scripts will launch from when defined to launch from within a script. - * - * @return The folder that all scripts will launch from when defined to launch from within a script. - */ - public File getScriptFolder() { - return scriptFolder; - } - - /** - * Allows the folder that all scripts will launch from when defined to launch from within a script to be - * changed. - * - * @param folder The new folder that said scripts should launch from. - */ - public void setScriptFolder(File folder) { - if (!folder.isDirectory()) { - throw new IllegalArgumentException("folder must be a directory!"); - } - this.scriptFolder = folder; - } - - /** - * Loops through all StringReplacers registered with this Buscript object and replaces their regex strings with - * their replacement string and returns the result. By default this includes a replacement of %t with the script's - * current target. This will also replace '&' with the appropriate color character. - * - * Note: This ONLY works correctly when used from within a script function. - * - * @param string The string to replace in. - * @return The string that has had replacements for each registered StringReplacer. - */ - public String stringReplace(String string) { - if (string == null) { - throw new IllegalArgumentException("string must not be null"); - } - String result = string; - if (delayedReplacements != null) { - for (Map replacement : delayedReplacements) { - Object regex = replacement.get("regex"); - Object replace = replacement.get("replace"); - if (regex != null) { - if (replace == null) { - replace = NULL; - } - result = result.replaceAll(regex.toString(), replace.toString()); - } - } - } else { - for (StringReplacer r : stringReplacers) { - String regex = r.getRegexString(); - if (regex == null) { - continue; - } - String replace = r.getReplacement(); - if (replace == null) { - replace = NULL; - } - result = result.replaceAll(regex, replace); - } - } - result = ChatColor.translateAlternateColorCodes('&', result); - return result; - } - - /** - * Adds a new {@link StringReplacer} to this Buscript instance which will allow built in global script functions - * to replace strings as defined by the replacer. - * - * @param replacer the new StringReplacer to add. - */ - public void registerStringReplacer(StringReplacer replacer) { - Iterator it = stringReplacers.iterator(); - while (it.hasNext()) { - StringReplacer r = it.next(); - if (r.getRegexString().equals(replacer.getRegexString())) { - it.remove(); - } - } - stringReplacers.add(replacer); - } - - /** - * Adds all methods from the given obj to the global scope. - * Methods intended to be added should all have unique names or you may have conflicts. - * - * @param obj The object whose methods should be added. - */ - public void addScriptMethods(Object obj) { - try { - invocable.invokeMethod(objectConstructor, "bindProperties", globalObject, obj); - } catch (ScriptException | NoSuchMethodException e) { - e.printStackTrace(); - } - } - - /** - * Creates/sets a variable for use in the global scope. - * - * @param name The name of the variable which will be used in javascript as a "var". - * @param object Value for the variable. - */ - public void setScriptVariable(String name, Object object) { - engineBindings.put(name, object); - } - - /** - * Obtains the value of a global scope variable. - * - * @param name The name of the javascript "var" to obtain. - * @return The value of the global variable of the given name. - */ - public Object getScriptVariable(String name) { - return engineBindings.get(name); - } - - /** - * Obtains the value of a global scope variable that will be automatically casted to the type parameter. - * - * @param name The name of the javascript "var" to obtain. - * @param type A class representing the type to cast the variable's value to. - * @param The type represented by the type parameter. - * @return The value of of variable, automatically cast to the given type. If unable to cast or value is null, - * null will be returned. - */ - public T getScriptVariable(String name, Class type) { - try { - return type.cast(getScriptVariable(name)); - } catch (ClassCastException e) { - return null; - } catch (NullPointerException e) { - return null; - } - } - - /** - * Executes a javascript function. The function must be declared in the scripting environment before this is - * called. - * - * @param obj - "Scope" object for use as the 'this' object in javascript. - * @param functionName The name of the javascript function. - * @param args - Arguments for the script function. - * @return The result of the function call. - * @throws ScriptException if the calling of the function resulted in an exception. - * @throws FunctionNotFoundException if the named variable is not a function or its value is null. - */ - public Object runScriptFunction(Object obj, String functionName, Object... args) - throws FunctionNotFoundException, ScriptException { - Object o = getScriptVariable(functionName); - try { - return invocable.invokeMethod(obj, functionName, args); - } catch (NoSuchMethodException e) { - throw new FunctionNotFoundException("'" + functionName + "' is not a valid function!"); - } - } - - Object executeDelayedScript(File scriptFile, List> replacements, Map data) { - if (data != null) { - metaData = data; - } - delayedReplacements = replacements; - Object res = executeScript(scriptFile, null, null); - delayedReplacements = null; - return res; - } - - /** - * Executes the given scriptFile with no target. - * - * @param scriptFile The file to execute. - */ - public Object executeScript(File scriptFile) { - return executeScript(scriptFile, null, null); - } - - /** - * Executes the given scriptFile with no target and messages the given executor if anything goes wrong. - * - * @param scriptFile the file to execute. - * @param executor the executor to notify of errors. - */ - public Object executeScript(File scriptFile, ScriptExecutor executor) { - return executeScript(scriptFile, null, executor); - } - - /** - * Executes the given scriptFile with the given target. - * - * @param scriptFile the file to execute. - * @param target the target of the script which is used to replace the string '%t' and is added in the global scope - * as variable 'target' - */ - public Object executeScript(File scriptFile, String target) { - return executeScript(scriptFile, target, null); - } - - /** - * Executes the given scriptFile with the specified target and messages the given executor if anything goes wrong. - * - * @param scriptFile the file to execute. - * @param target the target of the script which is used to replace the string '%t' and is added in the global scope - * as variable 'target' - * @param executor the executor to notify of errors. - */ - public Object executeScript(File scriptFile, String target, ScriptExecutor executor) { - this.target = target; - Object res = runScript(scriptFile, executor); - this.target = null; - metaData.clear(); - return res; - } - - /** - * Executes the given script string (literal javascript) with no target. - * - * @param script The literal javascript to execute. - * @param source The source of the script. This can be anything except null. It is what will show up if errors - * occur. - */ - public Object executeScript(String script, String source) { - return executeScript(script, source, null, null); - } - - /** - * Executes the given script string (literal javascript) with no target and messages the given executor if - * anything goes wrong. - * - * @param script The literal javascript to execute. - * @param source The source of the script. This can be anything except null. It is what will show up if errors - * occur. - * @param executor the executor to notify of errors. - */ - public Object executeScript(String script, String source, ScriptExecutor executor) { - return executeScript(script, source, null, executor); - } - - /** - * Executes the given script string (literal javascript) with the given target. - * - * @param script The literal javascript to execute. - * @param source The source of the script. This can be anything except null. It is what will show up if errors - * occur. - * @param target the target of the script which is used to replace the string '%t' and is added in the global scope - * as variable 'target' - */ - public Object executeScript(String script, String source, String target) { - return executeScript(script, source, target, null); - } - - /** - * Executes the given script string (literal javascript) with the specified target and messages the given executor - * if anything goes wrong. - * - * @param script The literal javascript to execute. - * @param source The source of the script. This can be anything except null. It is what will show up if errors - * occur. - * @param target the target of the script which is used to replace the string '%t' and is added in the global scope - * as variable 'target' - * @param executor the executor to notify of errors. - */ - public Object executeScript(String script, String source, String target, ScriptExecutor executor) { - this.target = target; - Object res = runScript(script, executor); - this.target = null; - metaData.clear(); - return res; - } - - Object runScript(String script, ScriptExecutor executor) { - setup(); - try { - return scriptEngine.eval(script); - } catch (ScriptException e) { - getLogger().warning("Error running script: " + e.getMessage()); - if (executor != null) { - executor.sendMessage("Error running script: " + e.getMessage()); - } - return null; - } - } - - Object runScript(File script, ScriptExecutor executor) { - setup(); - try (Reader reader = new FileReader(script)){ - return scriptEngine.eval(reader); - } catch (ScriptException | IOException e) { - getLogger().warning("Error running script: " + e.getMessage()); - if (executor != null) { - executor.sendMessage("Error running script: " + e.getMessage()); - } - return null; - } - } - - private void setup() { - if (delayedReplacements != null) { - for (Map replacement : delayedReplacements) { - Object var = replacement.get("var"); - Object replace = replacement.get("replace"); - if (var != null) { - if (replace == null) { - replace = NULL; - } - setScriptVariable(var.toString(), replace); - } - } - } else { - for (StringReplacer r : stringReplacers) { - String var = r.getGlobalVarName(); - String replace = r.getReplacement(); - if (var != null) { - if (replace == null) { - replace = NULL; - } - setScriptVariable(var, replace); - } - } - } - setScriptVariable("metaData", metaData); - } - - void cacheScript(String fileName) { - File file = new File(fileName); - if (!file.exists()) { - try { - file.createNewFile(); - } catch (IOException e) { - getLogger().warning(e.getMessage()); - return; - } - } - - scriptCache.put(fileName, FileTools.readFileAsString(file, getLogger())); - } - - String getCachedScript(String fileName) { - String cached = scriptCache.get(fileName); - if (cached == null) { - cacheScript(fileName); - cached = scriptCache.get(fileName); - } - return cached != null ? cached : ""; - } - - /** - * Clears scripts that have been cached so that they may be reloaded from the disk. Scripts are typically cached - * when set bound to an event. - */ - public void clearScriptCache() { - scriptCache.clear(); - } -} diff --git a/dumptruckman-busscript/src/main/java/buscript/ScriptTask.java b/dumptruckman-busscript/src/main/java/buscript/ScriptTask.java deleted file mode 100644 index 85a2b4b7e11f1fba6965a129c9df450c1a6b2661..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/src/main/java/buscript/ScriptTask.java +++ /dev/null @@ -1,121 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -package buscript; - -import org.bukkit.plugin.Plugin; - -import java.io.File; -import java.io.IOException; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -class ScriptTask implements Runnable { - - private Buscript buscript; - private Plugin plugin; - private int id = -1; - - ScriptTask(Buscript buscript) { - this.plugin = buscript.getPlugin(); - this.buscript = buscript; - } - - void start() { - id = plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, this, 20L, 20L); - } - - void kill() { - plugin.getServer().getScheduler().cancelTask(id); - } - - @Override - public void run() { - if (!buscript.runTasks) { - kill(); - return; - } - long time = System.currentTimeMillis(); - Iterator>>> allScriptsIt = buscript.delayedScripts.entrySet().iterator(); - while (allScriptsIt.hasNext()) { - final Map.Entry>> entry = allScriptsIt.next(); - boolean removed = false; - Iterator> scriptsIt = entry.getValue().iterator(); - while (scriptsIt.hasNext()) { - final Map script = scriptsIt.next(); - if (script.get("time") != null) { - try { - long scriptTime = (Long) script.get("time"); - if (time >= scriptTime) { - if (script.get("file") != null) { - final File scriptFile = new File(script.get("file").toString()); - if (scriptFile.exists()) { - try { - final List> replacements = (List>) script.get("replacements"); - final Map metaData = (Map) script.get("metaData"); - buscript.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { - @Override - public void run() { - buscript.executeDelayedScript(scriptFile, replacements, metaData); - } - }); - scriptsIt.remove(); - removed = true; - } catch (ClassCastException e) { - plugin.getLogger().warning("Invalid delayed script entry"); - scriptsIt.remove(); - removed = true; - } - } else { - try { - scriptFile.createNewFile(); - } catch (IOException ignore) { } - if (scriptFile.exists()) { - try { - final List> replacements = (List>) script.get("replacements"); - final Map metaData = (Map) script.get("metaData"); - buscript.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { - @Override - public void run() { - buscript.executeDelayedScript(scriptFile, replacements, metaData); - } - }); - scriptsIt.remove(); - removed = true; - } catch (ClassCastException e) { - scriptsIt.remove(); - removed = true; - System.out.println("could not cast"); - } - } else { - plugin.getLogger().warning("Missing script file: " + scriptFile); - scriptsIt.remove(); - removed = true; - } - } - } else { - plugin.getLogger().warning("Invalid delayed script entry"); - scriptsIt.remove(); - removed = true; - } - } - } catch (NumberFormatException ignore) { - plugin.getLogger().warning("Invalid delayed script entry"); - scriptsIt.remove(); - removed = true; - } - } else { - plugin.getLogger().warning("Invalid delayed script entry"); - scriptsIt.remove(); - removed = true; - } - } - if (removed) { - buscript.saveData(); - } - } - } - - -} \ No newline at end of file diff --git a/dumptruckman-busscript/src/main/java/buscript/StringReplacer.java b/dumptruckman-busscript/src/main/java/buscript/StringReplacer.java deleted file mode 100644 index 82e3826aa5d37b7f380896a465955ab06b000234..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/src/main/java/buscript/StringReplacer.java +++ /dev/null @@ -1,29 +0,0 @@ -package buscript; - -/** - * Represents a regex string, usually something simple like "%t" to be replaced by another string. - */ -public interface StringReplacer { - - /** - * A regex string representing what should be replaced. - * - * @return a regex string representing what should be replaced. - */ - String getRegexString(); - - /** - * The string to replace with. This should probably return null after a script has been run. - * - * @return the string to replace with. - */ - String getReplacement(); - - /** - * If this does not return null, Buscript will create a global variable in the scripting environment with this - * as a name and {@link #getReplacement()} as a value. - * - * @return the name for a global script variable or null to not use this feature. - */ - String getGlobalVarName(); -} diff --git a/dumptruckman-busscript/src/main/java/buscript/VaultListener.java b/dumptruckman-busscript/src/main/java/buscript/VaultListener.java deleted file mode 100644 index 78466af36bb323fea9e672a8c1c78a2895f8b81a..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/src/main/java/buscript/VaultListener.java +++ /dev/null @@ -1,43 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -package buscript; - -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.server.PluginDisableEvent; -import org.bukkit.event.server.PluginEnableEvent; - -public class VaultListener implements Listener { - - private Buscript buscript; - - public VaultListener(Buscript buscript) { - this.buscript = buscript; - } - - /** - * This handler listens for Vault to be enabled so that it's api can be hooked even if the plugin implementing - * Buscript does not depend on Vault. - * - * @param event event thrown when a plugin is enabled. - */ - @EventHandler - public void pluginEnable(PluginEnableEvent event) { - if (event.getPlugin().getName().equals("Vault")) { - buscript.setupVault(); - } - } - - /** - * Listens for vault to be disabled so that buscript can unhook it's API. - * - * @param event event thrown when a plugin is disabled. - */ - @EventHandler - public void pluginDisable(PluginDisableEvent event) { - if (event.getPlugin().getName().equals("Vault")) { - buscript.disableVault(); - } - } -} diff --git a/dumptruckman-busscript/src/main/java/buscript/util/FileTools.java b/dumptruckman-busscript/src/main/java/buscript/util/FileTools.java deleted file mode 100644 index 1ea03019442c93ace8ff43080b71c27aa95fb67a..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/src/main/java/buscript/util/FileTools.java +++ /dev/null @@ -1,40 +0,0 @@ -package buscript.util; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.logging.Logger; - -public class FileTools { - - public static String readFileAsString(File file, Logger log) { - if (file == null) { - throw new IllegalArgumentException("File may not be null!"); - } - if (file.isDirectory()) { - throw new IllegalArgumentException("File may not be directory!"); - } - StringBuilder fileData = new StringBuilder(1000); - BufferedReader reader = null; - try { - reader = new BufferedReader(new FileReader(file)); - char[] buf = new char[1024]; - int numRead = 0; - while((numRead = reader.read(buf)) != -1){ - String readData = String.valueOf(buf, 0, numRead); - fileData.append(readData); - buf = new char[1024]; - } - } catch (IOException e) { - log.warning("Error reading file '" + file + "': " + e.getMessage()); - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException ignore) { } - } - } - return fileData.toString(); - } -} diff --git a/dumptruckman-busscript/src/main/java/buscript/util/TimeTools.java b/dumptruckman-busscript/src/main/java/buscript/util/TimeTools.java deleted file mode 100644 index d5647edadd2bce05e09602d5590b40dfe488b48c..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/src/main/java/buscript/util/TimeTools.java +++ /dev/null @@ -1,169 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -package buscript.util; - -public class TimeTools { - - public static String toShortForm(long second) { - long minute = second / 60; - second = second % 60; - long hour = minute / 60; - minute = minute % 60; - long day = hour / 24; - hour = hour % 24; - StringBuilder time = new StringBuilder(); - if (day != 0) { - time.append(hour).append("d "); - } - if (hour != 0) { - time.append(hour).append("h "); - } - if (minute != 0) { - time.append(minute).append("m "); - } - if (second!= 0) { - time.append(second).append("s "); - } - return time.toString().trim(); - } - - public static String toLongForm(long second) { - if (second == 0) { - return "0 seconds"; - } - long minute = second / 60; - second = second % 60; - long hour = minute / 60; - minute = minute % 60; - long day = hour / 24; - hour = hour % 24; - StringBuilder time = new StringBuilder(); - if (day != 0) { - time.append(day); - } - if (day == 1) { - time.append(" day "); - } else if (day > 1) { - time.append(" days "); - } - if (hour != 0) { - time.append(hour); - } - if (hour == 1) { - time.append(" hour "); - } else if (hour > 1) { - time.append(" hours "); - } - if (minute != 0) { - time.append(minute); - } - if (minute == 1) { - time.append(" minute "); - } else if (minute > 1) { - time.append(" minutes "); - } - if (second!= 0) { - time.append(second); - } - if (second == 1) { - time.append(" second"); - } else if (second > 1) { - time.append(" seconds"); - } - return time.toString().trim(); - } - - public static long fromShortForm(String dhms) { - long seconds = 0, minutes = 0, hours = 0, days = 0; - if (dhms.contains("d")) { - try { - days = Integer.parseInt(dhms.split("d")[0].replaceAll(" ", "")); - } catch (NumberFormatException ignore) { } - if (dhms.contains("h") || dhms.contains("m") || dhms.contains("s")) { - dhms = dhms.split("d")[1]; - } - } - if (dhms.contains("h")) { - try { - hours = Integer.parseInt(dhms.split("h")[0].replaceAll(" ", "")); - } catch (NumberFormatException ignore) { } - if (dhms.contains("m") || dhms.contains("s")) { - dhms = dhms.split("h")[1]; - } - } - if (dhms.contains("m")) { - try { - minutes = Integer.parseInt(dhms.split("m")[0].replaceAll(" ", "")); - } catch (NumberFormatException ignore) { } - if (dhms.contains("s")) { - dhms = dhms.split("m")[1]; - } - } - if (dhms.contains("s")) { - try { - seconds = Integer.parseInt(dhms.split("s")[0].replaceAll(" ", "")); - } catch (NumberFormatException ignore) { } - } - return (days * 86400) + (hours * 3600) + (minutes * 60) + seconds; - } - - public static long fromLongForm(String dhms) { - long seconds = 0, minutes = 0, hours = 0, days = 0; - if (dhms.contains("days")) { - try { - days = Integer.parseInt(dhms.split("days")[0].replaceAll(" ", "")); - } catch (NumberFormatException ignore) { } - if (dhms.contains("hours") || dhms.contains("hour") || dhms.contains("minutes") || dhms.contains("seconds") || dhms.contains("minute") || dhms.contains("second")) { - dhms = dhms.split("days")[1]; - } - } else if (dhms.contains("day")) { - try { - days = Integer.parseInt(dhms.split("day")[0].replaceAll(" ", "")); - } catch (NumberFormatException ignore) { } - if (dhms.contains("hours") || dhms.contains("hour") || dhms.contains("minutes") || dhms.contains("seconds") || dhms.contains("minute") || dhms.contains("second")) { - dhms = dhms.split("day")[1]; - } - } - if (dhms.contains("hours")) { - try { - hours = Integer.parseInt(dhms.split("hours")[0].replaceAll(" ", "")); - } catch (NumberFormatException ignore) { } - if (dhms.contains("minutes") || dhms.contains("seconds") || dhms.contains("minute") || dhms.contains("second")) { - dhms = dhms.split("hours")[1]; - } - } else if (dhms.contains("hour")) { - try { - hours = Integer.parseInt(dhms.split("hour")[0].replaceAll(" ", "")); - } catch (NumberFormatException ignore) { } - if (dhms.contains("minutes") || dhms.contains("seconds") || dhms.contains("minute") || dhms.contains("second")) { - dhms = dhms.split("hour")[1]; - } - } - if (dhms.contains("minutes")) { - try { - minutes = Integer.parseInt(dhms.split("minutes")[0].replaceAll(" ", "")); - } catch (NumberFormatException ignore) { } - if (dhms.contains("seconds") || dhms.contains("second")) { - dhms = dhms.split("minutes")[1]; - } - } else if (dhms.contains("minute")) { - try { - minutes = Integer.parseInt(dhms.split("minute")[0].replaceAll(" ", "")); - } catch (NumberFormatException ignore) { } - if (dhms.contains("seconds") || dhms.contains("second")) { - dhms = dhms.split("minute")[1]; - } - } - if (dhms.contains("seconds")) { - try { - seconds = Integer.parseInt(dhms.split("seconds")[0].replaceAll(" ", "")); - } catch (NumberFormatException ignore) { } - } else if (dhms.contains("second")) { - try { - seconds = Integer.parseInt(dhms.split("second")[0].replaceAll(" ", "")); - } catch (NumberFormatException ignore) { } - } - return (days * 86400) + (hours * 3600) + (minutes * 60) + seconds; - } -} diff --git a/dumptruckman-busscript/src/main/resources/plugin.yml b/dumptruckman-busscript/src/main/resources/plugin.yml deleted file mode 100644 index c11212457d74d6708365fe96f1a79cc154097fb8..0000000000000000000000000000000000000000 --- a/dumptruckman-busscript/src/main/resources/plugin.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Buscript -main: buscript.BuscriptPlugin -version: 2.0.0-SNAPSHOT -author: dumptruckman -softdepend: [Vault] - -commands: - run: - description: Runs the given script file with an optional target - usage: / - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lc-esp-kabe/src/main/resources/lc/esp/kensho/test.vm b/lc-esp-kabe/src/main/resources/lc/esp/kensho/test.vm deleted file mode 100644 index 1c71cbc863fae72be69a14bd23bb5d9db6937161..0000000000000000000000000000000000000000 --- a/lc-esp-kabe/src/main/resources/lc/esp/kensho/test.vm +++ /dev/null @@ -1 +0,0 @@ -Hello World! The time is now ${now}. \ No newline at end of file diff --git a/lc-esp-keikai-sdk/LICENSE.md b/lc-esp-keikai-sdk/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/lc-esp-keikai-sdk/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-esp-keikai-sdk/build.gradle b/lc-esp-keikai-sdk/build.gradle deleted file mode 100644 index b5334ae15ea6677fcd3fb1f44503578a06391228..0000000000000000000000000000000000000000 --- a/lc-esp-keikai-sdk/build.gradle +++ /dev/null @@ -1,34 +0,0 @@ -plugins { - id 'java' - id 'java-library' - id 'application' -} -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 - -group 'leigh' -version '16.0' - -repositories { - mavenCentral() -} - -dependencies { - api project(':lc-esp-sdk') - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} - -application { - mainClass = 'leigh.esp.keikai.sdk.KeikaiClient' -} - -startScripts { - doLast { - unixScript.text = unixScript.text.replace('DEFAULT_JVM_OPTS=""', 'DEFAULT_JVM_OPTS="--illegal-access=permit"') - } -} \ No newline at end of file diff --git a/lc-esp-keikai-sdk/src/main/java/lc/esp/keikai/sdk/KeikaiClient.java b/lc-esp-keikai-sdk/src/main/java/lc/esp/keikai/sdk/KeikaiClient.java deleted file mode 100644 index 21713da2a8bb7f44a53f01b5380e6212c3252bf4..0000000000000000000000000000000000000000 --- a/lc-esp-keikai-sdk/src/main/java/lc/esp/keikai/sdk/KeikaiClient.java +++ /dev/null @@ -1,59 +0,0 @@ -package lc.esp.keikai.sdk; - -import lc.eo.EO; -import lc.esp.sdk.ESPClient; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.UniversalJob; - -public class KeikaiClient implements Runnable { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(KeikaiClient.class); - public static String SRC_URI = "srcUri"; - public static String DST_URI = "dstUri"; - private final String kabeServer; - private final String srcUri; - private final String dstUri; - - public KeikaiClient(String kabeServer, String srcUri, String dstUri) { - this.kabeServer = kabeServer; - this.srcUri = srcUri; - this.dstUri = dstUri; - } - - public static void main(String[] args) { - if (args.length != 3) { - logger.info("Usage: KeikaiClient kabe_url src_uri dst_url"); - System.exit(UniversalJob.RET_BADARGS); - } - - KeikaiClient client = new KeikaiClient(args[0], args[1], args[2]); - client.run(); - } - - @Override - public void run() { - ESPClient ctx = new ESPClient(kabeServer); - - EO req = new EO(); - req.setValue(SRC_URI, srcUri); - req.setValue(DST_URI, dstUri); - - logger.info("Attempting to register service... [kabe: {}] [src: {}] [dst: {}]", kabeServer, srcUri, dstUri); - - while (true) { - try { - - ctx.request("/keikai/v1", req); - logger.debug("Done."); - } catch (Exception e) { - // Do nothing - } - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // Do nothing - } - } - } -} diff --git a/lc-esp-kensho-sdk/LICENSE.md b/lc-esp-kensho-sdk/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/lc-esp-kensho-sdk/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-esp-kensho-sdk/build.gradle b/lc-esp-kensho-sdk/build.gradle deleted file mode 100644 index 54172a639a1e78f41b4c10c3fe9769dfe632c1d1..0000000000000000000000000000000000000000 --- a/lc-esp-kensho-sdk/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -plugins { - id 'java' - id 'java-library' -} -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 - -group 'leigh' -version '16.0' - -repositories { - mavenCentral() -} - -dependencies { - api project(':lc-esp-sdk') - api project(':lc-eo-schema') - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/lc-esp-kensho-sdk/src/main/java/lc/kensho/sdk/KenshoSchemaGeneratorApp.java b/lc-esp-kensho-sdk/src/main/java/lc/kensho/sdk/KenshoSchemaGeneratorApp.java deleted file mode 100644 index 3669401c8475ddf5f570f3268113aab29b6d71aa..0000000000000000000000000000000000000000 --- a/lc-esp-kensho-sdk/src/main/java/lc/kensho/sdk/KenshoSchemaGeneratorApp.java +++ /dev/null @@ -1,30 +0,0 @@ -package lc.kensho.sdk; - -import lc.eo.EO; -import lc.eo.schema.DAOGenerator; -import lc.eo.schema.dao.SchemaUtil; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.UniversalJob; - -import java.io.File; -import java.io.FileNotFoundException; - -public class KenshoSchemaGeneratorApp { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(KenshoSchemaGeneratorApp.class); - - public static EO generate() { - final EO schema = SchemaUtil.create(SchemaUtil.API_KEY); - return schema; - } - - public static void main(final String... args) throws FileNotFoundException { - UniversalJob.banner(logger, "Apotheosis mk3", "2014 Alex Leigh"); - final EO schema = generate(); - final DAOGenerator gen = new DAOGenerator(new File("leigh-esp-kensho-sdk/src/main/java")); - gen.generateJava("leigh.esp.kensho.sdk.schema.v1", schema); - - logger.info("Generated schema: {}", schema); - } -} - diff --git a/lc-esp-sdk/.gitignore b/lc-esp-sdk/.gitignore deleted file mode 100644 index ede7310f5aa22a8bb16f7393dedac5d9b0cba2c9..0000000000000000000000000000000000000000 --- a/lc-esp-sdk/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -kabe.log -velocity.log -.DS_Store -statistic.xml -.gradle -/*/build/ -/build/ -gradle-app.setting -!gradle-wrapper.jar -.gradletasknamecache -.idea/ -*.iml -out/ -.cache -node_modules -/*/.idea -.vi -/*/graph.eo -.vai -graph.bak -.idea -tests.vai -vds.log -hosts.json -tests.vai.old \ No newline at end of file diff --git a/lc-esp-sdk/LICENSE.md b/lc-esp-sdk/LICENSE.md deleted file mode 100644 index 226d1f25b12e58e21c29a6c1869d1ec05095d443..0000000000000000000000000000000000000000 --- a/lc-esp-sdk/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-esp-sdk/build.gradle b/lc-esp-sdk/build.gradle deleted file mode 100644 index 7ce1ddd1d6323f3e31f48ef64e97522e40d43fed..0000000000000000000000000000000000000000 --- a/lc-esp-sdk/build.gradle +++ /dev/null @@ -1,73 +0,0 @@ -plugins { - id 'java' - id 'java-library' - id 'maven-publish' -} - -// Because of Android -sourceCompatibility = JavaVersion.VERSION_11 -targetCompatibility = JavaVersion.VERSION_11 - -repositories { - mavenCentral() -} - -version leigh_esp_sdk - -dependencies { - api project(':lc-eo-schema') - api project(':lc-mecha') - api project(':lc-eo-json') - api project(':lc-mecha-http-client') - // This is really for HttpClient / Esp - api 'commons-logging:commons-logging:1.2' - api 'org.apache.httpcomponents:httpclient:4.5.13' - api 'org.apache.httpcomponents:httpmime:4.5.13' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} - - -publishing { - publications { - mavenJava(MavenPublication) { - artifactId = 'leigh-esp-sdk' - from components.java - versionMapping { - usage('java-api') { - fromResolutionOf('runtimeClasspath') - } - usage('java-runtime') { - fromResolutionResult() - } - } - pom { - name = 'LEIGH ESP SDK' - description = 'ESP SDK' - url = 'http://leigh-co.com' - licenses { - license { - name = 'COMMERCIAL' - url = 'http://leigh-co.com' - } - } - developers { - developer { - id = 'aleigh' - name = 'Alex Leigh' - email = 'a@leigh-co.com' - } - } - } - } - } - repositories { - maven { - url = "$buildDir/repos/dist" - } - } -} diff --git a/lc-esp-sdk/src/main/java/lc/esp/sdk/ContentPart.java b/lc-esp-sdk/src/main/java/lc/esp/sdk/ContentPart.java deleted file mode 100644 index 923711e3804df53a02c15ed02a55c930a226fb41..0000000000000000000000000000000000000000 --- a/lc-esp-sdk/src/main/java/lc/esp/sdk/ContentPart.java +++ /dev/null @@ -1,70 +0,0 @@ -package lc.esp.sdk; - -import org.apache.http.entity.ContentType; -import org.apache.http.entity.mime.MultipartEntityBuilder; - -import java.io.InputStream; -import java.util.Objects; - -/** - * A simple class to hold a content part. - * - * @author Alex Leigh - */ -public class ContentPart { - private final InputStream inputStream; - private final String name; - private final String mimeType; - private final boolean isText; - - public ContentPart(InputStream inputStream, String name, String mimeType, boolean isText) { - this.inputStream = inputStream; - this.name = name; - this.mimeType = mimeType; - this.isText = isText; - } - - public void addToBuilder(MultipartEntityBuilder builder) { - builder.addBinaryBody(name, inputStream, ContentType.create(mimeType), null); - } - - public String getName() { - return name; - } - - public InputStream getInputStream() { - return inputStream; - } - - public String getMimeType() { - return mimeType; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - ContentPart that = (ContentPart) o; - return isText == that.isText && Objects.equals(inputStream, that.inputStream) - && Objects.equals(name, that.name) && Objects.equals(mimeType, that.mimeType); - } - - @Override - public String toString() { - return "ContentPart{" + - "inputStream=" + inputStream + - ", name='" + name + '\'' + - ", mimeType='" + mimeType + '\'' + - ", isText=" + isText + - '}'; - } - - @Override - public int hashCode() { - return Objects.hash(inputStream, name, mimeType, isText); - } - - public boolean isText() { - return isText; - } -} diff --git a/lc-esp-sdk/src/main/java/lc/esp/sdk/ContentTypes.java b/lc-esp-sdk/src/main/java/lc/esp/sdk/ContentTypes.java deleted file mode 100644 index 0f758a9b85e3f3dc98a79cc557f3d46c6ddd0e87..0000000000000000000000000000000000000000 --- a/lc-esp-sdk/src/main/java/lc/esp/sdk/ContentTypes.java +++ /dev/null @@ -1,7 +0,0 @@ -package lc.esp.sdk; - -public class ContentTypes { - public final static String CONTENT_TYPE_FST = "application/fst"; - public final static String CONTENT_TYPE_JSON = "application/json"; - public final static String CONTENT_TYPE_TEXT = "text/plain"; -} diff --git a/lc-esp-sdk/src/main/java/lc/esp/sdk/EOResponseConsumer.java b/lc-esp-sdk/src/main/java/lc/esp/sdk/EOResponseConsumer.java deleted file mode 100644 index 00fda73ac64a389768a55c4508cdbeaee528132d..0000000000000000000000000000000000000000 --- a/lc-esp-sdk/src/main/java/lc/esp/sdk/EOResponseConsumer.java +++ /dev/null @@ -1,7 +0,0 @@ -package lc.esp.sdk; - -import lc.eo.EO; - -public interface EOResponseConsumer { - void handle(EO obj) throws Exception; -} diff --git a/lc-esp-sdk/src/main/java/lc/esp/sdk/ESPClient.java b/lc-esp-sdk/src/main/java/lc/esp/sdk/ESPClient.java deleted file mode 100644 index eae9810e1f8c10dea76935b8143d72d715192d06..0000000000000000000000000000000000000000 --- a/lc-esp-sdk/src/main/java/lc/esp/sdk/ESPClient.java +++ /dev/null @@ -1,236 +0,0 @@ -package lc.esp.sdk; - -import lc.eo.EO; -import lc.eo.io.EOInputStream; -import lc.eo.json.JsonInput; -import lc.eo.json.JsonOutput; -import lc.esp.sdk.link23.Link23Request; -import lc.esp.sdk.link23.Link23Response; -import lc.mecha.http.client.PersistentCookieStore; -import lc.mecha.lang.FutureResult; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ByteArrayEntity; -import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.client.LaxRedirectStrategy; -import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Path; -import java.util.List; - -/** - * This class implements a network client for the Enhanced Services Platform (ESP). - * - * @author Alex Leigh - */ -public class ESPClient { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(ESPClient.class); - private final CloseableHttpClient httpClient; - private final String doorUrl; - - public ESPClient(String doorUrl) { - this.doorUrl = doorUrl; - PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); - cm.setMaxTotal(200); - cm.setDefaultMaxPerRoute(20); - httpClient = HttpClientBuilder.create(). - setRedirectStrategy(new LaxRedirectStrategy()).setConnectionManager(cm).build(); - } - - public ESPClient(String doorUrl, Path cookieDb) throws IOException, ClassNotFoundException { - this.doorUrl = doorUrl; - PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); - cm.setMaxTotal(200); - cm.setDefaultMaxPerRoute(20); - - PersistentCookieStore cookieStore = PersistentCookieStore.loadOrNew(cookieDb); - - httpClient = HttpClientBuilder.create().setDefaultCookieStore(cookieStore). - setRedirectStrategy(new LaxRedirectStrategy()).setConnectionManager(cm).build(); - } - - public Link23Response link23Request(String path, EO data) throws IOException { - HttpPost post = new HttpPost(doorUrl + path); - post.setHeader("Content-type", ContentTypes.CONTENT_TYPE_JSON); - - if (data != null) { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - logger.debug("Sending request: {}", data); - JsonOutput out = new JsonOutput(bos); - out.writeEO(data); - post.setEntity(new ByteArrayEntity(bos.toByteArray())); - } - - CloseableHttpResponse response = httpClient.execute(post); - if (response.getStatusLine().getStatusCode() != 200) { - throw new IOException("ESP returned other than 200. Status: [" - + response.getStatusLine().getStatusCode() + "] [path: [" + path + "]"); - } - - return new Link23Response(response); - } - - public Link23Response link23Request(String path, EOInputStream data) throws IOException { - HttpPost post = new HttpPost(doorUrl + path); - post.setHeader("Content-type", ContentTypes.CONTENT_TYPE_JSON); - - if (data != null) { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - logger.debug("Sending request: {}", data); - JsonOutput out = new JsonOutput(bos); - while (true) { - EO obj = data.readEo(); - if (obj == null) break; - out.writeEO(obj); - } - post.setEntity(new ByteArrayEntity(bos.toByteArray())); - } - - CloseableHttpResponse response = httpClient.execute(post); - if (response.getStatusLine().getStatusCode() != 200) { - throw new IOException("ESP returned other than 200. Status: [" - + response.getStatusLine().getStatusCode() + "] [path: [" + path + "]"); - } - - return new Link23Response(response); - } - - /** - * Perform a multipart request. - */ - public Link23Response request(String path, EO data, List parts) throws Exception { - MultipartEntityBuilder mimeBuilder = MultipartEntityBuilder.create(); - HttpPost post = new HttpPost(doorUrl + path); - - - // TODO We are leaking the bos, technically, but it should gc - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - logger.debug("Sending request: {}", data); - JsonOutput out = new JsonOutput(bos); - out.writeEO(data); - mimeBuilder.addTextBody(Link23Request.MULTIPART_REQUEST_KEY, bos.toString()); - - - for (ContentPart part : parts) { - logger.info("Adding part to request: {}", part); - part.addToBuilder(mimeBuilder); - } - - post.setEntity(mimeBuilder.build()); - - CloseableHttpResponse response = httpClient.execute(post); - - if (response.getStatusLine().getStatusCode() != 200) { - throw new IOException("ESP returned other than 200. Status: [" - + response.getStatusLine().getStatusCode() + "] [path: [" + path + "]"); - } - - return new Link23Response(response); - } - - /** - * Perform an ESP API request, and return the result as EOs. - *

- * If the response fails to contain any data, response.handle() will be called with - * null once. This indicates that the request has completed processing and no data - * has been returned. - */ - public FutureResult apiRequest(String path, EO data, List parts) { - final FutureResult fr = new FutureResult<>(); - new Thread(() -> { - try { - fr.set(request(path, data, parts)); - // TODO: Set an error here instead - } catch (Exception e) { - fr.set(null); - e.printStackTrace(); - } - }).start(); - return fr; - } - - public FutureResult apiRequest(String path, EO data) { - final FutureResult fr = new FutureResult<>(); - new Thread(() -> { - try { - fr.set(link23Request(path, data)); - } catch (Exception e) { - // TODO: Set an error here instead - fr.set(null); - e.printStackTrace(); - } - }).start(); - return fr; - } - - @Deprecated - public void request(String path, EO data) throws Exception { - request(path, data, (ResponseConsumer) null); - } - - /** - * Perform a singlepart request against the HTTP endpoint, and return an input stream for the response content. - *

- * This request form holds the encoded version of the entire request in RAM temporarily. - */ - @Deprecated - public void request(String path, EO data, ResponseConsumer consumer) throws Exception { - HttpPost post = new HttpPost(doorUrl + path); - post.setHeader("Content-type", ContentTypes.CONTENT_TYPE_JSON); - - if (data != null) { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - logger.debug("Sending request: {}", data); - JsonOutput out = new JsonOutput(bos); - out.writeEO(data); - post.setEntity(new ByteArrayEntity(bos.toByteArray())); - } - - try (CloseableHttpResponse response = httpClient.execute(post)) { - if (response.getStatusLine().getStatusCode() != 200) { - throw new IOException("ESP returned other than 200. Status: [" - + response.getStatusLine().getStatusCode() + "] [path: [" + path + "]"); - } - if (consumer != null) { - consumer.drainResponse(response.getEntity().getContent()); - } - } - } - - /** - * Perform an ESP API request, and return the result as EOs. - *

- * If the response fails to contain any data, response.handle() will be called with - * null once. This indicates that the request has completed processing and no data - * has been returned. - */ - @Deprecated - public void apiRequest(String path, EO data, EOResponseConsumer response) throws Exception { - // TODO: If the response errored (vs 200 w/ no data), we should do something special to indicate it to the - // caller, who may care. - request(path, data, new ResponseConsumer() { - @Override - public void drainResponse(InputStream is) throws Exception { - JsonInput in = new JsonInput(is); - boolean hasWritten = false; - while (true) { - EO obj = in.readEo(); - if (obj != null) { - response.handle(obj); - hasWritten = true; - } else { - if (!hasWritten) response.handle(null); - return; - } - } - } - }); - } -} diff --git a/lc-esp-sdk/src/main/java/lc/esp/sdk/ResponseConsumer.java b/lc-esp-sdk/src/main/java/lc/esp/sdk/ResponseConsumer.java deleted file mode 100644 index e6e75cba7ad146c42f536f3722edd2e9251dec45..0000000000000000000000000000000000000000 --- a/lc-esp-sdk/src/main/java/lc/esp/sdk/ResponseConsumer.java +++ /dev/null @@ -1,8 +0,0 @@ -package lc.esp.sdk; - -import java.io.InputStream; - -@Deprecated -public interface ResponseConsumer { - void drainResponse(InputStream is) throws Exception; -} diff --git a/lc-esp-sdk/src/main/java/lc/esp/sdk/SchemaGeneratorApp.java b/lc-esp-sdk/src/main/java/lc/esp/sdk/SchemaGeneratorApp.java deleted file mode 100644 index 26e330d6df96118af0f884539bb803fd8372506d..0000000000000000000000000000000000000000 --- a/lc-esp-sdk/src/main/java/lc/esp/sdk/SchemaGeneratorApp.java +++ /dev/null @@ -1,36 +0,0 @@ -package lc.esp.sdk; - -import lc.eo.EO; -import lc.eo.schema.DAOGenerator; -import lc.eo.schema.dao.ElementElementDAO; -import lc.eo.schema.dao.SchemaElementDAO; -import lc.eo.schema.dao.SchemaUtil; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.UniversalJob; - -import java.io.File; -import java.io.FileNotFoundException; - -public class SchemaGeneratorApp { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(SchemaGeneratorApp.class); - - public static EO generate() { - final EO schema = SchemaUtil.create(SchemaUtil.API_KEY); - - final EO moveEvent = ElementElementDAO.create(); - SchemaElementDAO.getElements(schema).add(moveEvent); - ElementElementDAO.setApiName(moveEvent, "leigh.esp.link23.Heartbeat"); - - return schema; - } - - public static void main(final String... args) throws FileNotFoundException { - UniversalJob.banner(logger, "Apotheosis mk3", "2014 Alex Leigh"); - final EO schema = generate(); - final DAOGenerator gen = new DAOGenerator(new File("leigh-esp-sdk/src/main/java")); - gen.generateJava("leigh.esp.sdk.link23.schema", schema); - - logger.info("Generated schema: {}", schema); - } -} diff --git a/lc-esp-sdk/src/main/java/lc/esp/sdk/link23/Link23Request.java b/lc-esp-sdk/src/main/java/lc/esp/sdk/link23/Link23Request.java deleted file mode 100644 index 9b79f473000095b56dcef2cd33d18f3413b950db..0000000000000000000000000000000000000000 --- a/lc-esp-sdk/src/main/java/lc/esp/sdk/link23/Link23Request.java +++ /dev/null @@ -1,5 +0,0 @@ -package lc.esp.sdk.link23; - -public class Link23Request { - public static String MULTIPART_REQUEST_KEY = "leigh.esp.link23.request"; -} diff --git a/lc-esp-sdk/src/main/java/lc/esp/sdk/link23/Link23Response.java b/lc-esp-sdk/src/main/java/lc/esp/sdk/link23/Link23Response.java deleted file mode 100644 index 330dcd6f89837d3f7347a9484c71906e760182bd..0000000000000000000000000000000000000000 --- a/lc-esp-sdk/src/main/java/lc/esp/sdk/link23/Link23Response.java +++ /dev/null @@ -1,47 +0,0 @@ -package lc.esp.sdk.link23; - -import lc.eo.EO; -import lc.eo.io.EOInputStream; -import lc.eo.json.JsonInput; -import org.apache.http.client.methods.CloseableHttpResponse; - -import java.io.IOException; -import java.io.InputStream; - -public class Link23Response implements AutoCloseable { - private final CloseableHttpResponse response; - - @Override - public String toString() { - return "Link23Response{" + - "response=" + response + - '}'; - } - - public Link23Response(CloseableHttpResponse response) { - this.response = response; - } - - public InputStream getInputStream() throws IOException { - return response.getEntity().getContent(); - } - - public String getContentType() { - return response.getEntity().getContentType().getValue(); - } - - public EOInputStream getResponseEoStream() throws IOException { - return new JsonInput(response.getEntity().getContent()); - } - - public EO getResponse() throws Exception { - try (EOInputStream is = getResponseEoStream()) { - return is.readEo(); - } - } - - @Override - public void close() throws Exception { - response.close(); - } -} diff --git a/lc-esp-sdk/src/main/java/lc/esp/sdk/link23/schema/HeartbeatElementDAO.java b/lc-esp-sdk/src/main/java/lc/esp/sdk/link23/schema/HeartbeatElementDAO.java deleted file mode 100644 index 57589aa964f3ee665eaccaf4a839e090b93d801e..0000000000000000000000000000000000000000 --- a/lc-esp-sdk/src/main/java/lc/esp/sdk/link23/schema/HeartbeatElementDAO.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2014-2021, by Alex Leigh. - * All rights reserved. - * - * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE - * The copyright notice above does not evidence any - * actual or intended publication of such source code. - */ - -package lc.esp.sdk.link23.schema; - -import lc.eo.EO; - -/** -* This is a dynamically generated DAO class for accessing objects within an ESP graph. This class -* has been generated by DAOGenerator and should not be modified. -* -* @author DAOGenerator (synthetically generated class) -*/ -public final class HeartbeatElementDAO { -public static final String API_TYPE = "leigh.esp.link23.Heartbeat"; - -public static EO create() { -EO eo = new EO(API_TYPE); -return eo; -} - -public static boolean assertType(final EO eo) { -return eo.getApiType().equals(API_TYPE); -} - - -public static String apiType(final EO eo) { -return eo.getApiType(); -} - - -} \ No newline at end of file diff --git a/lc-esp-service-sdk/LICENSE.md b/lc-esp-service-sdk/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/lc-esp-service-sdk/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-esp-service-sdk/build.gradle b/lc-esp-service-sdk/build.gradle deleted file mode 100644 index 4354bfbc8221190b7485ad4a8f1eaefbe93938c6..0000000000000000000000000000000000000000 --- a/lc-esp-service-sdk/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -plugins { - id 'java' - id 'java-library' -} -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -group 'leigh' -version '16.0' - -repositories { - mavenCentral() -} - -dependencies { - api project(':lc-esp-keikai-sdk') - api project(':lc-eo-schema') - api project(':lc-mecha-http-server') - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/lc-esp-service-sdk/src/main/java/lc/esp/sdk/service/MicroService.java b/lc-esp-service-sdk/src/main/java/lc/esp/sdk/service/MicroService.java deleted file mode 100644 index 322329a85aab7add668af0cf6d14623e3c508c4a..0000000000000000000000000000000000000000 --- a/lc-esp-service-sdk/src/main/java/lc/esp/sdk/service/MicroService.java +++ /dev/null @@ -1,150 +0,0 @@ -package lc.esp.sdk.service; - -import jakarta.servlet.MultipartConfigElement; -import jakarta.servlet.ServletException; -import jakarta.servlet.http.Part; -import lc.eo.EO; -import lc.eo.io.EOInputStream; -import lc.eo.json.JsonInput; -import lc.eo.json.JsonOutput; -import lc.esp.keikai.sdk.KeikaiClient; -import lc.esp.sdk.ESPClient; -import lc.esp.sdk.link23.Link23Request; -import lc.esp.sdk.service.schema.v1.MicroServiceCfgElementDAO; -import lc.mecha.fabric.HandlerStatus; -import lc.mecha.fabric.LiteralMessageSubscription; -import lc.mecha.http.server.PrefixedHandler; -import lc.mecha.http.server.WebPipeline; -import lc.mecha.http.server.WebServer; -import lc.mecha.http.server.WebTransaction; -import lc.mecha.io.FileUtil; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.net.NetworkPortUtils; -import org.eclipse.jetty.server.Request; - -import java.io.IOException; -import java.net.InetAddress; -import java.nio.charset.StandardCharsets; -import java.util.HashSet; - -/** - * A basic implementation of an Enhanced Services Platform (ESP) micro-service. A micro-service registers itself - * with a Kabe instance via KeiKai and presents a service interface to remote callers. This is distinguished from - * ESP clients, which may consume services through Kabe, but do not present any themselves. If you need a - * client and not a service, see the {@link ESPClient} class. - *

- * This implementation will detect the local system's hostname and will find an available TCP/IP port. Therefore, - * the system hostname must be set properly to something reachable by all the Kabe servers. - *

- * This implementation only provides support for a single {@link PrefixedHandler} for the sake of simplicity. If - * multiple handlers are required to implement the service, they can be routed internally from the base handler - * the caller provides. - * - * @author Alex Leigh - */ -public abstract class MicroService extends PrefixedHandler implements Runnable { - public final static String LOCAL_PREFIX = "/svc"; - private static final MechaLogger logger = MechaLoggerFactory.getLogger(MicroService.class); - private final static HashSet prefixes = new HashSet<>(); - - static { - prefixes.add(MicroService.LOCAL_PREFIX); - } - - private final KeikaiClient keikaiClient; - private final WebServer webserver; - // TODO: Do this right - private final MultipartConfigElement MULTI_PART_CONFIG = - new MultipartConfigElement(String.valueOf(FileUtil.createTmpDirectory("esp", ".tmp"))); - private boolean isRunning = false; - - public MicroService(EO cfg) throws IOException { - super(prefixes); - String hostAddress = InetAddress.getLocalHost().getHostName(); - int localPort = NetworkPortUtils.findFreePort(); - - String localUrl = "http://" + hostAddress + ":" + localPort + LOCAL_PREFIX; - logger.info("Initializing. [host: {}] [localUrl: {}]", hostAddress, localUrl); - - keikaiClient = new KeikaiClient(MicroServiceCfgElementDAO.getKabeUrl(cfg), - MicroServiceCfgElementDAO.getSrcUri(cfg), - localUrl); - - webserver = new WebServer(localPort, 1000); - - prefixes.add(LOCAL_PREFIX); - webserver.getWebPipeline().getServicePipeline().getSubscriptionBase().subscribe( - new LiteralMessageSubscription<>(this, WebPipeline.KEY_SERVICE)); - } - - @Override - public void run() { - isRunning = true; - new Thread(keikaiClient).start(); - webserver.start(); - } - - /** - * Return an {@link EOInputStream} representing the request. If there was no request, null - * is returned. - *

- * If this is a multi-part request, then multi-part processing will be performed. The method will look for - * a Link23 request located in one of the parts. Clients should send this part first, ideally, to reduce - * processing latency. - */ - public EOInputStream getInputStream(WebTransaction txn) throws IOException, ServletException { - logger.info("Mime-type: {}", txn.httpServletRequest.getContentType()); - - if (!txn.isMultipartRequest()) { - return new JsonInput(txn.httpServletRequest.getInputStream()); - } - - txn.request.setAttribute(Request.__MULTIPART_CONFIG_ELEMENT, MULTI_PART_CONFIG); - Part p = txn.httpServletRequest.getPart(Link23Request.MULTIPART_REQUEST_KEY); - if (p == null) return null; - - return new JsonInput(p.getInputStream()); - } - - public EO getInputObject(WebTransaction txn) throws Exception { - try (EOInputStream is = getInputStream(txn)) { - return is.readEo(); - } - } - - @Override - public String toString() { - return "MicroService{" + - "keikaiClient=" + keikaiClient + - ", webserver=" + webserver + - ", isRunning=" + isRunning + - '}'; - } - - /** - * Send a standardized error to the caller. - */ - public void sendError(WebTransaction request, int statusCode) throws IOException { - request.httpServletResponse.setStatus(statusCode); - request.httpServletResponse.setContentType("text/plain"); - StringBuffer sb = new StringBuffer(); - // TODO: Add more information here, like request id, processing node, software, etc. - sb.append("ERROR " + statusCode + "\n"); - request.httpServletResponse.getOutputStream().write(sb.toString().getBytes(StandardCharsets.UTF_8)); - } - - public void sendResponse(WebTransaction txn, EO response) throws IOException { - try (JsonOutput out = new JsonOutput(txn.httpServletResponse.getOutputStream())) { - out.writeEO(response); - } - } - - public abstract void serviceRequest(WebTransaction request) throws Throwable; - - @Override - public final HandlerStatus handlePrefixedWebRequest(WebTransaction request) throws Throwable { - serviceRequest(request); - return HandlerStatus.BREAK; - } -} diff --git a/lc-esp-service-sdk/src/main/java/lc/esp/sdk/service/MicroServiceEnvironment.java b/lc-esp-service-sdk/src/main/java/lc/esp/sdk/service/MicroServiceEnvironment.java deleted file mode 100644 index 6cfb2b2f691775cb49d65f462973e40d07fb21ce..0000000000000000000000000000000000000000 --- a/lc-esp-service-sdk/src/main/java/lc/esp/sdk/service/MicroServiceEnvironment.java +++ /dev/null @@ -1,24 +0,0 @@ -package lc.esp.sdk.service; - -import lc.eo.EO; -import lc.esp.sdk.service.schema.v1.MicroServiceCfgElementDAO; - -/** - * Simple runtime to launch an Enhanced Services Platform (ESP) microservice. This is intended to consolidate - * at least some of the boilerplate that otherwise would be required to be in the main() method of - * every microservice. - * - * @author Alex Leigh - */ -public class MicroServiceEnvironment { - /** - * Return the MicroServices configuration for this environment, helped by the provided arguments. The arguments - * are expected to be the Kabe URL and the Source URL. - */ - public static EO getCfg(String[] args) { - EO cfg = MicroServiceCfgElementDAO.create(); - MicroServiceCfgElementDAO.setKabeUrl(cfg, args[0]); - MicroServiceCfgElementDAO.setSrcUri(cfg, args[1]); - return cfg; - } -} diff --git a/lc-esp-service-sdk/src/main/java/lc/esp/sdk/service/schema/SchemaGeneratorApp.java b/lc-esp-service-sdk/src/main/java/lc/esp/sdk/service/schema/SchemaGeneratorApp.java deleted file mode 100644 index aa76bb8a85b8fdc521482ba53ce47ea0e3e861a1..0000000000000000000000000000000000000000 --- a/lc-esp-service-sdk/src/main/java/lc/esp/sdk/service/schema/SchemaGeneratorApp.java +++ /dev/null @@ -1,40 +0,0 @@ -package lc.esp.sdk.service.schema; - -import lc.eo.EO; -import lc.eo.schema.DAOGenerator; -import lc.eo.schema.dao.ElementElementDAO; -import lc.eo.schema.dao.FieldUtil; -import lc.eo.schema.dao.SchemaElementDAO; -import lc.eo.schema.dao.SchemaUtil; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.UniversalJob; - -import java.io.File; -import java.io.FileNotFoundException; - -public class SchemaGeneratorApp { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(SchemaGeneratorApp.class); - - public static EO generate() { - final EO schema = SchemaUtil.create(SchemaUtil.API_KEY); - - final EO microSvcCfg = ElementElementDAO.create(); - SchemaElementDAO.getElements(schema).add(microSvcCfg); - ElementElementDAO.setApiName(microSvcCfg, "leigh.esp.sdk.service.v1.MicroServiceCfg"); - - ElementElementDAO.getFields(microSvcCfg).add(FieldUtil.createNotNull("kabeUrl", "Kabe URL")); - ElementElementDAO.getFields(microSvcCfg).add(FieldUtil.createNotNull("srcUri", "Source URI")); - - return schema; - } - - public static void main(final String... args) throws FileNotFoundException { - UniversalJob.banner(logger, "Apotheosis mk3", "2014 Alex Leigh"); - final EO schema = generate(); - final DAOGenerator gen = new DAOGenerator(new File("leigh-esp-sdk-service/src/main/java")); - gen.generateJava("leigh.esp.sdk.service.schema.v1", schema); - - logger.info("Generated schema: {}", schema); - } -} diff --git a/lc-esp-service-sdk/src/main/java/lc/esp/sdk/service/schema/v1/MicroServiceCfgElementDAO.java b/lc-esp-service-sdk/src/main/java/lc/esp/sdk/service/schema/v1/MicroServiceCfgElementDAO.java deleted file mode 100644 index 2226e681c9bc2573fa9a397c0d060f33f7865a9f..0000000000000000000000000000000000000000 --- a/lc-esp-service-sdk/src/main/java/lc/esp/sdk/service/schema/v1/MicroServiceCfgElementDAO.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2014-2021, by Alex Leigh. - * All rights reserved. - * - * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE - * The copyright notice above does not evidence any - * actual or intended publication of such source code. - */ - -package lc.esp.sdk.service.schema.v1; - -import lc.eo.EO; - -/** - * This is a dynamically generated DAO class for accessing objects within an ESP graph. This class - * has been generated by DAOGenerator and should not be modified. - * - * @author DAOGenerator (synthetically generated class) - */ -public final class MicroServiceCfgElementDAO { - public static final String API_TYPE = "leigh.esp.sdk.service.v1.MicroServiceCfg"; - - public static EO create() { - EO eo = new EO(API_TYPE); - return eo; - } - - public static boolean assertType(final EO eo) { - return eo.getApiType().equals(API_TYPE); - } - - public static final String KEY_KABEURL = "kabeUrl"; - public static final String KEY_SRCURI = "srcUri"; - public static final String KEY_LISTENPORT = "listenPort"; - - public static String apiType(final EO eo) { - return eo.getApiType(); - } - - - /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=kabeUrl, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Kabe URL, locale=en}}]} , type=string}} */ - - - public static java.lang.String getKabeUrl(EO eo) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_KABEURL); - - } - - public static void setKabeUrl(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_KABEURL, value); - } - - public static void setIfUnsetKabeUrl(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValueIfUnset(KEY_KABEURL, value); - } - - - - /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=srcUri, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Source URI, locale=en}}]} , type=string}} */ - - - public static java.lang.String getSrcUri(EO eo) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_SRCURI); - - } - - public static void setSrcUri(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_SRCURI, value); - } - - public static void setIfUnsetSrcUri(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValueIfUnset(KEY_SRCURI, value); - } - - - - /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=listenPort, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Local Listen Port Number, locale=en}}]} , type=number}} */ - - - public static void setListenPort(final EO eo, int value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_LISTENPORT, value); - } - - public static void setListenPort(final EO eo, float value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_LISTENPORT, value); - } - - public static void setListenPort(final EO eo, double value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_LISTENPORT, value); - } - - public static void setListenPort(final EO eo, long value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_LISTENPORT, value); - } - - public static void setListenPort(final EO eo, short value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_LISTENPORT, value); - } - - public static java.math.BigDecimal getListenPort(EO eo) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getNumber(KEY_LISTENPORT); - - } - - public static void setListenPort(final EO eo, java.math.BigDecimal value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_LISTENPORT, value); - } - - public static void setIfUnsetListenPort(final EO eo, java.math.BigDecimal value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValueIfUnset(KEY_LISTENPORT, value); - } - - - -} \ No newline at end of file diff --git a/lc-esp-sutoresu/LICENSE.md b/lc-esp-sutoresu/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/lc-esp-sutoresu/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-esp-sutoresu/build.gradle b/lc-esp-sutoresu/build.gradle deleted file mode 100644 index 44f88831b69157e1beb24f3c7100157f1137a83c..0000000000000000000000000000000000000000 --- a/lc-esp-sutoresu/build.gradle +++ /dev/null @@ -1,33 +0,0 @@ -plugins { - id 'java' - id 'java-library' - id 'application' -} -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -group 'leigh' -version '16.0' - -repositories { - mavenCentral() -} - -dependencies { - api project(':lc-esp-sdk') - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} - -application { - mainClass = 'leigh.esp.keikai.sdk.KeikaiClient' -} - -startScripts { - doLast { - unixScript.text = unixScript.text.replace('DEFAULT_JVM_OPTS=""', 'DEFAULT_JVM_OPTS="--illegal-access=permit"') - } -} \ No newline at end of file diff --git a/lc-esp-sutoresu/src/main/java/lc/esp/sutoresu/SutoresuApp.java b/lc-esp-sutoresu/src/main/java/lc/esp/sutoresu/SutoresuApp.java deleted file mode 100644 index 7a9b409bdbf8943990ef85428544e2098459470f..0000000000000000000000000000000000000000 --- a/lc-esp-sutoresu/src/main/java/lc/esp/sutoresu/SutoresuApp.java +++ /dev/null @@ -1,65 +0,0 @@ -package lc.esp.sutoresu; - -import lc.eo.EO; -import lc.esp.sdk.ESPClient; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.UniversalJob; -import lc.mecha.util.VelocityWatch; -import org.apache.commons.io.IOUtils; -import org.apache.commons.io.output.CountingOutputStream; -import org.apache.commons.io.output.NullOutputStream; - -import java.time.Duration; -import java.time.Instant; - -public class SutoresuApp { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(SutoresuApp.class); - private final static String EKO_URI = "/eko/v1"; - private final ESPClient ctx; - - public SutoresuApp(String kabeUrl) { - ctx = new ESPClient(kabeUrl); - } - - public static void main(String[] args) { - if (args.length != 1) { - logger.info("Usage: SutoresuApp kabe_url"); - System.exit(UniversalJob.RET_BADARGS); - } - - SutoresuApp app = new SutoresuApp(args[0]); - app.exercise(); - } - - private void exercise() { - VelocityWatch vw = new VelocityWatch(logger); - workerThread(vw, 1000, 1024 * 1024); - } - - private void workerThread(VelocityWatch vw, int count, int requestData) { - EO req = new EO(); - - req.setValue("replyBytes", requestData); - - String name = Thread.currentThread().getName(); - - Instant start = Instant.now(); - logger.info("Attempting {} short link23 transactions...", count); - for (int i = 0; i < count; i++) { - try { - CountingOutputStream cos = new CountingOutputStream(new NullOutputStream()); - ctx.request(EKO_URI, req, is -> IOUtils.copy(is, cos)); - vw.event(name); - logger.info("Read bytes: {}", cos.getByteCount()); - } catch (Exception e) { - logger.error("Unable to contact EKO service: {}", e); - System.exit(UniversalJob.RET_ERROR); - } - } - Instant end = Instant.now(); - Duration length = Duration.between(start, end); - - logger.info("Done. [rate/s: {}] [d: {}}", count / length.getSeconds(), length); - } -} diff --git a/lc-historian/.gitignore b/lc-historian/.gitignore deleted file mode 100644 index ede7310f5aa22a8bb16f7393dedac5d9b0cba2c9..0000000000000000000000000000000000000000 --- a/lc-historian/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -kabe.log -velocity.log -.DS_Store -statistic.xml -.gradle -/*/build/ -/build/ -gradle-app.setting -!gradle-wrapper.jar -.gradletasknamecache -.idea/ -*.iml -out/ -.cache -node_modules -/*/.idea -.vi -/*/graph.eo -.vai -graph.bak -.idea -tests.vai -vds.log -hosts.json -tests.vai.old \ No newline at end of file diff --git a/lc-historian/LICENSE.md b/lc-historian/LICENSE.md deleted file mode 100644 index cb0d6ccde175abfbf02884b9373349fb118682b2..0000000000000000000000000000000000000000 --- a/lc-historian/LICENSE.md +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) 1994, 2021 Alex Leigh, All Rights Reserved - * - * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Alex Leigh - * The copyright notice above does not evidence any actual or intended - * publication of such source code. - * - * Disclosure, copying, distribution, or transmission of this code without - * express permission is prohibited. - */ diff --git a/lc-historian/build.gradle b/lc-historian/build.gradle deleted file mode 100644 index c936672fa2168263c77e690327e350924be2e7f7..0000000000000000000000000000000000000000 --- a/lc-historian/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -plugins { - id 'java' - id 'java-library' -} - -group 'leigh' -version '15.0' -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -repositories { - mavenCentral() -} - -dependencies { - api project(':lc-mecha') - api group: 'org.scream3r', name: 'jssc', version: '2.8.0' - api group: 'net.opentsdb', name: 'opentsdb', version: '2.4.0' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/lc-historian/src/main/java/ModbusRTU/ModbusRTU.java b/lc-historian/src/main/java/ModbusRTU/ModbusRTU.java deleted file mode 100644 index c8905c1803943e28ca10213f34fe692e340cb3b2..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/ModbusRTU/ModbusRTU.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (c) Stefan Rossmann - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package ModbusRTU; - -import de.re.easymodbus.exceptions.ModbusException; -import de.re.easymodbus.modbusclient.ModbusClient; -import jssc.SerialPortException; -import jssc.SerialPortTimeoutException; - -import java.io.IOException; - -/** - * @author SR555 - */ -public class ModbusRTU { - public static void main(String args[]) throws IOException, SerialPortException, ModbusException, SerialPortTimeoutException, InterruptedException { - boolean success = false; - ModbusClient modbusClient = new ModbusClient("127.0.0.1", 502); - System.out.println(modbusClient.Available(500)); - modbusClient.Connect(); - while (true) { - System.out.println(modbusClient.ReadInputRegisters(0, 10)[5]); - //Thread.sleep(200); - } - //modbusClient.WriteMultipleCoils(0, new boolean[] {true,true,true}); - //modbusClient.Disconnect(); - /* - while (success == false) - { - try - { - modbusClient.Connect("127.0.0.1",502); - boolean[] response = modbusClient.ReadCoils(2, 20); - int[] responseint = modbusClient.ReadHoldingRegisters(0, 20); - modbusClient.WriteSingleCoil(0, true); - modbusClient.WriteSingleRegister(200, 456); - modbusClient.WriteMultipleCoils(200, new boolean[]{true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true}); - modbusClient.WriteMultipleRegisters(300, new int[]{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}); - for (int i = 0; i < response.length; i++) - { - System.out.println(response[i]); - System.out.println(responseint[i]); - } - success = true; - Thread.sleep(1000); - } - catch (Exception e) - { - e.printStackTrace(); - } - finally - { - modbusClient.Disconnect(); - } - - } - */ - } -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/datatypes/Parity.java b/lc-historian/src/main/java/de/re/easymodbus/datatypes/Parity.java deleted file mode 100644 index 441dd4c5cb6e22ced825d18ba18a42af955a7cc7..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/datatypes/Parity.java +++ /dev/null @@ -1,17 +0,0 @@ -package de.re.easymodbus.datatypes; - -public enum Parity { - None(0), - Even(2), - Odd(1); - - private int value; - - private Parity(int value) { - this.value = value; - } - - public int getValue() { - return value; - } -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/datatypes/RegisterOrder.java b/lc-historian/src/main/java/de/re/easymodbus/datatypes/RegisterOrder.java deleted file mode 100644 index c637d853fbca47eb78ab2869610ef4e686d60ad3..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/datatypes/RegisterOrder.java +++ /dev/null @@ -1,4 +0,0 @@ -package de.re.easymodbus.datatypes; - -public enum RegisterOrder {LowHigh, HighLow}; - diff --git a/lc-historian/src/main/java/de/re/easymodbus/datatypes/StopBits.java b/lc-historian/src/main/java/de/re/easymodbus/datatypes/StopBits.java deleted file mode 100644 index 8df17e6fca0ccf6c5182c38113cb2eae85af5fe6..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/datatypes/StopBits.java +++ /dev/null @@ -1,17 +0,0 @@ -package de.re.easymodbus.datatypes; - -public enum StopBits { - One(1), - OnePointFive(3), - Two(2); - - private int value; - - private StopBits(int value) { - this.value = value; - } - - public int getValue() { - return value; - } -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/exceptions/CRCCheckFailedException.java b/lc-historian/src/main/java/de/re/easymodbus/exceptions/CRCCheckFailedException.java deleted file mode 100644 index 9fbbbf96b435d7bb6aeb42681c1b000fcd8e8c60..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/exceptions/CRCCheckFailedException.java +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package de.re.easymodbus.exceptions; - -/** - * @author Stefan Roßmann - */ -@SuppressWarnings("serial") -public class CRCCheckFailedException extends ModbusException { - public CRCCheckFailedException() { - } - - public CRCCheckFailedException(String s) { - super(s); - } -} - - diff --git a/lc-historian/src/main/java/de/re/easymodbus/exceptions/ConnectionException.java b/lc-historian/src/main/java/de/re/easymodbus/exceptions/ConnectionException.java deleted file mode 100644 index eac04f6e0fd369d792f888f624fe6ff84dae99ec..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/exceptions/ConnectionException.java +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package de.re.easymodbus.exceptions; - -/** - * @author Stefan Roßmann - */ -@SuppressWarnings("serial") -public class ConnectionException extends ModbusException { - public ConnectionException() { - } - - public ConnectionException(String s) { - super(s); - } -} - - diff --git a/lc-historian/src/main/java/de/re/easymodbus/exceptions/FunctionCodeNotSupportedException.java b/lc-historian/src/main/java/de/re/easymodbus/exceptions/FunctionCodeNotSupportedException.java deleted file mode 100644 index bcb0165f4470549c5276245d7a8a57db96e7abfe..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/exceptions/FunctionCodeNotSupportedException.java +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package de.re.easymodbus.exceptions; - -/** - * @author Stefan Roßmann - */ -@SuppressWarnings("serial") -public class FunctionCodeNotSupportedException extends ModbusException { - public FunctionCodeNotSupportedException() { - } - - public FunctionCodeNotSupportedException(String s) { - super(s); - } -} - - diff --git a/lc-historian/src/main/java/de/re/easymodbus/exceptions/ModbusException.java b/lc-historian/src/main/java/de/re/easymodbus/exceptions/ModbusException.java deleted file mode 100644 index b272186a74091a9b88cec7e5049556266dcd508c..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/exceptions/ModbusException.java +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package de.re.easymodbus.exceptions; - -/** - * @author Stefan Rossmann - */ -@SuppressWarnings("serial") -public class ModbusException extends Exception { - public ModbusException() { - } - - public ModbusException(String s) { - super(s); - } -} - - diff --git a/lc-historian/src/main/java/de/re/easymodbus/exceptions/QuantityInvalidException.java b/lc-historian/src/main/java/de/re/easymodbus/exceptions/QuantityInvalidException.java deleted file mode 100644 index f1f463d23f40e4cbb28c798f5d8d272e91c1338e..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/exceptions/QuantityInvalidException.java +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package de.re.easymodbus.exceptions; - -/** - * @author Stefan Roßmann - */ -@SuppressWarnings("serial") -public class QuantityInvalidException extends ModbusException { - public QuantityInvalidException() { - } - - public QuantityInvalidException(String s) { - super(s); - } -} - - diff --git a/lc-historian/src/main/java/de/re/easymodbus/exceptions/SerialPortException.java b/lc-historian/src/main/java/de/re/easymodbus/exceptions/SerialPortException.java deleted file mode 100644 index 4675b4006de467f957cac319686ace71edabfddc..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/exceptions/SerialPortException.java +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package de.re.easymodbus.exceptions; - -/** - * @author Stefan Roßmann - */ -@SuppressWarnings("serial") -public class SerialPortException extends ModbusException { - public SerialPortException() { - } - - public SerialPortException(String s) { - super(s); - } -} - - diff --git a/lc-historian/src/main/java/de/re/easymodbus/exceptions/StartingAddressInvalidException.java b/lc-historian/src/main/java/de/re/easymodbus/exceptions/StartingAddressInvalidException.java deleted file mode 100644 index e5ef34ac41c94c168525183326c234fc8b5206ca..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/exceptions/StartingAddressInvalidException.java +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package de.re.easymodbus.exceptions; - -/** - * @author Stefan Roßmann - */ -@SuppressWarnings("serial") -public class StartingAddressInvalidException extends ModbusException { - public StartingAddressInvalidException() { - } - - public StartingAddressInvalidException(String s) { - super(s); - } -} - - diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/DateTime.java b/lc-historian/src/main/java/de/re/easymodbus/modbusclient/DateTime.java deleted file mode 100644 index 3d3cbd492ea8ab1d85a50b20d98b76782415d853..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/DateTime.java +++ /dev/null @@ -1,57 +0,0 @@ -package de.re.easymodbus.modbusclient; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Calendar; - -/** - * Returns the Current Date and Time in different Formats. - * - * @author Stefan Rossmann - */ -public class DateTime { - /** - * Returns the current DateTime in Ticks (one ms = 10000ticks) - * - * @return Current Date and Time in Ticks - */ - public static long getDateTimeTicks() { - long TICKS_AT_EPOCH = 621355968000000000L; - long tick = System.currentTimeMillis() * 10000 + TICKS_AT_EPOCH; - return tick; - } - - /** - * Returns the current DateTme in String Format yyyy/MM/dd HH:mm:ss - * - * @return current DateTme in String Format yyyy/MM/dd HH:mm:ss - */ - public static String getDateTimeString() { - DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); - Calendar cal = Calendar.getInstance(); - return (dateFormat.format(cal.getTime())); - } - - /** - * Returns the current DateTme in String Format yyyy/MM/dd HH:mm:ss - * - * @return current DateTme in String Format yyyy/MM/dd HH:mm:ss - */ - public static String getDateTimeStringMilliseconds() { - DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS"); - Calendar cal = Calendar.getInstance(); - return (dateFormat.format(cal.getTime())); - } - - /** - * Returns the current Date in String Format yyyyMMdd - * - * @return current DateTme in String Format yyyyMMdd - */ - public static String getDateString() { - DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); - Calendar cal = Calendar.getInstance(); - return (dateFormat.format(cal.getTime())); - } - -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/ModbusClient.java b/lc-historian/src/main/java/de/re/easymodbus/modbusclient/ModbusClient.java deleted file mode 100644 index 7e2d75df4adab37a3c7e4f62b2abf11a915a0fa4..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/ModbusClient.java +++ /dev/null @@ -1,2135 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package de.re.easymodbus.modbusclient; - -import de.re.easymodbus.datatypes.Parity; -import de.re.easymodbus.datatypes.RegisterOrder; -import de.re.easymodbus.datatypes.StopBits; -import de.re.easymodbus.exceptions.ModbusException; -import jssc.SerialPort; -import jssc.SerialPortException; -import jssc.SerialPortTimeoutException; - -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.*; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - - -/** - * @author Stefan Roßmann - */ -public class ModbusClient { - private Socket tcpClientSocket = new Socket(); - protected String ipAddress = "190.201.100.100"; - protected int port = 502; - private byte[] transactionIdentifier = new byte[2]; - private byte[] protocolIdentifier = new byte[2]; - private byte[] length = new byte[2]; - private byte[] crc = new byte[2]; - private byte unitIdentifier = 1; - private byte functionCode; - private byte[] startingAddress = new byte[2]; - private byte[] quantity = new byte[2]; - private boolean udpFlag = false; - private boolean serialflag = false; - private int connectTimeout = 1000; - private InputStream inStream; - private DataOutputStream outStream; - public byte[] receiveData; - public byte[] sendData; - private List receiveDataChangedListener = new ArrayList(); - private List sendDataChangedListener = new ArrayList(); - private SerialPort serialPort; - - private String comPort; - private int numberOfRetries = 3; //Number of retries in case of serial connection - private int baudrate = 9600; - private Parity parity = Parity.Even; - private StopBits stopBits = StopBits.One; - private boolean debug = false; - - public ModbusClient(String ipAddress, int port) { - System.out.println("EasyModbus Client Library"); - System.out.println("Copyright (c) Stefan Rossmann Engineering Solutions"); - System.out.println("www.rossmann-engineering.de"); - System.out.println(""); - if (debug) - StoreLogData.getInstance().Store("EasyModbus library initialized for Modbus-TCP, IPAddress: " + ipAddress + ", Port: " + port); - this.ipAddress = ipAddress; - this.port = port; - } - - public ModbusClient() { - System.out.println("EasyModbus Client Library"); - System.out.println("Copyright (c) Stefan Rossmann Engineering Solutions"); - System.out.println("www.rossmann-engineering.de"); - System.out.println(""); - if (debug) StoreLogData.getInstance().Store("EasyModbus library initialized for Modbus-TCP"); - } - - public ModbusClient(String serialPort) { - System.out.println("EasyModbus Client Library"); - System.out.println("Copyright (c) Stefan Rossmann Engineering Solutions"); - System.out.println("www.rossmann-engineering.de"); - System.out.println(""); - if (debug) - StoreLogData.getInstance().Store("EasyModbus library initialized for Modbus-RTU, COM-Port: " + serialPort); - this.comPort = serialPort; - this.serialflag = true; - if (debug) StoreLogData.getInstance().Store("Open Serial Port: " + comPort); - } - - /** - * Connects to ModbusServer - * - * @throws UnknownHostException - * @throws IOException - */ - public void Connect() throws UnknownHostException, IOException { - if (!udpFlag && !this.serialflag) { - - tcpClientSocket = new Socket(ipAddress, port); - tcpClientSocket.setSoTimeout(connectTimeout); - outStream = new DataOutputStream(tcpClientSocket.getOutputStream()); - inStream = tcpClientSocket.getInputStream(); - if (debug) - StoreLogData.getInstance().Store("Open TCP-Socket, IP-Address: " + ipAddress + ", Port: " + port); - } - if (this.serialflag) { - serialPort = new SerialPort(comPort); - - try { - serialPort.openPort(); - - - serialPort.setParams(this.baudrate, - 8, - this.stopBits.getValue(), - this.parity.getValue()); - - serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE); - } catch (SerialPortException e) { - - e.printStackTrace(); - } - if (debug) StoreLogData.getInstance().Store("Open Serial Port: " + comPort); - - } - } - - /** - * Connects to ModbusServer - * - * @param ipAddress IP Address of Modbus Server to connect to - * @param port Port Modbus Server listenning (standard 502) - * @throws UnknownHostException - * @throws IOException - */ - public void Connect(String ipAddress, int port) throws UnknownHostException, IOException { - this.ipAddress = ipAddress; - this.port = port; - - tcpClientSocket = new Socket(ipAddress, port); - tcpClientSocket.setSoTimeout(connectTimeout); - outStream = new DataOutputStream(tcpClientSocket.getOutputStream()); - inStream = tcpClientSocket.getInputStream(); - if (debug) StoreLogData.getInstance().Store("Open TCP-Socket, IP-Address: " + ipAddress + ", Port: " + port); - } - - /** - * Connects to ModbusServer with serial connection - * - * @param comPort used Com-Port - * @throws UnknownHostException - * @throws IOException - */ - public void Connect(String comPort) throws SerialPortException { - this.serialflag = true; - serialPort = new SerialPort(comPort); - - serialPort.openPort(); - - serialPort.setParams(this.baudrate, - 8, - this.stopBits.getValue(), - this.parity.getValue()); - - serialPort.setFlowControlMode(SerialPort.FLOWCONTROL_NONE); - } - - /** - * Convert two 16 Bit Registers to 32 Bit real value - * - * @param registers 16 Bit Registers - * @return 32 bit real value - */ - public static float ConvertRegistersToFloat(int[] registers) throws IllegalArgumentException { - if (registers.length != 2) - throw new IllegalArgumentException("Input Array length invalid"); - int highRegister = registers[1]; - int lowRegister = registers[0]; - byte[] highRegisterBytes = toByteArray(highRegister); - byte[] lowRegisterBytes = toByteArray(lowRegister); - byte[] floatBytes = { - highRegisterBytes[1], - highRegisterBytes[0], - lowRegisterBytes[1], - lowRegisterBytes[0] - }; - return ByteBuffer.wrap(floatBytes).getFloat(); - } - - /** - * Convert two 16 Bit Registers to 64 Bit double value Reg0: Low Word.....Reg3: High Word - * - * @param registers 16 Bit Registers - * @return 64 bit double value - */ - public static double ConvertRegistersToDouble(int[] registers) throws IllegalArgumentException { - if (registers.length != 4) - throw new IllegalArgumentException("Input Array length invalid"); - byte[] highRegisterBytes = toByteArray(registers[3]); - byte[] highLowRegisterBytes = toByteArray(registers[2]); - byte[] lowHighRegisterBytes = toByteArray(registers[1]); - byte[] lowRegisterBytes = toByteArray(registers[0]); - byte[] doubleBytes = { - highRegisterBytes[1], - highRegisterBytes[0], - highLowRegisterBytes[1], - highLowRegisterBytes[0], - lowHighRegisterBytes[1], - lowHighRegisterBytes[0], - lowRegisterBytes[1], - lowRegisterBytes[0] - }; - return ByteBuffer.wrap(doubleBytes).getDouble(); - } - - /** - * Convert two 16 Bit Registers to 64 Bit double value Order "LowHigh": Reg0: Low Word.....Reg3: High Word, "HighLow": Reg0: High Word.....Reg3: Low Word - * - * @param registers 16 Bit Registers - * @param registerOrder High Register first or low Register first - * @return 64 bit double value - */ - public static double ConvertRegistersToDouble(int[] registers, RegisterOrder registerOrder) throws IllegalArgumentException { - if (registers.length != 4) - throw new IllegalArgumentException("Input Array length invalid"); - int[] swappedRegisters = {registers[0], registers[1], registers[2], registers[3]}; - if (registerOrder == RegisterOrder.HighLow) - swappedRegisters = new int[]{registers[3], registers[2], registers[1], registers[0]}; - return ConvertRegistersToDouble(swappedRegisters); - } - - /** - * Convert two 16 Bit Registers to 32 Bit real value - * - * @param registers 16 Bit Registers - * @param registerOrder High Register first or low Register first - * @return 32 bit real value - */ - public static float ConvertRegistersToFloat(int[] registers, RegisterOrder registerOrder) throws IllegalArgumentException { - int[] swappedRegisters = {registers[0], registers[1]}; - if (registerOrder == RegisterOrder.HighLow) - swappedRegisters = new int[]{registers[1], registers[0]}; - return ConvertRegistersToFloat(swappedRegisters); - } - - - /** - * Convert four 16 Bit Registers to 64 Bit long value Reg0: Low Word.....Reg3: High Word - * - * @param registers 16 Bit Registers - * @return 64 bit value - */ - public static long ConvertRegistersToLong(int[] registers) throws IllegalArgumentException { - if (registers.length != 4) - throw new IllegalArgumentException("Input Array length invalid"); - byte[] highRegisterBytes = toByteArray(registers[3]); - byte[] highLowRegisterBytes = toByteArray(registers[2]); - byte[] lowHighRegisterBytes = toByteArray(registers[1]); - byte[] lowRegisterBytes = toByteArray(registers[0]); - byte[] longBytes = { - highRegisterBytes[1], - highRegisterBytes[0], - highLowRegisterBytes[1], - highLowRegisterBytes[0], - lowHighRegisterBytes[1], - lowHighRegisterBytes[0], - lowRegisterBytes[1], - lowRegisterBytes[0] - }; - return ByteBuffer.wrap(longBytes).getLong(); - } - - /** - * Convert four 16 Bit Registers to 64 Bit long value Register Order "LowHigh": Reg0: Low Word.....Reg3: High Word, "HighLow": Reg0: High Word.....Reg3: Low Word - * - * @param registers 16 Bit Registers - * @return 64 bit value - */ - public static long ConvertRegistersToLong(int[] registers, RegisterOrder registerOrder) throws IllegalArgumentException { - if (registers.length != 4) - throw new IllegalArgumentException("Input Array length invalid"); - int[] swappedRegisters = {registers[0], registers[1], registers[2], registers[3]}; - if (registerOrder == RegisterOrder.HighLow) - swappedRegisters = new int[]{registers[3], registers[2], registers[1], registers[0]}; - return ConvertRegistersToLong(swappedRegisters); - } - - /** - * Convert two 16 Bit Registers to 32 Bit long value - * - * @param registers 16 Bit Registers - * @return 32 bit value - */ - public static int ConvertRegistersToInt(int[] registers) throws IllegalArgumentException { - if (registers.length != 2) - throw new IllegalArgumentException("Input Array length invalid"); - int highRegister = registers[1]; - int lowRegister = registers[0]; - byte[] highRegisterBytes = toByteArray(highRegister); - byte[] lowRegisterBytes = toByteArray(lowRegister); - byte[] doubleBytes = { - highRegisterBytes[1], - highRegisterBytes[0], - lowRegisterBytes[1], - lowRegisterBytes[0] - }; - return ByteBuffer.wrap(doubleBytes).getInt(); - } - - /** - * Convert two 16 Bit Registers to 32 Bit long value - * - * @param registers 16 Bit Registers - * @param registerOrder High Register first or low Register first - * @return 32 bit value - */ - public static int ConvertRegistersToInt(int[] registers, RegisterOrder registerOrder) throws IllegalArgumentException { - int[] swappedRegisters = {registers[0], registers[1]}; - if (registerOrder == RegisterOrder.HighLow) - swappedRegisters = new int[]{registers[1], registers[0]}; - return ConvertRegistersToInt(swappedRegisters); - } - - /** - * Convert 32 Bit real Value to two 16 Bit Value to send as Modbus Registers - * - * @param floatValue real to be converted - * @return 16 Bit Register values - */ - public static int[] ConvertFloatToRegisters(float floatValue) { - byte[] floatBytes = toByteArray(floatValue); - byte[] highRegisterBytes = - { - 0, 0, - floatBytes[0], - floatBytes[1], - - }; - byte[] lowRegisterBytes = - { - 0, 0, - floatBytes[2], - floatBytes[3], - - }; - int[] returnValue = - { - ByteBuffer.wrap(lowRegisterBytes).getInt(), - ByteBuffer.wrap(highRegisterBytes).getInt() - }; - return returnValue; - } - - /** - * Convert 32 Bit real Value to two 16 Bit Value to send as Modbus Registers - * - * @param floatValue real to be converted - * @param registerOrder High Register first or low Register first - * @return 16 Bit Register values - */ - public static int[] ConvertFloatToRegisters(float floatValue, RegisterOrder registerOrder) { - int[] registerValues = ConvertFloatToRegisters(floatValue); - int[] returnValue = registerValues; - if (registerOrder == RegisterOrder.HighLow) - returnValue = new int[]{registerValues[1], registerValues[0]}; - return returnValue; - } - - /** - * Convert 32 Bit Value to two 16 Bit Value to send as Modbus Registers - * - * @param intValue Value to be converted - * @return 16 Bit Register values - */ - public static int[] ConvertIntToRegisters(int intValue) { - byte[] doubleBytes = toByteArrayInt(intValue); - byte[] highRegisterBytes = - { - 0, 0, - doubleBytes[0], - doubleBytes[1], - - }; - byte[] lowRegisterBytes = - { - 0, 0, - doubleBytes[2], - doubleBytes[3], - - }; - int[] returnValue = - { - ByteBuffer.wrap(lowRegisterBytes).getInt(), - ByteBuffer.wrap(highRegisterBytes).getInt() - }; - return returnValue; - } - - /** - * Convert 32 Bit Value to two 16 Bit Value to send as Modbus Registers - * - * @param intValue Value to be converted - * @param registerOrder High Register first or low Register first - * @return 16 Bit Register values - */ - public static int[] ConvertIntToRegisters(int intValue, RegisterOrder registerOrder) { - int[] registerValues = ConvertIntToRegisters(intValue); - int[] returnValue = registerValues; - if (registerOrder == RegisterOrder.HighLow) - returnValue = new int[]{registerValues[1], registerValues[0]}; - return returnValue; - } - - /** - * Convert 64 Bit Value to four 16 Bit Value to send as Modbus Registers - * - * @param longValue Value to be converted - * @return 16 Bit Register values - */ - public static int[] ConvertLongToRegisters(long longValue) { - byte[] doubleBytes = toByteArrayLong(longValue); - byte[] highhighRegisterBytes = - { - 0, 0, - doubleBytes[0], - doubleBytes[1], - - }; - byte[] highlowRegisterBytes = - { - 0, 0, - doubleBytes[2], - doubleBytes[3], - - }; - byte[] lowHighRegisterBytes = - { - 0, 0, - doubleBytes[4], - doubleBytes[5], - }; - byte[] lowlowRegisterBytes = - { - 0, 0, - doubleBytes[6], - doubleBytes[7], - - }; - int[] returnValue = - { - ByteBuffer.wrap(lowlowRegisterBytes).getInt(), - ByteBuffer.wrap(lowHighRegisterBytes).getInt(), - ByteBuffer.wrap(highlowRegisterBytes).getInt(), - ByteBuffer.wrap(highhighRegisterBytes).getInt(), - }; - return returnValue; - } - - /** - * Convert 64 Bit Value to two 16 Bit Value to send as Modbus Registers - * - * @param longValue Value to be converted - * @param registerOrder High Register first or low Register first - * @return 16 Bit Register values - */ - public static int[] ConvertLongToRegisters(int longValue, RegisterOrder registerOrder) { - int[] registerValues = ConvertLongToRegisters(longValue); - int[] returnValue = registerValues; - if (registerOrder == RegisterOrder.HighLow) - returnValue = new int[]{registerValues[3], registerValues[2], registerValues[1], registerValues[0]}; - return returnValue; - } - - /** - * Convert 64 Bit Value to four 16 Bit Value to send as Modbus Registers - * - * @param doubleValue Value to be converted - * @return 16 Bit Register values - */ - public static int[] ConvertDoubleToRegisters(double doubleValue) { - byte[] doubleBytes = toByteArrayDouble(doubleValue); - byte[] highhighRegisterBytes = - { - 0, 0, - doubleBytes[0], - doubleBytes[1], - - }; - byte[] highlowRegisterBytes = - { - 0, 0, - doubleBytes[2], - doubleBytes[3], - - }; - byte[] lowHighRegisterBytes = - { - 0, 0, - doubleBytes[4], - doubleBytes[5], - }; - byte[] lowlowRegisterBytes = - { - 0, 0, - doubleBytes[6], - doubleBytes[7], - - }; - int[] returnValue = - { - ByteBuffer.wrap(lowlowRegisterBytes).getInt(), - ByteBuffer.wrap(lowHighRegisterBytes).getInt(), - ByteBuffer.wrap(highlowRegisterBytes).getInt(), - ByteBuffer.wrap(highhighRegisterBytes).getInt(), - }; - return returnValue; - } - - - /** - * Convert 64 Bit Value to two 16 Bit Value to send as Modbus Registers - * - * @param doubleValue Value to be converted - * @param registerOrder High Register first or low Register first - * @return 16 Bit Register values - */ - public static int[] ConvertDoubleToRegisters(double doubleValue, RegisterOrder registerOrder) { - int[] registerValues = ConvertDoubleToRegisters(doubleValue); - int[] returnValue = registerValues; - if (registerOrder == RegisterOrder.HighLow) - returnValue = new int[]{registerValues[3], registerValues[2], registerValues[1], registerValues[0]}; - return returnValue; - } - - /** - * Converts 16 - Bit Register values to String - * - * @param registers Register array received via Modbus - * @param offset First Register containing the String to convert - * @param stringLength number of characters in String (must be even) - * @return Converted String - */ - public static String ConvertRegistersToString(int[] registers, int offset, int stringLength) { - byte[] result = new byte[stringLength]; - byte[] registerResult = new byte[2]; - - for (int i = 0; i < stringLength / 2; i++) { - registerResult = toByteArray(registers[offset + i]); - result[i * 2] = registerResult[0]; - result[i * 2 + 1] = registerResult[1]; - } - return new String(result); - } - - /** - * Converts a String to 16 - Bit Registers - * - * @param stringToConvert String to Convert< - * @return Converted String - */ - public static int[] ConvertStringToRegisters(String stringToConvert) { - byte[] array = stringToConvert.getBytes(); - int[] returnarray = new int[stringToConvert.length() / 2 + stringToConvert.length() % 2]; - for (int i = 0; i < returnarray.length; i++) { - returnarray[i] = array[i * 2]; - if (i * 2 + 1 < array.length) { - returnarray[i] = returnarray[i] | ((int) array[i * 2 + 1] << 8); - } - } - return returnarray; - } - - - public static byte[] calculateCRC(byte[] data, int numberOfBytes, int startByte) { - byte[] auchCRCHi = { - (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, - (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, - (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, - (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, - (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, - (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, - (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, - (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, - (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, - (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, - (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, - (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, - (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, - (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, - (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, - (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, - (byte) 0x00, (byte) 0xC1, (byte) 0x81, (byte) 0x40, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x01, (byte) 0xC0, (byte) 0x80, (byte) 0x41, (byte) 0x00, (byte) 0xC1, (byte) 0x81, - (byte) 0x40 - }; - - byte[] auchCRCLo = { - (byte) 0x00, (byte) 0xC0, (byte) 0xC1, (byte) 0x01, (byte) 0xC3, (byte) 0x03, (byte) 0x02, (byte) 0xC2, (byte) 0xC6, (byte) 0x06, (byte) 0x07, (byte) 0xC7, (byte) 0x05, (byte) 0xC5, (byte) 0xC4, - (byte) 0x04, (byte) 0xCC, (byte) 0x0C, (byte) 0x0D, (byte) 0xCD, (byte) 0x0F, (byte) 0xCF, (byte) 0xCE, (byte) 0x0E, (byte) 0x0A, (byte) 0xCA, (byte) 0xCB, (byte) 0x0B, (byte) 0xC9, (byte) 0x09, - (byte) 0x08, (byte) 0xC8, (byte) 0xD8, (byte) 0x18, (byte) 0x19, (byte) 0xD9, (byte) 0x1B, (byte) 0xDB, (byte) 0xDA, (byte) 0x1A, (byte) 0x1E, (byte) 0xDE, (byte) 0xDF, (byte) 0x1F, (byte) 0xDD, - (byte) 0x1D, (byte) 0x1C, (byte) 0xDC, (byte) 0x14, (byte) 0xD4, (byte) 0xD5, (byte) 0x15, (byte) 0xD7, (byte) 0x17, (byte) 0x16, (byte) 0xD6, (byte) 0xD2, (byte) 0x12, (byte) 0x13, (byte) 0xD3, - (byte) 0x11, (byte) 0xD1, (byte) 0xD0, (byte) 0x10, (byte) 0xF0, (byte) 0x30, (byte) 0x31, (byte) 0xF1, (byte) 0x33, (byte) 0xF3, (byte) 0xF2, (byte) 0x32, (byte) 0x36, (byte) 0xF6, (byte) 0xF7, - (byte) 0x37, (byte) 0xF5, (byte) 0x35, (byte) 0x34, (byte) 0xF4, (byte) 0x3C, (byte) 0xFC, (byte) 0xFD, (byte) 0x3D, (byte) 0xFF, (byte) 0x3F, (byte) 0x3E, (byte) 0xFE, (byte) 0xFA, (byte) 0x3A, - (byte) 0x3B, (byte) 0xFB, (byte) 0x39, (byte) 0xF9, (byte) 0xF8, (byte) 0x38, (byte) 0x28, (byte) 0xE8, (byte) 0xE9, (byte) 0x29, (byte) 0xEB, (byte) 0x2B, (byte) 0x2A, (byte) 0xEA, (byte) 0xEE, - (byte) 0x2E, (byte) 0x2F, (byte) 0xEF, (byte) 0x2D, (byte) 0xED, (byte) 0xEC, (byte) 0x2C, (byte) 0xE4, (byte) 0x24, (byte) 0x25, (byte) 0xE5, (byte) 0x27, (byte) 0xE7, (byte) 0xE6, (byte) 0x26, - (byte) 0x22, (byte) 0xE2, (byte) 0xE3, (byte) 0x23, (byte) 0xE1, (byte) 0x21, (byte) 0x20, (byte) 0xE0, (byte) 0xA0, (byte) 0x60, (byte) 0x61, (byte) 0xA1, (byte) 0x63, (byte) 0xA3, (byte) 0xA2, - (byte) 0x62, (byte) 0x66, (byte) 0xA6, (byte) 0xA7, (byte) 0x67, (byte) 0xA5, (byte) 0x65, (byte) 0x64, (byte) 0xA4, (byte) 0x6C, (byte) 0xAC, (byte) 0xAD, (byte) 0x6D, (byte) 0xAF, (byte) 0x6F, - (byte) 0x6E, (byte) 0xAE, (byte) 0xAA, (byte) 0x6A, (byte) 0x6B, (byte) 0xAB, (byte) 0x69, (byte) 0xA9, (byte) 0xA8, (byte) 0x68, (byte) 0x78, (byte) 0xB8, (byte) 0xB9, (byte) 0x79, (byte) 0xBB, - (byte) 0x7B, (byte) 0x7A, (byte) 0xBA, (byte) 0xBE, (byte) 0x7E, (byte) 0x7F, (byte) 0xBF, (byte) 0x7D, (byte) 0xBD, (byte) 0xBC, (byte) 0x7C, (byte) 0xB4, (byte) 0x74, (byte) 0x75, (byte) 0xB5, - (byte) 0x77, (byte) 0xB7, (byte) 0xB6, (byte) 0x76, (byte) 0x72, (byte) 0xB2, (byte) 0xB3, (byte) 0x73, (byte) 0xB1, (byte) 0x71, (byte) 0x70, (byte) 0xB0, (byte) 0x50, (byte) 0x90, (byte) 0x91, - (byte) 0x51, (byte) 0x93, (byte) 0x53, (byte) 0x52, (byte) 0x92, (byte) 0x96, (byte) 0x56, (byte) 0x57, (byte) 0x97, (byte) 0x55, (byte) 0x95, (byte) 0x94, (byte) 0x54, (byte) 0x9C, (byte) 0x5C, - (byte) 0x5D, (byte) 0x9D, (byte) 0x5F, (byte) 0x9F, (byte) 0x9E, (byte) 0x5E, (byte) 0x5A, (byte) 0x9A, (byte) 0x9B, (byte) 0x5B, (byte) 0x99, (byte) 0x59, (byte) 0x58, (byte) 0x98, (byte) 0x88, - (byte) 0x48, (byte) 0x49, (byte) 0x89, (byte) 0x4B, (byte) 0x8B, (byte) 0x8A, (byte) 0x4A, (byte) 0x4E, (byte) 0x8E, (byte) 0x8F, (byte) 0x4F, (byte) 0x8D, (byte) 0x4D, (byte) 0x4C, (byte) 0x8C, - (byte) 0x44, (byte) 0x84, (byte) 0x85, (byte) 0x45, (byte) 0x87, (byte) 0x47, (byte) 0x46, (byte) 0x86, (byte) 0x82, (byte) 0x42, (byte) 0x43, (byte) 0x83, (byte) 0x41, (byte) 0x81, (byte) 0x80, - (byte) 0x40 - }; - short usDataLen = (short) numberOfBytes; - byte uchCRCHi = (byte) 0xFF; - byte uchCRCLo = (byte) 0xFF; - int i = 0; - int uIndex; - while (usDataLen > 0) { - usDataLen--; - uIndex = (int) (uchCRCLo ^ (int) data[i + startByte]); - if (uIndex < 0) - uIndex = 256 + uIndex; - uchCRCLo = (byte) (uchCRCHi ^ auchCRCHi[uIndex]); - uchCRCHi = (byte) auchCRCLo[uIndex]; - i++; - } - byte[] returnValue = {uchCRCLo, uchCRCHi}; - return returnValue; - } - - /** - * Read Discrete Inputs from Server - * - * @param startingAddress Fist Address to read; Shifted by -1 - * @param quantity Number of Inputs to read - * @return Discrete Inputs from Server - * @throws ModbusException - * @throws UnknownHostException - * @throws SocketException - * @throws SerialPortTimeoutException - * @throws SerialPortException - */ - public boolean[] ReadDiscreteInputs(int startingAddress, int quantity) throws ModbusException, - UnknownHostException, SocketException, IOException, SerialPortException, SerialPortTimeoutException { - if (tcpClientSocket == null) - throw new de.re.easymodbus.exceptions.ConnectionException("connection Error"); - if (startingAddress > 65535 | quantity > 2000) - throw new IllegalArgumentException("Starting adress must be 0 - 65535; quantity must be 0 - 2000"); - boolean[] response = null; - this.transactionIdentifier = toByteArray(0x0001); - this.protocolIdentifier = toByteArray(0x0000); - this.length = toByteArray(0x0006); - this.functionCode = 0x02; - this.startingAddress = toByteArray(startingAddress); - this.quantity = toByteArray(quantity); - byte[] data = new byte[] - { - this.transactionIdentifier[1], - this.transactionIdentifier[0], - this.protocolIdentifier[1], - this.protocolIdentifier[0], - this.length[1], - this.length[0], - this.unitIdentifier, - this.functionCode, - this.startingAddress[1], - this.startingAddress[0], - this.quantity[1], - this.quantity[0], - this.crc[0], - this.crc[1] - }; - if (this.serialflag) { - crc = calculateCRC(data, 6, 6); - data[data.length - 2] = crc[0]; - data[data.length - 1] = crc[1]; - } - byte[] serialdata = null; - if (serialflag) { - serialdata = new byte[8]; - System.arraycopy(data, 6, serialdata, 0, 8); - serialPort.purgePort(SerialPort.PURGE_RXCLEAR); - serialPort.writeBytes(serialdata); - if (debug) StoreLogData.getInstance().Store("Send Serial-Data: " + Arrays.toString(serialdata)); - long dateTimeSend = DateTime.getDateTimeTicks(); - byte receivedUnitIdentifier = (byte) 0xFF; - serialdata = new byte[256]; - int expectedlength = 5 + quantity / 8 + 1; - if (quantity % 8 == 0) - expectedlength = 5 + quantity / 8; - while (receivedUnitIdentifier != this.unitIdentifier & !((DateTime.getDateTimeTicks() - dateTimeSend) > 10000 * this.connectTimeout)) { - - serialdata = serialPort.readBytes(expectedlength, this.connectTimeout); - - - receivedUnitIdentifier = serialdata[0]; - } - if (receivedUnitIdentifier != this.unitIdentifier) { - serialdata = new byte[256]; - } - } - if (serialdata != null) { - data = new byte[262]; - System.arraycopy(serialdata, 0, data, 6, serialdata.length); - if (debug) StoreLogData.getInstance().Store("Receive ModbusRTU-Data: " + Arrays.toString(data)); - } - - if (tcpClientSocket.isConnected() | udpFlag) { - if (udpFlag) { - InetAddress ipAddress = InetAddress.getByName(this.ipAddress); - DatagramPacket sendPacket = new DatagramPacket(data, data.length - 2, ipAddress, this.port); - DatagramSocket clientSocket = new DatagramSocket(); - clientSocket.setSoTimeout(500); - clientSocket.send(sendPacket); - data = new byte[2100]; - DatagramPacket receivePacket = new DatagramPacket(data, data.length); - clientSocket.receive(receivePacket); - clientSocket.close(); - data = receivePacket.getData(); - } else { - outStream.write(data, 0, data.length - 2); - if (debug) StoreLogData.getInstance().Store("Send ModbusTCP-Data: " + Arrays.toString(data)); - if (sendDataChangedListener.size() > 0) { - sendData = new byte[data.length - 2]; - System.arraycopy(data, 0, sendData, 0, data.length - 2); - for (SendDataChangedListener hl : sendDataChangedListener) - hl.SendDataChanged(); - } - data = new byte[2100]; - int numberOfBytes = inStream.read(data, 0, data.length); - if (receiveDataChangedListener.size() > 0) { - receiveData = new byte[numberOfBytes]; - System.arraycopy(data, 0, receiveData, 0, numberOfBytes); - for (ReceiveDataChangedListener hl : receiveDataChangedListener) - hl.ReceiveDataChanged(); - if (debug) StoreLogData.getInstance().Store("Receive ModbusTCP-Data: " + Arrays.toString(data)); - - } - } - } - if (((int) (data[7] & 0xff)) == 0x82 & ((int) data[8]) == 0x01) { - if (debug) StoreLogData.getInstance().Store("FunctionCodeNotSupportedException Throwed"); - throw new de.re.easymodbus.exceptions.FunctionCodeNotSupportedException("Function code not supported by master"); - } - if (((int) (data[7] & 0xff)) == 0x82 & ((int) data[8]) == 0x02) { - if (debug) - StoreLogData.getInstance().Store("Starting adress invalid or starting adress + quantity invalid"); - throw new de.re.easymodbus.exceptions.StartingAddressInvalidException("Starting adress invalid or starting adress + quantity invalid"); - } - if (((int) (data[7] & 0xff)) == 0x82 & ((int) data[8]) == 0x03) { - if (debug) StoreLogData.getInstance().Store("Quantity invalid"); - throw new de.re.easymodbus.exceptions.QuantityInvalidException("Quantity invalid"); - } - if (((int) (data[7] & 0xff)) == 0x82 & ((int) data[8]) == 0x04) { - if (debug) StoreLogData.getInstance().Store("Error reading"); - throw new ModbusException("Error reading"); - } - response = new boolean[quantity]; - for (int i = 0; i < quantity; i++) { - int intData = data[9 + i / 8]; - int mask = (int) Math.pow(2, (i % 8)); - intData = ((intData & mask) / mask); - if (intData > 0) - response[i] = true; - else - response[i] = false; - } - - - return (response); - } - - - /** - * Read Coils from Server - * - * @param startingAddress Fist Address to read; Shifted by -1 - * @param quantity Number of Inputs to read - * @return coils from Server - * @throws ModbusException - * @throws UnknownHostException - * @throws SocketException - * @throws SerialPortTimeoutException - * @throws SerialPortException - */ - public boolean[] ReadCoils(int startingAddress, int quantity) throws ModbusException, - UnknownHostException, SocketException, IOException, SerialPortException, SerialPortTimeoutException { - if (tcpClientSocket == null) - throw new de.re.easymodbus.exceptions.ConnectionException("connection Error"); - if (startingAddress > 65535 | quantity > 2000) - throw new IllegalArgumentException("Starting adress must be 0 - 65535; quantity must be 0 - 2000"); - boolean[] response = new boolean[quantity]; - this.transactionIdentifier = toByteArray(0x0001); - this.protocolIdentifier = toByteArray(0x0000); - this.length = toByteArray(0x0006); - //this.unitIdentifier = 0x00; - this.functionCode = 0x01; - this.startingAddress = toByteArray(startingAddress); - this.quantity = toByteArray(quantity); - byte[] data = new byte[] - { - this.transactionIdentifier[1], - this.transactionIdentifier[0], - this.protocolIdentifier[1], - this.protocolIdentifier[0], - this.length[1], - this.length[0], - this.unitIdentifier, - this.functionCode, - this.startingAddress[1], - this.startingAddress[0], - this.quantity[1], - this.quantity[0], - this.crc[0], - this.crc[1] - }; - if (this.serialflag) { - crc = calculateCRC(data, 6, 6); - data[data.length - 2] = crc[0]; - data[data.length - 1] = crc[1]; - - } - byte[] serialdata = null; - if (serialflag) { - serialdata = new byte[8]; - System.arraycopy(data, 6, serialdata, 0, 8); - serialPort.purgePort(SerialPort.PURGE_RXCLEAR); - serialPort.writeBytes(serialdata); - if (debug) StoreLogData.getInstance().Store("Send Serial-Data: " + Arrays.toString(serialdata)); - long dateTimeSend = DateTime.getDateTimeTicks(); - byte receivedUnitIdentifier = (byte) 0xFF; - serialdata = new byte[256]; - int expectedlength = 5 + quantity / 8 + 1; - if (quantity % 8 == 0) - expectedlength = 5 + quantity / 8; - while (receivedUnitIdentifier != this.unitIdentifier & !((DateTime.getDateTimeTicks() - dateTimeSend) > 10000 * this.connectTimeout)) { - serialdata = serialPort.readBytes(expectedlength, this.connectTimeout); - - receivedUnitIdentifier = serialdata[0]; - } - if (receivedUnitIdentifier != this.unitIdentifier) { - serialdata = new byte[256]; - } - } - if (serialdata != null) { - data = new byte[262]; - System.arraycopy(serialdata, 0, data, 6, serialdata.length); - if (debug) StoreLogData.getInstance().Store("Receive ModbusRTU-Data: " + Arrays.toString(data)); - } - if (tcpClientSocket.isConnected() | udpFlag) { - if (udpFlag) { - InetAddress ipAddress = InetAddress.getByName(this.ipAddress); - DatagramPacket sendPacket = new DatagramPacket(data, data.length, ipAddress, this.port); - DatagramSocket clientSocket = new DatagramSocket(); - clientSocket.setSoTimeout(500); - clientSocket.send(sendPacket); - data = new byte[2100]; - DatagramPacket receivePacket = new DatagramPacket(data, data.length); - clientSocket.receive(receivePacket); - clientSocket.close(); - data = receivePacket.getData(); - } else { - outStream.write(data, 0, data.length - 2); - if (debug) StoreLogData.getInstance().Store("Send ModbusTCP-Data: " + Arrays.toString(data)); - if (sendDataChangedListener.size() > 0) { - sendData = new byte[data.length - 2]; - System.arraycopy(data, 0, sendData, 0, data.length - 2); - for (SendDataChangedListener hl : sendDataChangedListener) - hl.SendDataChanged(); - } - data = new byte[2100]; - int numberOfBytes = inStream.read(data, 0, data.length); - if (receiveDataChangedListener.size() > 0) { - receiveData = new byte[numberOfBytes]; - System.arraycopy(data, 0, receiveData, 0, numberOfBytes); - for (ReceiveDataChangedListener hl : receiveDataChangedListener) - hl.ReceiveDataChanged(); - if (debug) StoreLogData.getInstance().Store("Receive ModbusTCP-Data: " + Arrays.toString(data)); - } - } - } - if (((int) (data[7] & 0xff)) == 0x81 & ((int) data[8]) == 0x01) { - if (debug) StoreLogData.getInstance().Store("FunctionCodeNotSupportedException Throwed"); - throw new de.re.easymodbus.exceptions.FunctionCodeNotSupportedException("Function code not supported by master"); - } - if (((int) (data[7] & 0xff)) == 0x81 & ((int) data[8]) == 0x02) { - if (debug) - StoreLogData.getInstance().Store("Starting adress invalid or starting adress + quantity invalid"); - throw new de.re.easymodbus.exceptions.StartingAddressInvalidException("Starting adress invalid or starting adress + quantity invalid"); - } - if (((int) (data[7] & 0xff)) == 0x81 & ((int) data[8]) == 0x03) { - if (debug) StoreLogData.getInstance().Store("Quantity invalid"); - throw new de.re.easymodbus.exceptions.QuantityInvalidException("Quantity invalid"); - } - if (((int) (data[7] & 0xff)) == 0x81 & ((int) data[8]) == 0x04) { - if (debug) StoreLogData.getInstance().Store("Error reading"); - throw new ModbusException("Error reading"); - } - for (int i = 0; i < quantity; i++) { - int intData = (int) data[9 + i / 8]; - int mask = (int) Math.pow(2, (i % 8)); - intData = ((intData & mask) / mask); - if (intData > 0) - response[i] = true; - else - response[i] = false; - } - - - return (response); - } - - - /** - * Read Holding Registers from Server - * - * @param startingAddress Fist Address to read; Shifted by -1 - * @param quantity Number of Inputs to read - * @return Holding Registers from Server - * @throws ModbusException - * @throws UnknownHostException - * @throws SocketException - * @throws SerialPortTimeoutException - * @throws SerialPortException - */ - public int[] ReadHoldingRegisters(int startingAddress, int quantity) throws ModbusException, - UnknownHostException, SocketException, IOException, SerialPortException, SerialPortTimeoutException { - if (tcpClientSocket == null) - throw new de.re.easymodbus.exceptions.ConnectionException("connection Error"); - if (startingAddress > 65535 | quantity > 125) - throw new IllegalArgumentException("Starting adress must be 0 - 65535; quantity must be 0 - 125"); - int[] response = new int[quantity]; - this.transactionIdentifier = toByteArray(0x0001); - this.protocolIdentifier = toByteArray(0x0000); - this.length = toByteArray(0x0006); - //serialdata = this.unitIdentifier; - this.functionCode = 0x03; - this.startingAddress = toByteArray(startingAddress); - this.quantity = toByteArray(quantity); - - byte[] data = new byte[] - { - this.transactionIdentifier[1], - this.transactionIdentifier[0], - this.protocolIdentifier[1], - this.protocolIdentifier[0], - this.length[1], - this.length[0], - this.unitIdentifier, - this.functionCode, - this.startingAddress[1], - this.startingAddress[0], - this.quantity[1], - this.quantity[0], - this.crc[0], - this.crc[1] - }; - - if (this.serialflag) { - crc = calculateCRC(data, 6, 6); - data[data.length - 2] = crc[0]; - data[data.length - 1] = crc[1]; - } - byte[] serialdata = null; - if (serialflag) { - serialdata = new byte[8]; - System.arraycopy(data, 6, serialdata, 0, 8); - serialPort.purgePort(SerialPort.PURGE_RXCLEAR); - serialPort.writeBytes(serialdata); - if (debug) StoreLogData.getInstance().Store("Send Serial-Data: " + Arrays.toString(serialdata)); - long dateTimeSend = DateTime.getDateTimeTicks(); - byte receivedUnitIdentifier = (byte) 0xFF; - serialdata = new byte[256]; - int expectedlength = 5 + 2 * quantity; - while (receivedUnitIdentifier != this.unitIdentifier & !((DateTime.getDateTimeTicks() - dateTimeSend) > 10000 * this.connectTimeout)) { - serialdata = serialPort.readBytes(expectedlength, this.connectTimeout); - - receivedUnitIdentifier = serialdata[0]; - } - if (receivedUnitIdentifier != this.unitIdentifier) { - data = new byte[256]; - } - if (serialdata != null) { - data = new byte[262]; - System.arraycopy(serialdata, 0, data, 6, serialdata.length); - if (debug) StoreLogData.getInstance().Store("Receive ModbusRTU-Data: " + Arrays.toString(data)); - } - for (int i = 0; i < quantity; i++) { - byte[] bytes = new byte[2]; - bytes[0] = data[3 + i * 2]; - bytes[1] = data[3 + i * 2 + 1]; - ByteBuffer byteBuffer = ByteBuffer.wrap(bytes); - response[i] = byteBuffer.getShort(); - } - } - - - if (tcpClientSocket.isConnected() | udpFlag) { - if (udpFlag) { - InetAddress ipAddress = InetAddress.getByName(this.ipAddress); - DatagramPacket sendPacket = new DatagramPacket(data, data.length, ipAddress, this.port); - DatagramSocket clientSocket = new DatagramSocket(); - clientSocket.setSoTimeout(500); - clientSocket.send(sendPacket); - data = new byte[2100]; - DatagramPacket receivePacket = new DatagramPacket(data, data.length); - clientSocket.receive(receivePacket); - clientSocket.close(); - data = receivePacket.getData(); - } else { - outStream.write(data, 0, data.length - 2); - if (debug) StoreLogData.getInstance().Store("Send ModbusTCP-Data: " + Arrays.toString(data)); - if (sendDataChangedListener.size() > 0) { - sendData = new byte[data.length - 2]; - System.arraycopy(data, 0, sendData, 0, data.length - 2); - for (SendDataChangedListener hl : sendDataChangedListener) - hl.SendDataChanged(); - } - data = new byte[2100]; - int numberOfBytes = inStream.read(data, 0, data.length); - if (receiveDataChangedListener.size() > 0) { - receiveData = new byte[numberOfBytes]; - System.arraycopy(data, 0, receiveData, 0, numberOfBytes); - for (ReceiveDataChangedListener hl : receiveDataChangedListener) - hl.ReceiveDataChanged(); - if (debug) StoreLogData.getInstance().Store("Receive ModbusTCP-Data: " + Arrays.toString(data)); - } - } - } - if (((int) data[7]) == 0x83 & ((int) data[8]) == 0x01) { - if (debug) StoreLogData.getInstance().Store("FunctionCodeNotSupportedException Throwed"); - throw new de.re.easymodbus.exceptions.FunctionCodeNotSupportedException("Function code not supported by master"); - } - if (((int) data[7]) == 0x83 & ((int) data[8]) == 0x02) { - if (debug) - StoreLogData.getInstance().Store("Starting adress invalid or starting adress + quantity invalid"); - throw new de.re.easymodbus.exceptions.StartingAddressInvalidException("Starting adress invalid or starting adress + quantity invalid"); - } - if (((int) data[7]) == 0x83 & ((int) data[8]) == 0x03) { - if (debug) StoreLogData.getInstance().Store("Quantity invalid"); - throw new de.re.easymodbus.exceptions.QuantityInvalidException("Quantity invalid"); - } - if (((int) data[7]) == 0x83 & ((int) data[8]) == 0x04) { - if (debug) StoreLogData.getInstance().Store("Error reading"); - throw new ModbusException("Error reading"); - } - for (int i = 0; i < quantity; i++) { - byte[] bytes = new byte[2]; - bytes[0] = data[9 + i * 2]; - bytes[1] = data[9 + i * 2 + 1]; - ByteBuffer byteBuffer = ByteBuffer.wrap(bytes); - - response[i] = byteBuffer.getShort(); - } - - - return (response); - } - - - /** - * Read Input Registers from Server - * - * @param startingAddress Fist Address to read; Shifted by -1 - * @param quantity Number of Inputs to read - * @return Input Registers from Server - * @throws ModbusException - * @throws UnknownHostException - * @throws SocketException - * @throws SerialPortTimeoutException - * @throws SerialPortException - */ - public int[] ReadInputRegisters(int startingAddress, int quantity) throws ModbusException, - UnknownHostException, SocketException, IOException, SerialPortException, SerialPortTimeoutException { - if (tcpClientSocket == null) - throw new de.re.easymodbus.exceptions.ConnectionException("connection Error"); - if (startingAddress > 65535 | quantity > 125) - throw new IllegalArgumentException("Starting adress must be 0 - 65535; quantity must be 0 - 125"); - int[] response = new int[quantity]; - this.transactionIdentifier = toByteArray(0x0001); - this.protocolIdentifier = toByteArray(0x0000); - this.length = toByteArray(0x0006); - //this.unitIdentifier = 0x00; - this.functionCode = 0x04; - this.startingAddress = toByteArray(startingAddress); - this.quantity = toByteArray(quantity); - byte[] data = new byte[] - { - this.transactionIdentifier[1], - this.transactionIdentifier[0], - this.protocolIdentifier[1], - this.protocolIdentifier[0], - this.length[1], - this.length[0], - this.unitIdentifier, - this.functionCode, - this.startingAddress[1], - this.startingAddress[0], - this.quantity[1], - this.quantity[0], - this.crc[0], - this.crc[1] - }; - if (this.serialflag) { - crc = calculateCRC(data, 6, 6); - data[data.length - 2] = crc[0]; - data[data.length - 1] = crc[1]; - } - byte[] serialdata = null; - if (serialflag) { - serialdata = new byte[8]; - System.arraycopy(data, 6, serialdata, 0, 8); - serialPort.purgePort(SerialPort.PURGE_RXCLEAR); - serialPort.writeBytes(serialdata); - if (debug) StoreLogData.getInstance().Store("Send Serial-Data: " + Arrays.toString(serialdata)); - long dateTimeSend = DateTime.getDateTimeTicks(); - byte receivedUnitIdentifier = (byte) 0xFF; - serialdata = new byte[256]; - int expectedlength = 5 + 2 * quantity; - while (receivedUnitIdentifier != this.unitIdentifier & !((DateTime.getDateTimeTicks() - dateTimeSend) > 10000 * this.connectTimeout)) { - serialdata = serialPort.readBytes(expectedlength, this.connectTimeout); - - - receivedUnitIdentifier = serialdata[0]; - } - if (receivedUnitIdentifier != this.unitIdentifier) { - data = new byte[256]; - } - if (serialdata != null) { - data = new byte[262]; - System.arraycopy(serialdata, 0, data, 6, serialdata.length); - if (debug) StoreLogData.getInstance().Store("Receive ModbusRTU-Data: " + Arrays.toString(data)); - } - for (int i = 0; i < quantity; i++) { - byte[] bytes = new byte[2]; - bytes[0] = data[3 + i * 2]; - bytes[1] = data[3 + i * 2 + 1]; - ByteBuffer byteBuffer = ByteBuffer.wrap(bytes); - response[i] = byteBuffer.getShort(); - } - } - - if (tcpClientSocket.isConnected() | udpFlag) { - if (udpFlag) { - InetAddress ipAddress = InetAddress.getByName(this.ipAddress); - DatagramPacket sendPacket = new DatagramPacket(data, data.length, ipAddress, this.port); - DatagramSocket clientSocket = new DatagramSocket(); - clientSocket.setSoTimeout(500); - clientSocket.send(sendPacket); - data = new byte[2100]; - DatagramPacket receivePacket = new DatagramPacket(data, data.length); - clientSocket.receive(receivePacket); - clientSocket.close(); - data = receivePacket.getData(); - } else { - outStream.write(data, 0, data.length - 2); - if (debug) StoreLogData.getInstance().Store("Send ModbusTCP-Data: " + Arrays.toString(data)); - if (sendDataChangedListener.size() > 0) { - sendData = new byte[data.length - 2]; - System.arraycopy(data, 0, sendData, 0, data.length - 2); - for (SendDataChangedListener hl : sendDataChangedListener) - hl.SendDataChanged(); - } - data = new byte[2100]; - int numberOfBytes = inStream.read(data, 0, data.length); - if (receiveDataChangedListener.size() > 0) { - receiveData = new byte[numberOfBytes]; - System.arraycopy(data, 0, receiveData, 0, numberOfBytes); - for (ReceiveDataChangedListener hl : receiveDataChangedListener) - hl.ReceiveDataChanged(); - if (debug) StoreLogData.getInstance().Store("Receive ModbusTCP-Data: " + Arrays.toString(data)); - } - } - if (((int) (data[7] & 0xff)) == 0x84 & ((int) data[8]) == 0x01) { - if (debug) StoreLogData.getInstance().Store("FunctionCodeNotSupportedException Throwed"); - throw new de.re.easymodbus.exceptions.FunctionCodeNotSupportedException("Function code not supported by master"); - } - if (((int) (data[7] & 0xff)) == 0x84 & ((int) data[8]) == 0x02) { - if (debug) - StoreLogData.getInstance().Store("Starting adress invalid or starting adress + quantity invalid"); - throw new de.re.easymodbus.exceptions.StartingAddressInvalidException("Starting adress invalid or starting adress + quantity invalid"); - } - if (((int) (data[7] & 0xff)) == 0x84 & ((int) data[8]) == 0x03) { - if (debug) StoreLogData.getInstance().Store("Quantity invalid"); - throw new de.re.easymodbus.exceptions.QuantityInvalidException("Quantity invalid"); - } - if (((int) (data[7] & 0xff)) == 0x84 & ((int) data[8]) == 0x04) { - if (debug) StoreLogData.getInstance().Store("Error reading"); - throw new ModbusException("Error reading"); - } - } - for (int i = 0; i < quantity; i++) { - byte[] bytes = new byte[2]; - bytes[0] = (byte) data[9 + i * 2]; - bytes[1] = (byte) data[9 + i * 2 + 1]; - ByteBuffer byteBuffer = ByteBuffer.wrap(bytes); - response[i] = byteBuffer.getShort(); - } - - - return (response); - } - - /** - * Write Single Coil to Server - * - * @param startingAddress Address to write; Shifted by -1 - * @param value Value to write to Server - * @throws ModbusException - * @throws UnknownHostException - * @throws SocketException - * @throws SerialPortTimeoutException - * @throws SerialPortException - */ - public void WriteSingleCoil(int startingAddress, boolean value) throws ModbusException, - UnknownHostException, SocketException, IOException, SerialPortException, SerialPortTimeoutException { - if (tcpClientSocket == null & !udpFlag) - throw new de.re.easymodbus.exceptions.ConnectionException("connection error"); - byte[] coilValue = new byte[2]; - this.transactionIdentifier = toByteArray(0x0001); - this.protocolIdentifier = toByteArray(0x0000); - this.length = toByteArray(0x0006); - //this.unitIdentifier = 0; - this.functionCode = 0x05; - this.startingAddress = toByteArray(startingAddress); - if (value == true) { - coilValue = toByteArray((int) 0xFF00); - } else { - coilValue = toByteArray((int) 0x0000); - } - byte[] data = new byte[]{this.transactionIdentifier[1], - this.transactionIdentifier[0], - this.protocolIdentifier[1], - this.protocolIdentifier[0], - this.length[1], - this.length[0], - this.unitIdentifier, - this.functionCode, - this.startingAddress[1], - this.startingAddress[0], - coilValue[1], - coilValue[0], - this.crc[0], - this.crc[1] - }; - if (this.serialflag) { - crc = calculateCRC(data, 6, 6); - data[data.length - 2] = crc[0]; - data[data.length - 1] = crc[1]; - } - byte[] serialdata = null; - if (serialflag) { - serialdata = new byte[8]; - System.arraycopy(data, 6, serialdata, 0, 8); - serialPort.purgePort(SerialPort.PURGE_RXCLEAR); - serialPort.writeBytes(serialdata); - if (debug) StoreLogData.getInstance().Store("Send Serial-Data: " + Arrays.toString(serialdata)); - long dateTimeSend = DateTime.getDateTimeTicks(); - byte receivedUnitIdentifier = (byte) 0xFF; - serialdata = new byte[256]; - int expectedlength = 8; - while (receivedUnitIdentifier != this.unitIdentifier & !((DateTime.getDateTimeTicks() - dateTimeSend) > 10000 * this.connectTimeout)) { - serialdata = serialPort.readBytes(expectedlength, this.connectTimeout); - - receivedUnitIdentifier = serialdata[0]; - } - if (receivedUnitIdentifier != this.unitIdentifier) { - data = new byte[256]; - } - } - if (serialdata != null) { - data = new byte[262]; - System.arraycopy(serialdata, 0, data, 6, serialdata.length); - if (debug) StoreLogData.getInstance().Store("Receive ModbusRTU-Data: " + Arrays.toString(data)); - } - if (tcpClientSocket.isConnected() | udpFlag) { - if (udpFlag) { - InetAddress ipAddress = InetAddress.getByName(this.ipAddress); - DatagramPacket sendPacket = new DatagramPacket(data, data.length, ipAddress, this.port); - DatagramSocket clientSocket = new DatagramSocket(); - clientSocket.setSoTimeout(500); - clientSocket.send(sendPacket); - data = new byte[2100]; - DatagramPacket receivePacket = new DatagramPacket(data, data.length); - clientSocket.receive(receivePacket); - clientSocket.close(); - data = receivePacket.getData(); - } else { - outStream.write(data, 0, data.length - 2); - if (debug) StoreLogData.getInstance().Store("Send ModbusTCP-Data: " + Arrays.toString(data)); - if (sendDataChangedListener.size() > 0) { - sendData = new byte[data.length - 2]; - System.arraycopy(data, 0, sendData, 0, data.length - 2); - for (SendDataChangedListener hl : sendDataChangedListener) - hl.SendDataChanged(); - } - data = new byte[2100]; - int numberOfBytes = inStream.read(data, 0, data.length); - if (receiveDataChangedListener.size() > 0) { - receiveData = new byte[numberOfBytes]; - System.arraycopy(data, 0, receiveData, 0, numberOfBytes); - for (ReceiveDataChangedListener hl : receiveDataChangedListener) - hl.ReceiveDataChanged(); - if (debug) StoreLogData.getInstance().Store("Receive ModbusTCP-Data: " + Arrays.toString(data)); - } - } - } - if (((int) (data[7] & 0xff)) == 0x85 & data[8] == 0x01) { - if (debug) StoreLogData.getInstance().Store("FunctionCodeNotSupportedException Throwed"); - throw new de.re.easymodbus.exceptions.FunctionCodeNotSupportedException("Function code not supported by master"); - } - if (((int) (data[7] & 0xff)) == 0x85 & data[8] == 0x02) { - if (debug) - StoreLogData.getInstance().Store("Starting adress invalid or starting adress + quantity invalid"); - throw new de.re.easymodbus.exceptions.StartingAddressInvalidException("Starting adress invalid or starting adress + quantity invalid"); - } - if (((int) (data[7] & 0xff)) == 0x85 & data[8] == 0x03) { - if (debug) StoreLogData.getInstance().Store("Quantity invalid"); - throw new de.re.easymodbus.exceptions.QuantityInvalidException("Quantity invalid"); - } - if (((int) (data[7] & 0xff)) == 0x85 & data[8] == 0x04) { - if (debug) StoreLogData.getInstance().Store("Error reading"); - throw new ModbusException("Error reading"); - } - } - - /** - * Write Single Register to Server - * - * @param startingAddress Address to write; Shifted by -1 - * @param value Value to write to Server - * @throws ModbusException - * @throws UnknownHostException - * @throws SocketException - * @throws SerialPortTimeoutException - * @throws SerialPortException - */ - public void WriteSingleRegister(int startingAddress, int value) throws ModbusException, - UnknownHostException, SocketException, IOException, SerialPortException, SerialPortTimeoutException { - if (tcpClientSocket == null & !udpFlag) - throw new de.re.easymodbus.exceptions.ConnectionException("connection error"); - byte[] registerValue = new byte[2]; - this.transactionIdentifier = toByteArray((int) 0x0001); - this.protocolIdentifier = toByteArray((int) 0x0000); - this.length = toByteArray((int) 0x0006); - this.functionCode = 0x06; - this.startingAddress = toByteArray(startingAddress); - registerValue = toByteArray((short) value); - - byte[] data = new byte[]{this.transactionIdentifier[1], - this.transactionIdentifier[0], - this.protocolIdentifier[1], - this.protocolIdentifier[0], - this.length[1], - this.length[0], - this.unitIdentifier, - this.functionCode, - this.startingAddress[1], - this.startingAddress[0], - registerValue[1], - registerValue[0], - this.crc[0], - this.crc[1] - }; - if (this.serialflag) { - crc = calculateCRC(data, 6, 6); - data[data.length - 2] = crc[0]; - data[data.length - 1] = crc[1]; - } - byte[] serialdata = null; - if (serialflag) { - serialdata = new byte[8]; - System.arraycopy(data, 6, serialdata, 0, 8); - serialPort.purgePort(SerialPort.PURGE_RXCLEAR); - serialPort.writeBytes(serialdata); - if (debug) StoreLogData.getInstance().Store("Send Serial-Data: " + Arrays.toString(serialdata)); - long dateTimeSend = DateTime.getDateTimeTicks(); - byte receivedUnitIdentifier = (byte) 0xFF; - serialdata = new byte[256]; - int expectedlength = 8; - while (receivedUnitIdentifier != this.unitIdentifier & !((DateTime.getDateTimeTicks() - dateTimeSend) > 10000 * this.connectTimeout)) { - serialdata = serialPort.readBytes(expectedlength, this.connectTimeout); - - receivedUnitIdentifier = serialdata[0]; - } - if (receivedUnitIdentifier != this.unitIdentifier) { - data = new byte[256]; - } - } - if (serialdata != null) { - data = new byte[262]; - System.arraycopy(serialdata, 0, data, 6, serialdata.length); - if (debug) StoreLogData.getInstance().Store("Receive ModbusRTU-Data: " + Arrays.toString(data)); - } - if (tcpClientSocket.isConnected() | udpFlag) { - if (udpFlag) { - InetAddress ipAddress = InetAddress.getByName(this.ipAddress); - DatagramPacket sendPacket = new DatagramPacket(data, data.length, ipAddress, this.port); - DatagramSocket clientSocket = new DatagramSocket(); - clientSocket.setSoTimeout(500); - clientSocket.send(sendPacket); - data = new byte[2100]; - DatagramPacket receivePacket = new DatagramPacket(data, data.length); - clientSocket.receive(receivePacket); - clientSocket.close(); - data = receivePacket.getData(); - } else { - outStream.write(data, 0, data.length - 2); - if (debug) StoreLogData.getInstance().Store("Send ModbusTCP-Data: " + Arrays.toString(data)); - if (sendDataChangedListener.size() > 0) { - sendData = new byte[data.length - 2]; - System.arraycopy(data, 0, sendData, 0, data.length - 2); - for (SendDataChangedListener hl : sendDataChangedListener) - hl.SendDataChanged(); - } - data = new byte[2100]; - int numberOfBytes = inStream.read(data, 0, data.length); - if (receiveDataChangedListener.size() > 0) { - receiveData = new byte[numberOfBytes]; - System.arraycopy(data, 0, receiveData, 0, numberOfBytes); - for (ReceiveDataChangedListener hl : receiveDataChangedListener) - hl.ReceiveDataChanged(); - if (debug) StoreLogData.getInstance().Store("Receive ModbusTCP-Data: " + Arrays.toString(data)); - } - } - } - if (((int) (data[7] & 0xff)) == 0x86 & data[8] == 0x01) { - if (debug) StoreLogData.getInstance().Store("FunctionCodeNotSupportedException Throwed"); - throw new de.re.easymodbus.exceptions.FunctionCodeNotSupportedException("Function code not supported by master"); - } - if (((int) (data[7] & 0xff)) == 0x86 & data[8] == 0x02) { - if (debug) - StoreLogData.getInstance().Store("Starting adress invalid or starting adress + quantity invalid"); - throw new de.re.easymodbus.exceptions.StartingAddressInvalidException("Starting adress invalid or starting adress + quantity invalid"); - } - if (((int) (data[7] & 0xff)) == 0x86 & data[8] == 0x03) { - if (debug) StoreLogData.getInstance().Store("Quantity invalid"); - throw new de.re.easymodbus.exceptions.QuantityInvalidException("Quantity invalid"); - } - if (((int) (data[7] & 0xff)) == 0x86 & data[8] == 0x04) { - if (debug) StoreLogData.getInstance().Store("Error reading"); - throw new ModbusException("Error reading"); - } - } - - /** - * Write Multiple Coils to Server - * - * @param startingAddress Firts Address to write; Shifted by -1 - * @param values Values to write to Server - * @throws ModbusException - * @throws UnknownHostException - * @throws SocketException - * @throws SerialPortTimeoutException - * @throws SerialPortException - */ - public void WriteMultipleCoils(int startingAddress, boolean[] values) throws ModbusException, - UnknownHostException, SocketException, IOException, SerialPortException, SerialPortTimeoutException { - byte byteCount = (byte) (values.length / 8 + 1); - if (values.length % 8 == 0) - byteCount = (byte) (byteCount - 1); - byte[] quantityOfOutputs = toByteArray((int) values.length); - byte singleCoilValue = 0; - if (tcpClientSocket == null & !udpFlag) - throw new de.re.easymodbus.exceptions.ConnectionException("connection error"); - this.transactionIdentifier = toByteArray((int) 0x0001); - this.protocolIdentifier = toByteArray((int) 0x0000); - this.length = toByteArray((int) (7 + (values.length / 8 + 1))); - this.functionCode = 0x0F; - this.startingAddress = toByteArray(startingAddress); - - byte[] data = new byte[16 + byteCount - 1]; - data[0] = this.transactionIdentifier[1]; - data[1] = this.transactionIdentifier[0]; - data[2] = this.protocolIdentifier[1]; - data[3] = this.protocolIdentifier[0]; - data[4] = this.length[1]; - data[5] = this.length[0]; - data[6] = this.unitIdentifier; - data[7] = this.functionCode; - data[8] = this.startingAddress[1]; - data[9] = this.startingAddress[0]; - data[10] = quantityOfOutputs[1]; - data[11] = quantityOfOutputs[0]; - data[12] = byteCount; - for (int i = 0; i < values.length; i++) { - if ((i % 8) == 0) - singleCoilValue = 0; - byte CoilValue; - if (values[i] == true) - CoilValue = 1; - else - CoilValue = 0; - - - singleCoilValue = (byte) ((int) CoilValue << (i % 8) | (int) singleCoilValue); - - data[13 + (i / 8)] = singleCoilValue; - } - if (this.serialflag) { - crc = calculateCRC(data, data.length - 8, 6); - data[data.length - 2] = crc[0]; - data[data.length - 1] = crc[1]; - } - byte[] serialdata = null; - if (serialflag) { - serialdata = new byte[9 + byteCount]; - System.arraycopy(data, 6, serialdata, 0, 9 + byteCount); - serialPort.purgePort(SerialPort.PURGE_RXCLEAR); - serialPort.writeBytes(serialdata); - if (debug) StoreLogData.getInstance().Store("Send Serial-Data: " + Arrays.toString(serialdata)); - long dateTimeSend = DateTime.getDateTimeTicks(); - byte receivedUnitIdentifier = (byte) 0xFF; - serialdata = new byte[256]; - int expectedlength = 8; - while (receivedUnitIdentifier != this.unitIdentifier & !((DateTime.getDateTimeTicks() - dateTimeSend) > 10000 * this.connectTimeout)) { - serialdata = serialPort.readBytes(expectedlength, this.connectTimeout); - - - receivedUnitIdentifier = serialdata[0]; - } - if (receivedUnitIdentifier != this.unitIdentifier) { - data = new byte[256]; - } - } - if (serialdata != null) { - data = new byte[262]; - System.arraycopy(serialdata, 0, data, 6, serialdata.length); - if (debug) StoreLogData.getInstance().Store("Receive ModbusRTU-Data: " + Arrays.toString(data)); - } - if (tcpClientSocket.isConnected() | udpFlag) { - if (udpFlag) { - InetAddress ipAddress = InetAddress.getByName(this.ipAddress); - DatagramPacket sendPacket = new DatagramPacket(data, data.length, ipAddress, this.port); - DatagramSocket clientSocket = new DatagramSocket(); - clientSocket.setSoTimeout(500); - clientSocket.send(sendPacket); - data = new byte[2100]; - DatagramPacket receivePacket = new DatagramPacket(data, data.length); - clientSocket.receive(receivePacket); - clientSocket.close(); - data = receivePacket.getData(); - } else { - outStream.write(data, 0, data.length - 2); - if (debug) StoreLogData.getInstance().Store("Send ModbusTCP-Data: " + Arrays.toString(data)); - if (sendDataChangedListener.size() > 0) { - sendData = new byte[data.length - 2]; - System.arraycopy(data, 0, sendData, 0, data.length - 2); - for (SendDataChangedListener hl : sendDataChangedListener) - hl.SendDataChanged(); - } - data = new byte[2100]; - int numberOfBytes = inStream.read(data, 0, data.length); - if (receiveDataChangedListener.size() > 0) { - receiveData = new byte[numberOfBytes]; - System.arraycopy(data, 0, receiveData, 0, numberOfBytes); - for (ReceiveDataChangedListener hl : receiveDataChangedListener) - hl.ReceiveDataChanged(); - if (debug) StoreLogData.getInstance().Store("Receive ModbusTCP-Data: " + Arrays.toString(data)); - } - } - } - if (((int) (data[7] & 0xff)) == 0x8F & data[8] == 0x01) { - if (debug) StoreLogData.getInstance().Store("FunctionCodeNotSupportedException Throwed"); - throw new de.re.easymodbus.exceptions.FunctionCodeNotSupportedException("Function code not supported by master"); - } - if (((int) (data[7] & 0xff)) == 0x8F & data[8] == 0x02) { - if (debug) - StoreLogData.getInstance().Store("Starting adress invalid or starting adress + quantity invalid"); - throw new de.re.easymodbus.exceptions.StartingAddressInvalidException("Starting adress invalid or starting adress + quantity invalid"); - } - if (((int) (data[7] & 0xff)) == 0x8F & data[8] == 0x03) { - if (debug) StoreLogData.getInstance().Store("Quantity invalid"); - throw new de.re.easymodbus.exceptions.QuantityInvalidException("Quantity invalid"); - } - if (((int) (data[7] & 0xff)) == 0x8F & data[8] == 0x04) { - if (debug) StoreLogData.getInstance().Store("Error reading"); - throw new ModbusException("Error reading"); - } - } - - /** - * Write Multiple Registers to Server - * - * @param startingAddress Firts Address to write; Shifted by -1 - * @param values Values to write to Server - * @throws ModbusException - * @throws UnknownHostException - * @throws SocketException - * @throws SerialPortTimeoutException - * @throws SerialPortException - */ - public void WriteMultipleRegisters(int startingAddress, int[] values) throws ModbusException, - UnknownHostException, SocketException, IOException, SerialPortException, SerialPortTimeoutException { - byte byteCount = (byte) (values.length * 2); - byte[] quantityOfOutputs = toByteArray((int) values.length); - if (tcpClientSocket == null & !udpFlag) - throw new de.re.easymodbus.exceptions.ConnectionException("connection error"); - this.transactionIdentifier = toByteArray((int) 0x0001); - this.protocolIdentifier = toByteArray((int) 0x0000); - this.length = toByteArray((int) (7 + values.length * 2)); - this.functionCode = 0x10; - this.startingAddress = toByteArray(startingAddress); - - byte[] data = new byte[15 + values.length * 2]; - data[0] = this.transactionIdentifier[1]; - data[1] = this.transactionIdentifier[0]; - data[2] = this.protocolIdentifier[1]; - data[3] = this.protocolIdentifier[0]; - data[4] = this.length[1]; - data[5] = this.length[0]; - data[6] = this.unitIdentifier; - data[7] = this.functionCode; - data[8] = this.startingAddress[1]; - data[9] = this.startingAddress[0]; - data[10] = quantityOfOutputs[1]; - data[11] = quantityOfOutputs[0]; - data[12] = byteCount; - for (int i = 0; i < values.length; i++) { - byte[] singleRegisterValue = toByteArray((int) values[i]); - data[13 + i * 2] = singleRegisterValue[1]; - data[14 + i * 2] = singleRegisterValue[0]; - } - if (this.serialflag) { - crc = calculateCRC(data, data.length - 8, 6); - data[data.length - 2] = crc[0]; - data[data.length - 1] = crc[1]; - } - byte[] serialdata = null; - if (serialflag) { - serialdata = new byte[9 + byteCount]; - System.arraycopy(data, 6, serialdata, 0, 9 + byteCount); - serialPort.purgePort(SerialPort.PURGE_RXCLEAR); - serialPort.writeBytes(serialdata); - if (debug) StoreLogData.getInstance().Store("Send Serial-Data: " + Arrays.toString(serialdata)); - long dateTimeSend = DateTime.getDateTimeTicks(); - byte receivedUnitIdentifier = (byte) 0xFF; - serialdata = new byte[256]; - int expectedlength = 8; - while (receivedUnitIdentifier != this.unitIdentifier & !((DateTime.getDateTimeTicks() - dateTimeSend) > 10000 * this.connectTimeout)) { - serialdata = serialPort.readBytes(expectedlength, this.connectTimeout); - - receivedUnitIdentifier = serialdata[0]; - } - if (receivedUnitIdentifier != this.unitIdentifier) { - data = new byte[256]; - } - } - if (serialdata != null) { - data = new byte[262]; - System.arraycopy(serialdata, 0, data, 6, serialdata.length); - if (debug) StoreLogData.getInstance().Store("Receive ModbusRTU-Data: " + Arrays.toString(data)); - } - if (tcpClientSocket.isConnected() | udpFlag) { - if (udpFlag) { - InetAddress ipAddress = InetAddress.getByName(this.ipAddress); - DatagramPacket sendPacket = new DatagramPacket(data, data.length, ipAddress, this.port); - DatagramSocket clientSocket = new DatagramSocket(); - clientSocket.setSoTimeout(500); - clientSocket.send(sendPacket); - data = new byte[2100]; - DatagramPacket receivePacket = new DatagramPacket(data, data.length); - clientSocket.receive(receivePacket); - clientSocket.close(); - data = receivePacket.getData(); - } else { - outStream.write(data, 0, data.length - 2); - if (debug) StoreLogData.getInstance().Store("Send ModbusTCP-Data: " + Arrays.toString(data)); - if (sendDataChangedListener.size() > 0) { - sendData = new byte[data.length - 2]; - System.arraycopy(data, 0, sendData, 0, data.length - 2); - for (SendDataChangedListener hl : sendDataChangedListener) - hl.SendDataChanged(); - } - data = new byte[2100]; - int numberOfBytes = inStream.read(data, 0, data.length); - if (receiveDataChangedListener.size() > 0) { - receiveData = new byte[numberOfBytes]; - System.arraycopy(data, 0, receiveData, 0, numberOfBytes); - for (ReceiveDataChangedListener hl : receiveDataChangedListener) - hl.ReceiveDataChanged(); - if (debug) StoreLogData.getInstance().Store("Receive ModbusTCP-Data: " + Arrays.toString(data)); - } - } - } - if (((int) (data[7] & 0xff)) == 0x90 & data[8] == 0x01) { - if (debug) StoreLogData.getInstance().Store("FunctionCodeNotSupportedException Throwed"); - throw new de.re.easymodbus.exceptions.FunctionCodeNotSupportedException("Function code not supported by master"); - } - if (((int) (data[7] & 0xff)) == 0x90 & data[8] == 0x02) { - if (debug) - StoreLogData.getInstance().Store("Starting adress invalid or starting adress + quantity invalid"); - throw new de.re.easymodbus.exceptions.StartingAddressInvalidException("Starting adress invalid or starting adress + quantity invalid"); - } - if (((int) (data[7] & 0xff)) == 0x90 & data[8] == 0x03) { - if (debug) StoreLogData.getInstance().Store("Quantity invalid"); - throw new de.re.easymodbus.exceptions.QuantityInvalidException("Quantity invalid"); - } - if (((int) (data[7] & 0xff)) == 0x90 & data[8] == 0x04) { - if (debug) StoreLogData.getInstance().Store("Error reading"); - throw new ModbusException("Error reading"); - } - } - - /** - * Read and Write Multiple Registers to Server - * - * @param startingAddressRead Firts Address to Read; Shifted by -1 - * @param quantityRead Number of Values to Read - * @param startingAddressWrite Firts Address to write; Shifted by -1 - * @param values Values to write to Server - * @return Register Values from Server - * @throws ModbusException - * @throws UnknownHostException - * @throws SocketException - * @throws SerialPortTimeoutException - * @throws SerialPortException - */ - public int[] ReadWriteMultipleRegisters(int startingAddressRead, int quantityRead, int startingAddressWrite, int[] values) throws ModbusException, - UnknownHostException, SocketException, IOException, SerialPortException, SerialPortTimeoutException { - byte[] startingAddressReadLocal = new byte[2]; - byte[] quantityReadLocal = new byte[2]; - byte[] startingAddressWriteLocal = new byte[2]; - byte[] quantityWriteLocal = new byte[2]; - byte writeByteCountLocal = 0; - if (tcpClientSocket == null & !udpFlag) - throw new de.re.easymodbus.exceptions.ConnectionException("connection error"); - if (startingAddressRead > 65535 | quantityRead > 125 | startingAddressWrite > 65535 | values.length > 121) - throw new IllegalArgumentException("Starting address must be 0 - 65535; quantity must be 0 - 125"); - int[] response; - this.transactionIdentifier = toByteArray((int) 0x0001); - this.protocolIdentifier = toByteArray((int) 0x0000); - this.length = toByteArray((int) 0x0006); - this.functionCode = 0x17; - startingAddressReadLocal = toByteArray(startingAddressRead); - quantityReadLocal = toByteArray(quantityRead); - startingAddressWriteLocal = toByteArray(startingAddressWrite); - quantityWriteLocal = toByteArray(values.length); - writeByteCountLocal = (byte) (values.length * 2); - byte[] data = new byte[19 + values.length * 2]; - data[0] = this.transactionIdentifier[1]; - data[1] = this.transactionIdentifier[0]; - data[2] = this.protocolIdentifier[1]; - data[3] = this.protocolIdentifier[0]; - data[4] = this.length[1]; - data[5] = this.length[0]; - data[6] = this.unitIdentifier; - data[7] = this.functionCode; - data[8] = startingAddressReadLocal[1]; - data[9] = startingAddressReadLocal[0]; - data[10] = quantityReadLocal[1]; - data[11] = quantityReadLocal[0]; - data[12] = startingAddressWriteLocal[1]; - data[13] = startingAddressWriteLocal[0]; - data[14] = quantityWriteLocal[1]; - data[15] = quantityWriteLocal[0]; - data[16] = writeByteCountLocal; - - for (int i = 0; i < values.length; i++) { - byte[] singleRegisterValue = toByteArray((int) values[i]); - data[17 + i * 2] = singleRegisterValue[1]; - data[18 + i * 2] = singleRegisterValue[0]; - } - if (this.serialflag) { - crc = calculateCRC(data, data.length - 8, 6); - data[data.length - 2] = crc[0]; - data[data.length - 1] = crc[1]; - } - byte[] serialdata = null; - if (serialflag) { - serialdata = new byte[13 + writeByteCountLocal]; - System.arraycopy(data, 6, serialdata, 0, 13 + writeByteCountLocal); - serialPort.purgePort(SerialPort.PURGE_RXCLEAR); - serialPort.writeBytes(serialdata); - if (debug) StoreLogData.getInstance().Store("Send Serial-Data: " + Arrays.toString(serialdata)); - long dateTimeSend = DateTime.getDateTimeTicks(); - byte receivedUnitIdentifier = (byte) 0xFF; - serialdata = new byte[256]; - int expectedlength = 5 + quantityRead; - while (receivedUnitIdentifier != this.unitIdentifier & !((DateTime.getDateTimeTicks() - dateTimeSend) > 10000 * this.connectTimeout)) { - serialdata = serialPort.readBytes(expectedlength, this.connectTimeout); - - receivedUnitIdentifier = serialdata[0]; - } - if (receivedUnitIdentifier != this.unitIdentifier) { - data = new byte[256]; - } - } - if (serialdata != null) { - data = new byte[262]; - System.arraycopy(serialdata, 0, data, 6, serialdata.length); - if (debug) StoreLogData.getInstance().Store("Receive ModbusRTU-Data: " + Arrays.toString(data)); - } - if (tcpClientSocket.isConnected() | udpFlag) { - if (udpFlag) { - InetAddress ipAddress = InetAddress.getByName(this.ipAddress); - DatagramPacket sendPacket = new DatagramPacket(data, data.length, ipAddress, this.port); - DatagramSocket clientSocket = new DatagramSocket(); - clientSocket.setSoTimeout(500); - clientSocket.send(sendPacket); - data = new byte[2100]; - DatagramPacket receivePacket = new DatagramPacket(data, data.length); - clientSocket.receive(receivePacket); - clientSocket.close(); - data = receivePacket.getData(); - } else { - outStream.write(data, 0, data.length - 2); - if (debug) StoreLogData.getInstance().Store("Send ModbusTCP-Data: " + Arrays.toString(data)); - if (sendDataChangedListener.size() > 0) { - sendData = new byte[data.length - 2]; - System.arraycopy(data, 0, sendData, 0, data.length - 2); - for (SendDataChangedListener hl : sendDataChangedListener) - hl.SendDataChanged(); - } - data = new byte[2100]; - int numberOfBytes = inStream.read(data, 0, data.length); - if (receiveDataChangedListener.size() > 0) { - receiveData = new byte[numberOfBytes]; - System.arraycopy(data, 0, receiveData, 0, numberOfBytes); - for (ReceiveDataChangedListener hl : receiveDataChangedListener) - hl.ReceiveDataChanged(); - if (debug) StoreLogData.getInstance().Store("Receive ModbusTCP-Data: " + Arrays.toString(data)); - } - } - } - if (((int) (data[7] & 0xff)) == 0x97 & data[8] == 0x01) { - if (debug) StoreLogData.getInstance().Store("FunctionCodeNotSupportedException Throwed"); - throw new de.re.easymodbus.exceptions.FunctionCodeNotSupportedException("Function code not supported by master"); - } - if (((int) (data[7] & 0xff)) == 0x97 & data[8] == 0x02) { - if (debug) - StoreLogData.getInstance().Store("Starting adress invalid or starting adress + quantity invalid"); - throw new de.re.easymodbus.exceptions.StartingAddressInvalidException("Starting adress invalid or starting adress + quantity invalid"); - } - if (((int) (data[7] & 0xff)) == 0x97 & data[8] == 0x03) { - if (debug) StoreLogData.getInstance().Store("Quantity invalid"); - throw new de.re.easymodbus.exceptions.QuantityInvalidException("Quantity invalid"); - } - if (((int) (data[7] & 0xff)) == 0x97 & data[8] == 0x04) { - if (debug) StoreLogData.getInstance().Store("Error reading"); - throw new ModbusException("Error reading"); - } - response = new int[quantityRead]; - for (int i = 0; i < quantityRead; i++) { - byte lowByte; - byte highByte; - highByte = data[9 + i * 2]; - lowByte = data[9 + i * 2 + 1]; - - byte[] bytes = new byte[]{highByte, lowByte}; - - - ByteBuffer byteBuffer = ByteBuffer.wrap(bytes); - response[i] = byteBuffer.getShort(); - } - return (response); - } - - /** - * Close connection to Server - * - * @throws IOException - * @throws SerialPortException - */ - public void Disconnect() throws IOException, SerialPortException { - if (!serialflag) { - if (inStream != null) - inStream.close(); - if (outStream != null) - outStream.close(); - if (tcpClientSocket != null) - tcpClientSocket.close(); - tcpClientSocket = null; - - } else { - if (serialPort != null) { - serialPort.closePort(); - } - - } - } - - - public static byte[] toByteArray(int value) { - byte[] result = new byte[2]; - result[1] = (byte) (value >> 8); - result[0] = (byte) (value); - return result; - } - - public static byte[] toByteArrayInt(int value) { - return ByteBuffer.allocate(4).putInt(value).array(); - } - - public static byte[] toByteArrayLong(long value) { - return ByteBuffer.allocate(8).putLong(value).array(); - } - - public static byte[] toByteArrayDouble(double value) { - return ByteBuffer.allocate(8).putDouble(value).array(); - } - - public static byte[] toByteArray(float value) { - return ByteBuffer.allocate(4).putFloat(value).array(); - } - - /** - * client connected to Server - * - * @return if Client is connected to Server - */ - public boolean isConnected() { - if (serialflag) { - if (serialPort == null) - return false; - if (serialPort.isOpened()) - return true; - else - return false; - } - - boolean returnValue = false; - if (tcpClientSocket == null) - returnValue = false; - else { - if (tcpClientSocket.isConnected()) - returnValue = true; - else - returnValue = false; - } - return returnValue; - } - - public boolean Available(int timeout) { - InetAddress address; - try { - address = InetAddress.getByName(this.ipAddress); - boolean reachable = address.isReachable(timeout); - return reachable; - } catch (IOException e) { - e.printStackTrace(); - return false; - } - - } - - - /** - * Returns ip Address of Server - * - * @return ip address of server - */ - public String getipAddress() { - return ipAddress; - } - - /** - * sets IP-Address of server - * - * @param ipAddress ipAddress of Server - */ - public void setipAddress(String ipAddress) { - this.ipAddress = ipAddress; - } - - /** - * Returns port of Server listening - * - * @return port of Server listening - */ - public int getPort() { - return port; - } - - /** - * sets Portof server - * - * @param port Port of Server - */ - public void setPort(int port) { - this.port = port; - } - - /** - * Returns UDP-Flag which enables Modbus UDP and disabled Modbus TCP - * - * @return UDP Flag - */ - public boolean getUDPFlag() { - return udpFlag; - } - - /** - * sets UDP-Flag which enables Modbus UDP and disables Mopdbus TCP - * - * @param udpFlag UDP Flag - */ - public void setUDPFlag(boolean udpFlag) { - this.udpFlag = udpFlag; - } - - public int getConnectionTimeout() { - return connectTimeout; - } - - public void setConnectionTimeout(int connectionTimeout) { - this.connectTimeout = connectionTimeout; - } - - public void setSerialFlag(boolean serialflag) { - this.serialflag = serialflag; - } - - public boolean getSerialFlag() { - return this.serialflag; - } - - public void setUnitIdentifier(short unitIdentifier) { - this.unitIdentifier = (byte) unitIdentifier; - } - - public short getUnitIdentifier() { - return this.unitIdentifier; - } - - - /** - * Sets and enables the Logfilename which writes information about received and send messages to File - * - * @param logFileName File name to log files - */ - public void setLogFileName(String logFileName) { - StoreLogData.getInstance().setFilename(logFileName); - debug = true; - } - - /** - * Sets the Name of the serial port - * - * @param serialPort Name of the Serial port - */ - public void setSerialPort(String serialPort) { - this.serialflag = true; - this.comPort = serialPort; - } - - /** - * @return the Name of the Serial port - */ - public String getSerialPort() { - return this.comPort; - } - - /** - * Sets the Baudrate for Serial connection (Modbus RTU) - * - * @param baudrate Sets the Baudrate for Serial connection (Modbus RTU) - */ - public void setBaudrate(int baudrate) { - this.baudrate = baudrate; - } - - /** - * returns the Baudrate for Serial connection (Modbus RTU) - * - * @return returns the Baudrate for Serial connection (Modbus RTU) - */ - public int getBaudrate() { - return this.baudrate; - } - - /** - * sets the Parity for Serial connection (Modbus RTU) - * - * @param parity sets the Parity for Serial connection (Modbus RTU) - */ - public void setParity(Parity parity) { - this.parity = parity; - } - - /** - * returns the Parity for Serial connection (Modbus RTU) - * - * @return returns the Parity for Serial connection (Modbus RTU) - */ - public Parity getParity() { - return this.parity; - } - - /** - * sets the stopbots for serial connection (Modbus RTU) - * - * @param stopBits sets the Stopbits for serial connection (Modbus RTU) - */ - public void setStopBits(StopBits stopBits) { - this.stopBits = stopBits; - } - - /** - * returns the Stopbits for serial connection (Modbus RTU) - * - * @return returns the Stopbits for serial connection (Modbus RTU) - */ - public StopBits getStopBits() { - return this.stopBits; - } - - public void addReveiveDataChangedListener(ReceiveDataChangedListener toAdd) { - receiveDataChangedListener.add(toAdd); - } - - public void addSendDataChangedListener(SendDataChangedListener toAdd) { - sendDataChangedListener.add(toAdd); - } - -} \ No newline at end of file diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/ReceiveDataChangedListener.java b/lc-historian/src/main/java/de/re/easymodbus/modbusclient/ReceiveDataChangedListener.java deleted file mode 100644 index fa7bf3a66929931f77b5874a272ea5449a37bf62..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/ReceiveDataChangedListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package de.re.easymodbus.modbusclient; - -public interface ReceiveDataChangedListener { - void ReceiveDataChanged(); - -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/SendDataChangedListener.java b/lc-historian/src/main/java/de/re/easymodbus/modbusclient/SendDataChangedListener.java deleted file mode 100644 index 3aa91e3ee4f849d06d4b7167b1d9a84a8b508a1d..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/SendDataChangedListener.java +++ /dev/null @@ -1,26 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package de.re.easymodbus.modbusclient; - -public interface SendDataChangedListener { - void SendDataChanged(); -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/StoreLogData.java b/lc-historian/src/main/java/de/re/easymodbus/modbusclient/StoreLogData.java deleted file mode 100644 index be2ad073232009ddf5e66148e2ac8d1c885c5112..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/StoreLogData.java +++ /dev/null @@ -1,102 +0,0 @@ -package de.re.easymodbus.modbusclient; - -import java.io.*; - -/** - * Stores Log Data is a File. The Data will be stored in the File logDataYYYYMMDD.txt - * Example: logData20170403.txt - * - * @author Stefan Rossmann - */ - -public class StoreLogData { - - FileWriter fileWriter = null; - private String filename = null; - - private static StoreLogData instance; - - /** - * Default constructor - * - * @throws IOException - */ - private StoreLogData() { - - } - - /** - * Store into LogData into File - * - * @param message Message to write into LogFile - */ - public synchronized void Store(String message) { - try { - fileWriter = new FileWriter(filename, true); - while (!new File(filename).canWrite()) ; - fileWriter.append(DateTime.getDateTimeStringMilliseconds() + " " + message + System.lineSeparator()); - - } catch (IOException e) { - - e.printStackTrace(); - } finally { - - if (fileWriter != null) - try { - fileWriter.close(); - ; - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - - /** - * Store into Exception into File - * - * @param message Message to write into LogFile - * @param e Stack Trace of Exception will be stored - */ - public void Store(String message, Exception e) { - e.printStackTrace(); - StringWriter sw = new StringWriter(); - e.printStackTrace(new PrintWriter(sw)); - String exceptionAsString = sw.toString(); - FileWriter fileWriter = null; - try { - fileWriter = new FileWriter(filename, true); - fileWriter.append(DateTime.getDateTimeStringMilliseconds() + " " + message + " " + exceptionAsString + System.lineSeparator()); - - } catch (IOException exc) { - exc.printStackTrace(); - } finally { - if (fileWriter != null) - try { - fileWriter.close(); - } catch (IOException exc) { - // TODO Auto-generated catch block - exc.printStackTrace(); - } - } - } - - public void setFilename(String filename) { - this.filename = filename; - } - - - /** - * Returns the instance of the class (Singleton) - */ - public static synchronized StoreLogData getInstance() { - if (StoreLogData.instance == null) { - StoreLogData.instance = new StoreLogData(); - - } - return StoreLogData.instance; - } - - -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/gui/EasyModbusTCPClientExampleGUI.java b/lc-historian/src/main/java/de/re/easymodbus/modbusclient/gui/EasyModbusTCPClientExampleGUI.java deleted file mode 100644 index 9c809c5d887ea4df0ea79145088c374fd11a3148..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/gui/EasyModbusTCPClientExampleGUI.java +++ /dev/null @@ -1,579 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package de.re.easymodbus.modbusclient.gui; - -import de.re.easymodbus.modbusclient.ModbusClient; -import de.re.easymodbus.modbusclient.ReceiveDataChangedListener; -import de.re.easymodbus.modbusclient.SendDataChangedListener; - -import javax.swing.*; -import javax.swing.GroupLayout.Alignment; -import javax.swing.LayoutStyle.ComponentPlacement; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; - -/** - * @author Stefan Ro�mann - */ -@SuppressWarnings("serial") -public class EasyModbusTCPClientExampleGUI extends JFrame - implements ReceiveDataChangedListener, SendDataChangedListener { - JComboBox comboBox; - /** - * Creates new form EasyModbusTCPClientExampleGUI - */ - private ModbusClient modbusClient; - - public EasyModbusTCPClientExampleGUI() { - - - initComponents(); - modbusClient = new ModbusClient(); - modbusClient.addReveiveDataChangedListener(this); - modbusClient.addSendDataChangedListener(this); - } - - public void ReceiveDataChanged() { - jTextArea1.append("Rx:"); - for (int i = 0; i < modbusClient.receiveData.length; i++) { - jTextArea1.append(" "); - if (modbusClient.receiveData[i] < 16) - jTextArea1.append("0"); - jTextArea1.append(Integer.toHexString(modbusClient.receiveData[i])); - - } - jTextArea1.append("\n"); - } - - public void SendDataChanged() { - jTextArea1.append("Tx:"); - for (int i = 0; i < modbusClient.sendData.length; i++) { - jTextArea1.append(" "); - if (modbusClient.sendData[i] < 16) - jTextArea1.append("0"); - jTextArea1.append(Integer.toHexString(modbusClient.sendData[i])); - } - jTextArea1.append("\n"); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - // //GEN-BEGIN:initComponents - private void initComponents() { - - jLabel1 = new JLabel(); - jButton1 = new JButton(); - jButton1.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - } - }); - jButton2 = new JButton(); - jButton3 = new JButton(); - jButton4 = new JButton(); - jPanel1 = new JPanel(); - jLabel5 = new JLabel(); - jTextFieldStartingAddress = new JTextField(); - jLabel6 = new JLabel(); - jTextFieldNumberOfValues = new JTextField(); - jScrollPane1 = new JScrollPane(); - jList1 = new JList(); - jLabel2 = new JLabel(); - jScrollPane2 = new JScrollPane(); - - setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); - - jLabel1.setToolTipText(""); - jLabel1.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - jLabel1MouseClicked(evt); - } - }); - - jButton1.setText("Read Coils - FC1"); - jButton1.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - jButton1MouseClicked(evt); - } - }); - - jButton2.setText("Read Discrete Inputs - FC2"); - jButton2.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - jButton2MouseClicked(evt); - } - }); - - jButton3.setText("Read Holding Registers - FC3"); - jButton3.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - jButton3MouseClicked(evt); - } - }); - - jButton4.setText("Read Input Registers - FC4"); - jButton4.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - jButton4MouseClicked(evt); - } - }); - - jLabel5.setText("Starting Address"); - - jTextFieldStartingAddress.setText("1"); - - jLabel6.setText("Number of Values"); - - jTextFieldNumberOfValues.setText("1"); - - jScrollPane1.setViewportView(jList1); - - jLabel2.setForeground(new java.awt.Color(0, 0, 204)); - jLabel2.setText("http://www.EasyModbusTCP.net"); - GroupLayout jPanel1Layout = new GroupLayout(jPanel1); - jPanel1Layout.setHorizontalGroup( - jPanel1Layout.createParallelGroup(Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel1Layout.createParallelGroup(Alignment.TRAILING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING) - .addComponent(jLabel5) - .addComponent(jLabel6) - .addComponent(jTextFieldStartingAddress, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE) - .addComponent(jTextFieldNumberOfValues, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)) - .addGap(10) - .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(0, 0, Short.MAX_VALUE) - .addComponent(jLabel2) - .addGap(73))) - .addContainerGap()) - ); - jPanel1Layout.setVerticalGroup( - jPanel1Layout.createParallelGroup(Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jLabel2) - .addGap(56) - .addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(jLabel5) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jTextFieldStartingAddress, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addGap(18) - .addComponent(jLabel6) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jTextFieldNumberOfValues, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) - .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 155, GroupLayout.PREFERRED_SIZE)) - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - jPanel1.setLayout(jPanel1Layout); - - comboBox = new JComboBox(); - comboBox.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent arg0) { - if ((String) (arg0.getItem()) == "Modbus TCP") { - modbusClient = new ModbusClient(); - jpModbusTCP.setVisible(true); - jpModbusRTU.setVisible(false); - } else { - modbusClient = new ModbusClient(); - jpModbusRTU.setVisible(true); - jpModbusTCP.setVisible(false); - } - } - }); - comboBox.setModel(new DefaultComboBoxModel(new String[]{"Modbus TCP", "Modbus RTU"})); - - jpModbusTCP = new JPanel(); - - jpModbusRTU = new JPanel(); - jpModbusRTU.setVisible(false); - - lblComport = new JLabel(); - lblComport.setText("COM-Port"); - - txtCom = new JTextField(); - txtCom.setToolTipText(""); - txtCom.setText("COM1"); - - textField_1 = new JTextField(); - textField_1.setText("1"); - - lblSlaveid = new JLabel(); - lblSlaveid.setText("Slave-ID"); - GroupLayout gl_jpModbusRTU = new GroupLayout(jpModbusRTU); - gl_jpModbusRTU.setHorizontalGroup( - gl_jpModbusRTU.createParallelGroup(Alignment.LEADING) - .addGap(0, 174, Short.MAX_VALUE) - .addGroup(Alignment.TRAILING, gl_jpModbusRTU.createSequentialGroup() - .addContainerGap() - .addGroup(gl_jpModbusRTU.createParallelGroup(Alignment.LEADING) - .addComponent(lblComport) - .addComponent(txtCom, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(ComponentPlacement.RELATED) - .addGroup(gl_jpModbusRTU.createParallelGroup(Alignment.TRAILING) - .addGroup(gl_jpModbusRTU.createSequentialGroup() - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(lblSlaveid, GroupLayout.DEFAULT_SIZE, 46, Short.MAX_VALUE)) - .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE)) - .addContainerGap()) - ); - gl_jpModbusRTU.setVerticalGroup( - gl_jpModbusRTU.createParallelGroup(Alignment.LEADING) - .addGap(0, 51, Short.MAX_VALUE) - .addGroup(gl_jpModbusRTU.createSequentialGroup() - .addGroup(gl_jpModbusRTU.createParallelGroup(Alignment.BASELINE) - .addComponent(lblComport) - .addComponent(lblSlaveid)) - .addPreferredGap(ComponentPlacement.RELATED) - .addGroup(gl_jpModbusRTU.createParallelGroup(Alignment.BASELINE) - .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(txtCom, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) - .addContainerGap()) - ); - jpModbusRTU.setLayout(gl_jpModbusRTU); - jTextArea1 = new JTextArea(); - - jTextArea1.setEditable(false); - jTextArea1.setBackground(new java.awt.Color(204, 204, 204)); - jTextArea1.setColumns(20); - jTextArea1.setRows(5); - GroupLayout groupLayout = new GroupLayout(getContentPane()); - groupLayout.setHorizontalGroup( - groupLayout.createParallelGroup(Alignment.LEADING) - .addGroup(groupLayout.createSequentialGroup() - .addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false) - .addComponent(jLabel1) - .addGroup(groupLayout.createSequentialGroup() - .addGap(10) - .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 174, GroupLayout.PREFERRED_SIZE)) - .addGroup(groupLayout.createSequentialGroup() - .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) - .addGroup(groupLayout.createSequentialGroup() - .addGap(10) - .addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false) - .addGroup(groupLayout.createSequentialGroup() - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jButton1, GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE)) - .addComponent(jButton2, GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE) - .addComponent(jButton3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jButton4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) - .addGroup(groupLayout.createSequentialGroup() - .addContainerGap() - .addComponent(jpModbusRTU, GroupLayout.PREFERRED_SIZE, 174, GroupLayout.PREFERRED_SIZE)) - .addGroup(groupLayout.createSequentialGroup() - .addContainerGap() - .addComponent(jpModbusTCP, GroupLayout.PREFERRED_SIZE, 174, GroupLayout.PREFERRED_SIZE))) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) - .addGroup(groupLayout.createSequentialGroup() - .addGap(10) - .addComponent(jScrollPane2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jTextArea1, GroupLayout.DEFAULT_SIZE, 424, Short.MAX_VALUE))) - .addContainerGap()) - ); - groupLayout.setVerticalGroup( - groupLayout.createParallelGroup(Alignment.LEADING) - .addGroup(groupLayout.createSequentialGroup() - .addComponent(jLabel1) - .addGap(11) - .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addGap(7) - .addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false) - .addComponent(jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(groupLayout.createSequentialGroup() - .addComponent(jpModbusTCP, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addGap(2) - .addComponent(jpModbusRTU, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE) - .addGap(18) - .addComponent(jButton1) - .addGap(11) - .addComponent(jButton2) - .addGap(11) - .addComponent(jButton3) - .addGap(11) - .addComponent(jButton4))) - .addGap(6) - .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) - .addComponent(jScrollPane2, GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE) - .addComponent(jTextArea1, GroupLayout.PREFERRED_SIZE, 101, GroupLayout.PREFERRED_SIZE))) - ); - jLabel3 = new JLabel(); - - jLabel3.setText("IP-Address"); - jLabel4 = new JLabel(); - - jLabel4.setText("Port"); - jTextFieldIPAddress = new JTextField(); - - jTextFieldIPAddress.setText("127.0.0.1"); - jTextFieldIPAddress.setToolTipText(""); - jTextFieldPort = new JTextField(); - - jTextFieldPort.setText("502"); - GroupLayout gl_jpModbusTCP = new GroupLayout(jpModbusTCP); - gl_jpModbusTCP.setHorizontalGroup( - gl_jpModbusTCP.createParallelGroup(Alignment.LEADING) - .addGroup(gl_jpModbusTCP.createSequentialGroup() - .addContainerGap() - .addGroup(gl_jpModbusTCP.createParallelGroup(Alignment.LEADING) - .addComponent(jTextFieldIPAddress, GroupLayout.PREFERRED_SIZE, 110, GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel3)) - .addPreferredGap(ComponentPlacement.RELATED) - .addGroup(gl_jpModbusTCP.createParallelGroup(Alignment.LEADING) - .addComponent(jLabel4) - .addComponent(jTextFieldPort, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE)) - .addGap(2)) - ); - gl_jpModbusTCP.setVerticalGroup( - gl_jpModbusTCP.createParallelGroup(Alignment.LEADING) - .addGroup(gl_jpModbusTCP.createSequentialGroup() - .addGroup(gl_jpModbusTCP.createParallelGroup(Alignment.BASELINE) - .addComponent(jLabel3) - .addComponent(jLabel4)) - .addPreferredGap(ComponentPlacement.RELATED) - .addGroup(gl_jpModbusTCP.createParallelGroup(Alignment.BASELINE) - .addComponent(jTextFieldIPAddress, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(jTextFieldPort, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) - .addContainerGap()) - ); - jpModbusTCP.setLayout(gl_jpModbusTCP); - getContentPane().setLayout(groupLayout); - - pack(); - }// //GEN-END:initComponents - - private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel1MouseClicked - if (java.awt.Desktop.isDesktopSupported()) { - java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); - if (desktop.isSupported(java.awt.Desktop.Action.BROWSE)) { - try { - desktop.browse(new java.net.URI("www.easymodbustcp.net")); - } catch (java.io.IOException e) { - e.printStackTrace(); - } catch (java.net.URISyntaxException e) { - e.printStackTrace(); - } - } - } - }//GEN-LAST:event_jLabel1MouseClicked - - private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked - if (!modbusClient.isConnected()) { - if (this.comboBox.getSelectedItem() == "Modbus TCP") { - modbusClient.setipAddress(jTextFieldIPAddress.getText()); - modbusClient.setPort(Integer.valueOf(jTextFieldPort.getText())); - try { - modbusClient.Connect(); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Connection failed", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - } else { - try { - modbusClient.setUnitIdentifier(Short.valueOf(textField_1.getText())); - modbusClient.Connect(txtCom.getText()); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Connection failed", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - } - } - DefaultListModel listModel = new DefaultListModel(); - int startingAddress = Integer.valueOf(jTextFieldStartingAddress.getText()) - 1; - int numberOfValues = Integer.valueOf(jTextFieldNumberOfValues.getText()); - try { - boolean[] serverResponse = modbusClient.ReadCoils(startingAddress, numberOfValues); - for (int i = 0; i < serverResponse.length; i++) - listModel.addElement(serverResponse[i]); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Server response error", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - jList1.setModel(listModel); - }//GEN-LAST:event_jButton1MouseClicked - - private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked - if (!modbusClient.isConnected()) { - if (this.comboBox.getSelectedItem() == "Modbus TCP") { - modbusClient.setipAddress(jTextFieldIPAddress.getText()); - modbusClient.setPort(Integer.valueOf(jTextFieldPort.getText())); - try { - - modbusClient.Connect(); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Connection failed", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - } else { - try { - modbusClient.setUnitIdentifier(Short.valueOf(textField_1.getText())); - modbusClient.Connect(txtCom.getText()); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Connection failed", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - } - } - DefaultListModel listModel = new DefaultListModel(); - int startingAddress = Integer.valueOf(jTextFieldStartingAddress.getText()) - 1; - int numberOfValues = Integer.valueOf(jTextFieldNumberOfValues.getText()); - try { - boolean[] serverResponse = modbusClient.ReadDiscreteInputs(startingAddress, numberOfValues); - for (int i = 0; i < serverResponse.length; i++) - listModel.addElement(serverResponse[i]); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Server response error ", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - jList1.setModel(listModel); - }//GEN-LAST:event_jButton2MouseClicked - - private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MouseClicked - if (!modbusClient.isConnected()) { - if (this.comboBox.getSelectedItem() == "Modbus TCP") { - modbusClient.setipAddress(jTextFieldIPAddress.getText()); - modbusClient.setPort(Integer.valueOf(jTextFieldPort.getText())); - try { - - modbusClient.Connect(); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Connection failed", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - } else { - try { - modbusClient.setUnitIdentifier(Short.valueOf(textField_1.getText())); - modbusClient.Connect(txtCom.getText()); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Connection failed", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - } - } - DefaultListModel listModel = new DefaultListModel(); - int startingAddress = Integer.valueOf(jTextFieldStartingAddress.getText()) - 1; - int numberOfValues = Integer.valueOf(jTextFieldNumberOfValues.getText()); - try { - int[] serverResponse = modbusClient.ReadHoldingRegisters(startingAddress, numberOfValues); - for (int i = 0; i < serverResponse.length; i++) - listModel.addElement(serverResponse[i]); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Server response error", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - jList1.setModel(listModel); - }//GEN-LAST:event_jButton3MouseClicked - - private void jButton4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton4MouseClicked - if (!modbusClient.isConnected()) { - if (this.comboBox.getSelectedItem() == "Modbus TCP") { - modbusClient.setipAddress(jTextFieldIPAddress.getText()); - modbusClient.setPort(Integer.valueOf(jTextFieldPort.getText())); - try { - - modbusClient.Connect(); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Connection failed", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - } else { - try { - modbusClient.setUnitIdentifier(Short.valueOf(textField_1.getText())); - modbusClient.Connect(txtCom.getText()); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Connection failed", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - } - } - DefaultListModel listModel = new DefaultListModel(); - int startingAddress = Integer.valueOf(jTextFieldStartingAddress.getText()) - 1; - int numberOfValues = Integer.valueOf(jTextFieldNumberOfValues.getText()); - try { - int[] serverResponse = modbusClient.ReadInputRegisters(startingAddress, numberOfValues); - for (int i = 0; i < serverResponse.length; i++) - listModel.addElement(serverResponse[i]); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Server response error", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - jList1.setModel(listModel); - }//GEN-LAST:event_jButton4MouseClicked - - /** - * @param args the command line arguments - */ - public static void main(String args[]) { - /* Set the Nimbus look and feel */ - // - /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. - * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html - */ - try { - for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { - if ("Nimbus".equals(info.getName())) { - UIManager.setLookAndFeel(info.getClassName()); - break; - } - } - } catch (ClassNotFoundException ex) { - java.util.logging.Logger.getLogger(EasyModbusTCPClientExampleGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (InstantiationException ex) { - java.util.logging.Logger.getLogger(EasyModbusTCPClientExampleGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (IllegalAccessException ex) { - java.util.logging.Logger.getLogger(EasyModbusTCPClientExampleGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (UnsupportedLookAndFeelException ex) { - java.util.logging.Logger.getLogger(EasyModbusTCPClientExampleGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } - // - - /* Create and display the form */ - java.awt.EventQueue.invokeLater(new Runnable() { - public void run() { - new EasyModbusTCPClientExampleGUI().setVisible(true); - } - }); - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private JButton jButton1; - private JButton jButton2; - private JButton jButton3; - private JButton jButton4; - private JLabel jLabel1; - private JLabel jLabel2; - private JLabel jLabel3; - private JLabel jLabel4; - private JLabel jLabel5; - private JLabel jLabel6; - private JList jList1; - private JPanel jPanel1; - private JScrollPane jScrollPane1; - private JScrollPane jScrollPane2; - private JTextArea jTextArea1; - private JTextField jTextFieldIPAddress; - private JTextField jTextFieldNumberOfValues; - private JTextField jTextFieldPort; - private JTextField jTextFieldStartingAddress; - private JPanel jpModbusTCP; - private JPanel jpModbusRTU; - private JLabel lblComport; - private JTextField txtCom; - private JTextField textField_1; - private JLabel lblSlaveid; -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/gui/EasyModbusTCPClientExampleJava.java b/lc-historian/src/main/java/de/re/easymodbus/modbusclient/gui/EasyModbusTCPClientExampleJava.java deleted file mode 100644 index 414442cacb3f2a8c8a9a2e9ef48bbdb3d421a6d8..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/gui/EasyModbusTCPClientExampleJava.java +++ /dev/null @@ -1,37 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package de.re.easymodbus.modbusclient.gui; - -/** - * @author srossmann - */ -public class EasyModbusTCPClientExampleJava { - - /** - * @param args the command line arguments - */ - public static void main(String[] args) { - EasyModbusTCPClientExampleGUI _easyModbusTCPClientExampleGUI = new EasyModbusTCPClientExampleGUI(); - _easyModbusTCPClientExampleGUI.setVisible(true); - } - -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/gui/EasyModbusTcpClient.java b/lc-historian/src/main/java/de/re/easymodbus/modbusclient/gui/EasyModbusTcpClient.java deleted file mode 100644 index 786e615c141ad9ee57631eeefd259a6328d3d411..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/gui/EasyModbusTcpClient.java +++ /dev/null @@ -1,566 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package de.re.easymodbus.modbusclient.gui; - -import de.re.easymodbus.modbusclient.ModbusClient; -import de.re.easymodbus.modbusclient.ReceiveDataChangedListener; -import de.re.easymodbus.modbusclient.SendDataChangedListener; - -import javax.swing.*; -import javax.swing.GroupLayout.Alignment; -import javax.swing.LayoutStyle.ComponentPlacement; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; - -/** - * @author Stefan Ro�mann - */ -@SuppressWarnings("serial") -public class EasyModbusTcpClient extends JFrame - implements ReceiveDataChangedListener, SendDataChangedListener { - JComboBox comboBox; - /** - * Creates new form EasyModbusTCPClientExampleGUI - */ - private ModbusClient modbusClient; - - public EasyModbusTcpClient() { - initComponents(); - modbusClient = new ModbusClient(); - modbusClient.addReveiveDataChangedListener(this); - modbusClient.addSendDataChangedListener(this); - } - - public void ReceiveDataChanged() { - jTextArea1.append("Rx:"); - for (int i = 0; i < modbusClient.receiveData.length; i++) { - jTextArea1.append(" "); - if (modbusClient.receiveData[i] < 16) - jTextArea1.append("0"); - jTextArea1.append(Integer.toHexString(modbusClient.receiveData[i])); - - } - jTextArea1.append("\n"); - } - - public void SendDataChanged() { - jTextArea1.append("Tx:"); - for (int i = 0; i < modbusClient.sendData.length; i++) { - jTextArea1.append(" "); - if (modbusClient.sendData[i] < 16) - jTextArea1.append("0"); - jTextArea1.append(Integer.toHexString(modbusClient.sendData[i])); - } - jTextArea1.append("\n"); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - // //GEN-BEGIN:initComponents - private void initComponents() { - - jLabel1 = new JLabel(); - jButton1 = new JButton(); - jButton2 = new JButton(); - jButton3 = new JButton(); - jButton4 = new JButton(); - jPanel1 = new JPanel(); - jLabel5 = new JLabel(); - jTextFieldStartingAddress = new JTextField(); - jLabel6 = new JLabel(); - jTextFieldNumberOfValues = new JTextField(); - jScrollPane1 = new JScrollPane(); - jList1 = new JList(); - jLabel2 = new JLabel(); - jScrollPane2 = new JScrollPane(); - - setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); - - jLabel1.setToolTipText(""); - jLabel1.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - jLabel1MouseClicked(evt); - } - }); - - jButton1.setText("Read Coils - FC1"); - jButton1.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - jButton1MouseClicked(evt); - } - }); - - jButton2.setText("Read Discrete Inputs - FC2"); - jButton2.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - jButton2MouseClicked(evt); - } - }); - - jButton3.setText("Read Holding Registers - FC3"); - jButton3.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - jButton3MouseClicked(evt); - } - }); - - jButton4.setText("Read Input Registers - FC4"); - jButton4.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - jButton4MouseClicked(evt); - } - }); - - jLabel5.setText("Starting Address"); - - jTextFieldStartingAddress.setText("1"); - - jLabel6.setText("Number of Values"); - - jTextFieldNumberOfValues.setText("1"); - - jScrollPane1.setViewportView(jList1); - - jLabel2.setForeground(new java.awt.Color(0, 0, 204)); - jLabel2.setText("http://www.EasyModbusTCP.net"); - GroupLayout jPanel1Layout = new GroupLayout(jPanel1); - jPanel1Layout.setHorizontalGroup( - jPanel1Layout.createParallelGroup(Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING) - .addComponent(jLabel5) - .addComponent(jLabel6) - .addComponent(jTextFieldStartingAddress, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE) - .addComponent(jTextFieldNumberOfValues, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)) - .addGap(10) - .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) - .addComponent(jLabel2)) - .addContainerGap()) - ); - jPanel1Layout.setVerticalGroup( - jPanel1Layout.createParallelGroup(Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(21) - .addComponent(jLabel2) - .addGap(46) - .addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(jLabel5) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jTextFieldStartingAddress, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addGap(18) - .addComponent(jLabel6) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jTextFieldNumberOfValues, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) - .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 155, GroupLayout.PREFERRED_SIZE)) - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - jPanel1.setLayout(jPanel1Layout); - - comboBox = new JComboBox(); - comboBox.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent arg0) { - if ((String) (arg0.getItem()) == "Modbus TCP") { - modbusClient = new ModbusClient(); - jpModbusTCP.setVisible(true); - jpModbusRTU.setVisible(false); - } else { - modbusClient = new ModbusClient(); - jpModbusRTU.setVisible(true); - jpModbusTCP.setVisible(false); - } - } - }); - comboBox.setModel(new DefaultComboBoxModel(new String[]{"Modbus TCP", "Modbus RTU"})); - - jpModbusTCP = new JPanel(); - - jpModbusRTU = new JPanel(); - jpModbusRTU.setVisible(false); - - lblComport = new JLabel(); - lblComport.setText("COM-Port"); - - txtCom = new JTextField(); - txtCom.setToolTipText(""); - txtCom.setText("COM1"); - - textField_1 = new JTextField(); - textField_1.setText("1"); - - lblSlaveid = new JLabel(); - lblSlaveid.setText("Slave-ID"); - GroupLayout gl_jpModbusRTU = new GroupLayout(jpModbusRTU); - gl_jpModbusRTU.setHorizontalGroup( - gl_jpModbusRTU.createParallelGroup(Alignment.LEADING) - .addGap(0, 174, Short.MAX_VALUE) - .addGroup(Alignment.TRAILING, gl_jpModbusRTU.createSequentialGroup() - .addContainerGap() - .addGroup(gl_jpModbusRTU.createParallelGroup(Alignment.LEADING) - .addComponent(lblComport) - .addComponent(txtCom, GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(ComponentPlacement.RELATED) - .addGroup(gl_jpModbusRTU.createParallelGroup(Alignment.TRAILING) - .addGroup(gl_jpModbusRTU.createSequentialGroup() - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(lblSlaveid, GroupLayout.DEFAULT_SIZE, 46, Short.MAX_VALUE)) - .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE)) - .addContainerGap()) - ); - gl_jpModbusRTU.setVerticalGroup( - gl_jpModbusRTU.createParallelGroup(Alignment.LEADING) - .addGap(0, 51, Short.MAX_VALUE) - .addGroup(gl_jpModbusRTU.createSequentialGroup() - .addGroup(gl_jpModbusRTU.createParallelGroup(Alignment.BASELINE) - .addComponent(lblComport) - .addComponent(lblSlaveid)) - .addPreferredGap(ComponentPlacement.RELATED) - .addGroup(gl_jpModbusRTU.createParallelGroup(Alignment.BASELINE) - .addComponent(textField_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(txtCom, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) - .addContainerGap()) - ); - jpModbusRTU.setLayout(gl_jpModbusRTU); - jTextArea1 = new JTextArea(); - - jTextArea1.setEditable(false); - jTextArea1.setBackground(new java.awt.Color(204, 204, 204)); - jTextArea1.setColumns(20); - jTextArea1.setRows(5); - GroupLayout groupLayout = new GroupLayout(getContentPane()); - groupLayout.setHorizontalGroup( - groupLayout.createParallelGroup(Alignment.LEADING) - .addGroup(groupLayout.createSequentialGroup() - .addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false) - .addComponent(jLabel1) - .addGroup(groupLayout.createSequentialGroup() - .addGap(10) - .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, 174, GroupLayout.PREFERRED_SIZE)) - .addGroup(groupLayout.createSequentialGroup() - .addGroup(groupLayout.createParallelGroup(Alignment.LEADING) - .addGroup(groupLayout.createSequentialGroup() - .addGap(10) - .addGroup(groupLayout.createParallelGroup(Alignment.LEADING, false) - .addGroup(groupLayout.createSequentialGroup() - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jButton1, GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE)) - .addComponent(jButton2, GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE) - .addComponent(jButton3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jButton4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) - .addGroup(groupLayout.createSequentialGroup() - .addContainerGap() - .addComponent(jpModbusTCP, GroupLayout.PREFERRED_SIZE, 174, GroupLayout.PREFERRED_SIZE)) - .addGroup(groupLayout.createSequentialGroup() - .addContainerGap() - .addComponent(jpModbusRTU, GroupLayout.PREFERRED_SIZE, 174, GroupLayout.PREFERRED_SIZE))) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jPanel1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) - .addGroup(groupLayout.createSequentialGroup() - .addGap(10) - .addComponent(jScrollPane2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jTextArea1))) - .addContainerGap()) - ); - groupLayout.setVerticalGroup( - groupLayout.createParallelGroup(Alignment.LEADING) - .addGroup(groupLayout.createSequentialGroup() - .addComponent(jLabel1) - .addGap(11) - .addComponent(comboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addGap(7) - .addGroup(groupLayout.createParallelGroup(Alignment.TRAILING, false) - .addComponent(jPanel1, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(Alignment.LEADING, groupLayout.createSequentialGroup() - .addComponent(jpModbusTCP, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addGap(2) - .addComponent(jpModbusRTU, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE) - .addGap(18) - .addComponent(jButton1) - .addGap(11) - .addComponent(jButton2) - .addGap(11) - .addComponent(jButton3) - .addGap(11) - .addComponent(jButton4))) - .addGap(6) - .addGroup(groupLayout.createParallelGroup(Alignment.BASELINE) - .addComponent(jScrollPane2, GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE) - .addComponent(jTextArea1, GroupLayout.PREFERRED_SIZE, 101, GroupLayout.PREFERRED_SIZE))) - ); - jLabel3 = new JLabel(); - - jLabel3.setText("IP-Address"); - jLabel4 = new JLabel(); - - jLabel4.setText("Port"); - jTextFieldIPAddress = new JTextField(); - - jTextFieldIPAddress.setText("127.0.0.1"); - jTextFieldIPAddress.setToolTipText(""); - jTextFieldPort = new JTextField(); - - jTextFieldPort.setText("502"); - GroupLayout gl_jpModbusTCP = new GroupLayout(jpModbusTCP); - gl_jpModbusTCP.setHorizontalGroup( - gl_jpModbusTCP.createParallelGroup(Alignment.LEADING) - .addGroup(gl_jpModbusTCP.createSequentialGroup() - .addContainerGap() - .addGroup(gl_jpModbusTCP.createParallelGroup(Alignment.TRAILING) - .addGroup(gl_jpModbusTCP.createSequentialGroup() - .addComponent(jLabel3) - .addGap(75)) - .addGroup(gl_jpModbusTCP.createSequentialGroup() - .addComponent(jTextFieldIPAddress, GroupLayout.PREFERRED_SIZE, 122, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(ComponentPlacement.RELATED))) - .addGroup(gl_jpModbusTCP.createParallelGroup(Alignment.LEADING) - .addComponent(jTextFieldPort, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel4)) - .addContainerGap()) - ); - gl_jpModbusTCP.setVerticalGroup( - gl_jpModbusTCP.createParallelGroup(Alignment.LEADING) - .addGroup(gl_jpModbusTCP.createSequentialGroup() - .addGroup(gl_jpModbusTCP.createParallelGroup(Alignment.BASELINE) - .addComponent(jLabel3) - .addComponent(jLabel4)) - .addPreferredGap(ComponentPlacement.RELATED) - .addGroup(gl_jpModbusTCP.createParallelGroup(Alignment.BASELINE) - .addComponent(jTextFieldPort, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(jTextFieldIPAddress, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) - .addContainerGap()) - ); - jpModbusTCP.setLayout(gl_jpModbusTCP); - getContentPane().setLayout(groupLayout); - - pack(); - }// //GEN-END:initComponents - - private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel1MouseClicked - if (java.awt.Desktop.isDesktopSupported()) { - java.awt.Desktop desktop = java.awt.Desktop.getDesktop(); - if (desktop.isSupported(java.awt.Desktop.Action.BROWSE)) { - try { - desktop.browse(new java.net.URI("www.easymodbustcp.net")); - } catch (java.io.IOException e) { - e.printStackTrace(); - } catch (java.net.URISyntaxException e) { - e.printStackTrace(); - } - } - } - }//GEN-LAST:event_jLabel1MouseClicked - - private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton1MouseClicked - if (!modbusClient.isConnected()) { - if (this.comboBox.getSelectedItem() == "Modbus TCP") { - modbusClient.setipAddress(jTextFieldIPAddress.getText()); - modbusClient.setPort(Integer.valueOf(jTextFieldPort.getText())); - try { - modbusClient.Connect(); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Connection failed", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - } else { - try { - modbusClient.setUnitIdentifier((byte) 1); - modbusClient.Connect(txtCom.getText()); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Connection failed", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - } - } - DefaultListModel listModel = new DefaultListModel(); - int startingAddress = Integer.valueOf(jTextFieldStartingAddress.getText()) - 1; - int numberOfValues = Integer.valueOf(jTextFieldNumberOfValues.getText()); - try { - boolean[] serverResponse = modbusClient.ReadCoils(startingAddress, numberOfValues); - for (int i = 0; i < serverResponse.length; i++) - listModel.addElement(serverResponse[i]); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Server response error", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - jList1.setModel(listModel); - }//GEN-LAST:event_jButton1MouseClicked - - private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton2MouseClicked - if (!modbusClient.isConnected()) { - if (this.comboBox.getSelectedItem() == "Modbus TCP") { - modbusClient.setipAddress(jTextFieldIPAddress.getText()); - modbusClient.setPort(Integer.valueOf(jTextFieldPort.getText())); - try { - modbusClient.setUnitIdentifier((byte) 1); - modbusClient.Connect(); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Connection failed", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - } else { - try { - modbusClient.Connect(txtCom.getText()); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Connection failed", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - } - } - DefaultListModel listModel = new DefaultListModel(); - int startingAddress = Integer.valueOf(jTextFieldStartingAddress.getText()) - 1; - int numberOfValues = Integer.valueOf(jTextFieldNumberOfValues.getText()); - try { - boolean[] serverResponse = modbusClient.ReadDiscreteInputs(startingAddress, numberOfValues); - for (int i = 0; i < serverResponse.length; i++) - listModel.addElement(serverResponse[i]); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Server response error ", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - jList1.setModel(listModel); - }//GEN-LAST:event_jButton2MouseClicked - - private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton3MouseClicked - if (!modbusClient.isConnected()) { - if (this.comboBox.getSelectedItem() == "Modbus TCP") { - modbusClient.setipAddress(jTextFieldIPAddress.getText()); - modbusClient.setPort(Integer.valueOf(jTextFieldPort.getText())); - try { - modbusClient.Connect(); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Connection failed", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - } else { - try { - modbusClient.Connect(txtCom.getText()); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Connection failed", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - } - } - DefaultListModel listModel = new DefaultListModel(); - int startingAddress = Integer.valueOf(jTextFieldStartingAddress.getText()) - 1; - int numberOfValues = Integer.valueOf(jTextFieldNumberOfValues.getText()); - try { - int[] serverResponse = modbusClient.ReadHoldingRegisters(startingAddress, numberOfValues); - for (int i = 0; i < serverResponse.length; i++) - listModel.addElement(serverResponse[i]); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Server response error", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - jList1.setModel(listModel); - }//GEN-LAST:event_jButton3MouseClicked - - private void jButton4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jButton4MouseClicked - if (!modbusClient.isConnected()) { - if (this.comboBox.getSelectedItem() == "Modbus TCP") { - modbusClient.setipAddress(jTextFieldIPAddress.getText()); - modbusClient.setPort(Integer.valueOf(jTextFieldPort.getText())); - try { - modbusClient.Connect(); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Connection failed", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - } else { - try { - modbusClient.Connect(txtCom.getText()); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Connection failed", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - } - } - DefaultListModel listModel = new DefaultListModel(); - int startingAddress = Integer.valueOf(jTextFieldStartingAddress.getText()) - 1; - int numberOfValues = Integer.valueOf(jTextFieldNumberOfValues.getText()); - try { - int[] serverResponse = modbusClient.ReadInputRegisters(startingAddress, numberOfValues); - for (int i = 0; i < serverResponse.length; i++) - listModel.addElement(serverResponse[i]); - } catch (Exception e) { - JOptionPane.showMessageDialog(null, "Server response error", "Connection failed", JOptionPane.OK_CANCEL_OPTION); - } - jList1.setModel(listModel); - }//GEN-LAST:event_jButton4MouseClicked - - /** - * @param args the command line arguments - */ - public static void main(String args[]) { - /* Set the Nimbus look and feel */ - // - /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. - * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html - */ - try { - for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { - if ("Nimbus".equals(info.getName())) { - UIManager.setLookAndFeel(info.getClassName()); - break; - } - } - } catch (ClassNotFoundException ex) { - java.util.logging.Logger.getLogger(EasyModbusTcpClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (InstantiationException ex) { - java.util.logging.Logger.getLogger(EasyModbusTcpClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (IllegalAccessException ex) { - java.util.logging.Logger.getLogger(EasyModbusTcpClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (UnsupportedLookAndFeelException ex) { - java.util.logging.Logger.getLogger(EasyModbusTcpClient.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } - // - - /* Create and display the form */ - java.awt.EventQueue.invokeLater(new Runnable() { - public void run() { - new EasyModbusTcpClient().setVisible(true); - } - }); - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private JButton jButton1; - private JButton jButton2; - private JButton jButton3; - private JButton jButton4; - private JLabel jLabel1; - private JLabel jLabel2; - private JLabel jLabel3; - private JLabel jLabel4; - private JLabel jLabel5; - private JLabel jLabel6; - private JList jList1; - private JPanel jPanel1; - private JScrollPane jScrollPane1; - private JScrollPane jScrollPane2; - private JTextArea jTextArea1; - private JTextField jTextFieldIPAddress; - private JTextField jTextFieldNumberOfValues; - private JTextField jTextFieldPort; - private JTextField jTextFieldStartingAddress; - private JPanel jpModbusTCP; - private JPanel jpModbusRTU; - private JLabel lblComport; - private JTextField txtCom; - private JTextField textField_1; - private JLabel lblSlaveid; -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/gui/Rossmann-Engineering_Logo_klein.png b/lc-historian/src/main/java/de/re/easymodbus/modbusclient/gui/Rossmann-Engineering_Logo_klein.png deleted file mode 100644 index 8a76f791657784d25966a263c4b35ac2f386c729..0000000000000000000000000000000000000000 Binary files a/lc-historian/src/main/java/de/re/easymodbus/modbusclient/gui/Rossmann-Engineering_Logo_klein.png and /dev/null differ diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ClientConnectionThread.java b/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ClientConnectionThread.java deleted file mode 100644 index 832696731f424e881eec824fd6470fd75bbbd0e3..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ClientConnectionThread.java +++ /dev/null @@ -1,61 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package de.re.easymodbus.modbusserver; - -class ClientConnectionThread extends Thread { - ModbusServer easyModbusTCPServer; - private java.net.Socket socket; - private byte[] inBuffer = new byte[1024]; - - public ClientConnectionThread(java.net.Socket socket, ModbusServer easyModbusTCPServer) { - this.easyModbusTCPServer = easyModbusTCPServer; - this.socket = socket; - } - - public void run() { - this.easyModbusTCPServer.setNumberOfConnectedClients(this.easyModbusTCPServer.getNumberOfConnectedClients() + 1); - - try { - socket.setSoTimeout(easyModbusTCPServer.getClientConnectionTimeout()); - java.io.InputStream inputStream; - inputStream = socket.getInputStream(); - while (socket.isConnected() & !socket.isClosed() & !socket.isClosed() & easyModbusTCPServer.getServerRunning()) { - - int numberOfBytes = (inputStream.read(inBuffer)); - if (numberOfBytes == -1) - break; - if (numberOfBytes > 4) - (new ProcessReceivedDataThread(inBuffer, easyModbusTCPServer, socket)).start(); - Thread.sleep(5); - } - this.easyModbusTCPServer.setNumberOfConnectedClients(this.easyModbusTCPServer.getNumberOfConnectedClients() - 1); - socket.close(); - } catch (Exception e) { - this.easyModbusTCPServer.setNumberOfConnectedClients(this.easyModbusTCPServer.getNumberOfConnectedClients() - 1); - try { - socket.close(); - } catch (Exception exc) { - } - e.printStackTrace(); - } - } -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/DataModel.java b/lc-historian/src/main/java/de/re/easymodbus/modbusserver/DataModel.java deleted file mode 100644 index 053377a2d8a4689a06ecd879aa36f62c23c8fb57..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/DataModel.java +++ /dev/null @@ -1,51 +0,0 @@ -package de.re.easymodbus.modbusserver; - - -class DataModel { - private int[] holdingRegisters = new int[65535]; - private int[] inputRegisters = new int[65535]; - private boolean[] coils = new boolean[65535]; - private boolean[] discreteInputs = new boolean[65535]; - - private int[] mqttHoldingRegistersOldValues = new int[65535]; - private int[] mqttInputRegistersOldValues = new int[65535]; - private boolean[] mqttCoilsOldValues = new boolean[65535]; - private boolean[] mqttDiscreteInputsOldValues = new boolean[65535]; - - public void setHoldingRegister(int i, int value) { - holdingRegisters[i] = value; - - } - - public void setInputRegister(int i, int value) { - inputRegisters[i] = value; - - } - - public void setCoil(int i, boolean value) { - coils[i] = value; - - } - - public void setDiscreteInput(int i, boolean value) { - discreteInputs[i] = value; - - } - - public int getHoldingRegister(int i) { - return holdingRegisters[i]; - } - - public int getInputRegister(int i) { - return inputRegisters[i]; - } - - public boolean getCoil(int i) { - return coils[i]; - } - - public boolean getDiscreteInput(int i) { - return discreteInputs[i]; - } - -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ICoilsChangedDelegator.java b/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ICoilsChangedDelegator.java deleted file mode 100644 index bef835863111cb6daf2a48feb217c72d59ece250..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ICoilsChangedDelegator.java +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package de.re.easymodbus.modbusserver; - -/** - * @author Stefan Roßmann - */ -public interface ICoilsChangedDelegator { - public void coilsChangedEvent(); -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/IHoldingRegistersChangedDelegator.java b/lc-historian/src/main/java/de/re/easymodbus/modbusserver/IHoldingRegistersChangedDelegator.java deleted file mode 100644 index e2d6dda812486e338e72c596368bc7d86aa1eac9..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/IHoldingRegistersChangedDelegator.java +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package de.re.easymodbus.modbusserver; - -/** - * @author Stefan Roßmann - */ -public interface IHoldingRegistersChangedDelegator { - public void holdingRegistersChangedEvent(); -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ILogDataChangedDelegator.java b/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ILogDataChangedDelegator.java deleted file mode 100644 index ace95a74e5566d0db2833432f96701b816b13e37..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ILogDataChangedDelegator.java +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package de.re.easymodbus.modbusserver; - -/** - * @author Stefan Rossmann - */ -public interface ILogDataChangedDelegator { - public void logDataChangedEvent(); -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/INumberOfConnectedClientsChangedDelegator.java b/lc-historian/src/main/java/de/re/easymodbus/modbusserver/INumberOfConnectedClientsChangedDelegator.java deleted file mode 100644 index 614e3502f5a1260c1ac976e02f621ff83369b782..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/INumberOfConnectedClientsChangedDelegator.java +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package de.re.easymodbus.modbusserver; - -/** - * @author Stefan Rossmann - */ -public interface INumberOfConnectedClientsChangedDelegator { - public void NumberOfConnectedClientsChanged(); -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ListenerThread.java b/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ListenerThread.java deleted file mode 100644 index a5d4a667983641db46b3f8b82d42ed146b75bdc8..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ListenerThread.java +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package de.re.easymodbus.modbusserver; - -import java.io.IOException; - -class ListenerThread extends Thread { - ModbusServer easyModbusTCPServer; - - public ListenerThread(ModbusServer easyModbusTCPServer) { - this.easyModbusTCPServer = easyModbusTCPServer; - } - - public void run() { - java.net.ServerSocket serverSocket = null; - try { - serverSocket = new java.net.ServerSocket(easyModbusTCPServer.getPort()); - - - while (easyModbusTCPServer.getServerRunning() & !this.isInterrupted()) { - java.net.Socket socket = serverSocket.accept(); - (new ClientConnectionThread(socket, easyModbusTCPServer)).start(); - } - } catch (IOException e) { - System.out.println(e.getMessage()); - // TODO Auto-generated catch block - e.printStackTrace(); - - } - if (serverSocket != null) - try { - serverSocket.close(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ModbusProtocoll.java b/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ModbusProtocoll.java deleted file mode 100644 index f07db8d6c001c3a782aabcf921a583925514b638..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ModbusProtocoll.java +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package de.re.easymodbus.modbusserver; - -public class ModbusProtocoll { - public java.util.Calendar timeStamp; - public boolean request; - public boolean response; - public int transactionIdentifier; - public int protocolIdentifier; - public int length; - public byte unitIdentifier; - public byte functionCode; - public int startingAdress; - public int quantity; - public short byteCount; - public byte exceptionCode; - public byte errorCode; - public short[] receiveCoilValues; - public int[] receiveRegisterValues; - public int[] sendRegisterValues; - public boolean[] sendCoilValues; -} - diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ModbusServer.java b/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ModbusServer.java deleted file mode 100644 index 8d63fe63ec853913ee632d715e4ddb548261fcb4..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ModbusServer.java +++ /dev/null @@ -1,1219 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package de.re.easymodbus.modbusserver; - -import java.io.IOException; -import java.util.Calendar; - - -/** - * @author Stefan Roßmann - */ -public class ModbusServer extends Thread { - private int port = 502; - protected ModbusProtocoll receiveData; - protected ModbusProtocoll sendData = new ModbusProtocoll(); - @Deprecated - public int[] holdingRegisters = new int[65535]; - @Deprecated - public int[] inputRegisters = new int[65535]; - @Deprecated - public boolean[] coils = new boolean[65535]; - @Deprecated - public boolean[] discreteInputs = new boolean[65535]; - private DataModel dataModel = new DataModel(); - private int numberOfConnections = 0; - public boolean udpFlag; - private int clientConnectionTimeout = 10000; - - - private ModbusProtocoll[] modbusLogData = new ModbusProtocoll[100]; - private boolean functionCode1Disabled; - private boolean functionCode2Disabled; - private boolean functionCode3Disabled; - private boolean functionCode4Disabled; - private boolean functionCode5Disabled; - private boolean functionCode6Disabled; - private boolean functionCode15Disabled; - private boolean functionCode16Disabled; - private boolean serverRunning; - private ListenerThread listenerThread; - - - //******************************************************** - //*** Events *** - //******************************************************** - protected ICoilsChangedDelegator notifyCoilsChanged; - protected IHoldingRegistersChangedDelegator notifyHoldingRegistersChanged; - protected INumberOfConnectedClientsChangedDelegator notifyNumberOfConnectedClientsChanged; - protected ILogDataChangedDelegator notifyLogDataChanged; - - public ModbusServer() { - System.out.println("EasyModbus Server Library"); - System.out.println("Copyright (c) Stefan Rossmann Engineering Solutions"); - System.out.println("www.rossmann-engineering.de"); - System.out.println(""); - } - - @SuppressWarnings("deprecation") - protected void finalize() { - serverRunning = false; - listenerThread.stop(); - } - - - /** - * Method opens port and starts listening for incomming requests from client. - * - * @throws IOException - */ - public void Listen() throws IOException { - /* - coils[1] = true; - coils[10] = true; - coils[8] = true; - holdingRegisters[0] = 500; - holdingRegisters[1] = 500; - holdingRegisters[2] = 5000; - holdingRegisters[3] = 5005; - holdingRegisters[4] = 500; - holdingRegisters[5] = 500; - holdingRegisters[6] = 500; - holdingRegisters[7] = 500;*/ - - serverRunning = true; - listenerThread = new ListenerThread(this); - listenerThread.start(); - } - - /** - * Stops the Modbus Server - */ - @SuppressWarnings("deprecation") - public void StopListening() { - serverRunning = false; - listenerThread.stop(); - } - - protected void CreateAnswer(java.net.Socket socket) { - - switch (receiveData.functionCode) { - // Read Coils - case 1: - if (!functionCode1Disabled) - this.ReadCoils(socket); - else { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 1; - sendException(sendData.errorCode, sendData.exceptionCode, socket); - } - break; - // Read Input Registers - case 2: - if (!functionCode2Disabled) - this.ReadDiscreteInputs(socket); - else { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 1; - sendException(sendData.errorCode, sendData.exceptionCode, socket); - } - - break; - // Read Holding Registers - case 3: - if (!functionCode3Disabled) - this.ReadHoldingRegisters(socket); - else { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 1; - sendException(sendData.errorCode, sendData.exceptionCode, socket); - } - - break; - // Read Input Registers - case 4: - if (!functionCode4Disabled) - this.ReadInputRegisters(socket); - else { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 1; - sendException(sendData.errorCode, sendData.exceptionCode, socket); - } - - break; - // Write single coil - case 5: - if (!functionCode5Disabled) - this.WriteSingleCoil(socket); - else { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 1; - sendException(sendData.errorCode, sendData.exceptionCode, socket); - } - - break; - // Write single register - case 6: - if (!functionCode6Disabled) - this.WriteSingleRegister(socket); - else { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 1; - sendException(sendData.errorCode, sendData.exceptionCode, socket); - } - - break; - // Write Multiple coils - case 15: - if (!functionCode15Disabled) - this.WriteMultipleCoils(socket); - else { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 1; - sendException(sendData.errorCode, sendData.exceptionCode, socket); - } - - break; - // Write Multiple registers - case 16: - if (!functionCode16Disabled) - this.WriteMultipleRegisters(socket); - else { - sendData.errorCode = (byte) (receiveData.functionCode + 0x90); - sendData.exceptionCode = 1; - sendException(sendData.errorCode, sendData.exceptionCode, socket); - } - - break; - // Error: Function Code not supported - default: - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 1; - sendException(sendData.errorCode, sendData.exceptionCode, socket); - break; - - } - sendData.timeStamp = Calendar.getInstance(); - } - - private void ReadCoils(java.net.Socket socket) { - sendData = new ModbusProtocoll(); - sendData.response = true; - - sendData.transactionIdentifier = receiveData.transactionIdentifier; - sendData.protocolIdentifier = receiveData.protocolIdentifier; - - sendData.unitIdentifier = receiveData.unitIdentifier; - sendData.functionCode = receiveData.functionCode; - if ((receiveData.quantity < 1) | (receiveData.quantity > 0x07D0)) //Invalid quantity - { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 3; - } - if ((receiveData.startingAdress + 1 + receiveData.quantity) > 65535) //Invalid Starting adress or Starting address + quantity - { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 2; - } - if ((receiveData.quantity % 8) == 0) - sendData.byteCount = (byte) (receiveData.quantity / 8); - else - sendData.byteCount = (byte) (receiveData.quantity / 8 + 1); - - sendData.sendCoilValues = new boolean[receiveData.quantity]; - - System.arraycopy(coils, receiveData.startingAdress + 1, sendData.sendCoilValues, 0, sendData.sendCoilValues.length); - - byte[] data; - if (sendData.exceptionCode > 0) - data = new byte[9]; - else - data = new byte[9 + sendData.byteCount]; - byte[] byteData = new byte[2]; - - sendData.length = (byte) (data.length - 6); - - //Send Transaction identifier - data[0] = (byte) ((sendData.transactionIdentifier & 0xff00) >> 8); - data[1] = (byte) (sendData.transactionIdentifier & 0xff); - - //Send Protocol identifier - data[2] = (byte) ((sendData.protocolIdentifier & 0xff00) >> 8); - data[3] = (byte) (sendData.protocolIdentifier & 0xff); - - //Send length - data[4] = (byte) ((sendData.length & 0xff00) >> 8); - data[5] = (byte) (sendData.length & 0xff); - - //Unit Identifier - data[6] = sendData.unitIdentifier; - - //Function Code - data[7] = sendData.functionCode; - - //ByteCount - data[8] = (byte) (sendData.byteCount & 0xff); - - if (sendData.exceptionCode > 0) { - data[7] = sendData.errorCode; - data[8] = sendData.exceptionCode; - sendData.sendCoilValues = null; - } - - if (sendData.sendCoilValues != null) - for (int i = 0; i < (sendData.byteCount); i++) { - byteData = new byte[2]; - for (int j = 0; j < 8; j++) { - - byte boolValue; - if (sendData.sendCoilValues[i * 8 + j] == true) - boolValue = 1; - else - boolValue = 0; - byteData[1] = (byte) ((byteData[1]) | (boolValue << j)); - if ((i * 8 + j + 1) >= sendData.sendCoilValues.length) - break; - } - data[9 + i] = byteData[1]; - } - java.io.OutputStream outputStream; - if (socket.isConnected() & !socket.isClosed()) - try { - outputStream = socket.getOutputStream(); - outputStream.write(data); - } catch (IOException e) { - - e.printStackTrace(); - } - } - - private void ReadDiscreteInputs(java.net.Socket socket) { - sendData = new ModbusProtocoll(); - sendData.response = true; - - sendData.transactionIdentifier = receiveData.transactionIdentifier; - sendData.protocolIdentifier = receiveData.protocolIdentifier; - - sendData.unitIdentifier = receiveData.unitIdentifier; - sendData.functionCode = receiveData.functionCode; - if ((receiveData.quantity < 1) | (receiveData.quantity > 0x07D0)) //Invalid quantity - { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 3; - } - if ((receiveData.startingAdress + 1 + receiveData.quantity) > 65535) //Invalid Starting adress or Starting address + quantity - { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 2; - } - if ((receiveData.quantity % 8) == 0) - sendData.byteCount = (byte) (receiveData.quantity / 8); - else - sendData.byteCount = (byte) (receiveData.quantity / 8 + 1); - - sendData.sendCoilValues = new boolean[receiveData.quantity]; - System.arraycopy(discreteInputs, receiveData.startingAdress + 1, sendData.sendCoilValues, 0, receiveData.quantity); - - - byte[] data; - if (sendData.exceptionCode > 0) - data = new byte[9]; - else - data = new byte[9 + sendData.byteCount]; - byte[] byteData = new byte[2]; - sendData.length = (byte) (data.length - 6); - - //Send Transaction identifier - data[0] = (byte) ((sendData.transactionIdentifier & 0xff00) >> 8); - data[1] = (byte) (sendData.transactionIdentifier & 0xff); - - //Send Protocol identifier - data[2] = (byte) ((sendData.protocolIdentifier & 0xff00) >> 8); - data[3] = (byte) (sendData.protocolIdentifier & 0xff); - - //Send length - data[4] = (byte) ((sendData.length & 0xff00) >> 8); - data[5] = (byte) (sendData.length & 0xff); - - //Unit Identifier - data[6] = sendData.unitIdentifier; - - //Function Code - data[7] = sendData.functionCode; - - //ByteCount - data[8] = (byte) (sendData.byteCount & 0xff); - - - if (sendData.exceptionCode > 0) { - data[7] = sendData.errorCode; - data[8] = sendData.exceptionCode; - sendData.sendCoilValues = null; - } - - if (sendData.sendCoilValues != null) - for (int i = 0; i < (sendData.byteCount); i++) { - byteData = new byte[2]; - for (int j = 0; j < 8; j++) { - byte boolValue; - if (sendData.sendCoilValues[i * 8 + j] == true) - boolValue = 1; - else - boolValue = 0; - byteData[1] = (byte) ((byteData[1]) | (boolValue << j)); - if ((i * 8 + j + 1) >= sendData.sendCoilValues.length) - break; - } - data[9 + i] = byteData[1]; - } - java.io.OutputStream outputStream; - if (socket.isConnected() & !socket.isClosed()) - try { - outputStream = socket.getOutputStream(); - outputStream.write(data); - } catch (IOException e) { - - e.printStackTrace(); - } - } - - private void ReadHoldingRegisters(java.net.Socket socket) { - sendData = new ModbusProtocoll(); - sendData.response = true; - - sendData.transactionIdentifier = receiveData.transactionIdentifier; - sendData.protocolIdentifier = receiveData.protocolIdentifier; - - sendData.unitIdentifier = receiveData.unitIdentifier; - sendData.functionCode = receiveData.functionCode; - if ((receiveData.quantity < 1) | (receiveData.quantity > 0x007D)) //Invalid quantity - { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 3; - } - if ((receiveData.startingAdress + 1 + receiveData.quantity) > 65535) //Invalid Starting adress or Starting address + quantity - { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 2; - } - sendData.byteCount = - (short) (2 * receiveData.quantity); - sendData.sendRegisterValues = new int[receiveData.quantity]; - System.arraycopy(holdingRegisters, receiveData.startingAdress + 1, sendData.sendRegisterValues, 0, receiveData.quantity); - - if (sendData.exceptionCode > 0) - sendData.length = 0x03; - else - sendData.length = (short) (0x03 + sendData.byteCount); - - - byte[] data; - if (sendData.exceptionCode > 0) - data = new byte[9]; - else - data = new byte[9 + sendData.byteCount]; - sendData.length = (byte) (data.length - 6); - - //Send Transaction identifier - data[0] = (byte) ((sendData.transactionIdentifier & 0xff00) >> 8); - data[1] = (byte) (sendData.transactionIdentifier & 0xff); - - //Send Protocol identifier - data[2] = (byte) ((sendData.protocolIdentifier & 0xff00) >> 8); - data[3] = (byte) (sendData.protocolIdentifier & 0xff); - - //Send length - data[4] = (byte) ((sendData.length & 0xff00) >> 8); - data[5] = (byte) (sendData.length & 0xff); - - //Unit Identifier - data[6] = sendData.unitIdentifier; - - //Function Code - data[7] = sendData.functionCode; - - //ByteCount - data[8] = (byte) (sendData.byteCount & 0xff); - - if (sendData.exceptionCode > 0) { - data[7] = sendData.errorCode; - data[8] = sendData.exceptionCode; - sendData.sendRegisterValues = null; - } - - - if (sendData.sendRegisterValues != null) - for (int i = 0; i < (sendData.byteCount / 2); i++) { - data[9 + i * 2] = (byte) ((sendData.sendRegisterValues[i] & 0xff00) >> 8); - data[10 + i * 2] = (byte) (sendData.sendRegisterValues[i] & 0xff); - } - java.io.OutputStream outputStream; - if (socket.isConnected() & !socket.isClosed()) - try { - outputStream = socket.getOutputStream(); - outputStream.write(data); - } catch (IOException e) { - - e.printStackTrace(); - } - } - - private void ReadInputRegisters(java.net.Socket socket) { - sendData = new ModbusProtocoll(); - sendData.response = true; - - sendData.transactionIdentifier = receiveData.transactionIdentifier; - sendData.protocolIdentifier = receiveData.protocolIdentifier; - - sendData.unitIdentifier = receiveData.unitIdentifier; - sendData.functionCode = receiveData.functionCode; - if ((receiveData.quantity < 1) | (receiveData.quantity > 0x007D)) //Invalid quantity - { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 3; - } - if ((receiveData.startingAdress + 1 + receiveData.quantity) > 65535) //Invalid Starting adress or Starting address + quantity - { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 2; - } - sendData.byteCount = (short) (2 * receiveData.quantity); - sendData.sendRegisterValues = new int[receiveData.quantity]; - System.arraycopy(inputRegisters, receiveData.startingAdress + 1, sendData.sendRegisterValues, 0, receiveData.quantity); - - if (sendData.exceptionCode > 0) - sendData.length = 0x03; - else - sendData.length = (short) (0x03 + sendData.byteCount); - - byte[] data; - if (sendData.exceptionCode > 0) - data = new byte[9]; - else - data = new byte[9 + sendData.byteCount]; - sendData.length = (byte) (data.length - 6); - - //Send Transaction identifier - data[0] = (byte) ((sendData.transactionIdentifier & 0xff00) >> 8); - data[1] = (byte) (sendData.transactionIdentifier & 0xff); - - //Send Protocol identifier - data[2] = (byte) ((sendData.protocolIdentifier & 0xff00) >> 8); - data[3] = (byte) (sendData.protocolIdentifier & 0xff); - - //Send length - data[4] = (byte) ((sendData.length & 0xff00) >> 8); - data[5] = (byte) (sendData.length & 0xff); - - //Unit Identifier - data[6] = sendData.unitIdentifier; - - //Function Code - data[7] = sendData.functionCode; - - //ByteCount - data[8] = (byte) (sendData.byteCount & 0xff); - - - if (sendData.exceptionCode > 0) { - data[7] = sendData.errorCode; - data[8] = sendData.exceptionCode; - sendData.sendRegisterValues = null; - } - - - if (sendData.sendRegisterValues != null) - for (int i = 0; i < (sendData.byteCount / 2); i++) { - data[9 + i * 2] = (byte) ((sendData.sendRegisterValues[i] & 0xff00) >> 8); - data[10 + i * 2] = (byte) (sendData.sendRegisterValues[i] & 0xff); - } - java.io.OutputStream outputStream; - if (socket.isConnected() & !socket.isClosed()) - try { - outputStream = socket.getOutputStream(); - outputStream.write(data); - } catch (IOException e) { - - e.printStackTrace(); - } - } - - private void WriteSingleCoil(java.net.Socket socket) { - sendData = new ModbusProtocoll(); - sendData.response = true; - - sendData.transactionIdentifier = receiveData.transactionIdentifier; - sendData.protocolIdentifier = receiveData.protocolIdentifier; - - sendData.unitIdentifier = receiveData.unitIdentifier; - sendData.functionCode = receiveData.functionCode; - sendData.startingAdress = receiveData.startingAdress; - sendData.receiveCoilValues = receiveData.receiveCoilValues; - if ((receiveData.receiveCoilValues[0] != 0x0000) & (receiveData.receiveCoilValues[0] != 0xFF)) //Invalid Value - { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 3; - } - if ((receiveData.startingAdress + 1) > 65535) //Invalid Starting adress or Starting address + quantity - { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 2; - } - if ((receiveData.receiveCoilValues[0]) > 0) { - this.setCoil(true, receiveData.startingAdress + 1); - } - if (receiveData.receiveCoilValues[0] == 0x0000) { - this.setCoil(false, receiveData.startingAdress + 1); - } - if (sendData.exceptionCode > 0) - sendData.length = 0x03; - else - sendData.length = 0x06; - - byte[] data; - if (sendData.exceptionCode > 0) - data = new byte[9]; - else - data = new byte[12]; - - sendData.length = (byte) (data.length - 6); - - //Send Transaction identifier - data[0] = (byte) ((sendData.transactionIdentifier & 0xff00) >> 8); - data[1] = (byte) (sendData.transactionIdentifier & 0xff); - - //Send Protocol identifier - data[2] = (byte) ((sendData.protocolIdentifier & 0xff00) >> 8); - data[3] = (byte) (sendData.protocolIdentifier & 0xff); - - //Send length - data[4] = (byte) ((sendData.length & 0xff00) >> 8); - data[5] = (byte) (sendData.length & 0xff); - - //Unit Identifier - data[6] = sendData.unitIdentifier; - - //Function Code - data[7] = sendData.functionCode; - - - if (sendData.exceptionCode > 0) { - data[7] = sendData.errorCode; - data[8] = sendData.exceptionCode; - sendData.sendRegisterValues = null; - } else { - data[8] = (byte) ((receiveData.startingAdress & 0xff00) >> 8); - data[9] = (byte) (receiveData.startingAdress & 0xff); - - data[10] = (byte) ((receiveData.receiveCoilValues[0])); - data[11] = 0; - } - - java.io.OutputStream outputStream; - if (socket.isConnected() & !socket.isClosed()) - try { - outputStream = socket.getOutputStream(); - outputStream.write(data); - } catch (IOException e) { - - e.printStackTrace(); - } - if (this.notifyCoilsChanged != null) - notifyCoilsChanged.coilsChangedEvent(); - } - - private void WriteSingleRegister(java.net.Socket socket) { - sendData = new ModbusProtocoll(); - sendData.response = true; - - sendData.transactionIdentifier = receiveData.transactionIdentifier; - sendData.protocolIdentifier = receiveData.protocolIdentifier; - - sendData.unitIdentifier = receiveData.unitIdentifier; - sendData.functionCode = receiveData.functionCode; - sendData.startingAdress = receiveData.startingAdress; - sendData.receiveRegisterValues = receiveData.receiveRegisterValues; - - if ((receiveData.receiveRegisterValues[0] < 0x0000) | (receiveData.receiveRegisterValues[0] > 0xFFFF)) //Invalid Value - { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 3; - } - if ((receiveData.startingAdress + 1) > 65535) //Invalid Starting adress or Starting address + quantity - { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 2; - } - this.setHoldingRegister(((int) receiveData.receiveRegisterValues[0]), receiveData.startingAdress + 1); - if (sendData.exceptionCode > 0) - sendData.length = 0x03; - else - sendData.length = 0x06; - - byte[] data; - if (sendData.exceptionCode > 0) - data = new byte[9]; - else - data = new byte[12]; - - sendData.length = (byte) (data.length - 6); - - - //Send Transaction identifier - data[0] = (byte) ((sendData.transactionIdentifier & 0xff00) >> 8); - data[1] = (byte) (sendData.transactionIdentifier & 0xff); - - //Send Protocol identifier - data[2] = (byte) ((sendData.protocolIdentifier & 0xff00) >> 8); - data[3] = (byte) (sendData.protocolIdentifier & 0xff); - - //Send length - data[4] = (byte) ((sendData.length & 0xff00) >> 8); - data[5] = (byte) (sendData.length & 0xff); - - //Unit Identifier - data[6] = sendData.unitIdentifier; - - //Function Code - data[7] = sendData.functionCode; - - - if (sendData.exceptionCode > 0) { - data[7] = sendData.errorCode; - data[8] = sendData.exceptionCode; - sendData.sendRegisterValues = null; - } else { - data[8] = (byte) ((receiveData.startingAdress & 0xff00) >> 8); - data[9] = (byte) (receiveData.startingAdress & 0xff); - - data[10] = (byte) ((receiveData.receiveRegisterValues[0] & 0xff00) >> 8); - data[11] = (byte) (receiveData.receiveRegisterValues[0] & 0xff); - } - java.io.OutputStream outputStream; - if (socket.isConnected() & !socket.isClosed()) - try { - outputStream = socket.getOutputStream(); - outputStream.write(data); - } catch (IOException e) { - - e.printStackTrace(); - } - if (this.notifyHoldingRegistersChanged != null) - notifyHoldingRegistersChanged.holdingRegistersChangedEvent(); - } - - private void WriteMultipleCoils(java.net.Socket socket) { - sendData = new ModbusProtocoll(); - sendData.response = true; - - sendData.transactionIdentifier = receiveData.transactionIdentifier; - sendData.protocolIdentifier = receiveData.protocolIdentifier; - - sendData.unitIdentifier = receiveData.unitIdentifier; - sendData.functionCode = receiveData.functionCode; - sendData.startingAdress = receiveData.startingAdress; - sendData.quantity = receiveData.quantity; - - if ((receiveData.quantity == 0x0000) | (receiveData.quantity > 0x07B0)) //Invalid Quantity - { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 3; - } - if (((int) receiveData.startingAdress + 1 + (int) receiveData.quantity) > 65535) //Invalid Starting adress or Starting address + quantity - { - sendData.errorCode = (byte) (receiveData.functionCode + 0x80); - sendData.exceptionCode = 2; - } - for (int i = 0; i < receiveData.quantity; i++) { - int shift = i % 16; - /* - if ((i == receiveData.quantity - 1) & (receiveData.quantity % 2 != 0)) - { - if (shift < 8) - shift = shift + 8; - else - shift = shift - 8; - } - */ - int mask = 0x1; - mask = mask << (shift); - if ((receiveData.receiveCoilValues[i / 16] & mask) == 0) - this.setCoil(false, receiveData.startingAdress + i + 1); - else - this.setCoil(true, receiveData.startingAdress + i + 1); - } - if (sendData.exceptionCode > 0) - sendData.length = 0x03; - else - sendData.length = 0x06; - - byte[] data; - if (sendData.exceptionCode > 0) - data = new byte[9]; - else - data = new byte[12]; - - sendData.length = (byte) (data.length - 6); - - //Send Transaction identifier - data[0] = (byte) ((sendData.transactionIdentifier & 0xff00) >> 8); - data[1] = (byte) (sendData.transactionIdentifier & 0xff); - - //Send Protocol identifier - data[2] = (byte) ((sendData.protocolIdentifier & 0xff00) >> 8); - data[3] = (byte) (sendData.protocolIdentifier & 0xff); - - //Send length - data[4] = (byte) ((sendData.length & 0xff00) >> 8); - data[5] = (byte) (sendData.length & 0xff); - - //Unit Identifier - data[6] = sendData.unitIdentifier; - - //Function Code - data[7] = sendData.functionCode; - - - if (sendData.exceptionCode > 0) { - data[7] = sendData.errorCode; - data[8] = sendData.exceptionCode; - sendData.sendRegisterValues = null; - } else { - data[8] = (byte) ((receiveData.startingAdress & 0xff00) >> 8); - data[9] = (byte) (receiveData.startingAdress & 0xff); - - data[10] = (byte) ((receiveData.quantity & 0xff00) >> 8); - data[11] = (byte) (receiveData.quantity & 0xff); - } - java.io.OutputStream outputStream; - if (socket.isConnected() & !socket.isClosed()) - try { - outputStream = socket.getOutputStream(); - outputStream.write(data); - } catch (Exception e) { - - - e.printStackTrace(); - } - if (this.notifyCoilsChanged != null) - notifyCoilsChanged.coilsChangedEvent(); - } - - private void WriteMultipleRegisters(java.net.Socket socket) { - sendData = new ModbusProtocoll(); - sendData.response = true; - - sendData.transactionIdentifier = receiveData.transactionIdentifier; - sendData.protocolIdentifier = receiveData.protocolIdentifier; - - sendData.unitIdentifier = receiveData.unitIdentifier; - sendData.functionCode = receiveData.functionCode; - sendData.startingAdress = receiveData.startingAdress; - sendData.quantity = receiveData.quantity; - - if ((receiveData.quantity == 0x0000) | (receiveData.quantity > 0x07B0)) //Invalid Quantity - { - sendData.errorCode = (byte) (receiveData.functionCode + 0x90); - sendData.exceptionCode = 3; - } - if (((int) receiveData.startingAdress + 1 + (int) receiveData.quantity) > 65535) //Invalid Starting adress or Starting address + quantity - { - sendData.errorCode = (byte) (receiveData.functionCode + 0x90); - sendData.exceptionCode = 2; - } - for (int i = 0; i < receiveData.quantity; i++) { - this.setHoldingRegister((receiveData.receiveRegisterValues[i]), receiveData.startingAdress + i + 1); - } - if (sendData.exceptionCode > 0) - sendData.length = 0x03; - else - sendData.length = 0x06; - - byte[] data; - if (sendData.exceptionCode > 0) - data = new byte[9]; - else - data = new byte[12]; - - sendData.length = (byte) (data.length - 6); - - //Send Transaction identifier - data[0] = (byte) ((sendData.transactionIdentifier & 0xff00) >> 8); - data[1] = (byte) (sendData.transactionIdentifier & 0xff); - - //Send Protocol identifier - data[2] = (byte) ((sendData.protocolIdentifier & 0xff00) >> 8); - data[3] = (byte) (sendData.protocolIdentifier & 0xff); - - //Send length - data[4] = (byte) ((sendData.length & 0xff00) >> 8); - data[5] = (byte) (sendData.length & 0xff); - - //Unit Identifier - data[6] = sendData.unitIdentifier; - - //Function Code - data[7] = sendData.functionCode; - - - if (sendData.exceptionCode > 0) { - data[7] = sendData.errorCode; - data[8] = sendData.exceptionCode; - sendData.sendRegisterValues = null; - } else { - data[8] = (byte) ((receiveData.startingAdress & 0xff00) >> 8); - data[9] = (byte) (receiveData.startingAdress & 0xff); - - data[10] = (byte) ((receiveData.quantity & 0xff00) >> 8); - data[11] = (byte) (receiveData.quantity & 0xff); - } - java.io.OutputStream outputStream; - if (socket.isConnected() & !socket.isClosed()) - try { - outputStream = socket.getOutputStream(); - outputStream.write(data); - } catch (IOException e) { - - e.printStackTrace(); - } - if (this.notifyHoldingRegistersChanged != null) - notifyHoldingRegistersChanged.holdingRegistersChangedEvent(); - } - - - private void sendException(int errorCode, int exceptionCode, java.net.Socket socket) { - sendData = new ModbusProtocoll(); - sendData.response = true; - - sendData.transactionIdentifier = receiveData.transactionIdentifier; - sendData.protocolIdentifier = receiveData.protocolIdentifier; - - sendData.unitIdentifier = receiveData.unitIdentifier; - sendData.errorCode = (byte) errorCode; - sendData.exceptionCode = (byte) exceptionCode; - - if (sendData.exceptionCode > 0) - sendData.length = 0x03; - else - sendData.length = (short) (0x03 + sendData.byteCount); - - - byte[] data; - if (sendData.exceptionCode > 0) - data = new byte[9]; - else - data = new byte[9 + sendData.byteCount]; - sendData.length = (byte) (data.length - 6); - - //Send Transaction identifier - data[0] = (byte) ((sendData.transactionIdentifier & 0xff00) >> 8); - data[1] = (byte) (sendData.transactionIdentifier & 0xff); - - //Send Protocol identifier - data[2] = (byte) ((sendData.protocolIdentifier & 0xff00) >> 8); - data[3] = (byte) (sendData.protocolIdentifier & 0xff); - - //Send length - data[4] = (byte) ((sendData.length & 0xff00) >> 8); - data[5] = (byte) (sendData.length & 0xff); - - //Unit Identifier - data[6] = sendData.unitIdentifier; - - - data[7] = sendData.errorCode; - data[8] = sendData.exceptionCode; - java.io.OutputStream outputStream; - if (socket.isConnected() & !socket.isClosed()) - try { - outputStream = socket.getOutputStream(); - outputStream.write(data); - } catch (IOException e) { - - e.printStackTrace(); - } - } - - protected void CreateLogData() { - for (int i = 0; i < 98; i++) { - modbusLogData[99 - i] = modbusLogData[99 - i - 2]; - } - modbusLogData[0] = receiveData; - modbusLogData[1] = sendData; - if (this.notifyLogDataChanged != null) - this.notifyLogDataChanged.logDataChangedEvent(); - } - - /** - * Sets the Port for the ModbusServer - * - * @param port port for Server - */ - public void setPort(int port) { - this.port = port; - } - - /** - * Disables or Enables Modbus Function code 1 - * - * @param functionCode1Disabled true disables Function code 1 - * false enables Function code 1 - */ - public void setFunctionCode1Disabled(boolean functionCode1Disabled) { - this.functionCode1Disabled = functionCode1Disabled; - } - - /** - * Disables or Enables Modbus Function code 2 - * - * @param functionCode2Disabled true disables Function code 2 - * false enables Function code 2 - */ - public void setFunctionCode2Disabled(boolean functionCode2Disabled) { - this.functionCode2Disabled = functionCode2Disabled; - } - - /** - * Disables or Enables Modbus Function code 3 - * - * @param functionCode3Disabled true disables Function code 3 - * false enables Function code 3 - */ - public void setFunctionCode3Disabled(boolean functionCode3Disabled) { - this.functionCode3Disabled = functionCode3Disabled; - } - - /** - * Disables or Enables Modbus Function code 4 - * - * @param functionCode4Disabled true disables Function code 4 - * false enables Function code 4 - */ - public void setFunctionCode4Disabled(boolean functionCode4Disabled) { - this.functionCode4Disabled = functionCode4Disabled; - } - - /** - * Disables or Enables Modbus Function code 5 - * - * @param functionCode5Disabled true disables Function code 5 - * false enables Function code 5 - */ - public void setFunctionCode5Disabled(boolean functionCode5Disabled) { - this.functionCode5Disabled = functionCode5Disabled; - } - - /** - * Disables or Enables Modbus Function code 6 - * - * @param functionCode6Disabled true disables Function code 6 - * false enables Function code 6 - */ - public void setFunctionCode6Disabled(boolean functionCode6Disabled) { - this.functionCode6Disabled = functionCode6Disabled; - } - - /** - * Disables or Enables Modbus Function code 15 - * - * @param functionCode15Disabled true disables Function code 15 - * false enables Function code 15 - */ - public void setFunctionCode15Disabled(boolean functionCode15Disabled) { - this.functionCode15Disabled = functionCode15Disabled; - } - - /** - * Disables or Enables Modbus Function code 16 - * - * @param functionCode16Disabled true disables Function code 16 - * false enables Function code 16 - */ - public void setFunctionCode16Disabled(boolean functionCode16Disabled) { - this.functionCode16Disabled = functionCode16Disabled; - } - - public void setNumberOfConnectedClients(int value) { - this.numberOfConnections = value; - if (this.notifyNumberOfConnectedClientsChanged != null) - this.notifyNumberOfConnectedClientsChanged.NumberOfConnectedClientsChanged(); - } - - - /** - * Gets the Port for the ModbusServer - * - * @return Current Port Server is listening to - */ - public int getPort() { - return this.port; - } - - public boolean getFunctionCode1Disabled() { - return this.functionCode1Disabled; - } - - public boolean getFunctionCode2Disabled() { - return this.functionCode2Disabled; - } - - public boolean getFunctionCode3Disabled() { - return this.functionCode3Disabled; - } - - public boolean getFunctionCode4Disabled() { - return this.functionCode4Disabled; - } - - public boolean getFunctionCode5Disabled() { - return this.functionCode5Disabled; - } - - public boolean getFunctionCode6Disabled() { - return this.functionCode6Disabled; - } - - public boolean getFunctionCode15Disabled() { - return this.functionCode15Disabled; - } - - public boolean getFunctionCode16Disabled() { - return this.functionCode16Disabled; - } - - /** - * Returns number of connected clients - * - * @return number of connected clients - */ - public int getNumberOfConnectedClients() { - return this.numberOfConnections; - } - - /** - * Gets Server runnig flag - * - * @return TRUE if server active - */ - public boolean getServerRunning() { - return this.serverRunning; - } - - /** - * Gets logged Modbus data - * - * @return logged Modbus data - */ - public ModbusProtocoll[] getLogData() { - return this.modbusLogData; - } - - /** - * Get notified if number if Coils has changed - * - * @param value Implementation of Interface ICoilsChangedDelegator - */ - public void setNotifyCoilsChanged(ICoilsChangedDelegator value) { - this.notifyCoilsChanged = value; - } - - /** - * Get notified if number if Holding Registers has changed - * - * @param value Implementation of Interface IHoldingRegistersChangedDelegator - */ - public void setNotifyHoldingRegistersChanged(IHoldingRegistersChangedDelegator value) { - this.notifyHoldingRegistersChanged = value; - } - - /** - * Get notified if number of connected clients has changed - * - * @param value Implementation of Interface INumberOfConnectedClientsChangedDelegator - */ - public void setNotifyNumberOfConnectedClientsChanged(INumberOfConnectedClientsChangedDelegator value) { - this.notifyNumberOfConnectedClientsChanged = value; - } - - /** - * Get notified if Log Data has changed - * - * @param value Implementation of Interface ILogDataChangedDelegator - */ - public void setNotifyLogDataChanged(ILogDataChangedDelegator value) { - this.notifyLogDataChanged = value; - } - - /** - * Gets the Client connection timeout, which disconnects a connection to a client - * - * @return clientConnectionTimout - */ - public int getClientConnectionTimeout() { - return clientConnectionTimeout; - } - - /*Sets the Client connection timeout, which disconnects a connection to a client - * @param value ClientConnectionTimeout - */ - public void setClientConnectionTimeout(int value) { - clientConnectionTimeout = value; - } - - - public int getHoldingRegister(int address) { - return dataModel.getHoldingRegister(address); - } - - public void setHoldingRegister(int holdingRegisterValue, int address) { - this.dataModel.setHoldingRegister(address, holdingRegisterValue); - this.holdingRegisters[address] = holdingRegisterValue; - - } - - public int getInputRegister(int address) { - return dataModel.getInputRegister(address); - } - - public void setInputRegister(int inputRegisterValue, int address) { - this.dataModel.setInputRegister(address, inputRegisterValue); - this.inputRegisters[address] = inputRegisterValue; - } - - public boolean getCoil(int address) { - return dataModel.getCoil(address); - } - - public void setCoil(boolean coilValue, int address) { - this.dataModel.setCoil(address, coilValue); - this.coils[address] = coilValue; - } - - public boolean getDiscreteInput(int address) { - return dataModel.getDiscreteInput(address); - } - - public void setDiscreteInput(boolean discreteInputValue, int address) { - this.dataModel.setDiscreteInput(address, discreteInputValue); - this.discreteInputs[address] = discreteInputValue; - } -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ProcessReceivedDataThread.java b/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ProcessReceivedDataThread.java deleted file mode 100644 index 572a3046b19baac5c0e09a27822b01e074bfa2ec..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/ProcessReceivedDataThread.java +++ /dev/null @@ -1,151 +0,0 @@ -/* -Copyright (c) 2018-2020 Rossmann-Engineering -Permission is hereby granted, free of charge, -to any person obtaining a copy of this software -and associated documentation files (the "Software"), -to deal in the Software without restriction, -including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, -subject to the following conditions: -The above copyright notice and this permission -notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE -OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package de.re.easymodbus.modbusserver; - -import java.util.Calendar; - -class ProcessReceivedDataThread extends Thread { - short[] inBuffer; - ModbusServer easyModbusTCPServer; - java.net.Socket socket; - - public ProcessReceivedDataThread(byte[] inBuffer, ModbusServer easyModbusTCPServer, java.net.Socket socket) { - this.socket = socket; - this.inBuffer = new short[inBuffer.length]; - for (int i = 0; i < inBuffer.length; i++) { - - this.inBuffer[i] = (short) ((short) inBuffer[i] & 0xff); - } - this.easyModbusTCPServer = easyModbusTCPServer; - } - - public void run() { - - synchronized (easyModbusTCPServer) { - short[] wordData = new short[1]; - short[] byteData = new short[2]; - easyModbusTCPServer.receiveData = new ModbusProtocoll(); - easyModbusTCPServer.receiveData.timeStamp = Calendar.getInstance(); - easyModbusTCPServer.receiveData.request = true; - - //Lese Transaction identifier - byteData[1] = inBuffer[0]; - byteData[0] = inBuffer[1]; - wordData[0] = (short) byteArrayToInt(byteData); - easyModbusTCPServer.receiveData.transactionIdentifier = wordData[0]; - - //Lese Protocol identifier - byteData[1] = inBuffer[2]; - byteData[0] = inBuffer[3]; - wordData[0] = (short) byteArrayToInt(byteData); - easyModbusTCPServer.receiveData.protocolIdentifier = wordData[0]; - - //Lese length - byteData[1] = inBuffer[4]; - byteData[0] = inBuffer[5]; - wordData[0] = (short) byteArrayToInt(byteData); - easyModbusTCPServer.receiveData.length = wordData[0]; - - //Lese unit identifier - easyModbusTCPServer.receiveData.unitIdentifier = (byte) inBuffer[6]; - - // Lese function code - easyModbusTCPServer.receiveData.functionCode = (byte) inBuffer[7]; - - // Lese starting address - byteData[1] = inBuffer[8]; - byteData[0] = inBuffer[9]; - wordData[0] = (short) byteArrayToInt(byteData); - easyModbusTCPServer.receiveData.startingAdress = wordData[0]; - - if (easyModbusTCPServer.receiveData.functionCode <= 4) { - // Lese quantity - byteData[1] = inBuffer[10]; - byteData[0] = inBuffer[11]; - wordData[0] = (short) byteArrayToInt(byteData); - easyModbusTCPServer.receiveData.quantity = wordData[0]; - } - if (easyModbusTCPServer.receiveData.functionCode == 5) { - easyModbusTCPServer.receiveData.receiveCoilValues = new short[1]; - // Lese Value - byteData[0] = inBuffer[10]; - byteData[1] = inBuffer[11]; - easyModbusTCPServer.receiveData.receiveCoilValues[0] = (short) byteArrayToInt(byteData); - } - if (easyModbusTCPServer.receiveData.functionCode == 6) { - easyModbusTCPServer.receiveData.receiveRegisterValues = new int[1]; - // Lese Value - byteData[1] = inBuffer[10]; - byteData[0] = inBuffer[11]; - easyModbusTCPServer.receiveData.receiveRegisterValues[0] = byteArrayToInt(byteData); - } - if (easyModbusTCPServer.receiveData.functionCode == 15) { - // Lese quantity - byteData[1] = inBuffer[10]; - byteData[0] = inBuffer[11]; - wordData[0] = (short) byteArrayToInt(byteData); - easyModbusTCPServer.receiveData.quantity = wordData[0]; - - easyModbusTCPServer.receiveData.byteCount = (byte) inBuffer[12]; - - if ((easyModbusTCPServer.receiveData.byteCount % 2) != 0) - easyModbusTCPServer.receiveData.receiveCoilValues = new short[easyModbusTCPServer.receiveData.byteCount / 2 + 1]; - else - easyModbusTCPServer.receiveData.receiveCoilValues = new short[easyModbusTCPServer.receiveData.byteCount / 2]; - // Lese Value - for (int i = 0; i < easyModbusTCPServer.receiveData.byteCount; i++) { - if ((i % 2) == 1) - easyModbusTCPServer.receiveData.receiveCoilValues[i / 2] = (short) (easyModbusTCPServer.receiveData.receiveCoilValues[i / 2] + 256 * inBuffer[13 + i]); - else - easyModbusTCPServer.receiveData.receiveCoilValues[i / 2] = inBuffer[13 + i]; - } - } - if (easyModbusTCPServer.receiveData.functionCode == 16) { - // Lese quantity - byteData[1] = inBuffer[10]; - byteData[0] = inBuffer[11]; - wordData[0] = (short) byteArrayToInt(byteData); - easyModbusTCPServer.receiveData.quantity = wordData[0]; - - easyModbusTCPServer.receiveData.byteCount = (byte) inBuffer[12]; - easyModbusTCPServer.receiveData.receiveRegisterValues = new int[easyModbusTCPServer.receiveData.quantity]; - for (int i = 0; i < easyModbusTCPServer.receiveData.quantity; i++) { - // Lese Value - byteData[1] = inBuffer[13 + i * 2]; - byteData[0] = inBuffer[14 + i * 2]; - easyModbusTCPServer.receiveData.receiveRegisterValues[i] = byteData[0]; - easyModbusTCPServer.receiveData.receiveRegisterValues[i] = (int) (easyModbusTCPServer.receiveData.receiveRegisterValues[i] + (byteData[1] << 8)); - } - } - easyModbusTCPServer.CreateAnswer(socket); - easyModbusTCPServer.CreateLogData(); - } - } - - public int byteArrayToInt(short[] byteArray) { - int returnValue; - returnValue = byteArray[0]; - returnValue = (int) (returnValue + 256 * byteArray[1]); - return returnValue; - } - -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/gui/NewJFrame.form b/lc-historian/src/main/java/de/re/easymodbus/modbusserver/gui/NewJFrame.form deleted file mode 100644 index a5dc2a5cbc1204b8ccc6c6cfbfb0cf618560fa5e..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/gui/NewJFrame.form +++ /dev/null @@ -1,592 +0,0 @@ - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - - -
-
-
- - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - - -
-
-
- - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
-
-
- - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - - -
-
-
- - - - - - - - - -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/gui/NewJFrame.java b/lc-historian/src/main/java/de/re/easymodbus/modbusserver/gui/NewJFrame.java deleted file mode 100644 index 7b6754ee1bcba1825c589dedd4011e1236023fa0..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/gui/NewJFrame.java +++ /dev/null @@ -1,948 +0,0 @@ -package de.re.easymodbus.modbusserver.gui; - -import javax.swing.*; -import javax.swing.GroupLayout.Alignment; -import javax.swing.LayoutStyle.ComponentPlacement; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import java.awt.*; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Random; - - -/** - * @author Stefan Roßmann - */ -public class NewJFrame extends javax.swing.JFrame implements de.re.easymodbus.modbusserver.ICoilsChangedDelegator, de.re.easymodbus.modbusserver.IHoldingRegistersChangedDelegator, de.re.easymodbus.modbusserver.INumberOfConnectedClientsChangedDelegator, de.re.easymodbus.modbusserver.ILogDataChangedDelegator { - - public de.re.easymodbus.modbusserver.ModbusServer modbusServer = new de.re.easymodbus.modbusserver.ModbusServer(); - - /** - * Creates new form NewJFrame - */ - public NewJFrame() { - - super("EasyModbusTCP Server Simulator"); - initComponents(); - modbusServer.setNotifyCoilsChanged(this); - modbusServer.setNotifyHoldingRegistersChanged(this); - modbusServer.setNotifyNumberOfConnectedClientsChanged(this); - modbusServer.setNotifyLogDataChanged(this); - modbusServer.setClientConnectionTimeout(10000); - try { - modbusServer.Listen(); - } catch (Exception e) { - } - jList1.setModel(model); - - - } - - private void initTables() { - javax.swing.table.DefaultTableModel model1 = (javax.swing.table.DefaultTableModel) jTable1.getModel(); - javax.swing.table.DefaultTableModel model2 = (javax.swing.table.DefaultTableModel) jTable2.getModel(); - javax.swing.table.DefaultTableModel model3 = (javax.swing.table.DefaultTableModel) jTable3.getModel(); - javax.swing.table.DefaultTableModel model4 = (javax.swing.table.DefaultTableModel) jTable4.getModel(); - for (int i = 0; i < 25; i++) { - model1.addRow(new Object[]{String.valueOf(i + 1), String.valueOf(false)}); - } - for (int i = 0; i < 25; i++) { - model2.addRow(new Object[]{String.valueOf(i + 1), String.valueOf(false)}); - } - for (int i = 0; i < 25; i++) { - model3.addRow(new Object[]{String.valueOf(i + 1), String.valueOf(0)}); - } - for (int i = 0; i < 25; i++) { - model4.addRow(new Object[]{String.valueOf(i + 1), String.valueOf(0)}); - } - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - - jTabbedPane1 = new javax.swing.JTabbedPane(); - jPanel1 = new javax.swing.JPanel(); - jScrollPane1 = new JScrollPane(); - jTable1 = new javax.swing.JTable(); - jScrollBar1 = new JScrollBar(); - jPanel2 = new javax.swing.JPanel(); - jScrollPane2 = new JScrollPane(); - jTable2 = new javax.swing.JTable(); - jScrollBar2 = new JScrollBar(); - jPanel3 = new javax.swing.JPanel(); - jScrollPane3 = new JScrollPane(); - jTable3 = new javax.swing.JTable(); - jScrollBar3 = new JScrollBar(); - jPanel4 = new javax.swing.JPanel(); - jScrollPane4 = new JScrollPane(); - jTable4 = new javax.swing.JTable(); - jScrollBar4 = new JScrollBar(); - jLabel1 = new JLabel(); - jLabel2 = new JLabel(); - jLabel3 = new JLabel(); - jPanel5 = new javax.swing.JPanel(); - jPanel5.setAlignmentX(Component.LEFT_ALIGNMENT); - jPanel5.setAlignmentY(Component.TOP_ALIGNMENT); - jLabel4 = new JLabel(); - jCheckBox1 = new JCheckBox(); - jCheckBox2 = new JCheckBox(); - jCheckBox3 = new JCheckBox(); - jCheckBox4 = new JCheckBox(); - jCheckBox5 = new JCheckBox(); - jCheckBox6 = new JCheckBox(); - jCheckBox7 = new JCheckBox(); - jCheckBox8 = new JCheckBox(); - jLabel5 = new JLabel(); - jLabel6 = new JLabel(); - jLabel7 = new JLabel(); - jCheckBox9 = new JCheckBox(); - - setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - setResizable(false); - setSize(new Dimension(888, 640)); - addWindowListener(new java.awt.event.WindowAdapter() { - public void windowClosing(java.awt.event.WindowEvent evt) { - formWindowClosing(evt); - } - }); - - jTabbedPane1.addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent evt) { - jTabbedPane1MouseClicked(evt); - } - }); - - jTable1.setModel(new javax.swing.table.DefaultTableModel( - new Object[][]{ - - }, - new String[]{ - "Address", "Value" - } - )); - jTable1.addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent evt) { - jTable1MouseClicked(evt); - } - }); - jTable1.addPropertyChangeListener(new java.beans.PropertyChangeListener() { - public void propertyChange(java.beans.PropertyChangeEvent evt) { - jTable1PropertyChange(evt); - } - }); - jScrollPane1.setViewportView(jTable1); - - jScrollBar1.setBlockIncrement(1); - jScrollBar1.setMaximum(65534); - jScrollBar1.addAdjustmentListener(new java.awt.event.AdjustmentListener() { - public void adjustmentValueChanged(java.awt.event.AdjustmentEvent evt) { - jScrollBar1AdjustmentValueChanged(evt); - } - }); - - GroupLayout jPanel1Layout = new GroupLayout(jPanel1); - jPanel1.setLayout(jPanel1Layout); - jPanel1Layout.setHorizontalGroup( - jPanel1Layout.createParallelGroup(Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jScrollBar1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addContainerGap()) - ); - jPanel1Layout.setVerticalGroup( - jPanel1Layout.createParallelGroup(Alignment.LEADING) - .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 456, Short.MAX_VALUE) - .addComponent(jScrollBar1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - ); - - jTabbedPane1.addTab("Discrete Inputs", jPanel1); - - jTable2.setModel(new javax.swing.table.DefaultTableModel( - new Object[][]{ - - }, - new String[]{ - "Address", "Value" - } - )); - jTable2.addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent evt) { - jTable2MouseClicked(evt); - } - }); - jTable2.addPropertyChangeListener(new java.beans.PropertyChangeListener() { - public void propertyChange(java.beans.PropertyChangeEvent evt) { - jTable2PropertyChange(evt); - } - }); - jScrollPane2.setViewportView(jTable2); - - jScrollBar2.setBlockIncrement(1); - jScrollBar2.setMaximum(65534); - jScrollBar2.addAdjustmentListener(new java.awt.event.AdjustmentListener() { - public void adjustmentValueChanged(java.awt.event.AdjustmentEvent evt) { - jScrollBar2AdjustmentValueChanged(evt); - } - }); - - GroupLayout jPanel2Layout = new GroupLayout(jPanel2); - jPanel2.setLayout(jPanel2Layout); - jPanel2Layout.setHorizontalGroup( - jPanel2Layout.createParallelGroup(Alignment.LEADING) - .addGroup(jPanel2Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jScrollPane2, GroupLayout.PREFERRED_SIZE, 228, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jScrollBar2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - jPanel2Layout.setVerticalGroup( - jPanel2Layout.createParallelGroup(Alignment.LEADING) - .addComponent(jScrollPane2, GroupLayout.DEFAULT_SIZE, 456, Short.MAX_VALUE) - .addComponent(jScrollBar2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - ); - - jTabbedPane1.addTab("Coils", jPanel2); - - jTable3.setModel(new javax.swing.table.DefaultTableModel( - new Object[][]{ - - }, - new String[]{ - "Address", "Value" - } - )); - jTable3.addPropertyChangeListener(new java.beans.PropertyChangeListener() { - public void propertyChange(java.beans.PropertyChangeEvent evt) { - jTable3PropertyChange(evt); - } - }); - jScrollPane3.setViewportView(jTable3); - - jScrollBar3.setBlockIncrement(1); - jScrollBar3.setMaximum(65534); - jScrollBar3.addAdjustmentListener(new java.awt.event.AdjustmentListener() { - public void adjustmentValueChanged(java.awt.event.AdjustmentEvent evt) { - jScrollBar3AdjustmentValueChanged(evt); - } - }); - - GroupLayout jPanel3Layout = new GroupLayout(jPanel3); - jPanel3.setLayout(jPanel3Layout); - jPanel3Layout.setHorizontalGroup( - jPanel3Layout.createParallelGroup(Alignment.LEADING) - .addGroup(jPanel3Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jScrollPane3, GroupLayout.PREFERRED_SIZE, 227, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jScrollBar3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - jPanel3Layout.setVerticalGroup( - jPanel3Layout.createParallelGroup(Alignment.LEADING) - .addComponent(jScrollPane3, GroupLayout.DEFAULT_SIZE, 456, Short.MAX_VALUE) - .addComponent(jScrollBar3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - ); - - jTabbedPane1.addTab("Input Registers", jPanel3); - - jPanel4.addPropertyChangeListener(new java.beans.PropertyChangeListener() { - public void propertyChange(java.beans.PropertyChangeEvent evt) { - jPanel4PropertyChange(evt); - } - }); - - jTable4.setModel(new javax.swing.table.DefaultTableModel( - new Object[][]{ - - }, - new String[]{ - "Address", "Value" - } - )); - jTable4.addPropertyChangeListener(new java.beans.PropertyChangeListener() { - public void propertyChange(java.beans.PropertyChangeEvent evt) { - jTable4PropertyChange(evt); - } - }); - jScrollPane4.setViewportView(jTable4); - - jScrollBar4.setBlockIncrement(1); - jScrollBar4.setMaximum(65534); - jScrollBar4.addAdjustmentListener(new java.awt.event.AdjustmentListener() { - public void adjustmentValueChanged(java.awt.event.AdjustmentEvent evt) { - jScrollBar4AdjustmentValueChanged(evt); - } - }); - - GroupLayout jPanel4Layout = new GroupLayout(jPanel4); - jPanel4.setLayout(jPanel4Layout); - jPanel4Layout.setHorizontalGroup( - jPanel4Layout.createParallelGroup(Alignment.LEADING) - .addGroup(jPanel4Layout.createSequentialGroup() - .addContainerGap() - .addComponent(jScrollPane4, GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jScrollBar4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addContainerGap()) - ); - jPanel4Layout.setVerticalGroup( - jPanel4Layout.createParallelGroup(Alignment.LEADING) - .addComponent(jScrollPane4, GroupLayout.DEFAULT_SIZE, 456, Short.MAX_VALUE) - .addComponent(jScrollBar4, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - ); - - jTabbedPane1.addTab("Holding Registers", jPanel4); - - jLabel1.setFont(new Font("Microsoft Sans Serif", 1, 18)); // NOI18N - jLabel1.setForeground(new java.awt.Color(102, 204, 0)); - jLabel1.setText("...Modbus-TCP Server Listening (Port 502)..."); - - - jLabel3.setText("Version 2.5"); - jLabel3.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); - - jPanel5.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); - - jLabel4.setText("Supported Function codes:"); - - jCheckBox1.setSelected(true); - jCheckBox1.setText("FC 01 (Read Coils)"); - jCheckBox1.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent evt) { - jCheckBox1StateChanged(evt); - } - }); - - jCheckBox2.setSelected(true); - jCheckBox2.setText("FC 02 (Read Discrete Inputs)"); - jCheckBox2.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent evt) { - jCheckBox2StateChanged(evt); - } - }); - - jCheckBox3.setSelected(true); - jCheckBox3.setText("FC 03 (Read Holding Registers)"); - jCheckBox3.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent evt) { - jCheckBox3StateChanged(evt); - } - }); - - jCheckBox4.setSelected(true); - jCheckBox4.setText("FC 04 (Read Input Registers)"); - jCheckBox4.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent evt) { - jCheckBox4StateChanged(evt); - } - }); - - jCheckBox5.setSelected(true); - jCheckBox5.setText("FC 05 (Write Single Coil)"); - jCheckBox5.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent evt) { - jCheckBox5StateChanged(evt); - } - }); - - jCheckBox6.setSelected(true); - jCheckBox6.setText("FC 06 (Write Single Register)"); - jCheckBox6.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent evt) { - jCheckBox6StateChanged(evt); - } - }); - - jCheckBox7.setSelected(true); - jCheckBox7.setText("FC 15 (Write Multiple Coils)"); - jCheckBox7.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent evt) { - jCheckBox7StateChanged(evt); - } - }); - - jCheckBox8.setSelected(true); - jCheckBox8.setText("FC 16 (Write Multiple Registers)"); - jCheckBox8.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent evt) { - jCheckBox8StateChanged(evt); - } - }); - - GroupLayout jPanel5Layout = new GroupLayout(jPanel5); - jPanel5Layout.setHorizontalGroup( - jPanel5Layout.createParallelGroup(Alignment.LEADING) - .addGroup(Alignment.TRAILING, jPanel5Layout.createSequentialGroup() - .addContainerGap(29, Short.MAX_VALUE) - .addGroup(jPanel5Layout.createParallelGroup(Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addGap(21) - .addComponent(jLabel4)) - .addGroup(jPanel5Layout.createParallelGroup(Alignment.LEADING) - .addComponent(jCheckBox2) - .addComponent(jCheckBox1) - .addComponent(jCheckBox3) - .addComponent(jCheckBox4) - .addComponent(jCheckBox5) - .addComponent(jCheckBox6) - .addComponent(jCheckBox7) - .addComponent(jCheckBox8))) - .addGap(22)) - ); - jPanel5Layout.setVerticalGroup( - jPanel5Layout.createParallelGroup(Alignment.LEADING) - .addGroup(jPanel5Layout.createSequentialGroup() - .addComponent(jLabel4) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jCheckBox1) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jCheckBox2) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jCheckBox3) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jCheckBox4) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jCheckBox5) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jCheckBox6) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jCheckBox7) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jCheckBox8) - .addContainerGap(11, Short.MAX_VALUE)) - ); - jPanel5.setLayout(jPanel5Layout); - - jLabel5.setText("http://www.EasyModbusTCP.net"); - jLabel5.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent evt) { - jLabel5MousePressed(evt); - } - }); - - jLabel6.setText("Number of connected clients: "); - - jLabel7.setText("0"); - - jCheckBox9.setSelected(true); - jCheckBox9.setText("Show Protocol Informations"); - jList1 = new javax.swing.JList(); - jList1.setAutoscrolls(false); - jList1.setAlignmentY(Component.BOTTOM_ALIGNMENT); - jList1.setAlignmentX(Component.LEFT_ALIGNMENT); - jList1.setFont(new Font("Tahoma", Font.PLAIN, 9)); - - chckbxEnableWebview = new JCheckBox("Enable Web View"); - chckbxEnableWebview.addChangeListener(new ChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - WebViewStateChanged(e); - - } - }); - - lblWebViewAddress = new JLabel("Webview-address:"); - lblWebViewAddress.setVisible(false); - - lblLink = new JLabel("link"); - lblLink.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - linkClicked(); - } - }); - lblLink.setVisible(false); - - GroupLayout layout = new GroupLayout(getContentPane()); - layout.setHorizontalGroup( - layout.createParallelGroup(Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(jLabel2) - .addGap(6) - .addGroup(layout.createParallelGroup(Alignment.TRAILING, false) - .addGroup(layout.createSequentialGroup() - .addComponent(jLabel5) - .addGap(624)) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(jLabel6) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jLabel7) - .addGap(59) - .addComponent(jLabel3)) - .addGroup(layout.createSequentialGroup() - .addComponent(jPanel5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addGap(6) - .addComponent(chckbxEnableWebview)) - .addGroup(layout.createSequentialGroup() - .addGap(430) - .addComponent(jCheckBox9)) - .addComponent(jList1, GroupLayout.PREFERRED_SIZE, 583, GroupLayout.PREFERRED_SIZE) - .addGroup(layout.createSequentialGroup() - .addComponent(lblWebViewAddress) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(lblLink))) - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jTabbedPane1, GroupLayout.PREFERRED_SIZE, 279, GroupLayout.PREFERRED_SIZE)))) - .addGroup(layout.createSequentialGroup() - .addGap(293) - .addComponent(jLabel1))) - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - layout.setVerticalGroup( - layout.createParallelGroup(Alignment.TRAILING) - .addGroup(layout.createSequentialGroup() - .addComponent(jLabel1) - .addPreferredGap(ComponentPlacement.RELATED, 6, Short.MAX_VALUE) - .addGroup(layout.createParallelGroup(Alignment.TRAILING) - .addGroup(layout.createSequentialGroup() - .addComponent(jCheckBox9) - .addPreferredGap(ComponentPlacement.UNRELATED)) - .addGroup(layout.createParallelGroup(Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(16) - .addComponent(jLabel2)) - .addGroup(layout.createSequentialGroup() - .addPreferredGap(ComponentPlacement.RELATED) - .addComponent(jLabel5) - .addPreferredGap(ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(Alignment.BASELINE) - .addComponent(jLabel6) - .addComponent(jLabel7) - .addComponent(jLabel3))))) - .addGap(8) - .addGroup(layout.createParallelGroup(Alignment.TRAILING) - .addGroup(layout.createSequentialGroup() - .addComponent(jList1, GroupLayout.PREFERRED_SIZE, 259, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(Alignment.LEADING) - .addComponent(chckbxEnableWebview) - .addComponent(jPanel5, GroupLayout.PREFERRED_SIZE, 207, GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(Alignment.BASELINE) - .addComponent(lblWebViewAddress) - .addComponent(lblLink)) - .addGap(19)) - .addGroup(layout.createSequentialGroup() - .addComponent(jTabbedPane1, GroupLayout.PREFERRED_SIZE, 502, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(ComponentPlacement.RELATED))) - .addGap(2)) - ); - getContentPane().setLayout(layout); - - jLabel5.getAccessibleContext().setAccessibleName("http://www.EasyModbusTCP.net"); - jLabel5.getAccessibleContext().setAccessibleDescription(""); - - pack(); - }// //GEN-END:initComponents - - private void jLabel5MousePressed(MouseEvent evt) {//GEN-FIRST:event_jLabel5MousePressed - try { - Desktop.getDesktop().browse(new URI("http://www.EasyModbusTCP.net")); - } catch (Exception ex) { - } - }//GEN-LAST:event_jLabel5MousePressed - - private void jCheckBox1StateChanged(ChangeEvent evt) {//GEN-FIRST:event_jCheckBox1StateChanged - if (modbusServer.getFunctionCode1Disabled()) - modbusServer.setFunctionCode1Disabled(false); - else - modbusServer.setFunctionCode1Disabled(true); - }//GEN-LAST:event_jCheckBox1StateChanged - - private void jCheckBox2StateChanged(ChangeEvent evt) {//GEN-FIRST:event_jCheckBox2StateChanged - if (modbusServer.getFunctionCode2Disabled()) - modbusServer.setFunctionCode2Disabled(false); - else - modbusServer.setFunctionCode2Disabled(true); - }//GEN-LAST:event_jCheckBox2StateChanged - - private void jCheckBox3StateChanged(ChangeEvent evt) {//GEN-FIRST:event_jCheckBox3StateChanged - if (modbusServer.getFunctionCode3Disabled()) - modbusServer.setFunctionCode3Disabled(false); - else - modbusServer.setFunctionCode3Disabled(true); - }//GEN-LAST:event_jCheckBox3StateChanged - - private void jCheckBox4StateChanged(ChangeEvent evt) {//GEN-FIRST:event_jCheckBox4StateChanged - if (modbusServer.getFunctionCode4Disabled()) - modbusServer.setFunctionCode4Disabled(false); - else - modbusServer.setFunctionCode4Disabled(true); - }//GEN-LAST:event_jCheckBox4StateChanged - - private void jCheckBox5StateChanged(ChangeEvent evt) {//GEN-FIRST:event_jCheckBox5StateChanged - if (modbusServer.getFunctionCode5Disabled()) - modbusServer.setFunctionCode5Disabled(false); - else - modbusServer.setFunctionCode5Disabled(true); - }//GEN-LAST:event_jCheckBox5StateChanged - - private void jCheckBox6StateChanged(ChangeEvent evt) {//GEN-FIRST:event_jCheckBox6StateChanged - if (modbusServer.getFunctionCode6Disabled()) - modbusServer.setFunctionCode6Disabled(false); - else - modbusServer.setFunctionCode6Disabled(true); - }//GEN-LAST:event_jCheckBox6StateChanged - - private void jCheckBox7StateChanged(ChangeEvent evt) {//GEN-FIRST:event_jCheckBox7StateChanged - if (modbusServer.getFunctionCode15Disabled()) - modbusServer.setFunctionCode15Disabled(false); - else - modbusServer.setFunctionCode15Disabled(true); - }//GEN-LAST:event_jCheckBox7StateChanged - - private void jCheckBox8StateChanged(ChangeEvent evt) {//GEN-FIRST:event_jCheckBox8StateChanged - if (modbusServer.getFunctionCode16Disabled()) - modbusServer.setFunctionCode16Disabled(false); - else - modbusServer.setFunctionCode16Disabled(true); - }//GEN-LAST:event_jCheckBox8StateChanged - - private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing - this.modbusServer.StopListening(); - }//GEN-LAST:event_formWindowClosing - - private void jScrollBar2AdjustmentValueChanged(java.awt.event.AdjustmentEvent evt) {//GEN-FIRST:event_jScrollBar2AdjustmentValueChanged - javax.swing.table.DefaultTableModel model2 = (javax.swing.table.DefaultTableModel) jTable2.getModel(); - model2.setNumRows(0); - for (int i = 0; i < 25; i++) { - if ((i + this.jScrollBar2.getValue() + 1) < 65535) - model2.addRow(new Object[]{String.valueOf(i + this.jScrollBar2.getValue() + 1), String.valueOf(modbusServer.coils[i + this.jScrollBar2.getValue() + 1])}); - } - }//GEN-LAST:event_jScrollBar2AdjustmentValueChanged - - private void jScrollBar3AdjustmentValueChanged(java.awt.event.AdjustmentEvent evt) {//GEN-FIRST:event_jScrollBar3AdjustmentValueChanged - javax.swing.table.DefaultTableModel model3 = (javax.swing.table.DefaultTableModel) jTable3.getModel(); - model3.setNumRows(0); - for (int i = 0; i < 25; i++) { - if ((i + this.jScrollBar3.getValue() + 1) < 65535) - model3.addRow(new Object[]{String.valueOf(i + this.jScrollBar3.getValue() + 1), String.valueOf(modbusServer.inputRegisters[i + this.jScrollBar3.getValue() + 1])}); - } - }//GEN-LAST:event_jScrollBar3AdjustmentValueChanged - - private void jScrollBar4AdjustmentValueChanged(java.awt.event.AdjustmentEvent evt) {//GEN-FIRST:event_jScrollBar4AdjustmentValueChanged - this.holdingRegistersChangedEvent(); - }//GEN-LAST:event_jScrollBar4AdjustmentValueChanged - - private void jScrollBar1AdjustmentValueChanged(java.awt.event.AdjustmentEvent evt) {//GEN-FIRST:event_jScrollBar1AdjustmentValueChanged - javax.swing.table.DefaultTableModel model1 = (javax.swing.table.DefaultTableModel) jTable1.getModel(); - model1.setNumRows(0); - for (int i = 0; i < 25; i++) { - if ((i + this.jScrollBar1.getValue() + 1) < 65535) - model1.addRow(new Object[]{String.valueOf(i + this.jScrollBar1.getValue() + 1), String.valueOf(modbusServer.discreteInputs[i + this.jScrollBar1.getValue() + 1])}); - - } - }//GEN-LAST:event_jScrollBar1AdjustmentValueChanged - - private void jTable1PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jTable1PropertyChange - for (int i = 0; i < jTable1.getRowCount(); i++) { - this.modbusServer.setDiscreteInput(Boolean.valueOf((String) this.jTable1.getValueAt(i, 1)), i + this.jScrollBar1.getValue() + 1); - } - jScrollBar1AdjustmentValueChanged(null); - }//GEN-LAST:event_jTable1PropertyChange - - private void jTable2PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jTable2PropertyChange - for (int i = 0; i < jTable2.getRowCount(); i++) { - this.modbusServer.setCoil(Boolean.valueOf((String) this.jTable2.getValueAt(i, 1)), i + this.jScrollBar2.getValue() + 1); - - } - jScrollBar2AdjustmentValueChanged(null); - }//GEN-LAST:event_jTable2PropertyChange - - private void jTable3PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jTable3PropertyChange - for (int i = 0; i < jTable3.getRowCount(); i++) { - this.modbusServer.setInputRegister(Integer.valueOf((String) this.jTable3.getValueAt(i, 1)), i + this.jScrollBar3.getValue() + 1); - - } - jScrollBar3AdjustmentValueChanged(null); - }//GEN-LAST:event_jTable3PropertyChange - - private void jPanel4PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jPanel4PropertyChange - - }//GEN-LAST:event_jPanel4PropertyChange - - private void jTable4PropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jTable4PropertyChange - for (int i = 0; i < jTable4.getRowCount(); i++) { - this.modbusServer.setHoldingRegister(Integer.valueOf((String) this.jTable4.getValueAt(i, 1)), i + this.jScrollBar4.getValue() + 1); - - } - jScrollBar4AdjustmentValueChanged(null); - }//GEN-LAST:event_jTable4PropertyChange - - private void jTable1MouseClicked(MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked - - this.modbusServer.setDiscreteInput((!this.modbusServer.getDiscreteInput(jTable1.getSelectedRow() + this.jScrollBar1.getValue() + 1)), (jTable1.getSelectedRow() + this.jScrollBar1.getValue() + 1)); - - jScrollBar1AdjustmentValueChanged(null); - }//GEN-LAST:event_jTable1MouseClicked - - private void jTabbedPane1MouseClicked(MouseEvent evt) {//GEN-FIRST:event_jTabbedPane1MouseClicked - - }//GEN-LAST:event_jTabbedPane1MouseClicked - - private void jTable2MouseClicked(MouseEvent evt) {//GEN-FIRST:event_jTable2MouseClicked - this.modbusServer.setCoil((!this.modbusServer.getCoil(jTable2.getSelectedRow() + this.jScrollBar2.getValue() + 1)), (jTable2.getSelectedRow() + this.jScrollBar2.getValue() + 1)); - jScrollBar2AdjustmentValueChanged(null); - }//GEN-LAST:event_jTable2MouseClicked - - public void coilsChangedEvent() { - javax.swing.table.DefaultTableModel model2 = (javax.swing.table.DefaultTableModel) jTable2.getModel(); - model2.setNumRows(0); - for (int i = 0; i < 25; i++) { - if ((i + this.jScrollBar2.getValue() + 1) < 65535) - model2.addRow(new Object[]{String.valueOf(i + this.jScrollBar2.getValue() + 1), String.valueOf(modbusServer.coils[i + this.jScrollBar2.getValue() + 1])}); - } - } - - public void holdingRegistersChangedEvent() { - javax.swing.table.DefaultTableModel model4 = (javax.swing.table.DefaultTableModel) jTable4.getModel(); - model4.setNumRows(0); - for (int i = 0; i < 25; i++) { - if ((i + this.jScrollBar4.getValue() + 1) < 65535) - model4.addRow(new Object[]{String.valueOf(i + this.jScrollBar4.getValue() + 1), String.valueOf(modbusServer.holdingRegisters[i + this.jScrollBar4.getValue() + 1])}); - } - } - - public void NumberOfConnectedClientsChanged() { - this.jLabel7.setText(String.valueOf(modbusServer.getNumberOfConnectedClients())); - } - - javax.swing.DefaultListModel model = new javax.swing.DefaultListModel(); - - public void logDataChangedEvent() { - if (jCheckBox9.getSelectedObjects() == null) - return; - - - //model.removeAllElements(); - - String listBoxData; - for (int i = 0; i < 2; i++) { - - if (modbusServer.getLogData()[i] == null) - break; - if (modbusServer.getLogData()[i].request) { - listBoxData = modbusServer.getLogData()[i].timeStamp.getTime() + " Request from Client - Functioncode: " + String.valueOf(modbusServer.getLogData()[i].functionCode); - if (modbusServer.getLogData()[i].functionCode <= 4) { - listBoxData = listBoxData + " Starting Address: " + String.valueOf(modbusServer.getLogData()[i].startingAdress) + " Quantity: " + String.valueOf(modbusServer.getLogData()[i].quantity); - } - if (modbusServer.getLogData()[i].functionCode == 5) { - listBoxData = listBoxData + " Output Address: " + String.valueOf(modbusServer.getLogData()[i].startingAdress) + " Output Value: "; - if (modbusServer.getLogData()[i].receiveCoilValues[0] == 0) - listBoxData = listBoxData + "False"; - if (modbusServer.getLogData()[i].receiveCoilValues[0] == 0xFF00) - listBoxData = listBoxData + "True"; - } - if (modbusServer.getLogData()[i].functionCode == 6) { - listBoxData = listBoxData + " Starting Address: " + String.valueOf(modbusServer.getLogData()[i].startingAdress) + " Register Value: " + String.valueOf(modbusServer.getLogData()[i].receiveRegisterValues[0]); - } - if (modbusServer.getLogData()[i].functionCode == 15) { - listBoxData = listBoxData + " Starting Address: " + String.valueOf(modbusServer.getLogData()[i].startingAdress) + " Quantity: " + String.valueOf(modbusServer.getLogData()[i].quantity) + " Byte Count: " + String.valueOf(modbusServer.getLogData()[i].byteCount) + " Values Received: "; - for (int j = 0; j < modbusServer.getLogData()[i].quantity; j++) { - int shift = j % 16; - if ((i == modbusServer.getLogData()[i].quantity - 1) & (modbusServer.getLogData()[i].quantity % 2 != 0)) { - if (shift < 8) - shift = shift + 8; - else - shift = shift - 8; - } - int mask = 0x1; - mask = mask << (shift); - if ((modbusServer.getLogData()[i].receiveCoilValues[j / 16] & mask) == 0) - listBoxData = listBoxData + " False"; - else - listBoxData = listBoxData + " True"; - } - } - if (modbusServer.getLogData()[i].functionCode == 16) { - listBoxData = listBoxData + " Starting Address: " + String.valueOf(modbusServer.getLogData()[i].startingAdress) + " Quantity: " + String.valueOf(modbusServer.getLogData()[i].quantity) + " Byte Count: " + String.valueOf(modbusServer.getLogData()[i].byteCount) + " Values Received: "; - for (int j = 0; j < modbusServer.getLogData()[i].quantity; j++) { - listBoxData = listBoxData + " " + modbusServer.getLogData()[i].receiveRegisterValues[j]; - } - } - model.add(0, listBoxData); - - - } - if (modbusServer.getLogData()[i].response) { - if (modbusServer.getLogData()[i].exceptionCode > 0) { - listBoxData = ("Response To Client - Error code: " + String.valueOf(modbusServer.getLogData()[i].errorCode)); - listBoxData = listBoxData + " Exception Code: " + String.valueOf(modbusServer.getLogData()[i].exceptionCode); - model.add(0, listBoxData); - - - } else { - listBoxData = (modbusServer.getLogData()[i].timeStamp.getTime() + " Response To Client - Functioncode: " + String.valueOf(modbusServer.getLogData()[i].functionCode)); - - if (modbusServer.getLogData()[i].functionCode <= 4) { - - listBoxData = listBoxData + " Bytecount: " + String.valueOf((int) modbusServer.getLogData()[i].byteCount) + " Values sent: "; - } - if (modbusServer.getLogData()[i].functionCode == 5) { - listBoxData = listBoxData + " Starting Address: " + String.valueOf(modbusServer.getLogData()[i].startingAdress) + " Output Value: "; - if (modbusServer.getLogData()[i].receiveCoilValues[0] == 0) - listBoxData = listBoxData + "False"; - if (modbusServer.getLogData()[i].receiveCoilValues[0] == 0xFF00) - listBoxData = listBoxData + "True"; - } - if (modbusServer.getLogData()[i].functionCode == 6) { - listBoxData = listBoxData + " Starting Address: " + String.valueOf(modbusServer.getLogData()[i].startingAdress) + " Register Value: " + String.valueOf(modbusServer.getLogData()[i].receiveRegisterValues[0]); - } - if (modbusServer.getLogData()[i].functionCode == 15) { - listBoxData = listBoxData + " Starting Address: " + String.valueOf(modbusServer.getLogData()[i].startingAdress) + " Quantity: " + String.valueOf(modbusServer.getLogData()[i].quantity); - } - if (modbusServer.getLogData()[i].functionCode == 16) { - listBoxData = listBoxData + " Starting Address: " + String.valueOf(modbusServer.getLogData()[i].startingAdress) + " Quantity: " + String.valueOf(modbusServer.getLogData()[i].quantity); - } - if (modbusServer.getLogData()[i].sendCoilValues != null) { - for (int j = 0; j < modbusServer.getLogData()[i].sendCoilValues.length; j++) { - listBoxData = listBoxData + String.valueOf(modbusServer.getLogData()[i].sendCoilValues[j]) + " "; - } - } - if (modbusServer.getLogData()[i].sendRegisterValues != null) { - for (int j = 0; j < modbusServer.getLogData()[i].sendRegisterValues.length; j++) { - listBoxData = listBoxData + String.valueOf(modbusServer.getLogData()[i].sendRegisterValues[j]) + " "; - } - } - model.add(0, listBoxData); - } - } - } - } - - int topic; - String link; - - private void WebViewStateChanged(ChangeEvent evt) { - topic = new Random().nextInt(99999); - if (chckbxEnableWebview.isSelected()) { - - link = "http://www.easymodbustcp.net/webview/easymodbuswebview.html?topic=" + topic; - lblLink.setText("" + link + ""); - lblWebViewAddress.setVisible(true); - lblLink.setVisible(true); - - - } else { - - lblWebViewAddress.setVisible(false); - lblLink.setVisible(false); - - } - - } - - private void linkClicked() { - if (Desktop.isDesktopSupported()) { - Desktop desktop = Desktop.getDesktop(); - try { - desktop.browse(new URI(link)); - } catch (IOException | URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } else { - Runtime runtime = Runtime.getRuntime(); - try { - runtime.exec("xdg-open " + link); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - /** - * @param args the command line arguments - */ - public static void main(String args[]) { - /* Set the Nimbus look and feel */ - // - /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. - * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html - */ - try { - for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { - if ("Nimbus".equals(info.getName())) { - javax.swing.UIManager.setLookAndFeel(info.getClassName()); - break; - } - } - } catch (ClassNotFoundException ex) { - java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (InstantiationException ex) { - java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (IllegalAccessException ex) { - java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (javax.swing.UnsupportedLookAndFeelException ex) { - java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } - // - - /* Create and display the form */ - java.awt.EventQueue.invokeLater(new Runnable() { - public void run() { - new NewJFrame().setVisible(true); - } - }); - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private JCheckBox jCheckBox1; - private JCheckBox jCheckBox2; - private JCheckBox jCheckBox3; - private JCheckBox jCheckBox4; - private JCheckBox jCheckBox5; - private JCheckBox jCheckBox6; - private JCheckBox jCheckBox7; - private JCheckBox jCheckBox8; - private JCheckBox jCheckBox9; - private JLabel jLabel1; - private JLabel jLabel2; - private JLabel jLabel3; - private JLabel jLabel4; - private JLabel jLabel5; - private JLabel jLabel6; - private JLabel jLabel7; - private javax.swing.JList jList1; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel2; - private javax.swing.JPanel jPanel3; - private javax.swing.JPanel jPanel4; - private javax.swing.JPanel jPanel5; - private JScrollBar jScrollBar1; - private JScrollBar jScrollBar2; - private JScrollBar jScrollBar3; - private JScrollBar jScrollBar4; - private JScrollPane jScrollPane1; - private JScrollPane jScrollPane2; - private JScrollPane jScrollPane3; - private JScrollPane jScrollPane4; - private javax.swing.JTabbedPane jTabbedPane1; - private javax.swing.JTable jTable1; - private javax.swing.JTable jTable2; - private javax.swing.JTable jTable3; - private javax.swing.JTable jTable4; - private JCheckBox chckbxEnableWebview; - private JLabel lblWebViewAddress; - private JLabel lblLink; -} diff --git a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/gui/PLCLoggerCompact.jpg b/lc-historian/src/main/java/de/re/easymodbus/modbusserver/gui/PLCLoggerCompact.jpg deleted file mode 100644 index 48d8d884fb80eea3ae142a5f6ef32afdf33ba900..0000000000000000000000000000000000000000 Binary files a/lc-historian/src/main/java/de/re/easymodbus/modbusserver/gui/PLCLoggerCompact.jpg and /dev/null differ diff --git a/lc-historian/src/main/java/lc/historian/Historian.java b/lc-historian/src/main/java/lc/historian/Historian.java deleted file mode 100644 index f15da4b10d33b61b4819b9065119fc50aa1ab0db..0000000000000000000000000000000000000000 --- a/lc-historian/src/main/java/lc/historian/Historian.java +++ /dev/null @@ -1,155 +0,0 @@ -package lc.historian; - -import com.stumbleupon.async.Callback; -import com.stumbleupon.async.Deferred; -import de.re.easymodbus.modbusclient.ModbusClient; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import net.opentsdb.core.TSDB; -import net.opentsdb.uid.NoSuchUniqueName; -import net.opentsdb.uid.UniqueId.UniqueIdType; -import net.opentsdb.utils.Config; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - - -public class Historian { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(Historian.class); - - public static void othermain(String[] args) { - ModbusClient modbusClient = new ModbusClient("10.52.0.150", 502); - try { - modbusClient.Connect(); - // modbusClient.WriteSingleCoil(0, true); - // modbusClient.WriteSingleRegister(0, 1234); - // modbusClient.WriteMultipleRegisters(11, ModbusClient.ConvertFloatToRegisters((float) 123.56)); - - logger.info("Reading... [register: {}] [value: {}]", 3, - modbusClient.ReadHoldingRegisters(3, 4)[0]); - - //System.out.println(modbusClient.ReadCoils(0, 1)[0]); - // System.out.println(modbusClient.ReadHoldingRegisters(0, 1)[0]); - // System.out.println(ModbusClient.ConvertRegistersToFloat(modbusClient.ReadHoldingRegisters(11, 2))); - } catch (Exception e) { - e.printStackTrace(); - } - } - - private static String pathToConfigFile; - - public static void processArgs(final String[] args) { - // Set these as arguments so you don't have to keep path information in - // source files - if (args != null && args.length > 0) { - pathToConfigFile = args[0]; - } - } - - public static void main(final String[] args) throws Exception { - processArgs(args); - - // Create a config object with a path to the file for parsing. Or manually - // override settings. - // e.g. config.overrideConfig("tsd.storage.hbase.zk_quorum", "localhost"); - final Config config; - if (pathToConfigFile != null && !pathToConfigFile.isEmpty()) { - config = new Config(pathToConfigFile); - } else { - // Search for a default config from /etc/opentsdb/opentsdb.conf, etc. - config = new Config(true); - } - - // Dev/Test Server - config.overrideConfig("tsd.storage.hbase.zk_quorum", "pod-db2.leigh-co.com"); - - final TSDB tsdb = new TSDB(config); - - // Declare new metric - String metricName = "my.tsdb.test.metric"; - // First check to see it doesn't already exist - byte[] byteMetricUID; // we don't actually need this for the first - // .addPoint() call below. - // TODO: Ideally we could just call a not-yet-implemented tsdb.uIdExists() - // function. - // Note, however, that this is optional. If auto metric is enabled - // (tsd.core.auto_create_metrics), the UID will be assigned in call to - // addPoint(). - try { - byteMetricUID = tsdb.getUID(UniqueIdType.METRIC, metricName); - } catch (IllegalArgumentException iae) { - System.out.println("Metric name not valid."); - iae.printStackTrace(); - System.exit(1); - } catch (NoSuchUniqueName nsune) { - // If not, great. Create it. - byteMetricUID = tsdb.assignUid("metric", metricName); - } - - // Make a single datum - long timestamp = System.currentTimeMillis() / 1000; - long value = 314159; - // Make key-val - Map tags = new HashMap(1); - tags.put("script", "example1"); - - // Start timer - long startTime1 = System.currentTimeMillis(); - - // Write a number of data points at 30 second intervals. Each write will - // return a deferred (similar to a Java Future or JS Promise) that will - // be called on completion with either a "null" value on success or an - // exception. - int n = 100; - ArrayList> deferreds = new ArrayList>(n); - for (int i = 0; i < n; i++) { - Deferred deferred = tsdb.addPoint(metricName, timestamp, value + i, tags); - deferreds.add(deferred); - timestamp += 30; - } - - // Add the callbacks to the deferred object. (They might have already - // returned, btw) - // This will cause the calling thread to wait until the add has completed. - System.out.println("Waiting for deferred result to return..."); - Deferred.groupInOrder(deferreds) - .addErrback(new Historian().new errBack()) - .addCallback(new Historian().new succBack()) - // Block the thread until the deferred returns it's result. - .join(); - // Alternatively you can add another callback here or use a join with a - // timeout argument. - - // End timer. - long elapsedTime1 = System.currentTimeMillis() - startTime1; - System.out.println("\nAdding " + n + " points took: " + elapsedTime1 - + " milliseconds.\n"); - - // Gracefully shutdown connection to TSDB. This is CRITICAL as it will - // flush any pending operations to HBase. - tsdb.shutdown().join(); - } - - // This is an optional errorback to handle when there is a failure. - class errBack implements Callback { - public String call(final Exception e) throws Exception { - String message = ">>>>>>>>>>>Failure!>>>>>>>>>>>"; - System.err.println(message + " " + e.getMessage()); - e.printStackTrace(); - return message; - } - } - - ; - - // This is an optional success callback to handle when there is a success. - class succBack implements Callback> { - public Object call(final ArrayList results) { - System.out.println("Successfully wrote " + results.size() + " data points"); - return null; - } - } - - ; -} diff --git a/lc-inkan/LICENSE.md b/lc-inkan/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/lc-inkan/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-inkan/build.gradle b/lc-inkan/build.gradle deleted file mode 100644 index e3608c9cba7c6f1c32d061fc454a04face5a6e86..0000000000000000000000000000000000000000 --- a/lc-inkan/build.gradle +++ /dev/null @@ -1,20 +0,0 @@ -plugins { - id 'java' -} - -group 'leigh' -version '16.0' -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -repositories { - mavenCentral() -} - -dependencies { - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/lc-inkan/src/main/java/lc/inkan/Inkan.java b/lc-inkan/src/main/java/lc/inkan/Inkan.java deleted file mode 100644 index e1c271a7544169b21a436e0f1527d66163c19ce4..0000000000000000000000000000000000000000 --- a/lc-inkan/src/main/java/lc/inkan/Inkan.java +++ /dev/null @@ -1,42 +0,0 @@ -package lc.inkan; - -import java.nio.charset.StandardCharsets; -import java.security.*; -import java.util.Base64; - -public class Inkan { - public static void main(String[] args) - throws NoSuchAlgorithmException, InvalidKeyException, SignatureException { - KeyPairGenerator kpg = KeyPairGenerator.getInstance("Ed25519"); - KeyPair kp = kpg.generateKeyPair(); - - byte[] msg = "Hello World!".getBytes(StandardCharsets.UTF_8); - - Signature sig = Signature.getInstance("Ed25519"); - sig.initSign(kp.getPrivate()); - sig.update(msg); - byte[] s = sig.sign(); - - byte[] privateKey = kp.getPrivate().getEncoded(); - byte[] publicKey = kp.getPublic().getEncoded(); - - String encPrivate = Base64.getEncoder().encodeToString(privateKey); - String encPublic = Base64.getEncoder().encodeToString(publicKey); - - System.out.println(encPrivate); - System.out.println(encPublic); - System.out.println(bytesToHex(publicKey)); - } - - private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray(); - - public static String bytesToHex(byte[] bytes) { - char[] hexChars = new char[bytes.length * 2]; - for (int j = 0; j < bytes.length; j++) { - int v = bytes[j] & 0xFF; - hexChars[j * 2] = HEX_ARRAY[v >>> 4]; - hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F]; - } - return new String(hexChars); - } -} diff --git a/lc-inventory/.gitignore b/lc-inventory/.gitignore deleted file mode 100644 index ede7310f5aa22a8bb16f7393dedac5d9b0cba2c9..0000000000000000000000000000000000000000 --- a/lc-inventory/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -kabe.log -velocity.log -.DS_Store -statistic.xml -.gradle -/*/build/ -/build/ -gradle-app.setting -!gradle-wrapper.jar -.gradletasknamecache -.idea/ -*.iml -out/ -.cache -node_modules -/*/.idea -.vi -/*/graph.eo -.vai -graph.bak -.idea -tests.vai -vds.log -hosts.json -tests.vai.old \ No newline at end of file diff --git a/lc-inventory/LICENSE.md b/lc-inventory/LICENSE.md deleted file mode 100644 index 226d1f25b12e58e21c29a6c1869d1ec05095d443..0000000000000000000000000000000000000000 --- a/lc-inventory/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-inventory/build.gradle b/lc-inventory/build.gradle deleted file mode 100644 index ff37cedb1152b17eb2604d6966e44ec3cebd50b2..0000000000000000000000000000000000000000 --- a/lc-inventory/build.gradle +++ /dev/null @@ -1,22 +0,0 @@ -plugins { - id 'java' - id 'java-library' -} - -group 'leigh' -version '16.0' -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -repositories { - mavenCentral() -} - -dependencies { - api project(':lc-mecha') - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/lc-inventory/src/main/java/lc/inventory/NumberGenerator.java b/lc-inventory/src/main/java/lc/inventory/NumberGenerator.java deleted file mode 100644 index dc219cf4635ab3d1aa39e8381791798b996408f4..0000000000000000000000000000000000000000 --- a/lc-inventory/src/main/java/lc/inventory/NumberGenerator.java +++ /dev/null @@ -1,22 +0,0 @@ -package lc.inventory; - -import lc.mecha.math.RadixConverter; -import lc.mecha.util.StringAccumulatorV2; - -import java.util.Locale; - -public class NumberGenerator { - public static void main(String args[]) { - RadixConverter r = new RadixConverter(RadixConverter.RADIX36); - - int x = 2000000; - - for (int i = x; i < x + 500; i++) { - StringAccumulatorV2 sa = new StringAccumulatorV2(","); - sa.add(Integer.toString(i)); - sa.add(r.encode(i).toUpperCase(Locale.ROOT)); - sa.add("https://leigh-co.com/inv/api/v1?lcit=" + r.encode(i).toUpperCase(Locale.ROOT)); - System.out.println(sa.asString()); - } - } -} diff --git a/lc-m3-sdk/LICENSE.md b/lc-m3-sdk/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/lc-m3-sdk/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-m3-sdk/build.gradle b/lc-m3-sdk/build.gradle deleted file mode 100644 index 6074262f517d7447dd86d9ba8ce4edf57df35cf4..0000000000000000000000000000000000000000 --- a/lc-m3-sdk/build.gradle +++ /dev/null @@ -1,22 +0,0 @@ -plugins { - id 'java' - id 'java-library' -} -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -group 'leigh' -version '16.0' - -repositories { - mavenCentral() -} - -dependencies { - api project(':lc-eo-schema') - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/lc-m3-sdk/src/main/java/lc/m3/sdk/SchemaGeneratorApp.java b/lc-m3-sdk/src/main/java/lc/m3/sdk/SchemaGeneratorApp.java deleted file mode 100644 index 7791c0b6ffc60f4ef607bef5a63bc732bf530685..0000000000000000000000000000000000000000 --- a/lc-m3-sdk/src/main/java/lc/m3/sdk/SchemaGeneratorApp.java +++ /dev/null @@ -1,40 +0,0 @@ -package lc.m3.sdk; - -import lc.eo.EO; -import lc.eo.schema.DAOGenerator; -import lc.eo.schema.dao.ElementElementDAO; -import lc.eo.schema.dao.FieldUtil; -import lc.eo.schema.dao.SchemaElementDAO; -import lc.eo.schema.dao.SchemaUtil; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.UniversalJob; - -import java.io.File; -import java.io.FileNotFoundException; - -public class SchemaGeneratorApp { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(SchemaGeneratorApp.class); - - public static EO generate() { - final EO schema = SchemaUtil.create(SchemaUtil.API_KEY); - - final EO currentPlaying = ElementElementDAO.create(); - SchemaElementDAO.getElements(schema).add(currentPlaying); - ElementElementDAO.setApiName(currentPlaying, "leigh.esp.sdk.v1.CurrentPlaying"); - ElementElementDAO.getFields(currentPlaying).add(FieldUtil.createNotNull("title", "Song Title")); - ElementElementDAO.getFields(currentPlaying).add(FieldUtil.createNotNull("album", "Artist")); - ElementElementDAO.getFields(currentPlaying).add(FieldUtil.createNotNull("artist", "Album")); - - return schema; - } - - public static void main(final String... args) throws FileNotFoundException { - UniversalJob.banner(logger, "Apotheosis mk3", "2014 Alex Leigh"); - final EO schema = generate(); - final DAOGenerator gen = new DAOGenerator(new File("leigh-m3-sdk/src/main/java")); - gen.generateJava("leigh.m3.sdk.v1.schema", schema); - - logger.info("Generated schema: {}", schema); - } -} diff --git a/lc-m3-sdk/src/main/java/lc/m3/sdk/v1/schema/CurrentPlayingElementDAO.java b/lc-m3-sdk/src/main/java/lc/m3/sdk/v1/schema/CurrentPlayingElementDAO.java deleted file mode 100644 index 1e812a0202caaa2c95951053bedf9c84befa22a2..0000000000000000000000000000000000000000 --- a/lc-m3-sdk/src/main/java/lc/m3/sdk/v1/schema/CurrentPlayingElementDAO.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2014-2021, by Alex Leigh. - * All rights reserved. - * - * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE - * The copyright notice above does not evidence any - * actual or intended publication of such source code. - */ - -package lc.m3.sdk.v1.schema; - -import lc.eo.EO; - -/** -* This is a dynamically generated DAO class for accessing objects within an ESP graph. This class -* has been generated by DAOGenerator and should not be modified. -* -* @author DAOGenerator (synthetically generated class) -*/ -public final class CurrentPlayingElementDAO { -public static final String API_TYPE = "leigh.esp.sdk.v1.CurrentPlaying"; - -public static EO create() { -EO eo = new EO(API_TYPE); -return eo; -} - -public static boolean assertType(final EO eo) { -return eo.getApiType().equals(API_TYPE); -} - -public static final String KEY_TITLE = "title"; -public static final String KEY_ALBUM = "album"; -public static final String KEY_ARTIST = "artist"; - -public static String apiType(final EO eo) { -return eo.getApiType(); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=title, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}, meta=null}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Song Title, locale=en}, meta=null}]} , type=string}, meta=null} */ - - - -public static java.lang.String getTitle(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_TITLE); - } - -public static void setTitle(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_TITLE, value); -} - -public static void setTitleLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_TITLE, label); -} - -public static void getLabelOrValueTitle(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_TITLE); -} - -public static void setIfUnsetTitle(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_TITLE, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=album, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}, meta=null}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Artist, locale=en}, meta=null}]} , type=string}, meta=null} */ - - - -public static java.lang.String getAlbum(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_ALBUM); - } - -public static void setAlbum(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_ALBUM, value); -} - -public static void setAlbumLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_ALBUM, label); -} - -public static void getLabelOrValueAlbum(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_ALBUM); -} - -public static void setIfUnsetAlbum(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_ALBUM, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=artist, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}, meta=null}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Album, locale=en}, meta=null}]} , type=string}, meta=null} */ - - - -public static java.lang.String getArtist(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_ARTIST); - } - -public static void setArtist(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_ARTIST, value); -} - -public static void setArtistLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_ARTIST, label); -} - -public static void getLabelOrValueArtist(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_ARTIST); -} - -public static void setIfUnsetArtist(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_ARTIST, value); -} - - -} \ No newline at end of file diff --git a/lc-m3-util/LICENSE.md b/lc-m3-util/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/lc-m3-util/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-m3-util/build.gradle b/lc-m3-util/build.gradle deleted file mode 100644 index 45acde59275371f3a2eb7ac2b71dcb41ba0365c8..0000000000000000000000000000000000000000 --- a/lc-m3-util/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -plugins { - id 'java' - id 'java-library' - id 'application' -} -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -group 'leigh' -version '2.0' - -repositories { - mavenCentral() -} - -dependencies { - api project (':lc-mecha-exec') - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} - -application { - mainClass = 'leigh.m3.util.M3UtilApp' -} \ No newline at end of file diff --git a/lc-m3-util/src/main/java/lc/m3/util/M3UtilApp.java b/lc-m3-util/src/main/java/lc/m3/util/M3UtilApp.java deleted file mode 100644 index 16f75f07742b74eaaac8b12c5cece1489544692f..0000000000000000000000000000000000000000 --- a/lc-m3-util/src/main/java/lc/m3/util/M3UtilApp.java +++ /dev/null @@ -1,99 +0,0 @@ -package lc.m3.util; - -import lc.mecha.exec.LocalExecutor; -import lc.mecha.exec.ProcessExecution; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.io.IOUtils; - -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.UUID; - -public class M3UtilApp { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(M3UtilApp.class); - - public static void main(String args[]) throws IOException { - Path dir = Paths.get("/Volumes/cal326/m34"); - Files.walk(dir).forEach(paths -> { - try { - extractCover(paths.toFile()); - } catch (Exception e) { - e.printStackTrace(); - } - }); - } - - public static void extractCover(File path) throws Exception { - if (!path.toString().endsWith("m4a") || !path.isFile()) return; - logger.info("Extracting cover art: {}", path); - String songBaseName = FilenameUtils.getName(path.toString().replace(".m4a", "")); - ArrayList args = new ArrayList<>(); - args.add(path.toString()); - args.add("-b"); - args.add("-CoverArt"); - LocalExecutor e = new LocalExecutor(); - ProcessExecution pe = e.execute("exiftool", args); - // Might be a PNG, who knows. Usually JPG so lets start there. - File output = new File(songBaseName + ".jpg"); - try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(output))) { - IOUtils.copy(pe.getInputStream(), bos); - } - - // If there was no cover art, we wound up with a 0 length file. Lets fix that now. - - if (output.length() == 0) output.delete(); - } - - public static void extractMeta(File path) throws Exception { - if (!path.toString().endsWith("m4a") || !path.isFile()) return; - String songBaseName = FilenameUtils.getName(path.toString().replace(".m4a", "")); - ArrayList args = new ArrayList<>(); - args.add(path.toString()); - args.add("-j"); - LocalExecutor e = new LocalExecutor(); - ProcessExecution pe = e.execute("exiftool", args); - String result = pe.drainInput(); - - File output = new File(songBaseName + ".json"); - try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(output))) { - bos.write(result.getBytes(StandardCharsets.UTF_8)); - } - - logger.info("Command result: {}", result); - } - - public static void uuidName(File path) { - if (!path.toString().endsWith("m4a") || !path.isFile()) return; - UUID id = UUID.randomUUID(); - path.renameTo(new File(id + ".m4a")); - } - - public static void segmentFile(File path) throws Exception { - if (!path.toString().endsWith("m4a") || !path.isFile()) return; - - String songBaseName = FilenameUtils.getName(path.toString().replace(".m4a", "")); - ArrayList args = new ArrayList<>(); - args.add("-t"); - args.add("6"); - args.add("-start-segments-with-iframe"); - args.add("-i"); - args.add(songBaseName + ".m3u8"); - args.add("-B"); - args.add(songBaseName + "_"); - args.add(path.toString()); - - LocalExecutor e = new LocalExecutor(); - ProcessExecution pe = e.execute("mediafilesegmenter", args); - String result = pe.drainInput(); - logger.info("Command result: {}", result); - } -} diff --git a/lc-m3/LICENSE.md b/lc-m3/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/lc-m3/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-m3/build.gradle b/lc-m3/build.gradle deleted file mode 100644 index 6137940b5a59b6eedb233641e81af866f671e854..0000000000000000000000000000000000000000 --- a/lc-m3/build.gradle +++ /dev/null @@ -1,28 +0,0 @@ -plugins { - id 'java' - id 'java-library' - id 'application' -} -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -group 'leigh' -version '2.0' - -repositories { - mavenCentral() -} - -dependencies { - api project (':lc-esp-service-sdk') - api project (':lc-m3-sdk') - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} - -application { - mainClass = 'leigh.m3.M3Service' -} \ No newline at end of file diff --git a/lc-m3/src/main/java/lc/m3/M3Service.java b/lc-m3/src/main/java/lc/m3/M3Service.java deleted file mode 100644 index 3befa3a5f60d5a3d53eba7d8aed7eca1f00f423c..0000000000000000000000000000000000000000 --- a/lc-m3/src/main/java/lc/m3/M3Service.java +++ /dev/null @@ -1,197 +0,0 @@ -package lc.m3; - -import lc.eo.EO; -import lc.eo.json.JsonOutput; -import lc.esp.sdk.service.MicroService; -import lc.esp.sdk.service.schema.v1.MicroServiceCfgElementDAO; -import lc.mecha.http.server.WebTransaction; -import lc.mecha.json.JSONArray; -import lc.mecha.json.JSONObject; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import org.apache.commons.io.FilenameUtils; -import org.apache.commons.io.IOUtils; - -import java.beans.Introspector; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.nio.file.Path; - -/** - * M3 V2.0 is a re-imagining of Eric Lindvall's M3 service for Continuity. This modern re-write implements - * the HLS protocol instead of ICYCAST. In general, the other mechanics of M3 are preserved. - *

- * M3Service is an Enhanced Services Platform (ESP) microservice, intended to be run behind a Kabe server. However, - * it can also be used stand-alone service by disabling the Keikai client and connecting directly. - *

- * THe service expects to find a media directory (as set by the BASE_PATH variable) which contains - * the following files: - *

- * AAC 256kbit TS media files, incrementing as filename_0.aac, filename_1.aac, filename_2.aac, etc. - * A M3U8 describing all segments for a given track, as filename.m3u8 - * A JSON file containing the meta values for the track, as filename.json - * An optional JPG image containing the cover art, as filename.jpg - * A JPG for missing cover art, named missingcover.jpg - *

- * Other media formats than AAC/256 will work, but various settings in this class have to be adjusted to produce - * correct playlists. - * - * @author Alex Leigh - */ -public class M3Service extends MicroService { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(M3Service.class); - // This must have a trailing slash - private static final String BASE_PATH = "/opt/music/mp3/"; - private static final String MISSING_COVER_IMG = "/opt/music/mp3/missingcover.jpg"; - private final MediaRepository repo = new MediaRepository(Path.of(BASE_PATH)); - private final MediaStream stream = new MediaStream(repo); - - - public M3Service(EO cfg) throws IOException { - super(cfg); - repo.scan(); - } - - public static void main(String args[]) throws IOException { - EO cfg = MicroServiceCfgElementDAO.create(); - MicroServiceCfgElementDAO.setKabeUrl(cfg, "https://leigh-co.com/"); - MicroServiceCfgElementDAO.setSrcUri(cfg, "/radio"); - M3Service svc = new M3Service(cfg); - svc.run(); - } - - @Override - public void serviceRequest(WebTransaction request) throws Throwable { - logger.info("request: {}", request.getPathInfo()); - - try { - switch (request.getPathInfo()) { - case "/playlist.m3u8": - doPlaylist(request); - return; - case "/master.m3u8": - doMasterPlaylist(request); - return; - case "/api/v1/current/read": - doCurrentSong(request); - return; - case "/api/v1/current/cover": - doCoverArt(request); - return; - default: - if (request.getPathInfo().endsWith("aac")) { - doMediaSegment(request); - return; - } - break; - } - request.httpServletResponse.setStatus(404); - request.httpServletResponse.getOutputStream().write("404 M3Handler".getBytes(StandardCharsets.UTF_8)); - } catch (Exception e) { - e.printStackTrace(); - } - } - - private void doCurrentSong(WebTransaction txn) throws IOException, InterruptedException { - StreamWindow current = stream.getCurrentSegments(); - SegmentSchedule currentSegment = current.getWindow().get(0); - - String metaFilename = currentSegment.getChunk().getM3u().getFile().toString().replace(".m3u8", ".json"); - logger.info("Opening metafile: {}", BASE_PATH + metaFilename); - - EO reply = new EO(); - try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(metaFilename))) { - JSONArray arr = new JSONArray(IOUtils.toString(bis, Charset.defaultCharset())); - JSONObject meta = (JSONObject) arr.get(0); - for (String key : meta.keySet()) { - reply.setValue(Introspector.decapitalize(key), meta.optString(key)); - } - } - - reply.remove("appleStoreAccount"); - reply.remove("coverArt"); - - try (JsonOutput out = new JsonOutput(txn.httpServletResponse.getOutputStream())) { - out.writeEO(reply); - } - } - - private void doCoverArt(WebTransaction txn) throws IOException, InterruptedException { - StreamWindow current = stream.getCurrentSegments(); - SegmentSchedule currentSegment = current.getWindow().get(0); - - String imgFilename = currentSegment.getChunk().getM3u().getFile().toString().replace(".m3u8", ".jpg"); - File imgFile = new File(imgFilename); - - logger.info("Deduced image file location: {}", imgFile); - - if (!imgFile.exists()) { - imgFile = new File(MISSING_COVER_IMG); - } - - try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(imgFile))) { - txn.httpServletResponse.setHeader("Cache-Control", "no-cache"); - txn.httpServletResponse.setContentType("image/jpeg"); - IOUtils.copy(bis, txn.httpServletResponse.getOutputStream()); - } - } - - /** - * Provide a media segment to the remote client. This works based on translating the requested sequence ID - * with the translation file to find the actual segment on disk. - */ - private void doMediaSegment(WebTransaction txn) throws IOException { - String tsFile = FilenameUtils.getName(txn.getPathInfo()); - Path fn = Path.of(BASE_PATH + tsFile); - logger.info("Streaming chunk to client. [fn: {}]", fn); - - try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(fn.toFile()))) { - txn.httpServletResponse.setContentType("video/mp2t"); - IOUtils.copy(bis, txn.httpServletResponse.getOutputStream()); - } - } - - private void doPlaylist(WebTransaction request) throws IOException, InterruptedException { - request.httpServletResponse.setContentType("application/vnd.apple.mpegurl"); - StreamWindow window = stream.getCurrentSegments(); - StringBuffer sb = new StringBuffer(); - - request.httpServletResponse.setHeader("Cache-Control", "no-cache"); - - // https://stackoverflow.com/questions/47047919/how-does-ext-x-discontinuity-sequence-tag-work-in-hls-m3u8-file - // Target duration must be an int, or Safari breaks - // Apple warns that no segments should be longer than the target duration - // Removing TARGETDURATION breaks it on Safari/IOS - // Files cannot be removed from the playlist if the type is EVENT. It can never change if VOD. - // Safari/IOS will go through stream boundaries without disco, VLC hangs silent - - sb.append("#EXTM3U\n" + - "#EXT-X-VERSION:4\n" + - "#EXT-X-INDEPENDENT-SEGMENTS\n" + - "#EXT-X-TARGETDURATION:6\n" + - "#EXT-X-DISCONTINUITY-SEQUENCE:" + window.getPastDiscos() + "\n" + - "#EXT-X-MEDIA-SEQUENCE:" + window.getLowSequence() + "\n" - ); - - for (SegmentSchedule scjed : window.getWindow()) { - if (scjed.isDiscontinuous()) { - sb.append("#EXT-X-DISCONTINUITY\n"); - } - sb.append("#EXTINF:" + scjed.getChunk().getDuration() + ",\n" + scjed.getChunk().getUrlEncodedFilename() + "\n"); - } - - logger.trace("Playlist: {}", sb); - - request.httpServletResponse.getOutputStream().write(sb.toString().getBytes(StandardCharsets.UTF_8)); - } - - private void doMasterPlaylist(WebTransaction request) throws IOException { - request.httpServletResponse.setContentType("application/vnd.apple.mpegurl"); - // This is based on the current ffmpeg settings for AAC/256 - request.httpServletResponse.getOutputStream().write("#EXTM3U\n#EXT-X-VERSION:4\n#EXT-X-STREAM-INF:BANDWIDTH=500000,CODECS=\"mp4a.40.2\"\nplaylist.m3u8".getBytes(StandardCharsets.UTF_8)); - } -} diff --git a/lc-m3/src/main/java/lc/m3/M3U.java b/lc-m3/src/main/java/lc/m3/M3U.java deleted file mode 100644 index fe74f15cd6721126524ead7120c6c6583b584dc2..0000000000000000000000000000000000000000 --- a/lc-m3/src/main/java/lc/m3/M3U.java +++ /dev/null @@ -1,70 +0,0 @@ -package lc.m3; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; - -import java.io.BufferedReader; -import java.io.FileReader; -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; - -/** - * This class represents a M3U8 file. Within the context of the M3 service, it represents all the media segments - * for a given media track. This class does not check to see if the media segments actually exist on disk. - * - * @author Alex Leigh - */ -public class M3U { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(M3U.class); - private final ArrayList segments = new ArrayList<>(); - private final Path file; - - /** - * Create a new M3U object from the given .m3u8 file located on disk. The file should have been generated - * with Apple's mediafilesegmenter tool. Other files, while legal, MAY not parse if they do not contain - * the bitrate information. - */ - public M3U(Path file) throws IOException { - this.file = file; - try (BufferedReader br = new BufferedReader(new FileReader(file.toFile()))) { - String line; - int i = 0; - while ((line = br.readLine()) != null) { - if (line.startsWith("#EXTINF:")) { - // We assume the file format is legal - String fn = br.readLine(); - // Skip a line - fn = br.readLine(); - String[] parse = line.split(":"); - segments.add(new MediaSegment(fn, parse[1].replace(",", "").trim(), this)); - i++; - } - logger.debug("Read line: {}", line); - } - } - } - - @Override - public String toString() { - return "M3U{" + - "chunks=" + segments + - '}'; - } - - public Path getFile() { - return file; - } - - /** - * Return all the segments associated with this media file. - */ - public ArrayList getSegments() { - return segments; - } - - public static void main(String[] args) throws IOException { - M3U m3u = new M3U(Path.of("music/[0ther]_Pendulum_Single_Pendulum.m3u8")); - logger.info("m3u: {}", m3u); - } -} diff --git a/lc-m3/src/main/java/lc/m3/MediaRepository.java b/lc-m3/src/main/java/lc/m3/MediaRepository.java deleted file mode 100644 index c3848ff97581744c83437804fcc00dfba14f572c..0000000000000000000000000000000000000000 --- a/lc-m3/src/main/java/lc/m3/MediaRepository.java +++ /dev/null @@ -1,60 +0,0 @@ -package lc.m3; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Collections; -import java.util.function.Consumer; - -/** - * This class implements a media repository which stores a total collection of media files which are available - * for streaming. It also contains the shuffle mechanic which randomizes the order the files are to be played in. - * - * @author Alex Leigh - */ -public class MediaRepository { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(MediaRepository.class); - private final Path base; - private ArrayList files; - - public MediaRepository(Path base) { - this.base = base; - } - - /** - * Return a shuffled list of all the files in this repo. - */ - public ArrayList getFiles() { - Collections.shuffle(files); - return files; - } - - /** - * Scan the base path for all .m3u8 files. Each file found will be loaded into this repo. - */ - public void scan() throws IOException { - ArrayList files = new ArrayList<>(); - - Files.walk(base).forEach(new Consumer() { - @Override - public void accept(Path path) { - logger.debug("Evaluating. [path: {}]", path); - if(path.toFile().isFile() && path.toString().endsWith(".m3u8")) { - try { - files.add(new M3U(path)); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - }); - - logger.info("Rescanned media folder. [count: {}]", files.size()); - - this.files = files; - } -} diff --git a/lc-m3/src/main/java/lc/m3/MediaSegment.java b/lc-m3/src/main/java/lc/m3/MediaSegment.java deleted file mode 100644 index 0136172ebc0cfc3b6abb69f82649d40255b3bbfc..0000000000000000000000000000000000000000 --- a/lc-m3/src/main/java/lc/m3/MediaSegment.java +++ /dev/null @@ -1,65 +0,0 @@ -package lc.m3; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; - -import java.math.BigDecimal; -import java.net.URLEncoder; -import java.nio.charset.Charset; -import java.util.Objects; - -public class MediaSegment { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(MediaSegment.class); - private final String filename; - private final String duration; - private final M3U m3u; - - public MediaSegment(String filename, String duration, M3U m3u) { - this.filename = filename; - this.duration = duration; - this.m3u = m3u; - } - - public M3U getM3u() { - return m3u; - } - - public String getFilename() { - return filename; - } - - public String getUrlEncodedFilename() { - return URLEncoder.encode(filename, Charset.defaultCharset()); - } - - public String getDuration() { - return duration; - } - - public long getDurationMs() { - logger.info("Parsing duration: {}", duration); - BigDecimal bs = new BigDecimal(duration); - return bs.multiply(new BigDecimal(1000)).longValue(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - MediaSegment that = (MediaSegment) o; - return Objects.equals(filename, that.filename) && Objects.equals(duration, that.duration); - } - - @Override - public int hashCode() { - return Objects.hash(filename, duration); - } - - @Override - public String toString() { - return "MediaChunk{" + - "filename=" + filename + - ", duration=" + duration + - '}'; - } -} diff --git a/lc-m3/src/main/java/lc/m3/MediaStream.java b/lc-m3/src/main/java/lc/m3/MediaStream.java deleted file mode 100644 index 6f428b71e52b41da6ef60a345b861edd8163a7c7..0000000000000000000000000000000000000000 --- a/lc-m3/src/main/java/lc/m3/MediaStream.java +++ /dev/null @@ -1,121 +0,0 @@ -package lc.m3; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; - -import java.time.Instant; -import java.time.temporal.ChronoUnit; -import java.util.ArrayList; -import java.util.concurrent.LinkedTransferQueue; - -/** - * Implementation of a media stream. This tracks the position in the stream over time and provides methods - * for getting access to the current window. - * - * @author Alex Leigh - */ -public class MediaStream { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(MediaStream.class); - private final LinkedTransferQueue queue = new LinkedTransferQueue<>(); - private final MediaRepository repo; - private final ArrayList discos = new ArrayList<>(); - private ArrayList currentSegments = new ArrayList<>(); - private M3U currentPlaying = null; - private Instant lastScheduledTime = Instant.now(); - private int globalSeq = 0; - - public MediaStream(MediaRepository repo) { - this.repo = repo; - } - - /** - * Take the next media track from the source queue, or, if the source queue is empty, repopulate it - * from the media source. - */ - private M3U takeOrReload() throws InterruptedException { - if (queue.isEmpty()) { - queue.addAll(repo.getFiles()); - } - return queue.take(); - } - - /** - * Count the number of discontinuities that have ever occured on the stream. - */ - private int countDiscos(Instant now) { - int cnt = 0; - - for (SegmentSchedule disco : discos) { - if (disco.getExpire().isBefore(now)) { - cnt++; - } else { - // This relies on the premise that the list is chrono-ordered - break; - } - } - - return cnt; - } - - public ArrayList removeExpired(ArrayList list, Instant time) { - ArrayList newList = new ArrayList<>(); - for (SegmentSchedule sched : list) { - if (sched.getExpire().isBefore(time)) continue; - newList.add(sched); - } - return newList; - } - - /** - * Return the chunks which should currently be available to the client. If necessary this will remove one or two - * media files from the pending queue. It is this information which it used to generate the current playlists - * M3U8 file which the clients poll. - */ - public synchronized StreamWindow getCurrentSegments() throws InterruptedException { - final ArrayList segmentSchedules = new ArrayList<>(); - final Instant now = Instant.now(); - - // The number of segments to present in the stream window at any one moment - int C = 5; - - currentSegments = removeExpired(currentSegments, now); - - // First we check to see if we have enough current segments to fill our need - - while (currentSegments.size() < C) { - // We do not have enough to fill the current need. So drain a new media file off the queue and fill - // its segments into currentSegments. Update lastScheduledTime and the global sequence. - - currentPlaying = takeOrReload(); - logger.info("Now playing. [media: {}]", currentPlaying); - - int cnt = 0; - for (MediaSegment chunk : currentPlaying.getSegments()) { - Instant expire = lastScheduledTime.plus(chunk.getDurationMs(), ChronoUnit.MILLIS); - logger.debug("New expire: {} [global: {}]", expire, globalSeq); - SegmentSchedule sched = new SegmentSchedule(chunk, expire, globalSeq, cnt == 0); - - if (cnt == 0) { - discos.add(sched); - } - - currentSegments.add(new SegmentSchedule(chunk, expire, globalSeq, cnt == 0)); - globalSeq++; - cnt++; - lastScheduledTime = expire; - } - } - - // We are now sure that we have enough segments to populate the need. - for (SegmentSchedule sched : currentSegments) { - segmentSchedules.add(sched); - if (segmentSchedules.size() == C) return new StreamWindow(countDiscos(now), segmentSchedules); - } - - // We should never get here. - logger.error("Unreachable case reached."); - - return new StreamWindow(countDiscos(now), segmentSchedules); - } -} - diff --git a/lc-m3/src/main/java/lc/m3/SegmentSchedule.java b/lc-m3/src/main/java/lc/m3/SegmentSchedule.java deleted file mode 100644 index b9275b94fd8fcabdc62c4bfccd7bf5bccbc6a3d4..0000000000000000000000000000000000000000 --- a/lc-m3/src/main/java/lc/m3/SegmentSchedule.java +++ /dev/null @@ -1,73 +0,0 @@ -package lc.m3; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; - -import java.time.Instant; -import java.util.Objects; - -/** - * This class represents a chunk which is scheduled to play in a stream. - * - * @author Alex Leigh - */ -public class SegmentSchedule { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(SegmentSchedule.class); - private final MediaSegment chunk; - private final Instant expire; - private final int sequenceNumber; - private final boolean isDiscontinuous; - - public SegmentSchedule(MediaSegment chunk, Instant expire, int sequenceNumber, boolean isDiscontinuous) { - this.chunk = chunk; - this.expire = expire; - this.sequenceNumber = sequenceNumber; - this.isDiscontinuous = isDiscontinuous; - - logger.info("Creating new chunk: {}", sequenceNumber); - - } - - /** - * Returns true if this scheduled segment is discontinuous with the previously scheduled segment. - */ - public boolean isDiscontinuous() { - return isDiscontinuous; - } - - @Override - public String toString() { - return "SegmentSchedule{" + - "chunk=" + chunk + - ", expire=" + expire + - ", sequenceNumber=" + sequenceNumber + - ", isDiscontinuous=" + isDiscontinuous + - '}'; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - SegmentSchedule that = (SegmentSchedule) o; - return sequenceNumber == that.sequenceNumber && isDiscontinuous == that.isDiscontinuous && Objects.equals(chunk, that.chunk) && Objects.equals(expire, that.expire); - } - - @Override - public int hashCode() { - return Objects.hash(chunk, expire, sequenceNumber, isDiscontinuous); - } - - public MediaSegment getChunk() { - return chunk; - } - - public int getSequenceNumber() { - return sequenceNumber; - } - - public Instant getExpire() { - return expire; - } - -} diff --git a/lc-m3/src/main/java/lc/m3/StreamWindow.java b/lc-m3/src/main/java/lc/m3/StreamWindow.java deleted file mode 100644 index 91a08313fa0492c6f03bf9dbaa71e6c164e97612..0000000000000000000000000000000000000000 --- a/lc-m3/src/main/java/lc/m3/StreamWindow.java +++ /dev/null @@ -1,47 +0,0 @@ -package lc.m3; - -import java.util.ArrayList; -import java.util.Objects; - -public class StreamWindow { - private final int pastDiscos; - private final ArrayList window; - - public StreamWindow(int pastDiscos, ArrayList window) { - this.pastDiscos = pastDiscos; - this.window = window; - } - - public int getLowSequence() { - return window.get(0).getSequenceNumber(); - } - - public int getPastDiscos() { - return pastDiscos; - } - - public ArrayList getWindow() { - return window; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - StreamWindow that = (StreamWindow) o; - return pastDiscos == that.pastDiscos && Objects.equals(window, that.window); - } - - @Override - public int hashCode() { - return Objects.hash(pastDiscos, window); - } - - @Override - public String toString() { - return "StreamWindow{" + - "pastDiscos=" + pastDiscos + - ", window=" + window + - '}'; - } -} diff --git a/lc-memory/.gitignore b/lc-memory/.gitignore deleted file mode 100644 index ede7310f5aa22a8bb16f7393dedac5d9b0cba2c9..0000000000000000000000000000000000000000 --- a/lc-memory/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -kabe.log -velocity.log -.DS_Store -statistic.xml -.gradle -/*/build/ -/build/ -gradle-app.setting -!gradle-wrapper.jar -.gradletasknamecache -.idea/ -*.iml -out/ -.cache -node_modules -/*/.idea -.vi -/*/graph.eo -.vai -graph.bak -.idea -tests.vai -vds.log -hosts.json -tests.vai.old \ No newline at end of file diff --git a/lc-memory/LICENSE.md b/lc-memory/LICENSE.md deleted file mode 100644 index 226d1f25b12e58e21c29a6c1869d1ec05095d443..0000000000000000000000000000000000000000 --- a/lc-memory/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-memory/build.gradle b/lc-memory/build.gradle deleted file mode 100644 index c543e0d192662257985b0b2ba8642f85be442947..0000000000000000000000000000000000000000 --- a/lc-memory/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ -plugins { - id 'java' - id 'org.openjfx.javafxplugin' version '0.0.9' - id 'java-library' -} - -group 'leigh' -version '15.0' -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -apply plugin: 'application' -apply plugin: 'org.openjfx.javafxplugin' - -repositories { - mavenCentral() -} - -dependencies { - api project(':lc-eo') - implementation group: 'org.fxmisc.richtext', name: 'richtextfx', version: '0.10.6' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' -} - -test { - useJUnitPlatform() -} - -javafx { - modules = [ 'javafx.controls', 'javafx.fxml' ] -} \ No newline at end of file diff --git a/lc-memory/src/main/java/lc/memory/MemoryApp.java b/lc-memory/src/main/java/lc/memory/MemoryApp.java deleted file mode 100644 index f171f0e2575b97c56b527ae25f0d8c2a104d270d..0000000000000000000000000000000000000000 --- a/lc-memory/src/main/java/lc/memory/MemoryApp.java +++ /dev/null @@ -1,49 +0,0 @@ -package lc.memory; - -import javafx.application.Application; -import javafx.scene.Scene; -import javafx.scene.control.*; -import javafx.scene.layout.VBox; -import javafx.stage.Stage; -import lc.eo.EO; -import lc.eo.EOLoop; - -public class MemoryApp extends Application { - private SplitPane root; - private final EOLoop zettel = new EOLoop(); - - @Override - public void start(Stage primaryStage) { - primaryStage.setTitle("Hello World!"); - - root = new SplitPane(); - - root.getItems().add(makeWestPanel()); - - primaryStage.setScene(new Scene(root, 300, 250)); - primaryStage.show(); - } - - public VBox makeWestPanel() { - VBox west = new VBox(); - - TableView tv = new TableView(); - - ToolBar tb = new ToolBar(); - - Button create = new Button("+"); - Button delete = new Button("-"); - - tb.getItems().addAll(create, delete); - - TableColumn idCol = new TableColumn<>("ID"); - TableColumn titleCol = new TableColumn<>("Title"); - - tv.getColumns().addAll(idCol, titleCol); - - west.getChildren().addAll(tb, tv); - - return west; - } - -} diff --git a/lc-memory/src/main/java/lc/memory/MemoryLauncher.java b/lc-memory/src/main/java/lc/memory/MemoryLauncher.java deleted file mode 100644 index 58959804add5fab8bc7a74653b121e77241ed473..0000000000000000000000000000000000000000 --- a/lc-memory/src/main/java/lc/memory/MemoryLauncher.java +++ /dev/null @@ -1,7 +0,0 @@ -package lc.memory; - -public class MemoryLauncher { - public static void main(String[] args) { - MemoryApp.launch(MemoryApp.class, args); - } -} diff --git a/lc-meteros/LICENSE.md b/lc-meteros/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/lc-meteros/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-meteros/build.gradle b/lc-meteros/build.gradle deleted file mode 100644 index aa5610ec3f9a3f1817c5fd3054006c48630977c2..0000000000000000000000000000000000000000 --- a/lc-meteros/build.gradle +++ /dev/null @@ -1,28 +0,0 @@ -plugins { - id 'java' - id 'java-library' - id 'application' -} - -group 'leigh' -version '1.0' -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -repositories { - mavenCentral() -} - -dependencies { - api project (':lc-teremetori-sdk') - api project (':lc-esp-sdk') - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} - -application { - mainClass = 'leigh.meteros.MeterosApp' -} \ No newline at end of file diff --git a/lc-meteros/src/main/java/lc/meteros/MeterosApp.java b/lc-meteros/src/main/java/lc/meteros/MeterosApp.java deleted file mode 100644 index 7ce0d0b261bc36d7fdbe8e52566392f2db6bef8a..0000000000000000000000000000000000000000 --- a/lc-meteros/src/main/java/lc/meteros/MeterosApp.java +++ /dev/null @@ -1,57 +0,0 @@ -package lc.meteros; - -import lc.eo.EO; -import lc.esp.sdk.ESPClient; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.UniversalJob; -import lc.teremetori.sdk.producer.TelemetrySource; - -import java.net.InetAddress; -import java.net.UnknownHostException; - -/** - * MeterosApp implements an OS monitoring daemon based on the Teremetori service. - * - * @author Alex Leigh - */ -public class MeterosApp implements Runnable { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(MeterosApp.class); - private final TelemetrySource esp; - private final String publishUri = "/test/meteros"; - - public static void main(String args[]) { - UniversalJob.banner(logger, "Meteros"); - new MeterosApp().run(); - } - - public MeterosApp() { - esp = new TelemetrySource(new ESPClient("https://leigh-co.com"), publishUri); - } - - @Override - public void run() { - while(true) { - EO currentValues = new EO(); - try { - currentValues.setValue("leigh.meteros.os.ip", InetAddress.getLocalHost().getHostAddress()); - currentValues.setValue("leigh.meteros.os.hostname", InetAddress.getLocalHost().getHostName()); - } catch (UnknownHostException e) { - e.printStackTrace(); - } - - Runtime rt = Runtime.getRuntime(); - currentValues.setValue("leigh.meteros.os.cpu.available", rt.availableProcessors()); - - logger.info("Publishing update. [update: {}}", currentValues); - - esp.update(new EO().setValue("channel", "meteros"), currentValues, null); - - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } -} diff --git a/lc-minecraft-asuka/LICENSE.md b/lc-minecraft-asuka/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/lc-minecraft-asuka/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-minecraft-asuka/build.gradle b/lc-minecraft-asuka/build.gradle deleted file mode 100644 index b7b0e88a31f3645dceab8bc67d885bac59ba13d4..0000000000000000000000000000000000000000 --- a/lc-minecraft-asuka/build.gradle +++ /dev/null @@ -1,57 +0,0 @@ -plugins { - id 'java' - id 'java-library' - id 'application' -} - -group 'leigh' -version '1.0' - -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 - -repositories { - mavenCentral() - mavenLocal() - maven { url 'https://jitpack.io' } - maven { - url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' - content { - includeGroup 'org.bukkit' - includeGroup 'org.spigotmc' - } - } - maven { url 'https://repo.essentialsx.net/releases/' } - maven { url "https://maven.enginehub.org/repo/" } - // Dynmap - maven {url "https://repo.mikeprimm.com/"} -} - -dependencies { - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' - compileOnly "com.github.MilkBowl:VaultAPI:1.7" - compileOnly 'org.bukkit:bukkit:1.15.2-R0.1-SNAPSHOT' - compileOnly 'net.ess3:EssentialsX:2.18.2' - compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.2' - compileOnly 'us.dynmap:dynmap-api:3.0-SNAPSHOT' - implementation project(':lc-esp-sdk') - implementation project(':lc-esp-keikai-sdk') - implementation project(':lc-mecha-http-server') - implementation project(':lc-mecha-cli') - implementation project(':lc-mecha-mq') - implementation project(':lc-eo-json') - implementation project(':lc-eo-yaml') - implementation project(':lc-eo-schema') -} - -test { - useJUnitPlatform() -} - -jar { - duplicatesStrategy = DuplicatesStrategy.INCLUDE - from { - configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } - } -} \ No newline at end of file diff --git a/lc-minecraft-asuka/src/main/java/lc/minecraft/BlockUtils.java b/lc-minecraft-asuka/src/main/java/lc/minecraft/BlockUtils.java deleted file mode 100644 index ca5db9ed13381bde102f1b719d3eea1a0951ddbd..0000000000000000000000000000000000000000 --- a/lc-minecraft-asuka/src/main/java/lc/minecraft/BlockUtils.java +++ /dev/null @@ -1,23 +0,0 @@ -package lc.minecraft; - -/** - * Utility routines for dealing with Minecraft blocks. - * - * @author Alex Leigh - */ -public class BlockUtils { - /** - * Returns true if the block is a leaf, a log, or mycellium. - */ - public static boolean isTree(String name) { - if (name.contains("leaves")) return true; - if (name.contains("log")) return true; - if (name.contains("mycellium")) return true; - return false; - } - - public static boolean isAir(String name) { - if (name.contains("air")) return true; - return false; - } -} diff --git a/lc-minecraft-asuka/src/main/java/lc/minecraft/asuka/AsukaPlugin.java b/lc-minecraft-asuka/src/main/java/lc/minecraft/asuka/AsukaPlugin.java deleted file mode 100644 index 9f851fc57d7d45a88824bdcbefadbc47b28a0911..0000000000000000000000000000000000000000 --- a/lc-minecraft-asuka/src/main/java/lc/minecraft/asuka/AsukaPlugin.java +++ /dev/null @@ -1,23 +0,0 @@ -package lc.minecraft.asuka; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.UniversalJob; -import org.bukkit.Bukkit; -import org.bukkit.plugin.java.JavaPlugin; - -/** - * ASUKA implements a land survey plugin that produces industry-standard GIS data from a Minecraft world which - * can be consumed with standard tools such as ArcGIS and QGIS. - * - * @author Alex Leigh - */ -public class AsukaPlugin extends JavaPlugin { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(AsukaPlugin.class); - - public void onEnable() { - UniversalJob.banner(logger, "LEIGH&CO ASUKA"); - - new Thread(new AsukaThread(Bukkit.getWorld("world"))).start(); - } -} diff --git a/lc-minecraft-asuka/src/main/java/lc/minecraft/asuka/AsukaThread.java b/lc-minecraft-asuka/src/main/java/lc/minecraft/asuka/AsukaThread.java deleted file mode 100644 index 87865e272d03c54e46d0b4492b760514f1ad91bd..0000000000000000000000000000000000000000 --- a/lc-minecraft-asuka/src/main/java/lc/minecraft/asuka/AsukaThread.java +++ /dev/null @@ -1,89 +0,0 @@ -package lc.minecraft.asuka; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.StringAccumulatorV2; -import lc.mecha.util.VelocityWatch; -import lc.minecraft.BlockUtils; -import org.bukkit.World; -import org.bukkit.block.Block; - -import java.io.BufferedOutputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.Locale; - -/** - * Perform an Asuka land survey. - * - * @author Alex Leigh - */ -public class AsukaThread implements Runnable { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(AsukaThread.class); - - private final World world; - private final int startX = 0; - private final int startZ = 0; - private final int size = 1000; - - public AsukaThread(World world) { - this.world = world; - } - - - @Override - public void run() { - VelocityWatch vw = new VelocityWatch(logger); - - try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream("asuka.csv"))) { - StringAccumulatorV2 sa = new StringAccumulatorV2(","); - sa.add("X"); - sa.add("Y"); - sa.add("Z"); - sa.add("Z_NEG"); - sa.add("LOW_Y"); - sa.add("TEMP"); - sa.add("HUMID"); - sa.add("TYPE"); - sa.add("LOW_TYPE"); - sa.writeLine(bos); - - for (int xi = startX; xi < startX + size; xi++) { - for (int zi = startZ; zi < startZ + size; zi++) { - Block b = world.getHighestBlockAt(xi, zi); - Block lowBlock = b; - - // Attempt to descend to the first non-tree block - while ((BlockUtils.isTree(lowBlock.getType().name().toLowerCase(Locale.ROOT)) || - BlockUtils.isAir(lowBlock.getType().name().toLowerCase(Locale.ROOT))) && lowBlock.getY() >= 0) { - lowBlock = world.getBlockAt(xi, lowBlock.getY() - 1, zi); - } - - sa.add(Integer.toString(xi)); - sa.add(Integer.toString(b.getY())); - sa.add(Integer.toString(zi)); - sa.add(Integer.toString(Math.negateExact(zi))); - - sa.add(Integer.toString(lowBlock.getY())); - sa.add(Double.toString(b.getTemperature())); - sa.add(Double.toString(b.getHumidity())); - sa.add(b.getBiome().name()); - sa.add(b.getType().name()); - sa.add(lowBlock.getType().name()); - - sa.writeLine(bos); - sa.clear(); - vw.event("asuka_sample"); - } - } - - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - - vw.status(); - } -} diff --git a/lc-minecraft-asuka/src/main/resources/config.yml b/lc-minecraft-asuka/src/main/resources/config.yml deleted file mode 100644 index 669bdd74c1cefcc4636f8eac52d820b57ce84445..0000000000000000000000000000000000000000 --- a/lc-minecraft-asuka/src/main/resources/config.yml +++ /dev/null @@ -1 +0,0 @@ -basePath: /changeme \ No newline at end of file diff --git a/lc-minecraft-asuka/src/main/resources/plugin.yml b/lc-minecraft-asuka/src/main/resources/plugin.yml deleted file mode 100644 index ca8921ff8352deaba4a2b0624df588eaaf8477e0..0000000000000000000000000000000000000000 --- a/lc-minecraft-asuka/src/main/resources/plugin.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: Asuka -main: leigh.minecraft.asuka.AsukaPlugin -version: 1.0 -depend: [ ] -commands: - asuka: - description: Asuka Land Survey - usage: /asuka \ No newline at end of file diff --git a/lc-minecraft-leighco/LICENSE.md b/lc-minecraft-leighco/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/lc-minecraft-leighco/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-minecraft-leighco/build.gradle b/lc-minecraft-leighco/build.gradle deleted file mode 100644 index a0c8daea6b00ba70448ec7f1855add92262d3015..0000000000000000000000000000000000000000 --- a/lc-minecraft-leighco/build.gradle +++ /dev/null @@ -1,31 +0,0 @@ - -plugins { - id 'java' - id 'java-library' - id 'application' -} - -group 'leigh' -version '1.0' -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -repositories { - mavenCentral() - mavenLocal() -} - -dependencies { - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' - implementation project(':lc-mecha-cli') - implementation project(':lc-esp-sdk') - implementation project(':lc-esp-service-sdk') - // Just to get the SDK for the msg constants - implementation project(':lc-minecraft-link-sdk') - // We have to maintain this until MinecraftLinkConstants is finally dead - implementation project(':lc-minecraft-link') -} - -application { - mainClass = 'leigh.minecraft.leighco.LeighCoApp' -} diff --git a/lc-minecraft-leighco/dist.sh b/lc-minecraft-leighco/dist.sh deleted file mode 100755 index 8d2627dc898b319dfe084942ce80810b0772f200..0000000000000000000000000000000000000000 --- a/lc-minecraft-leighco/dist.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -gradle distTar -x test -(cd build/distributions;rm -rf leigh-minecraft-leighco-1.0;tar xfv leigh-minecraft-leighco-1.0.tar) -(cd bin-leigh-minecraft-leighco;git pull;rm -rf *;cp -r ../build/distributions/leigh-minecraft-leighco-1.0/* .;git add -A;git add -u;git commit -m "autopublish";git push) - - diff --git a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/LeighCoApp.java b/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/LeighCoApp.java deleted file mode 100644 index 1b6d8e805552a3213e25223158b37d7eabb268f1..0000000000000000000000000000000000000000 --- a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/LeighCoApp.java +++ /dev/null @@ -1,171 +0,0 @@ -package lc.minecraft.leighco; - -import lc.eo.EO; -import lc.eo.EOLoop; -import lc.eo.json.JsonInput; -import lc.esp.sdk.EOResponseConsumer; -import lc.esp.sdk.ESPClient; -import lc.esp.sdk.ResponseConsumer; -import lc.esp.sdk.link23.schema.HeartbeatElementDAO; -import lc.mecha.cli.CommandFrame; -import lc.mecha.cli.CommandHandler; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.UniversalJob; -import lc.minecraft.leighco.cmd.LandCommand; -import lc.minecraft.leighco.cmd.PosCommand; -import lc.minecraft.link.MinecraftLinkConstants; -import lc.minecraft.link.sdk.schema.v1.LandMemberAddRequestElementDAO; -import lc.minecraft.link.sdk.schema.v1.LandMemberRemoveRequestElementDAO; - -import java.io.InputStream; -import java.util.ArrayList; -import java.util.UUID; - -public class LeighCoApp implements Runnable { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(LeighCoApp.class); - ESPClient esp = new ESPClient("https://leigh-co.com"); - CommandFrame frame = new CommandFrame<>(); - - public LeighCoApp() { - CommandFrame lcCmd = new CommandFrame<>(); - frame.putCommand("lc", lcCmd); - - lcCmd.putCommand("hello", new CommandHandler() { - public void handle(String[] cmd, LeighCoState state) throws Exception { - state.sendMessage("Hello " + state.getPlayerName() + "!"); - } - }); - - lcCmd.putCommand("land", new LandCommand()); - lcCmd.putCommand("pos", new PosCommand()); - } - - public static void main(String args[]) { - UniversalJob.banner(logger, "LeighCoApp mk1"); - new LeighCoApp().run(); - } - - @Override - public void run() { - final LeighCoApp app = this; - while (true) { - try { - logger.info("Attempting to call cmd/read on remote link..."); - esp.request("/minecraft/neweden/link/v1/cmd/read?_enc=ndj", new EO(), new ResponseConsumer() { - @Override - public void drainResponse(InputStream is) throws Exception { - JsonInput in = new JsonInput(is); - while (true) { - EO obj = in.readEo(); - - logger.info("Read command: {}", obj); - - if(HeartbeatElementDAO.assertType(obj)) { - logger.info("Received station-keeping message."); - continue; - } - - ArrayList argList = new ArrayList<>(); - // We want to build a C-style arguments stack - argList.add(obj.getValueString(MinecraftLinkConstants.CMD_KEY)); - EOLoop args = obj.getValueLoop(MinecraftLinkConstants.ARGS_KEY); - for (EO arg : args) { - argList.add(arg.getValueString(MinecraftLinkConstants.ARG_KEY)); - } - logger.info("Arguments found: {}", argList); - - Location location = new Location( - obj.getValueDouble(MinecraftLinkConstants.ARG_POS_X), - obj.getValueDouble(MinecraftLinkConstants.ARG_POS_Y), - obj.getValueDouble(MinecraftLinkConstants.ARG_POS_Z), - obj.getValueFloat(MinecraftLinkConstants.ARG_POS_PITCH), - obj.getValueFloat(MinecraftLinkConstants.ARG_POS_YAW)); - - frame.handle(argList.toArray(new String[0]), - new LeighCoState(obj.getValueString(MinecraftLinkConstants.SRC_KEY), app, - location, obj.getValueUUID("playerId"))); - - logger.info("Read response object: {}", obj); - } - } - }); - } catch (Exception e) { - e.printStackTrace(); - } - try { - Thread.sleep(250); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - - public void sendMessage(String destination, String msg) throws Exception { - EO request = new EO(); - request.setValue(MinecraftLinkConstants.DST_KEY, destination); - request.setValue(MinecraftLinkConstants.MSG_KEY, msg); - logger.info("Sending message to player... {}", request); - esp.request("/minecraft/neweden/link/v1/msg/write", request); - } - - public void sendMessageById(UUID destination, String msg) throws Exception { - EO request = new EO(); - request.setValue("dstId", destination); - request.setValue(MinecraftLinkConstants.MSG_KEY, msg); - logger.info("Sending message to player... {}", request); - esp.request("/minecraft/neweden/link/v1/msg/write", request); - } - - public void landCreate(Lot lot, String player, int price) throws Exception { - EO request = new EO(); - request.setValue(MinecraftLinkConstants.SRC_KEY, player); - request.setValue(MinecraftLinkConstants.POS_X1, lot.getX1()); - request.setValue(MinecraftLinkConstants.POS_X2, lot.getX2()); - request.setValue(MinecraftLinkConstants.POS_Z1, lot.getZ1()); - request.setValue(MinecraftLinkConstants.POS_Z2, lot.getZ2()); - request.setValue(MinecraftLinkConstants.PRICE, price); - - logger.info("Sending message to player... {}", request); - esp.apiRequest("/minecraft/neweden/link/v1/land/create", request, new EOResponseConsumer() { - @Override - public void handle(EO obj) throws Exception { - logger.info("Read back: {}", obj); - String msg = obj.getValueString(MinecraftLinkConstants.MSG_KEY); - sendMessage(player, msg); - } - }); - } - - public void landMemberAdd(String lotName, UUID ownerName, String playerName) throws Exception { - EO request = LandMemberAddRequestElementDAO.create(); - LandMemberAddRequestElementDAO.setLot(request, lotName); - LandMemberAddRequestElementDAO.setSrc(request, ownerName); - LandMemberAddRequestElementDAO.setPlayer(request, playerName); - - esp.apiRequest("/minecraft/neweden/link/v1/land/member/add", request, new EOResponseConsumer() { - @Override - public void handle(EO obj) throws Exception { - logger.info("Read back: {}", obj); - String msg = obj.getValueString(MinecraftLinkConstants.MSG_KEY); - sendMessageById(ownerName, msg); - } - }); - } - - public void landMemberRemove(String lotName, UUID ownerName, String playerName) throws Exception { - EO request = LandMemberRemoveRequestElementDAO.create(); - LandMemberRemoveRequestElementDAO.setLot(request, lotName); - LandMemberRemoveRequestElementDAO.setSrc(request, ownerName); - LandMemberRemoveRequestElementDAO.setPlayer(request, playerName); - - esp.apiRequest("/minecraft/neweden/link/v1/land/member/remove", request, new EOResponseConsumer() { - @Override - public void handle(EO obj) throws Exception { - logger.info("Read back: {}", obj); - String msg = obj.getValueString(MinecraftLinkConstants.MSG_KEY); - sendMessageById(ownerName, msg); - } - }); - } -} diff --git a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/LeighCoState.java b/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/LeighCoState.java deleted file mode 100644 index 5585d04a3613500e1f84df6de3aa7a3a933588e3..0000000000000000000000000000000000000000 --- a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/LeighCoState.java +++ /dev/null @@ -1,68 +0,0 @@ -package lc.minecraft.leighco; - -import lc.mecha.cli.CommandState; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; - -import java.util.Objects; -import java.util.UUID; - -public class LeighCoState implements CommandState { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(LeighCoState.class); - private final String playerName; - private final LeighCoApp app; - private final Location location; - private final UUID playerId; - - public LeighCoState(String playerName, LeighCoApp app, Location location, UUID playerId) { - this.playerName = playerName; - this.app = app; - this.location = location; - this.playerId = playerId; - } - - public String getPlayerName() { - return playerName; - } - - public LeighCoApp getApp() { - return app; - } - - public UUID getPlayerId() { - return playerId; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - LeighCoState that = (LeighCoState) o; - return Objects.equals(playerName, that.playerName) && Objects.equals(app, that.app) && Objects.equals(location, that.location) && Objects.equals(playerId, that.playerId); - } - - @Override - public int hashCode() { - return Objects.hash(playerName, app, location, playerId); - } - - public Location getLocation() { - return location; - } - - @Override - public String toString() { - return "LeighCoState{" + - "playerName='" + playerName + '\'' + - ", app=" + app + - ", location=" + location + - ", playerId=" + playerId + - '}'; - } - - @Override - public void sendMessage(String msg) throws Exception { - logger.info("Wanted to send msg: [p: {}] [msg: {}]", playerName, msg); - app.sendMessage(playerName, "[LC] " + msg); - } -} diff --git a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/Location.java b/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/Location.java deleted file mode 100644 index b65bf39bc21300bf265a31e18372e91b2061fb93..0000000000000000000000000000000000000000 --- a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/Location.java +++ /dev/null @@ -1,48 +0,0 @@ -package lc.minecraft.leighco; - -public class Location { - private final double x; - private final double y; - private final double z; - private final float pitch; - private final float yaw; - - public Location(double x, double y, double z, float pitch, float yaw) { - this.x = x; - this.y = y; - this.z = z; - this.pitch = pitch; - this.yaw = yaw; - } - - public double getX() { - return x; - } - - public double getY() { - return y; - } - - public double getZ() { - return z; - } - - public float getPitch() { - return pitch; - } - - public float getYaw() { - return yaw; - } - - @Override - public String toString() { - return "Location{" + - "x=" + x + - ", y=" + y + - ", z=" + z + - ", pitch=" + pitch + - ", yaw=" + yaw + - '}'; - } -} diff --git a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/Lot.java b/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/Lot.java deleted file mode 100644 index 282cb70f61b37c4f0b4d6ab114b2bc9744b2b175..0000000000000000000000000000000000000000 --- a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/Lot.java +++ /dev/null @@ -1,68 +0,0 @@ -package lc.minecraft.leighco; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; - -public class Lot { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(Lot.class); - - private int x1, x2, z1, z2; - - public Lot(int x1, int x2, int z1, int z2) { - this.x1 = x1; - this.x2 = x2; - this.z1 = z1; - this.z2 = z2; - } - - public Lot(Location loc, int size) { - // Just to get to integer - int px = (int) Math.abs(loc.getX()); - int pz = (int) Math.abs(loc.getZ()); - - this.x1 = (px / size) * size; - this.z1 = (pz / size) * size; - - this.x2 = x1 + size - 1; - this.z2 = z1 + size - 1; - - if (loc.getX() < 0) { - this.x1 = -this.x1; - this.x2 = -this.x2; - this.x1--; - this.x2--; - } - if (loc.getZ() < 0) { - this.z1 = -this.z1; - this.z2 = -this.z2; - this.z1--; - this.z2--; - } - } - - public int getX1() { - return x1; - } - - public int getX2() { - return x2; - } - - public int getZ1() { - return z1; - } - - public int getZ2() { - return z2; - } - - @Override - public String toString() { - return "Lot{" + - "x1=" + x1 + - ", z1=" + z1 + - ", x2=" + x2 + - ", z2=" + z2 + - '}'; - } -} diff --git a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/cmd/LandBuyCommand.java b/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/cmd/LandBuyCommand.java deleted file mode 100644 index e678560646f00657fc898ff91912bc1c5c102ae2..0000000000000000000000000000000000000000 --- a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/cmd/LandBuyCommand.java +++ /dev/null @@ -1,65 +0,0 @@ -package lc.minecraft.leighco.cmd; - -import lc.mecha.cli.CommandHandler; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.minecraft.MarblesUtil; -import lc.minecraft.leighco.LeighCoState; -import lc.minecraft.leighco.Lot; - -/** - * Implementation of the /LC BUY LAND command. The purpose of this command is to facilitate player purchases of - * real-estate. - *

- * Limitations: Currently the command only supports buying land from the server (vs. private-party sales, which may - * be supported at a future date). - */ -public class LandBuyCommand implements CommandHandler { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(LandBuyCommand.class); - - private final int landPrice = 19; - - @Override - public void handle(String[] cmd, LeighCoState state) throws Exception { - if ((cmd.length != 2 && cmd.length != 3) || !cmd[1].equals("16") && - !cmd[1].equals("32") && - !cmd[1].equals("64") && - !cmd[1].equals("128") && - !cmd[1].equals("256") && - !cmd[1].equals("512") && - !cmd[1].equals("1024")) { - state.sendMessage("Usage: /lc land buy 16|32|64|128|256|512|1024"); - return; - } - - // We previously guaranteed this will work - int sz = Integer.parseInt(cmd[1]); - int price = (sz * sz) * landPrice; - Lot lot = new Lot(state.getLocation(), sz); - - logger.info("Calculated lot. {} from position {}", lot, state.getLocation()); - String lotSb = "Area: " + - lot.getX1() + - "," + - lot.getZ1() + - " -> " + - lot.getX2() + - "," + - lot.getZ2(); - - state.sendMessage("Area: " + lotSb); - state.sendMessage("Price: " + MarblesUtil.formatCents(price)); - - if (cmd.length == 2) { - String sb = "To confirm price, enter /lc land buy " + sz + " confirm"; - state.sendMessage(sb); - } else { - if (cmd[2].equals("confirm")) { - // We do not need to reply - landCreate() will pass on the returned message to the caller - state.getApp().landCreate(lot, state.getPlayerName(), price); - } else { - state.sendMessage("Land purchase not confirmed."); - } - } - } -} diff --git a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/cmd/LandCommand.java b/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/cmd/LandCommand.java deleted file mode 100644 index 5e88eeb56988fe49953727587bacb30f96fdae77..0000000000000000000000000000000000000000 --- a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/cmd/LandCommand.java +++ /dev/null @@ -1,14 +0,0 @@ -package lc.minecraft.leighco.cmd; - -import lc.mecha.cli.CommandFrame; -import lc.minecraft.leighco.LeighCoState; - -public class LandCommand extends CommandFrame { - public LandCommand() { - putCommand("buy", new LandBuyCommand()); - CommandFrame memberFrame = new CommandFrame<>(); - memberFrame.putCommand("add", new LandMemberAddCommand()); - memberFrame.putCommand("remove", new LandMemberRemoveCommand()); - putCommand("member", memberFrame); - } -} diff --git a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/cmd/LandMemberAddCommand.java b/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/cmd/LandMemberAddCommand.java deleted file mode 100644 index c4ebc4aed006d53b9f8f598fc67dab92d9585341..0000000000000000000000000000000000000000 --- a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/cmd/LandMemberAddCommand.java +++ /dev/null @@ -1,19 +0,0 @@ -package lc.minecraft.leighco.cmd; - -import lc.mecha.cli.CommandHandler; -import lc.minecraft.leighco.LeighCoState; - -public class LandMemberAddCommand implements CommandHandler { - @Override - public void handle(String[] cmd, LeighCoState state) throws Exception { - if (cmd.length != 3) { - state.sendMessage("Usage: /lc land member add lotName survivorName"); - return; - } - - String lotName = cmd[1]; - String survivorName = cmd[2]; - - state.getApp().landMemberAdd(lotName, state.getPlayerId(), survivorName); - } -} diff --git a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/cmd/LandMemberRemoveCommand.java b/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/cmd/LandMemberRemoveCommand.java deleted file mode 100644 index 8a8b6a65402f6ad5be1dc6a0ec4826c634695683..0000000000000000000000000000000000000000 --- a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/cmd/LandMemberRemoveCommand.java +++ /dev/null @@ -1,19 +0,0 @@ -package lc.minecraft.leighco.cmd; - -import lc.mecha.cli.CommandHandler; -import lc.minecraft.leighco.LeighCoState; - -public class LandMemberRemoveCommand implements CommandHandler { - @Override - public void handle(String[] cmd, LeighCoState state) throws Exception { - if (cmd.length != 3) { - state.sendMessage("Usage: /lc land member remove lotName survivorName"); - return; - } - - String lotName = cmd[1]; - String survivorName = cmd[2]; - - state.getApp().landMemberRemove(lotName, state.getPlayerId(), survivorName); - } -} diff --git a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/cmd/PosCommand.java b/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/cmd/PosCommand.java deleted file mode 100644 index 7d9222df8f62ca5d0d0e96684c3846ef0b3605a4..0000000000000000000000000000000000000000 --- a/lc-minecraft-leighco/src/main/java/lc/minecraft/leighco/cmd/PosCommand.java +++ /dev/null @@ -1,29 +0,0 @@ -package lc.minecraft.leighco.cmd; - -import lc.mecha.cli.CommandHandler; -import lc.minecraft.leighco.LeighCoState; -import lc.minecraft.leighco.Location; -import lc.minecraft.leighco.Lot; - -public class PosCommand implements CommandHandler { - @Override - public void handle(String[] cmd, LeighCoState state) throws Exception { - Location loc = state.getLocation(); - - String sb = "Position: [x:" + - loc.getX() + - " y:" + - loc.getY() + - " z:" + - loc.getZ() + - "]"; - - state.sendMessage(sb); - - // Just for testing - - Lot lot = new Lot(state.getLocation(), 16); - state.sendMessage("16-size lot: " + lot); - - } -} diff --git a/lc-minecraft-leighco/src/test/java/lc/minecraft/leighco/LotTest.java b/lc-minecraft-leighco/src/test/java/lc/minecraft/leighco/LotTest.java deleted file mode 100644 index 66bf978dfd4095164be891d6a99c31809c9d8662..0000000000000000000000000000000000000000 --- a/lc-minecraft-leighco/src/test/java/lc/minecraft/leighco/LotTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package lc.minecraft.leighco; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; - -public class LotTest { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(LotTest.class); - - public void lotTest(float playerX, float playerY, int size) { - Lot l = new Lot(new Location(playerX, 0, playerY, 0, 0), size); - logger.info("Calculated lot for {},{}}: {}", playerX, playerY, l); - } - - // Because the test runner is broken - public static void main(String[] args) { - LotTest test = new LotTest(); - test.lotTest(10, 10, 16); - test.lotTest(-10, -10, 16); - test.lotTest(-10, 10, 16); - test.lotTest(10, -10, 16); - - - test.lotTest(30, 30, 16); - test.lotTest(-30, -30, 16); - test.lotTest(-30, 30, 16); - test.lotTest(30, -30, 16); - } -} diff --git a/lc-minecraft-link-quests/LICENSE.md b/lc-minecraft-link-quests/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/lc-minecraft-link-quests/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-minecraft-link-quests/build.gradle b/lc-minecraft-link-quests/build.gradle deleted file mode 100644 index 46aead21d4926632dd5b2ba802a13ea7c86017f1..0000000000000000000000000000000000000000 --- a/lc-minecraft-link-quests/build.gradle +++ /dev/null @@ -1,38 +0,0 @@ -plugins { - id 'java' - id 'java-library' -} - -group 'leigh' -version '16.0' -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -repositories { - mavenCentral() - mavenLocal() - maven { url 'https://jitpack.io' } - // Bukkit - maven { - url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' - content { - includeGroup 'org.bukkit' - includeGroup 'org.spigotmc' - } - } - // Quests - maven { url 'https://jitpack.io' } -} - - -dependencies { - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' - compileOnly 'com.github.PikaMug:Quests:4.1.3' - compileOnly 'org.bukkit:bukkit:1.15.2-R0.1-SNAPSHOT' - implementation project(':lc-minecraft-link') - implementation project(':lc-mecha') -} - -test { - useJUnitPlatform() -} diff --git a/lc-minecraft-link-quests/src/main/java/lc/minecraft/link/quests/ReputationReward.java b/lc-minecraft-link-quests/src/main/java/lc/minecraft/link/quests/ReputationReward.java deleted file mode 100644 index dfe033c26bc1cd39e1fbc430b568be59a1c2ef3d..0000000000000000000000000000000000000000 --- a/lc-minecraft-link-quests/src/main/java/lc/minecraft/link/quests/ReputationReward.java +++ /dev/null @@ -1,47 +0,0 @@ -package lc.minecraft.link.quests; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.minecraft.link.MinecraftLinkPlugin; -import lc.minecraft.link.faction.Reputation; -import me.blackvein.quests.CustomReward; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.util.Map; - -/** - * Custom reward handler for Quests which rewards the player with a reputation adjustment. - * - * @author Alex Leigh - */ -public class ReputationReward extends CustomReward { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(ReputationReward.class); - - private final static String KEY_FACTION_ID = "factionId"; - private final static String KEY_REPUTATION = "reputation"; - private final Reputation reputation; - - public ReputationReward() { - this.setName("LCReputationReward"); - this.setAuthor("LEIGH&CO"); - this.setDisplay("Reputation"); - this.setItem("CHEST", (short) 0); - this.addStringPrompt(KEY_FACTION_ID, "Faction ID", null); - this.addStringPrompt(KEY_REPUTATION, "Reputation Delta", null); - - MinecraftLinkPlugin link = - (MinecraftLinkPlugin) Bukkit.getPluginManager().getPlugin("MinecraftLink"); - assert link != null; - - reputation = link.getReputation(); - } - - @Override - public void giveReward(Player player, Map map) { - int factionId = Integer.parseInt((String) map.get(KEY_FACTION_ID)); - int delta = Integer.parseInt((String) map.get(KEY_REPUTATION)); - - reputation.adjustReputation(player.getUniqueId(), factionId, delta); - } -} diff --git a/lc-minecraft-link-quests/src/main/java/lc/minecraft/link/quests/SwordReward.java b/lc-minecraft-link-quests/src/main/java/lc/minecraft/link/quests/SwordReward.java deleted file mode 100644 index 4e88cf83a27ca90b83f3da3f1f67d05cef7eea5b..0000000000000000000000000000000000000000 --- a/lc-minecraft-link-quests/src/main/java/lc/minecraft/link/quests/SwordReward.java +++ /dev/null @@ -1,96 +0,0 @@ -package lc.minecraft.link.quests; - -import me.blackvein.quests.CustomReward; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.attribute.Attribute; -import org.bukkit.attribute.AttributeModifier; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.inventory.EquipmentSlot; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; - -import java.util.Arrays; -import java.util.Map; -import java.util.UUID; - -/** - * Custom reward for Quests which rewards the player with a LEIGH&CO prototype sword. - * - * @author Alex Leigh - */ -public class SwordReward extends CustomReward { - // Note that changing these may break previously-created quests. See quests.yml - private final static String KEY_ATTACK_SPEED = "attackSpeed"; - private final static String KEY_ATTACK_POWER = "attackPower"; - private final static String KEY_LORE = "lore"; - private final static String KEY_ENCHANT_DMG_ALL = "damageAll"; - private final static String KEY_DISPLAY_NAME = "displayName"; - - public SwordReward() { - // This is the name the quest editor will use - this.setName("LCSwordReward"); - this.setAuthor("LEIGH&CO"); - this.setDisplay("Prototype Sword"); - this.setItem("CHEST", (short) 0); - this.addStringPrompt(KEY_DISPLAY_NAME, "Display Name", null); - this.addStringPrompt(KEY_LORE, "Lore Text", null); - this.addStringPrompt(KEY_ATTACK_POWER, "Attack power of the sword.", null); - this.addStringPrompt(KEY_ATTACK_SPEED, "Attack Speed.", null); - this.addStringPrompt(KEY_ENCHANT_DMG_ALL, "DMG Enchant Level (0-3)", "0"); - } - - @Override - public void giveReward(Player player, Map map) { - // Multiple of 9, between 9 and 54 - Inventory inv = Bukkit.getServer().createInventory(player, 9, "Reward"); - ItemStack sword = new ItemStack(Material.IRON_SWORD, 1); - ItemMeta meta = sword.getItemMeta(); - - String lore = (String) map.get(KEY_LORE); - if (lore != null) { - meta.setLore(Arrays.asList(lore)); - } - - String name = (String) map.get(KEY_DISPLAY_NAME); - if (name != null) { - meta.setDisplayName(name); - } - - meta.setLore(Arrays.asList("A LEIGH&CO factory prototype.")); - - try { - int power = Integer.parseInt((String) map.get(KEY_ATTACK_POWER)); - AttributeModifier damageModifier = new AttributeModifier(UUID.randomUUID(), - "Technica", power, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND); - meta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, damageModifier); - } catch (Exception e) { - e.printStackTrace(); - } - - try { - int speed = Integer.parseInt((String) map.get(KEY_ATTACK_SPEED)); - AttributeModifier speedModifier = new AttributeModifier(UUID.randomUUID(), - "Technica", speed, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlot.HAND); - meta.addAttributeModifier(Attribute.GENERIC_ATTACK_SPEED, speedModifier); - } catch (Exception e) { - e.printStackTrace(); - } - - try { - int dmgLevel = Integer.parseInt((String) map.get(KEY_ENCHANT_DMG_ALL)); - // We prompted for 0-3 but will actually take more. - if (dmgLevel > 0) { - meta.addEnchant(Enchantment.DAMAGE_ALL, dmgLevel, true); - } - } catch (Exception e) { - e.printStackTrace(); - } - - sword.setItemMeta(meta); - inv.setItem(0, sword); - player.openInventory(inv); - } -} diff --git a/lc-minecraft-link-quests/src/main/resources/plugin.yml b/lc-minecraft-link-quests/src/main/resources/plugin.yml deleted file mode 100644 index f0f788f501db9fb78f52daa0bfd33c4063347b7c..0000000000000000000000000000000000000000 --- a/lc-minecraft-link-quests/src/main/resources/plugin.yml +++ /dev/null @@ -1,4 +0,0 @@ -name: LEIGHCOQuests -version: 1.0 -description: Quests module for LEIGH&CO -depend: [ Quests MinecraftLink ] \ No newline at end of file diff --git a/lc-minecraft-link-sdk/LICENSE.md b/lc-minecraft-link-sdk/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/lc-minecraft-link-sdk/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-minecraft-link-sdk/build.gradle b/lc-minecraft-link-sdk/build.gradle deleted file mode 100644 index 57a7fe087c5f4c39f0c712cf97d446a9e212ef3f..0000000000000000000000000000000000000000 --- a/lc-minecraft-link-sdk/build.gradle +++ /dev/null @@ -1,15 +0,0 @@ -plugins { - id 'java' - id 'java-library' -} - -repositories { - mavenCentral() -} -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -dependencies { - testImplementation group: 'junit', name: 'junit', version: '4.12' - api project (':lc-mecha') - api project (':lc-eo-schema') -} diff --git a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/MarblesUtil.java b/lc-minecraft-link-sdk/src/main/java/lc/minecraft/MarblesUtil.java deleted file mode 100644 index 15c1ff2fd33a5c1bd9cad7483ecf591d2fbce1c2..0000000000000000000000000000000000000000 --- a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/MarblesUtil.java +++ /dev/null @@ -1,54 +0,0 @@ -package lc.minecraft; - -import java.text.DecimalFormat; -import java.text.DecimalFormatSymbols; -import java.text.NumberFormat; - -/** - * Utility related class for currency (marble) related functionality. - * - * @author Alex Leigh - */ -public class MarblesUtil { - private static final NumberFormat marbleFormatter; - - static { - marbleFormatter = NumberFormat.getCurrencyInstance(); - DecimalFormatSymbols dfs = new DecimalFormatSymbols(); - dfs.setCurrencySymbol("M"); - dfs.setGroupingSeparator('.'); - dfs.setMonetaryDecimalSeparator('.'); - ((DecimalFormat) marbleFormatter).setDecimalFormatSymbols(dfs); - } - - public static String formatCents(int cents) { - StringBuffer sb = new StringBuffer(); - sb.append("M"); - sb.append(cents / 100); - int rem = cents % 100; - if (rem > 0) { - sb.append("."); - sb.append(cents % 100); - } - return sb.toString(); - } - - /** - * Convert a double currency value into a formatted Marbles string. Note that using this method is not recommended - * due to issues with floating point rounding. As a result, it is listed as deprecated. - */ - @Deprecated - public static String formatMarbles(double amount) { - return marbleFormatter.format(amount); - } - - /** - * Convert a double currency value into a formatted Marbles string. Note that using this method is not recommended - * due to issues with floating point rounding. As a result, it is listed as deprecated. - */ - @Deprecated - public static String formatGeneric(double amount) { - // I am self-aware that this is reprehensible. - return marbleFormatter.format(amount).substring(1); - } -} diff --git a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/SchemaGeneratorApp.java b/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/SchemaGeneratorApp.java deleted file mode 100644 index fde708c5edfd1e2170b96c71db19f087d3d65b73..0000000000000000000000000000000000000000 --- a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/SchemaGeneratorApp.java +++ /dev/null @@ -1,87 +0,0 @@ -package lc.minecraft.link.sdk; - -import lc.eo.EO; -import lc.eo.EODataType; -import lc.eo.schema.DAOGenerator; -import lc.eo.schema.dao.ElementElementDAO; -import lc.eo.schema.dao.FieldUtil; -import lc.eo.schema.dao.SchemaElementDAO; -import lc.eo.schema.dao.SchemaUtil; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.UniversalJob; - -import java.io.File; -import java.io.FileNotFoundException; - -public class SchemaGeneratorApp { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(SchemaGeneratorApp.class); - - public static EO generate() { - final EO schema = SchemaUtil.create(SchemaUtil.API_KEY); - - final EO moveEvent = ElementElementDAO.create(); - SchemaElementDAO.getElements(schema).add(moveEvent); - ElementElementDAO.setApiName(moveEvent, "leigh.minecraft.link.v1.MoveEvent"); - ElementElementDAO.getFields(moveEvent).add(FieldUtil.createNotNull("x", "X Coordinate")); - ElementElementDAO.getFields(moveEvent).add(FieldUtil.createNotNull("y", "Y Coordinate")); - ElementElementDAO.getFields(moveEvent).add(FieldUtil.createNotNull("z", "Z Coordinate")); - ElementElementDAO.getFields(moveEvent).add(FieldUtil.createNotNull("srcId", "Player ID", EODataType.uuid)); - ElementElementDAO.getFields(moveEvent).add(FieldUtil.createNotNull("srcName", "Player Name")); - - final EO shopEnchant = ElementElementDAO.create(); - SchemaElementDAO.getElements(schema).add(shopEnchant); - ElementElementDAO.setApiName(shopEnchant, "leigh.minecraft.link.v1.ShopEnchant"); - ElementElementDAO.getFields(shopEnchant).add(FieldUtil.createNotNull("name", "Name")); - ElementElementDAO.getFields(shopEnchant).add( - FieldUtil.createNotNull("level", "Level", EODataType.number)); - - final EO shop = ElementElementDAO.create(); - SchemaElementDAO.getElements(schema).add(shop); - ElementElementDAO.setApiName(shop, "leigh.minecraft.link.v1.Shop"); - ElementElementDAO.getFields(shop).add(FieldUtil.createNotNull("x", "X Coordinate")); - ElementElementDAO.getFields(shop).add(FieldUtil.createNotNull("y", "Y Coordinate")); - ElementElementDAO.getFields(shop).add(FieldUtil.createNotNull("z", "Z Coordinate")); - ElementElementDAO.getFields(shop).add(FieldUtil.createNotNull("owner", "Shop Owner", EODataType.uuid)); - ElementElementDAO.getFields(shop).add(FieldUtil.createNotNull("world", "World")); - ElementElementDAO.getFields(shop).add(FieldUtil.createNotNull("price", "Item Price")); - ElementElementDAO.getFields(shop).add(FieldUtil.createNotNull("item", "Item")); - ElementElementDAO.getFields(shop).add(FieldUtil.create("enchants", "Enchantments", EODataType.loop)); - - final EO chatMessage = ElementElementDAO.create(); - SchemaElementDAO.getElements(schema).add(chatMessage); - ElementElementDAO.setApiName(chatMessage, "leigh.minecraft.link.v1.ChatMessage"); - ElementElementDAO.getFields(chatMessage).add(FieldUtil.createNotNull("srcId", "Player ID", EODataType.uuid)); - ElementElementDAO.getFields(chatMessage).add(FieldUtil.createNotNull("srcName", "Player Name")); - ElementElementDAO.getFields(chatMessage).add(FieldUtil.createNotNull("msg", "Message")); - - final EO simpleResponse = ElementElementDAO.create(); - SchemaElementDAO.getElements(schema).add(simpleResponse); - ElementElementDAO.setApiName(simpleResponse, "leigh.minecraft.link.v1.SimpleResponse"); - ElementElementDAO.getFields(simpleResponse).add(FieldUtil.createNotNull("msg", "Message")); - - final EO landMemberRemoveRequest = ElementElementDAO.create(); - SchemaElementDAO.getElements(schema).add(landMemberRemoveRequest); - ElementElementDAO.setApiName(landMemberRemoveRequest, "leigh.minecraft.link.v1.LandMemberRemoveRequest"); - ElementElementDAO.getFields(landMemberRemoveRequest).add(FieldUtil.createNotNull("lot", "Lot Name")); - ElementElementDAO.getFields(landMemberRemoveRequest).add(FieldUtil.createNotNull("src", "Request Source", EODataType.uuid)); - ElementElementDAO.getFields(landMemberRemoveRequest).add(FieldUtil.createNotNull("player", "Player Name")); - - final EO landMemberAddRequest = ElementElementDAO.create(); - SchemaElementDAO.getElements(schema).add(landMemberAddRequest); - ElementElementDAO.setApiName(landMemberAddRequest, "leigh.minecraft.link.v1.LandMemberAddRequest"); - ElementElementDAO.getFields(landMemberAddRequest).add(FieldUtil.createNotNull("lot", "Lot Name")); - ElementElementDAO.getFields(landMemberAddRequest).add(FieldUtil.createNotNull("src", "Request Source", EODataType.uuid)); - ElementElementDAO.getFields(landMemberAddRequest).add(FieldUtil.createNotNull("player", "Player Name")); - return schema; - } - - public static void main(final String... args) throws FileNotFoundException { - UniversalJob.banner(logger, "Apotheosis mk3", "2014 Alex Leigh"); - final EO schema = generate(); - final DAOGenerator gen = new DAOGenerator(new File("leigh-minecraft-link-sdk/src/main/java")); - gen.generateJava("leigh.minecraft.link.sdk.schema.v1", schema); - - logger.info("Generated schema: {}", schema); - } -} diff --git a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/ChatMessageElementDAO.java b/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/ChatMessageElementDAO.java deleted file mode 100644 index ac2282e3d601e458bd367c5c9440bc7b08ce932d..0000000000000000000000000000000000000000 --- a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/ChatMessageElementDAO.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2014-2021, by Alex Leigh. - * All rights reserved. - * - * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE - * The copyright notice above does not evidence any - * actual or intended publication of such source code. - */ - -package lc.minecraft.link.sdk.schema.v1; - -import lc.eo.EO; - -/** -* This is a dynamically generated DAO class for accessing objects within an ESP graph. This class -* has been generated by DAOGenerator and should not be modified. -* -* @author DAOGenerator (synthetically generated class) -*/ -public final class ChatMessageElementDAO { -public static final String API_TYPE = "leigh.minecraft.link.v1.ChatMessage"; - -public static EO create() { -EO eo = new EO(API_TYPE); -return eo; -} - -public static boolean assertType(final EO eo) { -return eo.getApiType().equals(API_TYPE); -} - -public static final String KEY_SRCID = "srcId"; -public static final String KEY_SRCNAME = "srcName"; -public static final String KEY_MSG = "msg"; - -public static String apiType(final EO eo) { -return eo.getApiType(); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=srcId, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Player ID, locale=en}}]} , type=uuid}} */ - - - -public static java.util.UUID getSrcId(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueUUID(KEY_SRCID); - } - -public static void setSrcId(final EO eo, java.util.UUID value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_SRCID, value); -} - -public static void setSrcIdLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_SRCID, label); -} - -public static void getLabelOrValueSrcId(final EO eo, java.util.UUID value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_SRCID); -} - -public static void setIfUnsetSrcId(final EO eo, java.util.UUID value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_SRCID, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=srcName, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Player Name, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getSrcName(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_SRCNAME); - } - -public static void setSrcName(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_SRCNAME, value); -} - -public static void setSrcNameLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_SRCNAME, label); -} - -public static void getLabelOrValueSrcName(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_SRCNAME); -} - -public static void setIfUnsetSrcName(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_SRCNAME, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=msg, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Message, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getMsg(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_MSG); - } - -public static void setMsg(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_MSG, value); -} - -public static void setMsgLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_MSG, label); -} - -public static void getLabelOrValueMsg(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_MSG); -} - -public static void setIfUnsetMsg(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_MSG, value); -} - - -} \ No newline at end of file diff --git a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/LandMemberAddRequestElementDAO.java b/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/LandMemberAddRequestElementDAO.java deleted file mode 100644 index 73083049b4bd1144d6b91bc38675d8a0c2aba488..0000000000000000000000000000000000000000 --- a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/LandMemberAddRequestElementDAO.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2014-2021, by Alex Leigh. - * All rights reserved. - * - * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE - * The copyright notice above does not evidence any - * actual or intended publication of such source code. - */ - -package lc.minecraft.link.sdk.schema.v1; - -import lc.eo.EO; - -/** -* This is a dynamically generated DAO class for accessing objects within an ESP graph. This class -* has been generated by DAOGenerator and should not be modified. -* -* @author DAOGenerator (synthetically generated class) -*/ -public final class LandMemberAddRequestElementDAO { -public static final String API_TYPE = "leigh.minecraft.link.v1.LandMemberAddRequest"; - -public static EO create() { -EO eo = new EO(API_TYPE); -return eo; -} - -public static boolean assertType(final EO eo) { -return eo.getApiType().equals(API_TYPE); -} - -public static final String KEY_LOT = "lot"; -public static final String KEY_SRC = "src"; -public static final String KEY_PLAYER = "player"; - -public static String apiType(final EO eo) { -return eo.getApiType(); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=lot, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Lot Name, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getLot(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_LOT); - } - -public static void setLot(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_LOT, value); -} - -public static void setLotLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_LOT, label); -} - -public static void getLabelOrValueLot(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_LOT); -} - -public static void setIfUnsetLot(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_LOT, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=src, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Request Source, locale=en}}]} , type=uuid}} */ - - - -public static java.util.UUID getSrc(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueUUID(KEY_SRC); - } - -public static void setSrc(final EO eo, java.util.UUID value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_SRC, value); -} - -public static void setSrcLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_SRC, label); -} - -public static void getLabelOrValueSrc(final EO eo, java.util.UUID value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_SRC); -} - -public static void setIfUnsetSrc(final EO eo, java.util.UUID value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_SRC, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=player, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Player Name, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getPlayer(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_PLAYER); - } - -public static void setPlayer(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_PLAYER, value); -} - -public static void setPlayerLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_PLAYER, label); -} - -public static void getLabelOrValuePlayer(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_PLAYER); -} - -public static void setIfUnsetPlayer(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_PLAYER, value); -} - - -} \ No newline at end of file diff --git a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/LandMemberRemoveRequestElementDAO.java b/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/LandMemberRemoveRequestElementDAO.java deleted file mode 100644 index 293f42b27b398f1bd97597bd9839316a07bcdbf1..0000000000000000000000000000000000000000 --- a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/LandMemberRemoveRequestElementDAO.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2014-2021, by Alex Leigh. - * All rights reserved. - * - * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE - * The copyright notice above does not evidence any - * actual or intended publication of such source code. - */ - -package lc.minecraft.link.sdk.schema.v1; - -import lc.eo.EO; - -/** -* This is a dynamically generated DAO class for accessing objects within an ESP graph. This class -* has been generated by DAOGenerator and should not be modified. -* -* @author DAOGenerator (synthetically generated class) -*/ -public final class LandMemberRemoveRequestElementDAO { -public static final String API_TYPE = "leigh.minecraft.link.v1.LandMemberRemoveRequest"; - -public static EO create() { -EO eo = new EO(API_TYPE); -return eo; -} - -public static boolean assertType(final EO eo) { -return eo.getApiType().equals(API_TYPE); -} - -public static final String KEY_LOT = "lot"; -public static final String KEY_SRC = "src"; -public static final String KEY_PLAYER = "player"; - -public static String apiType(final EO eo) { -return eo.getApiType(); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=lot, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Lot Name, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getLot(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_LOT); - } - -public static void setLot(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_LOT, value); -} - -public static void setLotLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_LOT, label); -} - -public static void getLabelOrValueLot(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_LOT); -} - -public static void setIfUnsetLot(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_LOT, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=src, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Request Source, locale=en}}]} , type=uuid}} */ - - - -public static java.util.UUID getSrc(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueUUID(KEY_SRC); - } - -public static void setSrc(final EO eo, java.util.UUID value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_SRC, value); -} - -public static void setSrcLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_SRC, label); -} - -public static void getLabelOrValueSrc(final EO eo, java.util.UUID value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_SRC); -} - -public static void setIfUnsetSrc(final EO eo, java.util.UUID value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_SRC, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=player, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Player Name, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getPlayer(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_PLAYER); - } - -public static void setPlayer(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_PLAYER, value); -} - -public static void setPlayerLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_PLAYER, label); -} - -public static void getLabelOrValuePlayer(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_PLAYER); -} - -public static void setIfUnsetPlayer(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_PLAYER, value); -} - - -} \ No newline at end of file diff --git a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/MoveEventElementDAO.java b/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/MoveEventElementDAO.java deleted file mode 100644 index ac3855cfd652026147fc5e47d9733e7fb481caba..0000000000000000000000000000000000000000 --- a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/MoveEventElementDAO.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2014-2021, by Alex Leigh. - * All rights reserved. - * - * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE - * The copyright notice above does not evidence any - * actual or intended publication of such source code. - */ - -package lc.minecraft.link.sdk.schema.v1; - -import lc.eo.EO; - -/** -* This is a dynamically generated DAO class for accessing objects within an ESP graph. This class -* has been generated by DAOGenerator and should not be modified. -* -* @author DAOGenerator (synthetically generated class) -*/ -public final class MoveEventElementDAO { -public static final String API_TYPE = "leigh.minecraft.link.v1.MoveEvent"; - -public static EO create() { -EO eo = new EO(API_TYPE); -return eo; -} - -public static boolean assertType(final EO eo) { -return eo.getApiType().equals(API_TYPE); -} - -public static final String KEY_X = "x"; -public static final String KEY_Y = "y"; -public static final String KEY_Z = "z"; -public static final String KEY_SRCID = "srcId"; -public static final String KEY_SRCNAME = "srcName"; - -public static String apiType(final EO eo) { -return eo.getApiType(); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=x, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=X Coordinate, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getX(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_X); - } - -public static void setX(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_X, value); -} - -public static void setXLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_X, label); -} - -public static void getLabelOrValueX(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_X); -} - -public static void setIfUnsetX(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_X, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=y, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Y Coordinate, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getY(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_Y); - } - -public static void setY(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_Y, value); -} - -public static void setYLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_Y, label); -} - -public static void getLabelOrValueY(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_Y); -} - -public static void setIfUnsetY(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_Y, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=z, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Z Coordinate, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getZ(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_Z); - } - -public static void setZ(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_Z, value); -} - -public static void setZLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_Z, label); -} - -public static void getLabelOrValueZ(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_Z); -} - -public static void setIfUnsetZ(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_Z, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=srcId, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Player ID, locale=en}}]} , type=uuid}} */ - - - -public static java.util.UUID getSrcId(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueUUID(KEY_SRCID); - } - -public static void setSrcId(final EO eo, java.util.UUID value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_SRCID, value); -} - -public static void setSrcIdLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_SRCID, label); -} - -public static void getLabelOrValueSrcId(final EO eo, java.util.UUID value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_SRCID); -} - -public static void setIfUnsetSrcId(final EO eo, java.util.UUID value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_SRCID, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=srcName, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Player Name, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getSrcName(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_SRCNAME); - } - -public static void setSrcName(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_SRCNAME, value); -} - -public static void setSrcNameLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_SRCNAME, label); -} - -public static void getLabelOrValueSrcName(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_SRCNAME); -} - -public static void setIfUnsetSrcName(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_SRCNAME, value); -} - - -} \ No newline at end of file diff --git a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/ShopElementDAO.java b/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/ShopElementDAO.java deleted file mode 100644 index ab4f23887702900131af5d3d6fc24997c103e2a0..0000000000000000000000000000000000000000 --- a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/ShopElementDAO.java +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copyright (c) 2014-2021, by Alex Leigh. - * All rights reserved. - * - * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE - * The copyright notice above does not evidence any - * actual or intended publication of such source code. - */ - -package lc.minecraft.link.sdk.schema.v1; - -import lc.eo.EO; - -/** -* This is a dynamically generated DAO class for accessing objects within an ESP graph. This class -* has been generated by DAOGenerator and should not be modified. -* -* @author DAOGenerator (synthetically generated class) -*/ -public final class ShopElementDAO { -public static final String API_TYPE = "leigh.minecraft.link.v1.Shop"; - -public static EO create() { -EO eo = new EO(API_TYPE); -return eo; -} - -public static boolean assertType(final EO eo) { -return eo.getApiType().equals(API_TYPE); -} - -public static final String KEY_X = "x"; -public static final String KEY_Y = "y"; -public static final String KEY_Z = "z"; -public static final String KEY_OWNER = "owner"; -public static final String KEY_WORLD = "world"; -public static final String KEY_PRICE = "price"; -public static final String KEY_ITEM = "item"; -public static final String KEY_ENCHANTS = "enchants"; - -public static String apiType(final EO eo) { -return eo.getApiType(); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=x, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=X Coordinate, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getX(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_X); - } - -public static void setX(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_X, value); -} - -public static void setXLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_X, label); -} - -public static void getLabelOrValueX(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_X); -} - -public static void setIfUnsetX(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_X, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=y, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Y Coordinate, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getY(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_Y); - } - -public static void setY(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_Y, value); -} - -public static void setYLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_Y, label); -} - -public static void getLabelOrValueY(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_Y); -} - -public static void setIfUnsetY(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_Y, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=z, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Z Coordinate, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getZ(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_Z); - } - -public static void setZ(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_Z, value); -} - -public static void setZLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_Z, label); -} - -public static void getLabelOrValueZ(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_Z); -} - -public static void setIfUnsetZ(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_Z, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=owner, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Shop Owner, locale=en}}]} , type=uuid}} */ - - - -public static java.util.UUID getOwner(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueUUID(KEY_OWNER); - } - -public static void setOwner(final EO eo, java.util.UUID value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_OWNER, value); -} - -public static void setOwnerLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_OWNER, label); -} - -public static void getLabelOrValueOwner(final EO eo, java.util.UUID value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_OWNER); -} - -public static void setIfUnsetOwner(final EO eo, java.util.UUID value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_OWNER, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=world, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=World, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getWorld(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_WORLD); - } - -public static void setWorld(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_WORLD, value); -} - -public static void setWorldLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_WORLD, label); -} - -public static void getLabelOrValueWorld(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_WORLD); -} - -public static void setIfUnsetWorld(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_WORLD, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=price, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Item Price, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getPrice(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_PRICE); - } - -public static void setPrice(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_PRICE, value); -} - -public static void setPriceLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_PRICE, label); -} - -public static void getLabelOrValuePrice(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_PRICE); -} - -public static void setIfUnsetPrice(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_PRICE, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=item, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Item, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getItem(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_ITEM); - } - -public static void setItem(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_ITEM, value); -} - -public static void setItemLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_ITEM, label); -} - -public static void getLabelOrValueItem(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_ITEM); -} - -public static void setIfUnsetItem(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_ITEM, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=enchants, label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Enchantments, locale=en}}]} , type=loop}} */ - - - public static lc.eo.EOLoop getEnchants(EO eo) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueLoop(KEY_ENCHANTS); - } - - public static void setEnchants(final EO eo, lc.eo.EOLoop value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_ENCHANTS, value); - } - -public static void setEnchantsLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_ENCHANTS, label); -} - - public static void getLabelOrValueEnchants(final EO eo, lc.eo.EOLoop value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.getLabelOrValue(KEY_ENCHANTS); - } - - public static void setIfUnsetEnchants(final EO eo, lc.eo.EOLoop value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValueIfUnset(KEY_ENCHANTS, value); - } - - -} \ No newline at end of file diff --git a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/ShopEnchantElementDAO.java b/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/ShopEnchantElementDAO.java deleted file mode 100644 index 473d5addbc99d9fda0c48f6d7f039bfd190e2442..0000000000000000000000000000000000000000 --- a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/ShopEnchantElementDAO.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2014-2021, by Alex Leigh. - * All rights reserved. - * - * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE - * The copyright notice above does not evidence any - * actual or intended publication of such source code. - */ - -package lc.minecraft.link.sdk.schema.v1; - -import lc.eo.EO; - -/** -* This is a dynamically generated DAO class for accessing objects within an ESP graph. This class -* has been generated by DAOGenerator and should not be modified. -* -* @author DAOGenerator (synthetically generated class) -*/ -public final class ShopEnchantElementDAO { -public static final String API_TYPE = "leigh.minecraft.link.v1.ShopEnchant"; - -public static EO create() { -EO eo = new EO(API_TYPE); -return eo; -} - -public static boolean assertType(final EO eo) { -return eo.getApiType().equals(API_TYPE); -} - -public static final String KEY_NAME = "name"; -public static final String KEY_LEVEL = "level"; - -public static String apiType(final EO eo) { -return eo.getApiType(); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=name, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Name, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getName(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_NAME); - } - -public static void setName(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_NAME, value); -} - -public static void setNameLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_NAME, label); -} - -public static void getLabelOrValueName(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_NAME); -} - -public static void setIfUnsetName(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_NAME, value); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=level, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Level, locale=en}}]} , type=number}} */ - - - public static void setLevel(final EO eo, int value) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_LEVEL, value); - } - - public static void setLevel(final EO eo, float value) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_LEVEL, value); - } - - public static void setLevel(final EO eo, double value) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_LEVEL, value); - } - - public static void setLevel(final EO eo, long value) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_LEVEL, value); - } - - public static void setLevel(final EO eo, short value) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_LEVEL, value); - } - -public static java.math.BigDecimal getLevel(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getNumber(KEY_LEVEL); - } - -public static void setLevel(final EO eo, java.math.BigDecimal value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_LEVEL, value); -} - -public static void setLevelLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_LEVEL, label); -} - -public static void getLabelOrValueLevel(final EO eo, java.math.BigDecimal value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_LEVEL); -} - -public static void setIfUnsetLevel(final EO eo, java.math.BigDecimal value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_LEVEL, value); -} - - -} \ No newline at end of file diff --git a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/SimpleResponseElementDAO.java b/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/SimpleResponseElementDAO.java deleted file mode 100644 index f728251490eff2836d75f339f0f50f84c73fe511..0000000000000000000000000000000000000000 --- a/lc-minecraft-link-sdk/src/main/java/lc/minecraft/link/sdk/schema/v1/SimpleResponseElementDAO.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2014-2021, by Alex Leigh. - * All rights reserved. - * - * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE - * The copyright notice above does not evidence any - * actual or intended publication of such source code. - */ - -package lc.minecraft.link.sdk.schema.v1; - -import lc.eo.EO; - -/** -* This is a dynamically generated DAO class for accessing objects within an ESP graph. This class -* has been generated by DAOGenerator and should not be modified. -* -* @author DAOGenerator (synthetically generated class) -*/ -public final class SimpleResponseElementDAO { -public static final String API_TYPE = "leigh.minecraft.link.v1.SimpleResponse"; - -public static EO create() { -EO eo = new EO(API_TYPE); -return eo; -} - -public static boolean assertType(final EO eo) { -return eo.getApiType().equals(API_TYPE); -} - -public static final String KEY_MSG = "msg"; - -public static String apiType(final EO eo) { -return eo.getApiType(); -} - - -/* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=msg, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Message, locale=en}}]} , type=string}} */ - - - -public static java.lang.String getMsg(EO eo) { - if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_MSG); - } - -public static void setMsg(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValue(KEY_MSG, value); -} - -public static void setMsgLabel(final EO eo,final String label) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setLabel(KEY_MSG, label); -} - -public static void getLabelOrValueMsg(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.getLabelOrValue(KEY_MSG); -} - -public static void setIfUnsetMsg(final EO eo, java.lang.String value) { -if(!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); -eo.setValueIfUnset(KEY_MSG, value); -} - - -} \ No newline at end of file diff --git a/lc-minecraft-link/.gitignore b/lc-minecraft-link/.gitignore deleted file mode 100644 index ede7310f5aa22a8bb16f7393dedac5d9b0cba2c9..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -kabe.log -velocity.log -.DS_Store -statistic.xml -.gradle -/*/build/ -/build/ -gradle-app.setting -!gradle-wrapper.jar -.gradletasknamecache -.idea/ -*.iml -out/ -.cache -node_modules -/*/.idea -.vi -/*/graph.eo -.vai -graph.bak -.idea -tests.vai -vds.log -hosts.json -tests.vai.old \ No newline at end of file diff --git a/lc-minecraft-link/LICENSE.md b/lc-minecraft-link/LICENSE.md deleted file mode 100644 index 226d1f25b12e58e21c29a6c1869d1ec05095d443..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-minecraft-link/build.gradle b/lc-minecraft-link/build.gradle deleted file mode 100644 index c2e5e15a3193e5f307c4eeb8d188913614c8d297..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/build.gradle +++ /dev/null @@ -1,65 +0,0 @@ -plugins { - id 'java' - id 'java-library' - id 'application' -} - -group 'leigh' -version '1.0' -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -repositories { - mavenCentral() - mavenLocal() - maven { url 'https://jitpack.io' } - // Bukkit - maven { - url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' - content { - includeGroup 'org.bukkit' - includeGroup 'org.spigotmc' - } - } - maven { url 'https://repo.essentialsx.net/releases/' } - maven { url "https://maven.enginehub.org/repo/" } - // Dynmap - maven {url "https://repo.mikeprimm.com/"} - // QuickShop - maven {url "https://repo.codemc.io/repository/maven-public/"} - // Quests - maven { url 'https://jitpack.io' } -} - -dependencies { - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' - compileOnly "com.github.MilkBowl:VaultAPI:1.7" - compileOnly 'org.bukkit:bukkit:1.15.2-R0.1-SNAPSHOT' - compileOnly 'net.ess3:EssentialsX:2.18.2' - compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.2' - compileOnly 'com.github.PikaMug:Quests:4.1.3' -// compileOnly 'org.maxgamer:QuickShop:7.0.2:4.0.9.10' - compileOnly 'us.dynmap:dynmap-api:3.0-SNAPSHOT' - implementation group: 'c3p0', name: 'c3p0', version: '0.9.1.2' - implementation project(':lc-esp-service-sdk') - implementation project(':lc-esp-keikai-sdk') - implementation project(':lc-mecha-http-server') - implementation project(':lc-mecha-cli') - implementation project(':lc-mecha-mq') - implementation project(':lc-eo-json') - implementation project(':lc-eo-yaml') - implementation project(':lc-eo-schema') - implementation project(':lc-mecha-db-mysql') - implementation project(':lc-minecraft-link-sdk') -} - -test { - useJUnitPlatform() -} - -jar { - duplicatesStrategy = DuplicatesStrategy.INCLUDE - from { - configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } - } -} diff --git a/lc-minecraft-link/dist.sh b/lc-minecraft-link/dist.sh deleted file mode 100755 index 05a86c5ede619d8fdd23fb5c98d017d3e9471c55..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/dist.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# git clone git@gitlab.leigh-co.com:aleigh/leigh-bin-kabe.git - -gradle build -x test -cp build/libs/leigh-minecraft-link-1.0.jar leigh-bin-minecraft-plugin/ -(cd leigh-bin-minecraft-plugin;git add *;git commit -m "autopublish";git push) diff --git a/lc-minecraft-link/leigh-bin-minecraft-plugin b/lc-minecraft-link/leigh-bin-minecraft-plugin deleted file mode 160000 index 07aac4abb27af340433f6a5f0e23121a68ada9dc..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/leigh-bin-minecraft-plugin +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 07aac4abb27af340433f6a5f0e23121a68ada9dc diff --git a/lc-minecraft-link/quickshops.txt b/lc-minecraft-link/quickshops.txt deleted file mode 100644 index c39ed66bddc6ecc5a27f24f66509b16497bf1210..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/quickshops.txt +++ /dev/null @@ -1,448 +0,0 @@ -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GOLD_INGOT\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":40.0,"type":0,"unlimited":false,"world":"world","x":46,"y":71,"z":179,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GOLD_INGOT\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":35.0,"type":1,"unlimited":false,"world":"world","x":45,"y":71,"z":179,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: IRON_INGOT\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":4.0,"type":0,"unlimited":false,"world":"world","x":44,"y":71,"z":177,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: RABBIT_STEW\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":5.0,"type":0,"unlimited":false,"world":"world","x":80,"y":71,"z":162,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BEETROOT_SOUP\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":4.0,"type":0,"unlimited":false,"world":"world","x":79,"y":69,"z":162,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: PUMPKIN_PIE\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":8.0,"type":0,"unlimited":false,"world":"world","x":82,"y":69,"z":162,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CAKE\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":15.0,"type":0,"unlimited":false,"world":"world","x":82,"y":71,"z":162,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COOKIE\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":85,"y":69,"z":162,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BREAD\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":85,"y":71,"z":162,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BAKED_POTATO\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":4.0,"type":0,"unlimited":false,"world":"world","x":86,"y":69,"z":164,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CARROT\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":86,"y":69,"z":167,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MELON_SLICE\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":86,"y":71,"z":167,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BEETROOT\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":86,"y":71,"z":164,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COOKED_SALMON\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":6.0,"type":0,"unlimited":false,"world":"world","x":82,"y":69,"z":168,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COOKED_CHICKEN\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":4.0,"type":0,"unlimited":false,"world":"world","x":84,"y":71,"z":168,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COOKED_COD\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":4.0,"type":0,"unlimited":false,"world":"world","x":84,"y":69,"z":168,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COOKED_BEEF\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":8.0,"type":0,"unlimited":false,"world":"world","x":78,"y":69,"z":166,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COOKED_PORKCHOP\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":8.0,"type":0,"unlimited":false,"world":"world","x":78,"y":71,"z":166,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: WHEAT_SEEDS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":77,"y":71,"z":181,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: LAPIS_LAZULI\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":8.0,"type":0,"unlimited":false,"world":"world","x":44,"y":71,"z":175,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: LAPIS_LAZULI\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":1,"unlimited":false,"world":"world","x":44,"y":71,"z":174,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n DAMAGE_ALL: 3\n SWEEPING_EDGE: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":700.0,"type":0,"unlimited":false,"world":"world","x":40,"y":70,"z":190,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n LOYALTY: 3\n DURABILITY: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":900.0,"type":0,"unlimited":false,"world":"world","x":40,"y":70,"z":174,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n DEPTH_STRIDER: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1200.0,"type":0,"unlimited":false,"world":"world","x":34,"y":70,"z":185,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n OXYGEN: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1800.0,"type":0,"unlimited":false,"world":"world","x":40,"y":70,"z":185,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n ARROW_DAMAGE: 4\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":900.0,"type":0,"unlimited":false,"world":"world","x":40,"y":70,"z":180,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n WATER_WORKER: 1\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1600.0,"type":0,"unlimited":false,"world":"world","x":34,"y":70,"z":189,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n WATER_WORKER: 1\n CHANNELING: 1\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1200.0,"type":0,"unlimited":false,"world":"world","x":34,"y":70,"z":186,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n ARROW_FIRE: 1\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1500.0,"type":0,"unlimited":false,"world":"world","x":34,"y":70,"z":180,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n MULTISHOT: 1\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1600.0,"type":0,"unlimited":false,"world":"world","x":40,"y":70,"z":178,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n ARROW_DAMAGE: 4\n SILK_TOUCH: 1\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3500.0,"type":0,"unlimited":false,"world":"world","x":40,"y":70,"z":188,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n PIERCING: 4\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1200.0,"type":0,"unlimited":false,"world":"world","x":40,"y":70,"z":179,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n repair-cost: 1\n stored-enchants:\n PROTECTION_ENVIRONMENTAL: 4\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2000.0,"type":0,"unlimited":false,"world":"world","x":40,"y":70,"z":182,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n DAMAGE_ARTHROPODS: 4\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2600.0,"type":0,"unlimited":false,"world":"world","x":34,"y":70,"z":188,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n FIRE_ASPECT: 2\n DAMAGE_ALL: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3000.0,"type":0,"unlimited":false,"world":"world","x":34,"y":70,"z":182,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n PROTECTION_EXPLOSIONS: 4\n KNOCKBACK: 2\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":4800.0,"type":0,"unlimited":false,"world":"world","x":34,"y":70,"z":187,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n DIG_SPEED: 4\n KNOCKBACK: 2\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1250.0,"type":0,"unlimited":false,"world":"world","x":34,"y":70,"z":175,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n RIPTIDE: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1000.0,"type":0,"unlimited":false,"world":"world","x":40,"y":70,"z":186,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n PROTECTION_FIRE: 3\n ARROW_INFINITE: 1\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2800.0,"type":0,"unlimited":false,"world":"world","x":34,"y":70,"z":176,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BLAZE_POWDER\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":70.0,"type":0,"unlimited":false,"world":"world","x":39,"y":76,"z":179,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BLAZE_POWDER\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":50.0,"type":1,"unlimited":false,"world":"world","x":38,"y":76,"z":179,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GLASS_BOTTLE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":40,"y":76,"z":176,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GLASS_BOTTLE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.0,"type":1,"unlimited":false,"world":"world","x":40,"y":76,"z":177,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BOOK\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":29,"y":64,"z":189,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BOOK\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":1,"unlimited":false,"world":"world","x":29,"y":64,"z":188,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n potion-type: minecraft:water_breathing\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":150.0,"type":0,"unlimited":false,"world":"world","x":40,"y":76,"z":192,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DIAMOND\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":160.0,"type":1,"unlimited":true,"world":"world","x":52,"y":70,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DIAMOND_BLOCK\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1440.0,"type":1,"unlimited":true,"world":"world","x":52,"y":70,"z":182,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DIAMOND\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":200.0,"type":0,"unlimited":false,"world":"world","x":48,"y":71,"z":179,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ARROW\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":17,"y":76,"z":173,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ARROW\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":1.0,"type":1,"unlimited":false,"world":"world","x":18,"y":76,"z":173,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n ARROW_KNOCKBACK: 1\n RIPTIDE: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1600.0,"type":0,"unlimited":false,"world":"world","x":34,"y":70,"z":177,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n LUCK: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":4500.0,"type":0,"unlimited":false,"world":"world","x":40,"y":70,"z":175,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: END_ROD\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":125.0,"type":0,"unlimited":false,"world":"world","x":26,"y":76,"z":191,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: END_STONE\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":5.0,"type":0,"unlimited":false,"world":"world","x":26,"y":76,"z":189,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: END_STONE_BRICKS\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":26,"y":76,"z":187,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: PURPUR_PILLAR\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":26,"y":76,"z":185,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: PURPUR_BLOCK\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":26,"y":76,"z":183,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: PURPUR_STAIRS\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":40.0,"type":0,"unlimited":false,"world":"world","x":26,"y":76,"z":181,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: PURPUR_SLAB\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":26,"y":76,"z":179,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SHULKER_BOX\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":10000.0,"type":0,"unlimited":false,"world":"world","x":26,"y":76,"z":177,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SADDLE\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":200.0,"type":0,"unlimited":false,"world":"world","x":13,"y":76,"z":187,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n LOOT_BONUS_MOBS: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":4700.0,"type":0,"unlimited":false,"world":"world","x":34,"y":70,"z":174,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n FROST_WALKER: 2\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":5700.0,"type":0,"unlimited":false,"world":"world","x":34,"y":70,"z":178,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n PROTECTION_FALL: 4\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":800.0,"type":0,"unlimited":false,"world":"world","x":34,"y":70,"z":183,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n DAMAGE_ALL: 4\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2700.0,"type":0,"unlimited":false,"world":"world","x":40,"y":70,"z":187,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MILK_BUCKET\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":45.0,"type":0,"unlimited":false,"world":"world","x":77,"y":69,"z":162,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SWEET_BERRIES\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":75,"y":69,"z":164,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COAL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":8.25,"type":0,"unlimited":false,"world":"world","x":56,"y":71,"z":150,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENDER_PEARL\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":13,"y":76,"z":191,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ELYTRA\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":50000.0,"type":0,"unlimited":false,"world":"world","x":26,"y":76,"z":175,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MAGENTA_BANNER\n meta:\n \u003d\u003d: ItemMeta\n meta-type: BANNER\n patterns:\n - \u003d\u003d: Pattern\n color: BLACK\n pattern: tt\n - \u003d\u003d: Pattern\n color: BLACK\n pattern: bt\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":26,"y":76,"z":173,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GLASS_BOTTLE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":1,"unlimited":false,"world":"world","x":204,"y":69,"z":202,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SLIME_BALL\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":13,"y":76,"z":189,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BONE_MEAL\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":13,"y":76,"z":173,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NAME_TAG\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":400.0,"type":0,"unlimited":false,"world":"world","x":13,"y":76,"z":175,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: QUARTZ_BLOCK\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":35.0,"type":0,"unlimited":false,"world":"world","x":13,"y":76,"z":179,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MAGMA_CREAM\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":40.0,"type":1,"unlimited":false,"world":"world","x":23,"y":71,"z":179,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GLOWSTONE_DUST\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":2.0,"type":1,"unlimited":false,"world":"world","x":23,"y":71,"z":181,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: REDSTONE\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":2.0,"type":1,"unlimited":false,"world":"world","x":23,"y":71,"z":183,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: PHANTOM_MEMBRANE\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":4.0,"type":1,"unlimited":false,"world":"world","x":23,"y":71,"z":185,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SPIDER_EYE\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":4.0,"type":1,"unlimited":false,"world":"world","x":23,"y":71,"z":187,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n display-name: \u0027{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"white\",\"text\":\"Strong\n Hot Chocolate\"}],\"text\":\"\"}\u0027\n lore:\n - \u0027{\"extra\":[{\"text\":\"§u\"}],\"text\":\"\"}\u0027\n - \u0027{\"extra\":[{\"text\":\"§s\"},{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"dark_gray\",\"text\":\"[\"},{\"italic\":false,\"color\":\"gray\",\"text\":\"⭑⭑⭑⭑\"},{\"italic\":false,\"color\":\"black\",\"text\":\"⭑\"},{\"italic\":false,\"color\":\"dark_gray\",\"text\":\"]\"}],\"text\":\"\"}\u0027\n ItemFlags:\n - HIDE_POTION_EFFECTS\n PublicBukkitValues:\n brewery:brewdata: \u0027[B;86B,1B,0B,0B,8B,-72B,0B,13B,72B,111B,116B,32B,67B,104B,111B,99B,111B,108B,97B,116B,101B,0B,0B,0B,0B,0B]\u0027\n custom-color:\n \u003d\u003d: Color\n RED: 0\n BLUE: 0\n GREEN: 0\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":13.0,"type":0,"unlimited":false,"world":"world","x":204,"y":69,"z":174,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n display-name: \u0027{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"white\",\"text\":\"Russian\n Vodka\"}],\"text\":\"\"}\u0027\n lore:\n - \u0027{\"text\":\"\"}\u0027\n - \u0027{\"extra\":[{\"text\":\"§u\"}],\"text\":\"\"}\u0027\n - \u0027{\"extra\":[{\"text\":\"§s\"},{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"dark_gray\",\"text\":\"[\"},{\"italic\":false,\"color\":\"gray\",\"text\":\"⭑⭑⭑⭑⭑\"},{\"italic\":false,\"color\":\"dark_gray\",\"text\":\"]\"}],\"text\":\"\"}\u0027\n - \u0027{\"extra\":[{\"text\":\"Distilled\"}],\"text\":\"\"}\u0027\n ItemFlags:\n - HIDE_POTION_EFFECTS\n PublicBukkitValues:\n brewery:brewdata: \u0027[B;86B,1B,0B,0B,10B,-7B,0B,20B,3B,0B,5B,86B,111B,100B,107B,97B,0B,0B,0B,0B,0B]\u0027\n custom-color:\n \u003d\u003d: Color\n RED: 192\n BLUE: 192\n GREEN: 192\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":23.0,"type":0,"unlimited":false,"world":"world","x":202,"y":69,"z":174,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: DIAMOND\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":175.0,"type":1,"unlimited":true,"world":"world","x":17,"y":65,"z":3797,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GOLDEN_HORSE_ARMOR\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":2000.0,"type":0,"unlimited":false,"world":"world","x":15,"y":76,"z":192,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CLAY_BALL\n","moderators":"{\"owner\":\"7b8fe166-f351-4f6e-a521-2b80cf7fa5c2\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":-564,"y":70,"z":-91,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: CROSSBOW\n meta:\n \u003d\u003d: ItemMeta\n meta-type: CROSSBOW\n enchants:\n MENDING: 1\n PIERCING: 4\n QUICK_CHARGE: 3\n DURABILITY: 3\n charged: false\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":20000.0,"type":0,"unlimited":false,"world":"world","x":10,"y":65,"z":3817,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DIAMOND\n","moderators":"{\"owner\":\"7b8fe166-f351-4f6e-a521-2b80cf7fa5c2\",\"staffs\":[]}","price":0.01,"type":1,"unlimited":false,"world":"world","x":-566,"y":89,"z":-119,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BLAZE_ROD\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":150.0,"type":0,"unlimited":false,"world":"world","x":23,"y":71,"z":176,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BLAZE_ROD\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":100.0,"type":1,"unlimited":false,"world":"world","x":23,"y":71,"z":177,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MAGMA_CREAM\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":50.0,"type":0,"unlimited":false,"world":"world","x":23,"y":71,"z":178,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GLOWSTONE_DUST\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":4.0,"type":0,"unlimited":false,"world":"world","x":23,"y":71,"z":180,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: REDSTONE\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":4.0,"type":0,"unlimited":false,"world":"world","x":23,"y":71,"z":182,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: PHANTOM_MEMBRANE\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":4.0,"type":0,"unlimited":false,"world":"world","x":23,"y":71,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SPIDER_EYE\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":8.0,"type":0,"unlimited":false,"world":"world","x":23,"y":71,"z":186,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: LEATHER\n","moderators":"{\"owner\":\"7b8fe166-f351-4f6e-a521-2b80cf7fa5c2\",\"staffs\":[]}","price":25.0,"type":1,"unlimited":false,"world":"world","x":-563,"y":70,"z":-91,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: PUFFERFISH\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":16,"y":71,"z":187,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: PUFFERFISH\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":15.0,"type":1,"unlimited":false,"world":"world","x":16,"y":71,"z":186,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: ELYTRA\n meta:\n \u003d\u003d: ItemMeta\n meta-type: UNSPECIFIC\n enchants:\n MENDING: 1\n DURABILITY: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":65000.0,"type":0,"unlimited":false,"world":"world","x":16,"y":66,"z":3824,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: TRIDENT\n meta:\n \u003d\u003d: ItemMeta\n meta-type: UNSPECIFIC\n enchants:\n CHANNELING: 1\n IMPALING: 5\n LOYALTY: 3\n MENDING: 1\n DURABILITY: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":40000.0,"type":0,"unlimited":false,"world":"world","x":16,"y":65,"z":3833,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NETHER_WART\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":4.0,"type":0,"unlimited":false,"world":"world","x":16,"y":71,"z":189,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NETHER_WART\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":2.0,"type":1,"unlimited":false,"world":"world","x":16,"y":71,"z":188,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: RABBIT_FOOT\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":30.0,"type":0,"unlimited":false,"world":"world","x":16,"y":71,"z":185,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: RABBIT_FOOT\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":20.0,"type":1,"unlimited":false,"world":"world","x":16,"y":71,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: QUARTZ_BLOCK\n","moderators":"{\"owner\":\"7b8fe166-f351-4f6e-a521-2b80cf7fa5c2\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-565,"y":70,"z":-88,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SEA_PICKLE\n","moderators":"{\"owner\":\"7b8fe166-f351-4f6e-a521-2b80cf7fa5c2\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":-565,"y":70,"z":-85,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DIAMOND\n","moderators":"{\"owner\":\"7b8fe166-f351-4f6e-a521-2b80cf7fa5c2\",\"staffs\":[]}","price":0.01,"type":1,"unlimited":false,"world":"world","x":197,"y":71,"z":155,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BOWL\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":2.0,"type":1,"unlimited":false,"world":"world","x":74,"y":69,"z":168,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: FERMENTED_SPIDER_EYE\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":18.0,"type":0,"unlimited":false,"world":"world","x":23,"y":71,"z":188,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: FERMENTED_SPIDER_EYE\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":9.0,"type":1,"unlimited":false,"world":"world","x":23,"y":71,"z":189,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SUGAR\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":16,"y":71,"z":183,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SUGAR\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":1.0,"type":1,"unlimited":false,"world":"world","x":16,"y":71,"z":182,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: HONEY_BOTTLE\n","moderators":"{\"owner\":\"67f13fe2-9ce9-4ec0-9a4d-eba46ba97dfb\",\"staffs\":[]}","price":50.0,"type":0,"unlimited":false,"world":"world","x":-563,"y":70,"z":-88,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SPIDER_EYE\n","moderators":"{\"owner\":\"67f13fe2-9ce9-4ec0-9a4d-eba46ba97dfb\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":-565,"y":70,"z":-79,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: HONEY_BOTTLE\n","moderators":"{\"owner\":\"67f13fe2-9ce9-4ec0-9a4d-eba46ba97dfb\",\"staffs\":[]}","price":50.0,"type":0,"unlimited":false,"world":"world","x":221,"y":69,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: HONEY_BOTTLE\n","moderators":"{\"owner\":\"67f13fe2-9ce9-4ec0-9a4d-eba46ba97dfb\",\"staffs\":[]}","price":50.0,"type":0,"unlimited":false,"world":"world","x":221,"y":69,"z":152,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: NETHERITE_HELMET\n meta:\n \u003d\u003d: ItemMeta\n meta-type: UNSPECIFIC\n enchants:\n WATER_WORKER: 1\n MENDING: 1\n PROTECTION_ENVIRONMENTAL: 4\n OXYGEN: 3\n THORNS: 3\n DURABILITY: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":40000.0,"type":0,"unlimited":false,"world":"world","x":15,"y":65,"z":3815,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: NETHERITE_CHESTPLATE\n meta:\n \u003d\u003d: ItemMeta\n meta-type: UNSPECIFIC\n enchants:\n MENDING: 1\n PROTECTION_ENVIRONMENTAL: 4\n THORNS: 3\n DURABILITY: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":40000.0,"type":0,"unlimited":false,"world":"world","x":17,"y":65,"z":3815,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: NETHERITE_LEGGINGS\n meta:\n \u003d\u003d: ItemMeta\n meta-type: UNSPECIFIC\n enchants:\n MENDING: 1\n PROTECTION_ENVIRONMENTAL: 4\n THORNS: 1\n DURABILITY: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":40000.0,"type":0,"unlimited":false,"world":"world","x":19,"y":65,"z":3815,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: NETHERITE_BOOTS\n meta:\n \u003d\u003d: ItemMeta\n meta-type: UNSPECIFIC\n enchants:\n PROTECTION_FALL: 4\n FROST_WALKER: 2\n MENDING: 1\n PROTECTION_ENVIRONMENTAL: 4\n SOUL_SPEED: 3\n THORNS: 3\n DURABILITY: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":40000.0,"type":0,"unlimited":false,"world":"world","x":21,"y":65,"z":3815,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: NETHERITE_PICKAXE\n meta:\n \u003d\u003d: ItemMeta\n meta-type: UNSPECIFIC\n enchants:\n DIG_SPEED: 5\n LOOT_BONUS_BLOCKS: 1\n MENDING: 1\n DURABILITY: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":30000.0,"type":0,"unlimited":false,"world":"world","x":10,"y":65,"z":3824,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: NETHERITE_AXE\n meta:\n \u003d\u003d: ItemMeta\n meta-type: UNSPECIFIC\n enchants:\n DIG_SPEED: 5\n LOOT_BONUS_BLOCKS: 1\n MENDING: 1\n DAMAGE_ALL: 5\n DURABILITY: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":30000.0,"type":0,"unlimited":false,"world":"world","x":26,"y":65,"z":3814,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: NETHERITE_SWORD\n meta:\n \u003d\u003d: ItemMeta\n meta-type: UNSPECIFIC\n enchants:\n FIRE_ASPECT: 2\n KNOCKBACK: 2\n LOOT_BONUS_MOBS: 3\n MENDING: 1\n DAMAGE_ALL: 5\n SWEEPING_EDGE: 3\n DURABILITY: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":40000.0,"type":0,"unlimited":false,"world":"world","x":10,"y":65,"z":3831,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n LOOT_BONUS_BLOCKS: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":5000.0,"type":0,"unlimited":false,"world":"world","x":34,"y":70,"z":179,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n MENDING: 1\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":8000.0,"type":0,"unlimited":false,"world":"world","x":40,"y":70,"z":177,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n DURABILITY: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":4000.0,"type":0,"unlimited":false,"world":"world","x":40,"y":70,"z":192,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n PROTECTION_FIRE: 4\n DURABILITY: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":4500.0,"type":0,"unlimited":false,"world":"world","x":34,"y":70,"z":181,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n DIG_SPEED: 5\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1000.0,"type":0,"unlimited":false,"world":"world","x":34,"y":70,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n SILK_TOUCH: 1\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":3500.0,"type":0,"unlimited":false,"world":"world","x":32,"y":15,"z":-101,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n MENDING: 1\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":4000.0,"type":0,"unlimited":false,"world":"world","x":32,"y":15,"z":-99,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n LOOT_BONUS_BLOCKS: 3\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":3000.0,"type":0,"unlimited":false,"world":"world","x":32,"y":15,"z":-102,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-241,"y":73,"z":-405,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-241,"y":74,"z":-405,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-238,"y":73,"z":-405,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-239,"y":73,"z":-407,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-239,"y":74,"z":-407,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-238,"y":74,"z":-405,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-240,"y":73,"z":-407,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-240,"y":74,"z":-407,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":5.0,"type":0,"unlimited":false,"world":"world","x":-263,"y":65,"z":-405,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-239,"y":74,"z":-433,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-239,"y":73,"z":-433,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-238,"y":74,"z":-431,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-238,"y":73,"z":-431,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-240,"y":74,"z":-433,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-240,"y":73,"z":-433,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-241,"y":74,"z":-431,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-241,"y":73,"z":-431,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: TNT\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":10.0,"type":0,"unlimited":false,"world":"world","x":32,"y":15,"z":-98,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: DIAMOND\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":160.0,"type":1,"unlimited":true,"world":"world","x":16273,"y":72,"z":847,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MINECART\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":true,"world":"world","x":94,"y":70,"z":142,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MINECART\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":true,"world":"world","x":-750,"y":73,"z":139,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MINECART\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":true,"world":"world","x":-750,"y":73,"z":129,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MINECART\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":true,"world":"world","x":-209,"y":73,"z":129,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MINECART\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":true,"world":"world","x":-209,"y":73,"z":139,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MINECART\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":true,"world":"world","x":1276,"y":72,"z":-23,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MINECART\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":true,"world":"world","x":1276,"y":72,"z":-13,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MINECART\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":true,"world":"world","x":1738,"y":72,"z":681,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MINECART\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":true,"world":"world","x":1738,"y":72,"z":671,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: MINECART\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":true,"world":"world","x":5052,"y":72,"z":681,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: MINECART\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":true,"world":"world","x":5052,"y":72,"z":671,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: MINECART\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":4153,"y":72,"z":671,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: MINECART\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":4153,"y":72,"z":681,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DIAMOND\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":160.0,"type":1,"unlimited":true,"world":"world","x":16514,"y":83,"z":-5042,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SAND\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":5.99,"type":0,"unlimited":false,"world":"world","x":16511,"y":76,"z":-5037,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COBBLESTONE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.49,"type":0,"unlimited":false,"world":"world","x":16514,"y":76,"z":-5037,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SMOOTH_STONE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":4.99,"type":0,"unlimited":false,"world":"world","x":16517,"y":76,"z":-5037,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BIRCH_LOG\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":5.99,"type":0,"unlimited":false,"world":"world","x":16520,"y":76,"z":-5037,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COAL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":8.99,"type":0,"unlimited":false,"world":"world","x":16523,"y":76,"z":-5037,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SAND\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":5.99,"type":0,"unlimited":false,"world":"world","x":16526,"y":76,"z":-5037,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MOSSY_STONE_BRICKS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":6.99,"type":0,"unlimited":false,"world":"world","x":16526,"y":76,"z":-5040,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MOSSY_COBBLESTONE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":5.99,"type":0,"unlimited":false,"world":"world","x":16523,"y":76,"z":-5040,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COOKED_BEEF\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":8.0,"type":0,"unlimited":false,"world":"world","x":16573,"y":72,"z":-5055,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COOKED_SALMON\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":6.0,"type":0,"unlimited":false,"world":"world","x":16571,"y":72,"z":-5055,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n display-name: \u0027{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"white\",\"text\":\"Russian\n Vodka\"}],\"text\":\"\"}\u0027\n lore:\n - \u0027{\"text\":\"\"}\u0027\n - \u0027{\"extra\":[{\"text\":\"§u\"}],\"text\":\"\"}\u0027\n - \u0027{\"extra\":[{\"text\":\"§s\"},{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"dark_gray\",\"text\":\"[\"},{\"italic\":false,\"color\":\"gray\",\"text\":\"⭑⭑⭑⭑⭑\"},{\"italic\":false,\"color\":\"dark_gray\",\"text\":\"]\"}],\"text\":\"\"}\u0027\n - \u0027{\"extra\":[{\"text\":\"Distilled\"}],\"text\":\"\"}\u0027\n ItemFlags:\n - HIDE_POTION_EFFECTS\n PublicBukkitValues:\n brewery:brewdata: \u0027[B;86B,1B,0B,0B,10B,-7B,0B,20B,3B,0B,5B,86B,111B,100B,107B,97B,0B,0B,0B,0B,0B]\u0027\n custom-color:\n \u003d\u003d: Color\n RED: 192\n BLUE: 192\n GREEN: 192\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":23.0,"type":0,"unlimited":false,"world":"world","x":16511,"y":75,"z":-5056,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n display-name: \u0027{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"white\",\"text\":\"Strong\n Hot Chocolate\"}],\"text\":\"\"}\u0027\n lore:\n - \u0027{\"extra\":[{\"text\":\"§u\"}],\"text\":\"\"}\u0027\n - \u0027{\"extra\":[{\"text\":\"§s\"},{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"dark_gray\",\"text\":\"[\"},{\"italic\":false,\"color\":\"gray\",\"text\":\"⭑⭑⭑⭑\"},{\"italic\":false,\"color\":\"black\",\"text\":\"⭑\"},{\"italic\":false,\"color\":\"dark_gray\",\"text\":\"]\"}],\"text\":\"\"}\u0027\n ItemFlags:\n - HIDE_POTION_EFFECTS\n PublicBukkitValues:\n brewery:brewdata: \u0027[B;86B,1B,0B,0B,8B,-72B,0B,13B,72B,111B,116B,32B,67B,104B,111B,99B,111B,108B,97B,116B,101B,0B,0B,0B,0B,0B]\u0027\n custom-color:\n \u003d\u003d: Color\n RED: 0\n BLUE: 0\n GREEN: 0\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":13.0,"type":0,"unlimited":false,"world":"world","x":16523,"y":83,"z":-5047,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GLASS_BOTTLE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.0,"type":1,"unlimited":false,"world":"world","x":16524,"y":82,"z":-5044,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COOKED_MUTTON\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":6.0,"type":0,"unlimited":false,"world":"world","x":82,"y":71,"z":168,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: PINK_STAINED_GLASS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":6.63,"type":0,"unlimited":false,"world":"world","x":-38,"y":72,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: RED_STAINED_GLASS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":5.25,"type":0,"unlimited":false,"world":"world","x":-37,"y":72,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BROWN_STAINED_GLASS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":5.25,"type":0,"unlimited":false,"world":"world","x":-36,"y":72,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: YELLOW_STAINED_GLASS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":5.38,"type":0,"unlimited":false,"world":"world","x":-35,"y":72,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: LIME_STAINED_GLASS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":7.75,"type":0,"unlimited":false,"world":"world","x":-34,"y":72,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GREEN_STAINED_GLASS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":5.5,"type":0,"unlimited":false,"world":"world","x":-33,"y":72,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CYAN_STAINED_GLASS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":6.5,"type":0,"unlimited":false,"world":"world","x":-32,"y":72,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: LIGHT_BLUE_STAINED_GLASS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":7.25,"type":0,"unlimited":false,"world":"world","x":-31,"y":72,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BLUE_STAINED_GLASS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":6.25,"type":0,"unlimited":false,"world":"world","x":-30,"y":72,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: PURPLE_STAINED_GLASS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":5.38,"type":0,"unlimited":false,"world":"world","x":-29,"y":72,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: WHITE_STAINED_GLASS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":5.63,"type":0,"unlimited":false,"world":"world","x":-26,"y":72,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: LIGHT_GRAY_STAINED_GLASS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":5.38,"type":0,"unlimited":false,"world":"world","x":-25,"y":72,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GRAY_STAINED_GLASS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":6.63,"type":0,"unlimited":false,"world":"world","x":-24,"y":72,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BLACK_STAINED_GLASS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":6.25,"type":0,"unlimited":false,"world":"world","x":-23,"y":72,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GLASS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":6.0,"type":0,"unlimited":false,"world":"world","x":-22,"y":72,"z":184,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COOKED_SALMON\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":5.32,"type":0,"unlimited":false,"world":"world","x":122,"y":70,"z":167,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SKELETON_SKULL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":24.99,"type":0,"unlimited":false,"world":"world","x":0,"y":72,"z":297,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ZOMBIE_HEAD\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":24.99,"type":0,"unlimited":false,"world":"world","x":-1,"y":72,"z":297,"extra":""} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GUNPOWDER\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":12.0,"type":0,"unlimited":false,"world":"world","x":1,"y":71,"z":177,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: FIREWORK_ROCKET\n meta:\n \u003d\u003d: ItemMeta\n meta-type: FIREWORK\n power: 3\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":8.0,"type":0,"unlimited":false,"world":"world","x":-1,"y":71,"z":177,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: FIREWORK_ROCKET\n meta:\n \u003d\u003d: ItemMeta\n meta-type: FIREWORK\n power: 3\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":70.0,"type":0,"unlimited":false,"world":"world","x":-90,"y":97,"z":249,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BUCKET\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":20.0,"type":1,"unlimited":false,"world":"world","x":74,"y":69,"z":167,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: TNT\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":16.0,"type":0,"unlimited":false,"world":"world","x":4,"y":71,"z":177,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: WITHER_SKELETON_SKULL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":24.99,"type":0,"unlimited":false,"world":"world","x":-2,"y":72,"z":297,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: EMERALD\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":16.0,"type":0,"unlimited":false,"world":"world","x":6,"y":71,"z":174,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CARVED_PUMPKIN\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":24.99,"type":0,"unlimited":false,"world":"world","x":1,"y":72,"z":297,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SUSPICIOUS_STEW\n meta:\n \u003d\u003d: ItemMeta\n meta-type: SUSPICIOUS_STEW\n effects:\n - \u003d\u003d: PotionEffect\n effect: 18\n duration: 180\n amplifier: 0\n ambient: true\n has-particles: true\n has-icon: true\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":-63,"y":72,"z":188,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COOKIE\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":-64,"y":72,"z":188,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POISONOUS_POTATO\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":-65,"y":72,"z":188,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: WHEAT_SEEDS\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":-66,"y":72,"z":188,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ROTTEN_FLESH\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":5.0,"type":0,"unlimited":false,"world":"world","x":-67,"y":72,"z":188,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: WOODEN_SHOVEL\n meta:\n \u003d\u003d: ItemMeta\n meta-type: UNSPECIFIC\n Damage: 57\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":-64,"y":72,"z":183,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: STONE_HOE\n meta:\n \u003d\u003d: ItemMeta\n meta-type: UNSPECIFIC\n Damage: 118\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":-63,"y":72,"z":183,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BREAD\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":5.0,"type":0,"unlimited":false,"world":"world","x":-63,"y":72,"z":187,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BONE\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":-64,"y":72,"z":187,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: WOODEN_AXE\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":-65,"y":72,"z":183,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: WOODEN_PICKAXE\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":5.0,"type":0,"unlimited":false,"world":"world","x":-66,"y":72,"z":183,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: FIREWORK_ROCKET\n meta:\n \u003d\u003d: ItemMeta\n meta-type: FIREWORK\n firework-effects:\n - \u003d\u003d: Firework\n flicker: true\n trail: false\n colors:\n - \u003d\u003d: Color\n RED: 222\n BLUE: 42\n GREEN: 207\n - \u003d\u003d: Color\n RED: 179\n BLUE: 44\n GREEN: 49\n fade-colors: []\n type: STAR\n power: 2\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":8.0,"type":0,"unlimited":false,"world":"world","x":-2,"y":71,"z":177,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: FIREWORK_ROCKET\n meta:\n \u003d\u003d: ItemMeta\n meta-type: FIREWORK\n firework-effects:\n - \u003d\u003d: Firework\n flicker: false\n trail: false\n colors:\n - \u003d\u003d: Color\n RED: 37\n BLUE: 146\n GREEN: 49\n - \u003d\u003d: Color\n RED: 179\n BLUE: 44\n GREEN: 49\n - \u003d\u003d: Color\n RED: 240\n BLUE: 240\n GREEN: 240\n fade-colors: []\n type: STAR\n power: 2\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":8.0,"type":0,"unlimited":false,"world":"world","x":-3,"y":71,"z":177,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: FIREWORK_ROCKET\n meta:\n \u003d\u003d: ItemMeta\n meta-type: FIREWORK\n firework-effects:\n - \u003d\u003d: Firework\n flicker: false\n trail: false\n colors:\n - \u003d\u003d: Color\n RED: 123\n BLUE: 190\n GREEN: 47\n fade-colors: []\n type: STAR\n power: 2\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":10.0,"type":0,"unlimited":false,"world":"world","x":-3,"y":71,"z":173,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: FIREWORK_ROCKET\n meta:\n \u003d\u003d: ItemMeta\n meta-type: FIREWORK\n firework-effects:\n - \u003d\u003d: Firework\n flicker: false\n trail: false\n colors:\n - \u003d\u003d: Color\n RED: 37\n BLUE: 146\n GREEN: 49\n - \u003d\u003d: Color\n RED: 179\n BLUE: 44\n GREEN: 49\n - \u003d\u003d: Color\n RED: 222\n BLUE: 42\n GREEN: 207\n fade-colors: []\n type: BALL\n power: 2\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":8.0,"type":0,"unlimited":false,"world":"world","x":-2,"y":71,"z":173,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: FIREWORK_ROCKET\n meta:\n \u003d\u003d: ItemMeta\n meta-type: FIREWORK\n firework-effects:\n - \u003d\u003d: Firework\n flicker: false\n trail: false\n colors:\n - \u003d\u003d: Color\n RED: 171\n BLUE: 171\n GREEN: 171\n fade-colors: []\n type: BURST\n power: 2\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":8.0,"type":0,"unlimited":false,"world":"world","x":-1,"y":71,"z":173,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GRAVEL\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":4.0,"type":0,"unlimited":false,"world":"world","x":-64,"y":72,"z":178,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n MENDING: 1\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":6969.0,"type":0,"unlimited":false,"world":"world","x":-65,"y":72,"z":178,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DIAMOND_AXE\n meta:\n \u003d\u003d: ItemMeta\n meta-type: UNSPECIFIC\n display-name: \u0027{\"text\":\"The Harvester\"}\u0027\n enchants:\n DIG_SPEED: 3\n MENDING: 1\n SILK_TOUCH: 1\n DURABILITY: 3\n repair-cost: 3\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":1500.0,"type":0,"unlimited":false,"world":"world","x":-13,"y":63,"z":-188,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NAME_TAG\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":500.0,"type":0,"unlimited":false,"world":"world","x":-66,"y":72,"z":178,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n potion-type: minecraft:strong_healing\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":234,"y":69,"z":113,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n potion-type: minecraft:long_fire_resistance\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":234,"y":69,"z":115,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n potion-type: minecraft:long_strength\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":234,"y":69,"z":117,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n potion-type: minecraft:long_swiftness\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":234,"y":69,"z":119,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n potion-type: minecraft:long_night_vision\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":234,"y":69,"z":121,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n potion-type: minecraft:long_invisibility\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":234,"y":69,"z":123,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n potion-type: minecraft:long_invisibility\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":234,"y":69,"z":127,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n potion-type: minecraft:long_water_breathing\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":234,"y":69,"z":129,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n potion-type: minecraft:long_leaping\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":234,"y":69,"z":131,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n potion-type: minecraft:long_slowness\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":234,"y":69,"z":133,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n potion-type: minecraft:long_poison\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":-95,"y":65,"z":110,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n potion-type: minecraft:long_weakness\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":-95,"y":65,"z":112,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n potion-type: minecraft:strong_harming\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":-99,"y":65,"z":112,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n potion-type: minecraft:long_slowness\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":-99,"y":65,"z":110,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SNOWBALL\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":-65,"y":72,"z":187,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n display-name: \u0027{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"white\",\"text\":\"Fine\n Beer\"}],\"text\":\"\"}\u0027\n lore:\n - \u0027{\"extra\":[{\"text\":\"§u\"}],\"text\":\"\"}\u0027\n - \u0027{\"extra\":[{\"text\":\"§s\"},{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"dark_gray\",\"text\":\"[\"},{\"italic\":false,\"color\":\"gray\",\"text\":\"⭑⭑⭑⭑⭑\"},{\"italic\":false,\"color\":\"dark_gray\",\"text\":\"]\"}],\"text\":\"\"}\u0027\n - \u0027{\"extra\":[{\"text\":\"§y\"},{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"gray\",\"text\":\"Barrel\n aged\"}],\"text\":\"\"}\u0027\n ItemFlags:\n - HIDE_POTION_EFFECTS\n PublicBukkitValues:\n brewery:brewdata: \u0027[B;86B,1B,0B,0B,10B,-8B,0B,6B,0B,4B,66B,101B,101B,114B,0B,0B,0B,0B,0B]\u0027\n custom-color:\n \u003d\u003d: Color\n RED: 255\n BLUE: 0\n GREEN: 165\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":12.0,"type":0,"unlimited":false,"world":"world","x":-76,"y":71,"z":179,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POTION\n meta:\n \u003d\u003d: ItemMeta\n meta-type: POTION\n display-name: \u0027{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"white\",\"text\":\"Fine\n Darkbeer\"}],\"text\":\"\"}\u0027\n lore:\n - \u0027{\"extra\":[{\"text\":\"§u\"}],\"text\":\"\"}\u0027\n - \u0027{\"extra\":[{\"text\":\"§s\"},{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"dark_gray\",\"text\":\"[\"},{\"italic\":false,\"color\":\"gray\",\"text\":\"⭑⭑⭑⭑⭑\"},{\"italic\":false,\"color\":\"dark_gray\",\"text\":\"]\"}],\"text\":\"\"}\u0027\n - \u0027{\"extra\":[{\"text\":\"§y\"},{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"gray\",\"text\":\"Barrel\n aged\"}],\"text\":\"\"}\u0027\n ItemFlags:\n - HIDE_POTION_EFFECTS\n PublicBukkitValues:\n brewery:brewdata: \u0027[B;86B,1B,0B,0B,10B,-8B,0B,7B,0B,8B,68B,97B,114B,107B,98B,101B,101B,114B,0B,0B,0B,0B,0B]\u0027\n custom-color:\n \u003d\u003d: Color\n RED: 0\n BLUE: 0\n GREEN: 0\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":12.0,"type":0,"unlimited":false,"world":"world","x":-76,"y":71,"z":180,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n DIG_SPEED: 5\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":7000.0,"type":0,"unlimited":false,"world":"world","x":-67,"y":72,"z":178,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n DIG_SPEED: 5\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":8000.0,"type":0,"unlimited":false,"world":"world","x":32,"y":15,"z":-96,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n DURABILITY: 3\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":4500.0,"type":0,"unlimited":false,"world":"world","x":32,"y":15,"z":-95,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n LOOT_BONUS_MOBS: 3\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":2500.0,"type":0,"unlimited":false,"world":"world","x":32,"y":15,"z":-100,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: TNT\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":40.0,"type":0,"unlimited":false,"world":"world","x":1072,"y":65,"z":-3990,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: IRON_INGOT\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":10.0,"type":0,"unlimited":false,"world":"world","x":1072,"y":65,"z":-3991,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: WHITE_WOOL\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":5.0,"type":0,"unlimited":false,"world":"world","x":1072,"y":65,"z":-3992,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: BLUE_WOOL\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":8.0,"type":0,"unlimited":false,"world":"world","x":1072,"y":65,"z":-3993,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: MAGMA_BLOCK\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":false,"world":"world","x":1072,"y":65,"z":-3994,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: LANTERN\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":8.0,"type":0,"unlimited":false,"world":"world","x":1072,"y":65,"z":-3995,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: STRING\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":698,"y":65,"z":-5947,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: LANTERN\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":8.0,"type":0,"unlimited":false,"world":"world","x":698,"y":65,"z":-5946,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: OBSIDIAN\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":698,"y":65,"z":-5939,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: REDSTONE_BLOCK\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":698,"y":65,"z":-5940,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: MAGMA_BLOCK\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":698,"y":65,"z":-5941,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: SLIME_BLOCK\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":50.0,"type":0,"unlimited":false,"world":"world","x":698,"y":65,"z":-5942,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: LAPIS_BLOCK\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":100.0,"type":0,"unlimited":false,"world":"world","x":698,"y":65,"z":-5943,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: IRON_PICKAXE\n meta:\n \u003d\u003d: ItemMeta\n meta-type: UNSPECIFIC\n enchants:\n DIG_SPEED: 3\n DURABILITY: 3\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":100.0,"type":0,"unlimited":false,"world":"world","x":698,"y":65,"z":-5945,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: IRON_INGOT\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":8.0,"type":0,"unlimited":false,"world":"world","x":697,"y":65,"z":-5946,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: DIAMOND_SHOVEL\n meta:\n \u003d\u003d: ItemMeta\n meta-type: UNSPECIFIC\n enchants:\n DIG_SPEED: 3\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":1000.0,"type":0,"unlimited":false,"world":"world","x":697,"y":65,"z":-5944,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: DIAMOND_AXE\n meta:\n \u003d\u003d: ItemMeta\n meta-type: UNSPECIFIC\n enchants:\n DIG_SPEED: 4\n MENDING: 1\n SILK_TOUCH: 1\n DURABILITY: 3\n repair-cost: 3\n Damage: 1\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":4000.0,"type":0,"unlimited":false,"world":"world","x":697,"y":65,"z":-5943,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: WHITE_WOOL\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":10.0,"type":0,"unlimited":false,"world":"world","x":697,"y":65,"z":-5940,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: DIAMOND_BOOTS\n meta:\n \u003d\u003d: ItemMeta\n meta-type: UNSPECIFIC\n enchants:\n PROTECTION_PROJECTILE: 4\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":2000.0,"type":0,"unlimited":false,"world":"world","x":697,"y":65,"z":-5945,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: TNT\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":200.0,"type":0,"unlimited":false,"world":"world","x":697,"y":65,"z":-5942,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2586\n type: BIRCH_SLAB\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":5.0,"type":0,"unlimited":false,"world":"world","x":698,"y":65,"z":-5944,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SNOW\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":-38,"y":72,"z":265,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SNOW\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":1,"unlimited":false,"world":"world","x":-37,"y":72,"z":265,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SNOW_BLOCK\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":5.0,"type":0,"unlimited":false,"world":"world","x":-36,"y":72,"z":265,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SNOW_BLOCK\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.0,"type":1,"unlimited":false,"world":"world","x":-35,"y":72,"z":265,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ICE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":6.0,"type":0,"unlimited":false,"world":"world","x":-34,"y":72,"z":265,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ICE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.0,"type":1,"unlimited":false,"world":"world","x":-33,"y":72,"z":265,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SNOWBALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":-32,"y":72,"z":265,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SNOWBALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":1,"unlimited":false,"world":"world","x":-31,"y":72,"z":265,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GLASS\n","moderators":"{\"owner\":\"be098aeb-245f-482f-8986-88ef823af07a\",\"staffs\":[]}","price":8.0,"type":0,"unlimited":false,"world":"world","x":324,"y":76,"z":-157,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: EMERALD\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":100.0,"type":0,"unlimited":false,"world":"world","x":16,"y":71,"z":177,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: EMERALD\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":50.0,"type":1,"unlimited":false,"world":"world","x":16,"y":71,"z":176,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: LEATHER\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":20.0,"type":0,"unlimited":false,"world":"world","x":16,"y":71,"z":181,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: LEATHER\n","moderators":"{\"owner\":\"6128b74f-46fa-4fc6-a789-798246c0b40a\",\"staffs\":[]}","price":15.0,"type":1,"unlimited":false,"world":"world","x":16,"y":71,"z":180,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MINECART\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":25.0,"type":0,"unlimited":true,"world":"world","x":-702,"y":75,"z":660,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ENCHANTED_BOOK\n meta:\n \u003d\u003d: ItemMeta\n meta-type: ENCHANTED\n stored-enchants:\n DIG_SPEED: 5\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2300.0,"type":0,"unlimited":false,"world":"world","x":40,"y":70,"z":189,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ANDESITE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":21,"y":71,"z":163,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ANDESITE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":20,"y":71,"z":163,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ANDESITE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.5,"type":0,"unlimited":false,"world":"world","x":19,"y":71,"z":163,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ANDESITE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.4,"type":0,"unlimited":false,"world":"world","x":18,"y":71,"z":163,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ANDESITE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":17,"y":71,"z":163,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ANDESITE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":16,"y":71,"z":163,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ANDESITE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":15,"y":71,"z":163,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: ANDESITE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":14,"y":71,"z":163,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_ANDESITE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":12,"y":71,"z":163,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_ANDESITE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":11,"y":71,"z":163,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_ANDESITE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.5,"type":0,"unlimited":false,"world":"world","x":10,"y":71,"z":163,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_ANDESITE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.4,"type":1,"unlimited":false,"world":"world","x":9,"y":71,"z":163,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_ANDESITE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":8,"y":71,"z":163,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_ANDESITE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":7,"y":71,"z":163,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DIORITE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":20,"y":71,"z":159,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DIORITE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":21,"y":71,"z":159,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DIORITE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.5,"type":0,"unlimited":false,"world":"world","x":18,"y":71,"z":159,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DIORITE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.4,"type":1,"unlimited":false,"world":"world","x":19,"y":71,"z":159,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DIORITE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":16,"y":71,"z":159,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DIORITE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":17,"y":71,"z":159,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DIORITE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":14,"y":71,"z":159,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DIORITE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":15,"y":71,"z":159,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_DIORITE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":11,"y":71,"z":159,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_DIORITE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":12,"y":71,"z":159,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_DIORITE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.4,"type":1,"unlimited":false,"world":"world","x":10,"y":71,"z":159,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_DIORITE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.5,"type":0,"unlimited":false,"world":"world","x":9,"y":71,"z":159,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_DIORITE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":7,"y":71,"z":159,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_DIORITE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":8,"y":71,"z":159,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GRANITE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":21,"y":71,"z":157,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GRANITE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":20,"y":71,"z":157,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GRANITE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.5,"type":0,"unlimited":false,"world":"world","x":19,"y":71,"z":157,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GRANITE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.4,"type":1,"unlimited":false,"world":"world","x":18,"y":71,"z":157,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GRANITE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":17,"y":71,"z":157,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GRANITE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":16,"y":71,"z":157,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GRANITE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":15,"y":71,"z":157,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: GRANITE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":14,"y":71,"z":157,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_GRANITE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":12,"y":71,"z":157,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_GRANITE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":11,"y":71,"z":157,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_GRANITE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.5,"type":0,"unlimited":false,"world":"world","x":10,"y":71,"z":157,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_GRANITE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.4,"type":1,"unlimited":false,"world":"world","x":9,"y":71,"z":157,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_GRANITE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":8,"y":71,"z":157,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_GRANITE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":7,"y":71,"z":157,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NETHERRACK\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":21,"y":71,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NETHERRACK\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":20,"y":71,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NETHERITE_BLOCK\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":20132.0,"type":0,"unlimited":false,"world":"world","x":18,"y":71,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NETHERITE_BLOCK\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":16105.0,"type":1,"unlimited":false,"world":"world","x":19,"y":71,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NETHER_BRICKS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":15,"y":71,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NETHER_BRICKS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":16,"y":71,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NETHER_BRICK_FENCE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":13,"y":71,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NETHER_BRICK_FENCE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":14,"y":71,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NETHER_BRICK_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.5,"type":0,"unlimited":false,"world":"world","x":11,"y":71,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NETHER_BRICK_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.4,"type":1,"unlimited":false,"world":"world","x":12,"y":71,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NETHER_BRICK_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":9,"y":71,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NETHER_BRICK_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":10,"y":71,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NETHER_BRICK_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":7,"y":71,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: NETHER_BRICK_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":8,"y":71,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: STONE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":21,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: STONE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":20,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: STONE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.5,"type":0,"unlimited":false,"world":"world","x":19,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: STONE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.4,"type":1,"unlimited":false,"world":"world","x":18,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: STONE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":17,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: STONE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":16,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: STONE_BRICK_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":10,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: STONE_BRICK_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":0,"unlimited":false,"world":"world","x":9,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: STONE_BRICK_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":8,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: STONE_BRICK_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":7,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COBBLESTONE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":5,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COBBLESTONE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":0,"unlimited":false,"world":"world","x":4,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COBBLESTONE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.5,"type":0,"unlimited":false,"world":"world","x":3,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COBBLESTONE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.4,"type":1,"unlimited":false,"world":"world","x":2,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COBBLESTONE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":1,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COBBLESTONE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":0,"unlimited":false,"world":"world","x":0,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COBBLESTONE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":-1,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COBBLESTONE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":-2,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MOSSY_COBBLESTONE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":5,"y":73,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MOSSY_COBBLESTONE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":4,"y":73,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MOSSY_COBBLESTONE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.5,"type":0,"unlimited":false,"world":"world","x":3,"y":73,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MOSSY_COBBLESTONE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.2,"type":1,"unlimited":false,"world":"world","x":2,"y":73,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MOSSY_COBBLESTONE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":1,"y":73,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MOSSY_COBBLESTONE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":0,"y":73,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MOSSY_COBBLESTONE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":-1,"y":73,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: MOSSY_COBBLESTONE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":-2,"y":73,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: STONE_BRICKS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":14,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: STONE_BRICKS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":13,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: STONE_BRICK_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.5,"type":0,"unlimited":false,"world":"world","x":12,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: STONE_BRICK_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.4,"type":1,"unlimited":false,"world":"world","x":11,"y":71,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SMOOTH_STONE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":21,"y":73,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: SMOOTH_STONE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":20,"y":73,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CRACKED_STONE_BRICKS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":14,"y":73,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CRACKED_STONE_BRICKS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":13,"y":73,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CHISELED_STONE_BRICKS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":12,"y":73,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CHISELED_STONE_BRICKS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":11,"y":73,"z":151,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CHISELED_NETHER_BRICKS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":15,"y":73,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CHISELED_NETHER_BRICKS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":16,"y":73,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BLACKSTONE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":20,"y":71,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BLACKSTONE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.6,"type":0,"unlimited":false,"world":"world","x":21,"y":71,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BLACKSTONE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.65,"type":0,"unlimited":false,"world":"world","x":18,"y":71,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BLACKSTONE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.53,"type":1,"unlimited":false,"world":"world","x":19,"y":71,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BLACKSTONE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":16,"y":71,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BLACKSTONE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.6,"type":1,"unlimited":false,"world":"world","x":17,"y":71,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BLACKSTONE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":14,"y":71,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: BLACKSTONE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.6,"type":1,"unlimited":false,"world":"world","x":15,"y":71,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_BLACKSTONE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":11,"y":71,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_BLACKSTONE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.6,"type":0,"unlimited":false,"world":"world","x":12,"y":71,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_BLACKSTONE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":9,"y":71,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_BLACKSTONE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":0,"unlimited":false,"world":"world","x":10,"y":71,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_BLACKSTONE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":7,"y":71,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_BLACKSTONE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.6,"type":1,"unlimited":false,"world":"world","x":8,"y":71,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_BLACKSTONE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":5,"y":71,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_BLACKSTONE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.6,"type":1,"unlimited":false,"world":"world","x":6,"y":71,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CHISELED_POLISHED_BLACKSTONE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":11,"y":73,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CHISELED_POLISHED_BLACKSTONE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.6,"type":1,"unlimited":false,"world":"world","x":12,"y":73,"z":147,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":21,"y":73,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":20,"y":73,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE_BRICKS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":21,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE_BRICKS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":20,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE_BRICK_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.5,"type":0,"unlimited":false,"world":"world","x":19,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE_BRICK_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.2,"type":1,"unlimited":false,"world":"world","x":18,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE_BRICK_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":17,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE_BRICK_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":16,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE_BRICK_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":15,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE_BRICK_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":14,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_DEEPSLATE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":12,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_DEEPSLATE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":11,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_DEEPSLATE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":10,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_DEEPSLATE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.2,"type":1,"unlimited":false,"world":"world","x":9,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_DEEPSLATE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":8,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_DEEPSLATE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":7,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_DEEPSLATE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":6,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: POLISHED_DEEPSLATE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":5,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COBBLED_DEEPSLATE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":3,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COBBLED_DEEPSLATE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":2,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COBBLED_DEEPSLATE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.0,"type":0,"unlimited":false,"world":"world","x":1,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COBBLED_DEEPSLATE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.2,"type":1,"unlimited":false,"world":"world","x":0,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COBBLED_DEEPSLATE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":-1,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COBBLED_DEEPSLATE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":-2,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COBBLED_DEEPSLATE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":-3,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COBBLED_DEEPSLATE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":-4,"y":71,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CHISELED_DEEPSLATE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":19,"y":73,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CHISELED_DEEPSLATE\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":18,"y":73,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE_TILES\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":12,"y":73,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE_TILES\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":11,"y":73,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE_TILE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":10,"y":73,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE_TILE_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":9,"y":73,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE_TILE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":8,"y":73,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE_TILE_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":7,"y":73,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE_TILE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":6,"y":73,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: DEEPSLATE_TILE_WALL\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":5,"y":73,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CRACKED_DEEPSLATE_BRICKS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":17,"y":73,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CRACKED_DEEPSLATE_BRICKS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":16,"y":73,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CRACKED_DEEPSLATE_TILES\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":3.0,"type":0,"unlimited":false,"world":"world","x":15,"y":73,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CRACKED_DEEPSLATE_TILES\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":2.4,"type":1,"unlimited":false,"world":"world","x":14,"y":73,"z":145,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COPPER_BLOCK\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":70.0,"type":0,"unlimited":false,"world":"world","x":20,"y":71,"z":141,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: COPPER_BLOCK\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":56.0,"type":1,"unlimited":false,"world":"world","x":21,"y":71,"z":141,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CUT_COPPER_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":35.0,"type":0,"unlimited":false,"world":"world","x":18,"y":71,"z":141,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CUT_COPPER_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":28.0,"type":1,"unlimited":false,"world":"world","x":19,"y":71,"z":141,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CUT_COPPER_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":70.0,"type":0,"unlimited":false,"world":"world","x":16,"y":71,"z":141,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: CUT_COPPER_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":56.0,"type":1,"unlimited":false,"world":"world","x":17,"y":71,"z":141,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: WAXED_COPPER_BLOCK\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":70.0,"type":0,"unlimited":false,"world":"world","x":13,"y":71,"z":141,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: WAXED_COPPER_BLOCK\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":56.0,"type":1,"unlimited":false,"world":"world","x":14,"y":71,"z":141,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: WAXED_CUT_COPPER_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":11,"y":71,"z":141,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: WAXED_CUT_COPPER_SLAB\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":1,"unlimited":false,"world":"world","x":12,"y":71,"z":141,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: WAXED_CUT_COPPER_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":70.0,"type":0,"unlimited":false,"world":"world","x":9,"y":71,"z":141,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: WAXED_CUT_COPPER_STAIRS\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":56.0,"type":1,"unlimited":false,"world":"world","x":10,"y":71,"z":141,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: OBSIDIAN\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":1.0,"type":0,"unlimited":false,"world":"world","x":4,"y":71,"z":153,"extra":"QuickShop: {}\n"} -{"item":"item:\n \u003d\u003d: org.bukkit.inventory.ItemStack\n v: 2730\n type: OBSIDIAN\n","moderators":"{\"owner\":\"85725be8-413e-4087-b189-33bcb63fae8e\",\"staffs\":[]}","price":0.8,"type":1,"unlimited":false,"world":"world","x":5,"y":71,"z":153,"extra":"QuickShop: {}\n"} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/Flight.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/Flight.java deleted file mode 100644 index 6a57b0d9ffe14ff979e0f30b14e5c6733a60545d..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/Flight.java +++ /dev/null @@ -1,91 +0,0 @@ -package lc.minecraft.link; - -import org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import java.time.Instant; -import java.time.temporal.ChronoUnit; -import java.util.HashMap; - -/** - * This class handles powered flight mechanics for New Eden. - * - * @author Alex Leigh - */ -public class Flight { - // This depends on the player objects from Spigot always being the same - private static final int FLIGHT_TIME_SECS = 30; - private final HashMap fuel = new HashMap<>(); - private final ItemStack fuelUnit = new ItemStack(Material.POPPED_CHORUS_FRUIT, 1); - - public void tick() { - for (Player p : Bukkit.getServer().getOnlinePlayers()) { - // If the player is not survival, then we don't care about them at all. - if (p.getGameMode() == GameMode.SURVIVAL) { - // Is never null - ItemStack offHand = p.getInventory().getItemInOffHand(); - if (offHand.getType() == Material.ELYTRA) { - if(!p.getAllowFlight()) { - enableFlight(p); - } else { - if(!consumeFuelIfNeeded(p)) { - disableFlight(p); - } - } - } else { - if(p.getAllowFlight()) { - disableFlight(p); - } - } - } - } - } - - private void disableFlight(Player p) { - if(p.getAllowFlight()) { - p.setAllowFlight(false); - p.sendMessage("Elytra disengaged."); - } - } - - /** - * Initially enable flying for the user. For a zero-endurance user, this will consume 1 unit of fuel and reset - * the endurance time. - */ - private void enableFlight(Player p) { - if(consumeFuelIfNeeded(p)) { - p.setAllowFlight(true); - p.sendMessage("Elytra engaged. [fuel: " + FLIGHT_TIME_SECS + " seconds per 1 chorus fruit.]"); - } else { - p.sendMessage("Unable to engage Elytra. No fuel available."); - } - } - - private boolean hasFuelAvailable(Player p) { - for(ItemStack stack : p.getInventory()) { - if(fuelUnit.isSimilar(stack)) return true; - } - return false; - } - - /** - * Search the players inventory for a fuel item, and consume 1 if found. Returns true if a fuel - * item was successfully consumed. - */ - private boolean consumeFuelIfNeeded(Player p) { - Instant endurance = fuel.get(p); - if(endurance!=null && endurance.isAfter(Instant.now())) return true; - - if(hasFuelAvailable(p)) { - p.getInventory().removeItem(fuelUnit); - fuel.put(p, Instant.now().plus(60, ChronoUnit.SECONDS)); - p.sendMessage("1 unit of chorus fuel consumed by Elytra."); - return true; - } else { - return false; - } - } -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/LCMessages.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/LCMessages.java deleted file mode 100644 index 895986a4043f78b2dfeff0758137b6a7265c5e76..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/LCMessages.java +++ /dev/null @@ -1,5 +0,0 @@ -package lc.minecraft.link; - -public class LCMessages { - public static String LEIGHBOY = "LeighBoy 3000"; -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/LinkMicroService.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/LinkMicroService.java deleted file mode 100644 index 117954f2ea4500f4b72b5728dacff29316ccf3bb..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/LinkMicroService.java +++ /dev/null @@ -1,359 +0,0 @@ -package lc.minecraft.link; - -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldguard.WorldGuard; -import com.sk89q.worldguard.domains.DefaultDomain; -import com.sk89q.worldguard.protection.ApplicableRegionSet; -import com.sk89q.worldguard.protection.managers.RegionManager; -import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; -import com.sk89q.worldguard.protection.regions.ProtectedRegion; -import com.sk89q.worldguard.protection.regions.RegionContainer; -import lc.eo.EO; -import lc.eo.json.JsonInput; -import lc.eo.json.JsonOutput; -import lc.esp.sdk.ContentTypes; -import lc.esp.sdk.link23.schema.HeartbeatElementDAO; -import lc.esp.sdk.service.MicroService; -import lc.mecha.http.server.WebTransaction; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.mq.Fanout; -import lc.mecha.mq.Queue; -import lc.mecha.util.StringAccumulatorV2; -import lc.minecraft.link.bukkit.BukkitPlayerNameProvider; -import lc.minecraft.link.cmd.PlayerCommand; -import lc.minecraft.link.event.ChatMessage; -import lc.minecraft.link.land.Land; -import lc.minecraft.link.quickshop.QuickShopReader; -import lc.minecraft.link.sdk.schema.v1.LandMemberAddRequestElementDAO; -import lc.minecraft.link.sdk.schema.v1.LandMemberRemoveRequestElementDAO; -import lc.minecraft.link.sdk.schema.v1.SimpleResponseElementDAO; -import net.milkbowl.vault.economy.Economy; -import net.milkbowl.vault.economy.EconomyResponse; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.entity.Player; -import org.bukkit.plugin.RegisteredServiceProvider; - -import java.io.File; -import java.io.IOException; -import java.util.HashMap; -import java.util.Locale; -import java.util.UUID; - -import static org.bukkit.Bukkit.getServer; - -/** - * This class implements an Enhanced Services Platform - */ -public class LinkMicroService extends MicroService { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(LinkMicroService.class); - private final Fanout commandFanout; - private final Fanout chatFanout; - private final MinecraftLinkPlugin plugin; - private final HashMap cnts = new HashMap<>(); - - public LinkMicroService(EO serviceCfg, Fanout commandFanout, - Fanout chatFanout, MinecraftLinkPlugin plugin) throws IOException { - super(serviceCfg); - this.commandFanout = commandFanout; - this.chatFanout = chatFanout; - this.plugin = plugin; - - new Thread(new Runnable() { - @Override - public void run() { - while(true) { - logger.info("Request counts: {}", cnts); - try { - Thread.sleep(10*1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - } - }).start(); - } - - @Override - public void serviceRequest(WebTransaction request) throws Throwable { - try { - request.httpServletResponse.setContentType(ContentTypes.CONTENT_TYPE_JSON); - - String url = request.httpServletRequest.getRequestURI(); - Integer cnt = cnts.get(url); - if (cnt == null) cnt = 0; - cnt++; - cnts.put(url, cnt); - - try (JsonOutput out = new JsonOutput(request.httpServletResponse.getOutputStream())) { - switch (request.getPathInfo()) { - case "/v1/cmd/read": - cmdRead(out); - break; - case "/v1/chat/read": - chatRead(out); - break; - case "/v1/msg/write": - msgSend(new JsonInput(request.httpServletRequest.getInputStream())); - break; - case "/v1/land/create": - landBuy(out, new JsonInput(request.httpServletRequest.getInputStream())); - break; - case "/v1/shops/read": - shopsRead(out, new JsonInput(request.httpServletRequest.getInputStream())); - break; - case "/v1/land/member/add": - landMemberAdd(out, new JsonInput(request.httpServletRequest.getInputStream())); - break; - case "/v1/land/member/remove": - landMemberRemove(out, new JsonInput(request.httpServletRequest.getInputStream())); - break; - default: - request.httpServletResponse.setStatus(404); - } - } - - cnt = cnts.get(url); - if (cnt != null) { - if (cnt > 0) { - cnt--; - cnts.put(url, cnt); - } - } - - // Experiment - request.httpServletResponse.getOutputStream().close(); - } catch (Exception e) { - logger.error("Request failed: {}", e); - throw e; - } - } - - /** - * This API call returns a continuously streaming response of every /lc command which is entered by a user. - */ - public void cmdRead(JsonOutput out) throws IOException, InterruptedException { - EO heartbeat = HeartbeatElementDAO.create(); - - try (Queue q = commandFanout.createQueue()) { - while (true) { - PlayerCommand cmd = q.read(); - if(cmd==null) { - out.writeEO(heartbeat); - } else { - out.writeEO(cmd.makeEo()); - } - out.flush(); - } - } - } - - public void chatRead(JsonOutput out) throws IOException, InterruptedException { - try (Queue q = chatFanout.createQueue()) { - while (true) { - if (q == null) return; - ChatMessage cmd = q.read(); - if (cmd == null) return; - EO cmdEo = cmd.getAsEO(); - out.writeEO(cmdEo); - out.flush(); - } - } - } - - private void msgSend(JsonInput in) throws IOException { - EO request = in.readEo(); - logger.info("Got msg send request: {}", request); - UUID dstId = request.getValueUUID("dstId"); - if (dstId != null) { - String msg = request.getValueString(MinecraftLinkConstants.MSG_KEY); - plugin.sendMessage(dstId, msg); - } else { - String dst = request.getValueString(MinecraftLinkConstants.DST_KEY); - String msg = request.getValueString(MinecraftLinkConstants.MSG_KEY); - plugin.sendMessage(dst, msg); - } - } - - /** - * Enumerate the contents of the QuickShops export file to the caller. This data will be current as-of whenever - * the export file was created, which gives the opportunity to introduce market reporting delays and other - * effects & manipulations. - */ - private void shopsRead(JsonOutput out, JsonInput in) throws IOException { - QuickShopReader qsr = new QuickShopReader(new File("/opt/mc/plugins/QuickShop/export.txt"), - new BukkitPlayerNameProvider()); - for (EO obj : qsr.getShops()) { - out.writeEO(obj); - } - } - - private void landMemberRemove(JsonOutput out, JsonInput in) throws IOException { - EO request = in.readEo(); - EO reply = SimpleResponseElementDAO.create(); - - UUID owner = LandMemberRemoveRequestElementDAO.getSrc(request); - String player = LandMemberRemoveRequestElementDAO.getPlayer(request); - String lotName = LandMemberRemoveRequestElementDAO.getLot(request); - - // TODO: Add support for other worlds - World world = Bukkit.getWorld("world"); - RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer(); - RegionManager regions = container.get(BukkitAdapter.adapt(world)); - - ProtectedRegion lot = regions.getRegions().get(lotName); - if (lot == null) { - SimpleResponseElementDAO.setMsg(reply, "Could not find lot: " + lotName); - out.writeEO(reply); - return; - } - - DefaultDomain owners = lot.getOwners(); - if (!owners.contains(owner)) { - SimpleResponseElementDAO.setMsg(reply, - "Permission denied."); - out.writeEO(reply); - return; - } - - // TODO: Do we want to allow the owner to add themself as a member also? - DefaultDomain members = lot.getMembers(); - if (!members.contains(player)) { - SimpleResponseElementDAO.setMsg(reply, - "That Survivor is not a member of that lot."); - out.writeEO(reply); - return; - } - - // TODO: What happens if there is no such player? - members.removePlayer(player); - - SimpleResponseElementDAO.setMsg(reply, - "Survivor removed from lot."); - out.writeEO(reply); - } - - private void landMemberAdd(JsonOutput out, JsonInput in) throws IOException { - EO request = in.readEo(); - EO reply = SimpleResponseElementDAO.create(); - - UUID owner = LandMemberAddRequestElementDAO.getSrc(request); - String player = LandMemberAddRequestElementDAO.getPlayer(request); - String lotName = LandMemberAddRequestElementDAO.getLot(request); - - // TODO: Add support for other worlds - World world = Bukkit.getWorld("world"); - RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer(); - RegionManager regions = container.get(BukkitAdapter.adapt(world)); - - ProtectedRegion lot = regions.getRegions().get(lotName); - if (lot == null) { - SimpleResponseElementDAO.setMsg(reply, "Could not find lot: " + lotName); - out.writeEO(reply); - return; - } - - DefaultDomain owners = lot.getOwners(); - if (!owners.contains(owner)) { - SimpleResponseElementDAO.setMsg(reply, - "Permission denied."); - out.writeEO(reply); - return; - } - - // TODO: Do we want to allow the owner to add themself as a member also? - DefaultDomain members = lot.getMembers(); - if (members.contains(player)) { - SimpleResponseElementDAO.setMsg(reply, - "That Survivor is already a member of this lot."); - out.writeEO(reply); - return; - } - - // TODO: What happens if there is no such player? - members.addPlayer(player); - - SimpleResponseElementDAO.setMsg(reply, - "Survivor added to lot."); - out.writeEO(reply); - } - - /** - * Perform a land purchase operation. - *

- * This method verifies that the requested land area does not overlap an existing lot, unless that lot begins - * with "ctl-". The purchase operation calculates the size for the new lot based on the simple formula of - * M19/sqm. If the player has insufficient funds to complete the transaction, the land sale is blocked. - */ - // TODO: Is it safe to run this processing outside of a tick? - private void landBuy(JsonOutput out, JsonInput in) throws IOException { - logger.info("PROCESSING LAND BUY REQUEST"); - - EO request = in.readEo(); - EO reply = new EO(); - - Player p = Bukkit.getPlayer(request.getValueString(MinecraftLinkConstants.SRC_KEY)); - - int price = request.getValueInteger(MinecraftLinkConstants.PRICE); - RegisteredServiceProvider economyProvider = - getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class); - - // TODO: Verify math here, it may be truncating - double marbles = price / 100; - - // TODO: Add support for other worlds - World world = Bukkit.getWorld("world"); - RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer(); - RegionManager regions = container.get(BukkitAdapter.adapt(world)); - - BlockVector3 min = BlockVector3.at(request.getValueInteger(MinecraftLinkConstants.POS_X1), - Land.MIN_Y, - request.getValueInteger(MinecraftLinkConstants.POS_Z1)); - BlockVector3 max = BlockVector3.at(request.getValueInteger(MinecraftLinkConstants.POS_X2), - Land.MAX_Y, - request.getValueInteger(MinecraftLinkConstants.POS_Z2)); - - logger.info("Calculated min/max {} {}", min, max); - - // TODO: This leaks a lot # from the master sequence if there is a collision. - - String lotName = plugin.getRealmAbv() + "-" + plugin.getNewLotNumber(); - lotName = lotName.toUpperCase(Locale.getDefault()); - ProtectedRegion candidateLot = new ProtectedCuboidRegion(lotName, min, max); - ApplicableRegionSet set = regions.getApplicableRegions(candidateLot); - StringAccumulatorV2 sa = new StringAccumulatorV2(","); - - boolean foundCollision = false; - for (ProtectedRegion reg : set) { - // We ignore control zones, since they are for weather-mods, etc. - if (reg.getId().toLowerCase(Locale.getDefault()).startsWith("ctl-")) continue; - foundCollision = true; - sa.add(reg.getId()); - } - - if (foundCollision) { - reply.setValue(MinecraftLinkConstants.MSG_KEY, - "Could not create lot due to overlaps with existing lots: " + sa.asString()); - out.writeEO(reply); - return; - } - - DefaultDomain members = candidateLot.getOwners(); - members.addPlayer(p.getUniqueId()); - EconomyResponse er = economyProvider.getProvider().withdrawPlayer(p.getName(), marbles); - logger.info("Economy response: {} {}", er.transactionSuccess(), er.errorMessage); - - if (!er.transactionSuccess()) { - reply.setValue(MinecraftLinkConstants.MSG_KEY, "Insufficient funds."); - out.writeEO(reply); - return; - } - - // TODO: Transaction logging and auditing. - regions.addRegion(candidateLot); - reply.setValue(MinecraftLinkConstants.MSG_KEY, "Lot created. [name: " + lotName + "]"); - out.writeEO(reply); - } -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/MinecraftLinkConstants.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/MinecraftLinkConstants.java deleted file mode 100644 index 2671b1af5e67e1499d1027acbfac0c9e3d70c84f..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/MinecraftLinkConstants.java +++ /dev/null @@ -1,45 +0,0 @@ -package lc.minecraft.link; - -/** - * This class holds constants which are used for processing EO messages sent between the - * MinecraftLink service and clients. - * - * @author Alex Leigh - */ -@Deprecated -public class MinecraftLinkConstants { - @Deprecated - public static final String SRC_KEY = "src"; - @Deprecated - public static final String DST_KEY = "dst"; - @Deprecated - public static final String MSG_KEY = "msg"; - @Deprecated - public static final String CMD_KEY = "cmd"; - @Deprecated - public static final String ARGS_KEY = "args"; - @Deprecated - public static final String ARG_KEY = "arg"; - - @Deprecated - public static final String ARG_POS_X = "posX"; - @Deprecated - public static final String ARG_POS_Y = "posY"; - @Deprecated - public static final String ARG_POS_Z = "posZ"; - @Deprecated - public static final String ARG_POS_YAW = "yaw"; - @Deprecated - public static final String ARG_POS_PITCH = "pitch"; - - @Deprecated - public static final String POS_X1 = "x1"; - @Deprecated - public static final String POS_X2 = "x2"; - @Deprecated - public static final String POS_Z1 = "z1"; - @Deprecated - public static final String POS_Z2 = "z2"; - @Deprecated - public static final String PRICE = "price"; -} \ No newline at end of file diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/MinecraftLinkPlugin.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/MinecraftLinkPlugin.java deleted file mode 100644 index 0d7cfb0c188c680d37e4b20c7291190a963b85d8..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/MinecraftLinkPlugin.java +++ /dev/null @@ -1,213 +0,0 @@ -package lc.minecraft.link; - -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldguard.WorldGuard; -import com.sk89q.worldguard.protection.managers.RegionManager; -import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; -import com.sk89q.worldguard.protection.regions.ProtectedRegion; -import com.sk89q.worldguard.protection.regions.RegionContainer; -import lc.eo.EO; -import lc.esp.sdk.service.schema.v1.MicroServiceCfgElementDAO; -import lc.mecha.cred.Credential; -import lc.mecha.cred.CredentialConnection; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.minecraft.link.bukkit.BukkitEventHandler; -import lc.minecraft.link.bukkit.BukkitReputationEventHandler; -import lc.minecraft.link.cmd.LCCommandHandler; -import lc.minecraft.link.faction.Faction; -import lc.minecraft.link.faction.Reputation; -import lc.minecraft.link.item.XPBottle; -import lc.minecraft.link.land.Land; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.scheduler.BukkitRunnable; -import org.eclipse.jetty.util.StringUtil; - -import java.io.IOException; -import java.util.Map; -import java.util.UUID; - -/** - * This class implements a Bukkit plugin providing a RESTful API service compatible with the - * LEIGH&CO Enhanced Services Platform (ESP). The service may be used directly or may be placed - * onto an ESP grid behind a Kabe server. - *

- * The purpose of the service is to provide the means to author Minecraft extensions / plugins that - * run in a distributed fashion independently of the Bukkit server instance. This allows plugins - * to be added, removed, restarted dynamically without interfering or restarting the Bukkit server, - * provides insulation for the external services to be immune from server version changes, and opens - * the opportunity for the external services to be written in any programming language. - * - * @author Alex Leigh - */ -public class MinecraftLinkPlugin extends JavaPlugin { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(MinecraftLinkPlugin.class); - private final LCCommandHandler commandHandler; - private final BukkitEventHandler eventHandler; - private final Reputation reputation; - private final XPBottle xpBottle; - private int maxLot = 0; - private final String realmAbv = "ne"; - private final boolean fixLots = false; - - public MinecraftLinkPlugin() throws IOException { - FileConfiguration cfg = this.getConfig(); - - String reputationUrl = cfg.getString("reputationUrl"); - String reputationUser = cfg.getString("reputationUser"); - String reputationPassword = cfg.getString("reputationPassword"); - - reputation = new Reputation(new CredentialConnection(reputationUrl, - new Credential(reputationUser, reputationPassword)), new BukkitReputationEventHandler(), - new Faction()); - - xpBottle = new XPBottle(this); - eventHandler = new BukkitEventHandler(this, xpBottle); - commandHandler = new LCCommandHandler(reputation, xpBottle); - - String kabeUrl = cfg.getString("kabeUrl"); - String svcUri = cfg.getString("svcUri"); - - if (StringUtil.isEmpty(kabeUrl) || StringUtil.isEmpty(svcUri)) { - logger.error("kabeUrl and svcUri must be specified in config.yml. Aborting."); - return; - } - - EO serviceCfg = MicroServiceCfgElementDAO.create(); - MicroServiceCfgElementDAO.setKabeUrl(serviceCfg, kabeUrl); - MicroServiceCfgElementDAO.setSrcUri(serviceCfg, svcUri); - - LinkMicroService door = new LinkMicroService(serviceCfg, commandHandler.getPlayerCommandFanout(), - eventHandler.getChatFanout(), this); - - new Thread(door).start(); - } - - public void onEnable() { - getLogger().info("MinecraftLink mk1 Enabled"); - saveDefaultConfig(); - FileConfiguration config = getConfig(); - - initWorldGuard(); - - getLogger().info("Config: " + config); - Bukkit.getServer().getPluginManager().registerEvents(eventHandler, this); - getCommand("lc").setExecutor(commandHandler); - - Flight flight = new Flight(); - - Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { - @Override - public void run() { - flight.tick(); - } - }, 0L, 10L); - } - - public Reputation getReputation() { - return reputation; - } - - /** - * Interrogate the WorldGuard plugin to determine what our current lot sequence number is. - */ - // TODO: Move this into its on specific class now that the plugin does a lot of things - private void initWorldGuard() { - WorldGuard wg = WorldGuard.getInstance(); - logger.info("Found WG instance: {}", wg); - - // We just care about the main world at the moment - World world = Bukkit.getWorld("world"); - RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer(); - RegionManager regions = container.get(BukkitAdapter.adapt(world)); - - for (Map.Entry r : regions.getRegions().entrySet()) { - logger.info("Evaluating lot: {}", r.getKey()); - - ProtectedRegion rg = r.getValue(); - - if (r.getKey().startsWith("ne-")) { - int x = Integer.parseInt(r.getKey().substring(3)); - if (x > maxLot) maxLot = x; - - // Compatibility for lots that were created prior to 1.18. We want to expand their Y to reach the new - // dimensions. We only do this if they were previously 0 or 256 as this is what the landBuy() - // command is creating. - if (fixLots && rg instanceof ProtectedCuboidRegion) { - BlockVector3 minVec = rg.getMinimumPoint(); - BlockVector3 maxVec = rg.getMaximumPoint(); - - boolean modified = false; - - if (minVec.getBlockY() == 0) { - logger.info("Correcting Ymin on {}", r.getKey()); - minVec = BlockVector3.at(minVec.getX(), Land.MIN_Y, minVec.getZ()); - modified = true; - } - - if (maxVec.getBlockY() == 256) { - logger.info("Correcting Ymax on {}", r.getKey()); - maxVec = BlockVector3.at(maxVec.getX(), Land.MAX_Y, maxVec.getZ()); - modified = true; - } - - if (modified) { - ProtectedCuboidRegion newRegion = new ProtectedCuboidRegion(r.getKey(), minVec, maxVec); - newRegion.copyFrom(rg); - regions.addRegion(newRegion); - } - } - } - } - - logger.info("Located max region: {}", maxLot); - } - - public void onDisable() { - getLogger().info("MinecraftLink Disabled"); - } - - /** - * Send a message to the given player name on the Bukkit server, if they are logged in. - */ - public void sendMessage(String playerName, String msg) { - new BukkitRunnable() { - @Override - public void run() { - Player p = Bukkit.getPlayer(playerName); - logger.info("Found player: {}", p); - if (p != null) p.sendMessage(msg); - } - }.run(); - } - - public void sendMessage(UUID playerId, String msg) { - new BukkitRunnable() { - @Override - public void run() { - Player p = Bukkit.getPlayer(playerId); - logger.info("Found player: {}", p); - if (p != null) p.sendMessage(msg); - } - }.run(); - } - - /** - * Return the next sequence number to create a lot. It is acceptable if the caller does not actually - * use the sequence number, although one will be "consumed" regardless. - *

- * MTS: Safe. - */ - public synchronized int getNewLotNumber() { - return maxLot++; - } - - public String getRealmAbv() { - return realmAbv; - } -} \ No newline at end of file diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/PlayerNameProvider.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/PlayerNameProvider.java deleted file mode 100644 index e5dcc809517f1e0a9e4c514da6b511f33ff716b4..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/PlayerNameProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package lc.minecraft.link; - -import java.util.UUID; - -/** - * Classes implementing this interface are capable of converting a UUID playerId into a String playerName. - * - * @author Alex Leigh - */ -public interface PlayerNameProvider { - String getPlayerName(UUID playerId); -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/bukkit/BukkitCommandState.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/bukkit/BukkitCommandState.java deleted file mode 100644 index c4cef9dbe276a29171fcb4737c44aad04919fcba..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/bukkit/BukkitCommandState.java +++ /dev/null @@ -1,21 +0,0 @@ -package lc.minecraft.link.bukkit; - -import lc.mecha.cli.CommandState; -import org.bukkit.entity.Player; - -public class BukkitCommandState implements CommandState { - private final Player player; - - public BukkitCommandState(Player player) { - this.player = player; - } - - public Player getPlayer() { - return player; - } - - @Override - public void sendMessage(String msg) throws Exception { - player.sendMessage(msg); - } -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/bukkit/BukkitEventHandler.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/bukkit/BukkitEventHandler.java deleted file mode 100644 index cf5f2abe3e24842d0194e7679a485f56facf4b77..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/bukkit/BukkitEventHandler.java +++ /dev/null @@ -1,110 +0,0 @@ -package lc.minecraft.link.bukkit; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.mq.Fanout; -import lc.mecha.util.StringAccumulatorV2; -import lc.minecraft.link.MinecraftLinkPlugin; -import lc.minecraft.link.event.ChatMessage; -import lc.minecraft.link.item.XPBottle; -import net.milkbowl.vault.economy.Economy; -import org.apache.commons.lang.StringUtils; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.player.PlayerChatEvent; -import org.bukkit.event.player.PlayerItemConsumeEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.Damageable; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.plugin.RegisteredServiceProvider; - -import static org.bukkit.Bukkit.getServer; - -/** - * This class implements a {@link Listener} which instruments activity within a Minecraft server. - *

- * Since Bukkit does not support filtering of events in listeners (all listeners receive all events), - * to reduce server load, this class implements all event listeners for Rezrov and then distributes - * the events to other classes as required. Noted, that it is theoretically possible that some or all - * Minecraft implementations may cache the reflection results to provide a faster path optimization, - * we do not know that is the case universally and choose not to rely on it. - * - * @author Alex Leigh - */ -public class BukkitEventHandler implements Listener { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(BukkitEventHandler.class); - private final Fanout chatFanout = new Fanout<>(); - private Economy econ; - private final XPBottle xpBottle; - - public BukkitEventHandler(MinecraftLinkPlugin linkPlugin, XPBottle xpBottle) { - this.xpBottle = xpBottle; - RegisteredServiceProvider economyProvider = - getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class); - if (economyProvider != null) { - econ = economyProvider.getProvider(); - for (String bank : econ.getBanks()) { - linkPlugin.getLogger().info("Bank: " + bank); - } - } - } - - public Fanout getChatFanout() { - return chatFanout; - } - - @EventHandler - public void onPlayerItemConsume(PlayerItemConsumeEvent event) { - logger.info("onPlayerInteract. [cancelled: {}]", event.isCancelled()); - xpBottle.playerConsumeEvent(event); - } - - @EventHandler - public void onPlayerChat(PlayerChatEvent event) { - Player p = event.getPlayer(); - ChatMessage msg = new ChatMessage(p.getUniqueId(), p.getPlayerListName(), event.getMessage()); - new Thread(() -> chatFanout.write(msg)).start(); - } - - @EventHandler - public void onPlayerDeath(PlayerDeathEvent event) { - logger.info("Player has died. [p: {}]", event); - Player player = event.getEntity(); - - StringAccumulatorV2 sa = new StringAccumulatorV2(","); - - for (ItemStack item : player.getInventory()) { - if(item!=null) { - ItemMeta meta = item.getItemMeta(); - - if (meta instanceof Damageable) { - short maxDurability = item.getType().getMaxDurability(); - // 0 is undamaged. - int currentDamage = ((Damageable) meta).getDamage(); - // How many points of damage are left before the item breaks - int remaining = maxDurability - currentDamage; - // How many points of damage we therefore want to do - int todo = (int) (remaining * .55); - - logger.info("Item: [max: {}] [current: {}] [remaining: {}] [todo: {}]", - maxDurability, currentDamage, remaining, todo); - - // But we are not total assholes - if(currentDamage+todo>=maxDurability) todo = maxDurability-1; - - ((Damageable) meta).setDamage(currentDamage + todo); - item.setItemMeta(meta); - sa.pushUnique(item.getItemMeta().getDisplayName()); - } - } - } - - String things = sa.asString(); - if(!StringUtils.isEmpty(things)) { - // TODO: Grammar - player.sendMessage(sa.asString() + " receives 55% damage."); - } - } -} \ No newline at end of file diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/bukkit/BukkitPlayerNameProvider.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/bukkit/BukkitPlayerNameProvider.java deleted file mode 100644 index 37e5cb9fd813076b0ac992ae6986e0c7e7b59784..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/bukkit/BukkitPlayerNameProvider.java +++ /dev/null @@ -1,25 +0,0 @@ -package lc.minecraft.link.bukkit; - -import lc.minecraft.link.PlayerNameProvider; -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; - -import java.util.UUID; - -/** - * Implementation of {@link PlayerNameProvider} backed by Bukkit. - * - * @author Alex Leigh - */ -public class BukkitPlayerNameProvider implements PlayerNameProvider { - @Override - /** - * Return the name of the player. If the lookup fails for some reason (like that ID has never logged into - * the server), then the ID is returned in string form. - */ - public String getPlayerName(UUID playerId) { - OfflinePlayer p = Bukkit.getOfflinePlayer(playerId); - if(p==null) return null; - return p.getName(); - } -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/bukkit/BukkitReputationEventHandler.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/bukkit/BukkitReputationEventHandler.java deleted file mode 100644 index 368d8042e4e3c9ab8937ca514c173c7d9cdb5868..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/bukkit/BukkitReputationEventHandler.java +++ /dev/null @@ -1,36 +0,0 @@ -package lc.minecraft.link.bukkit; - -import lc.minecraft.link.faction.ReputationEventHandler; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -import java.util.UUID; - -/** - * Implementation of {@link ReputationEventHandler} for the Bukkit API. This implementation sends messages to the - * player when their reputation changes. - * - * @author Alex Leigh - */ -public class BukkitReputationEventHandler implements ReputationEventHandler { - @Override - public void reputationChanged(UUID playerId, String factionDisplayName, int delta) { - Player p = Bukkit.getPlayer(playerId); - if (p != null) { - if (delta >= 0) { - p.sendMessage("Your reputation with " + factionDisplayName + " has increased by " + delta + " points."); - } else { - int x = -delta; - p.sendMessage("Your reputation with " + factionDisplayName + " has decreased by " + x + " points."); - } - } - } - - @Override - public void reputationLevelChanged(UUID playerId, String factionDisplayName, String factionLevel) { - Player p = Bukkit.getPlayer(playerId); - if (p != null) { - p.sendMessage(factionDisplayName + " now consider you " + factionLevel + "!"); - } - } -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/bukkit/BukkitUtil.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/bukkit/BukkitUtil.java deleted file mode 100644 index 985373612b44316d3b2afbbe1ee22e3be9bcf7b0..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/bukkit/BukkitUtil.java +++ /dev/null @@ -1,95 +0,0 @@ -package lc.minecraft.link.bukkit; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import net.milkbowl.vault.economy.Economy; -import net.milkbowl.vault.economy.EconomyResponse; -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.plugin.RegisteredServiceProvider; - -import static org.bukkit.Bukkit.getServer; - -public class BukkitUtil { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(BukkitUtil.class); - - public static void giveItem(Player player, ItemStack stack, String title) { - Inventory inv = Bukkit.getServer().createInventory(player, 9, title); - inv.setItem(0, stack); - player.openInventory(inv); - } - - /** - * Attempt to charge the given amount to the player. If the player's balance is insufficient, an - * error message is sent to the player and false is returned. - */ - public static boolean chargeMoney(Player player, int amt) { - RegisteredServiceProvider economyProvider = - getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class); - EconomyResponse er = economyProvider.getProvider().withdrawPlayer(player, amt); - - logger.info("Economy response: {} {}", er.transactionSuccess(), er.errorMessage); - - if (!er.transactionSuccess()) { - player.sendMessage("Insufficient funds for transaction. [required: " + amt + "] [balance: " + er.balance + "]"); - } - - return er.transactionSuccess(); - } - - // Calculate amount of EXP needed to level up - public static int getExpToLevelUp(int level) { - if (level <= 15) { - return 2 * level + 7; - } else if (level <= 30) { - return 5 * level - 38; - } else { - return 9 * level - 158; - } - } - - // Calculate total experience up to a level - public static int getExpAtLevel(int level) { - if (level <= 16) { - return (int) (Math.pow(level, 2) + 6 * level); - } else if (level <= 31) { - return (int) (2.5 * Math.pow(level, 2) - 40.5 * level + 360.0); - } else { - return (int) (4.5 * Math.pow(level, 2) - 162.5 * level + 2220.0); - } - } - - // Calculate player's current EXP amount - public static int getPlayerExp(Player player) { - int exp = 0; - int level = player.getLevel(); - - // Get the amount of XP in past levels - exp += getExpAtLevel(level); - - // Get amount of XP towards next level - exp += Math.round(getExpToLevelUp(level) * player.getExp()); - - return exp; - } - - // Give or take EXP - public static int changePlayerExp(Player player, int exp) { - // Get player's current exp - int currentExp = getPlayerExp(player); - - // Reset player's current exp to 0 - player.setExp(0); - player.setLevel(0); - - // Give the player their exp back, with the difference - int newExp = currentExp + exp; - player.giveExp(newExp); - - // Return the player's new exp amount - return newExp; - } - -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/cmd/LCCommandHandler.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/cmd/LCCommandHandler.java deleted file mode 100644 index 7ba1c85e0ad9ea9febd94e95386dc7b2d8ebeae2..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/cmd/LCCommandHandler.java +++ /dev/null @@ -1,75 +0,0 @@ -package lc.minecraft.link.cmd; - -import lc.mecha.cli.CommandFrame; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.mq.Fanout; -import lc.minecraft.link.bukkit.BukkitCommandState; -import lc.minecraft.link.faction.Reputation; -import lc.minecraft.link.item.XPBottle; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -/** - * This class is the incoming, event-based link between Bukkit and the plugin. We register all of our handlers here, - * to reduce load on the server, which has to process each class registered for each event. - * - * @author Alex Leigh - */ -public class LCCommandHandler implements CommandExecutor { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(LCCommandHandler.class); - private final Fanout playerCommandFanout = new Fanout<>(); - private final Reputation reputation; - private final CommandFrame xpCommandFrame; - - public LCCommandHandler(Reputation reputation, XPBottle xpBottle) { - this.reputation = reputation; - xpCommandFrame = xpBottle.getCommandFrame(); - } - - public Fanout getPlayerCommandFanout() { - return playerCommandFanout; - } - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - logger.info("onCommand called. [sender: {}] [command: {}] [args: {}]", sender, command, args); - - // Note that bukkit strips the command LC - - if (args.length == 0) { - sender.sendMessage("Usage: /lc stuff"); - return true; - } - - // Hack in /lc xp. At this point args is something like "xp craft 10" - if ("xp".equals(args[0])) { - logger.info("XP command injection hack"); - try { - xpCommandFrame.handle(args, new BukkitCommandState(sender.getServer().getPlayer(sender.getName()))); - } catch (Exception e) { - e.printStackTrace(); - } - return true; - } - - // Hack in /lc rep - if ("rep".equals(args[0])) { - Player p = Bukkit.getPlayer(sender.getName()); - if (p != null) { - int factionId = Integer.parseInt(args[1]); - int delta = Integer.parseInt(args[2]); - reputation.adjustReputation(p.getUniqueId(), factionId, delta); - } - return true; - } - - PlayerCommand pc = new PlayerCommand(sender, command, args); - // TODO: Executor pool! - new Thread(() -> playerCommandFanout.write(pc)).start(); - return true; - } -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/cmd/PlayerCommand.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/cmd/PlayerCommand.java deleted file mode 100644 index 546244357fe2e2bf6c8cb7a5920f1196e532b4e8..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/cmd/PlayerCommand.java +++ /dev/null @@ -1,101 +0,0 @@ -package lc.minecraft.link.cmd; - -import lc.eo.EO; -import lc.eo.EOLoop; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.minecraft.link.MinecraftLinkConstants; -import org.bukkit.Location; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import java.util.Arrays; -import java.util.Objects; - -/** - * This class holds Bukkit-specific information about a client command invocation. - * - * @author Alex Leigh - */ -public class PlayerCommand { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(PlayerCommand.class); - private final CommandSender sender; - private final Command command; - private final String[] args; - - public PlayerCommand(CommandSender sender, Command command, String[] args) { - this.sender = sender; - this.command = command; - this.args = args; - } - - /** - * Return the sender for the command. - */ - public CommandSender getSender() { - return sender; - } - - /** - * Return the command. - */ - public Command getCommand() { - return command; - } - - public String[] getArgs() { - return args; - } - - /** - * Return the command data in EO format. This is suitable for sending out on the wire. - */ - public EO makeEo() { - EO cmd = new EO("leigh.minecraft.link.Command"); - cmd.setValue(MinecraftLinkConstants.SRC_KEY, sender.getName()); - - Player player = sender.getServer().getPlayer(sender.getName()); - Location loc = player.getLocation(); - - cmd.setValue(MinecraftLinkConstants.ARG_POS_X, loc.getBlockX()); - cmd.setValue(MinecraftLinkConstants.ARG_POS_Y, loc.getBlockY()); - cmd.setValue(MinecraftLinkConstants.ARG_POS_Z, loc.getBlockZ()); - cmd.setValue(MinecraftLinkConstants.ARG_POS_PITCH, loc.getPitch()); - cmd.setValue(MinecraftLinkConstants.ARG_POS_YAW, loc.getYaw()); - cmd.setValue("playerId", player.getUniqueId()); - - EOLoop argsLoop = cmd.getValueLoop(MinecraftLinkConstants.ARGS_KEY); - argsLoop.add(new EO().setValue("arg", command.getName())); - for (String arg : this.args) { - argsLoop.add(new EO().setValue("arg", arg)); - } - - return cmd; - } - - @Override - public String toString() { - return "PlayerCommand{" + - "sender=" + sender + - ", command=" + command + - ", args=" + Arrays.toString(args) + - '}'; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - PlayerCommand that = (PlayerCommand) o; - return Objects.equals(sender, that.sender) && Objects.equals(command, that.command) - && Arrays.equals(args, that.args); - } - - @Override - public int hashCode() { - int result = Objects.hash(sender, command); - result = 31 * result + Arrays.hashCode(args); - return result; - } -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/event/ChatMessage.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/event/ChatMessage.java deleted file mode 100644 index af91fc24d1a89266d74b6bb3a374c4b5d609a04d..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/event/ChatMessage.java +++ /dev/null @@ -1,35 +0,0 @@ -package lc.minecraft.link.event; - -import lc.eo.EO; -import lc.minecraft.link.sdk.schema.v1.ChatMessageElementDAO; - -import java.util.UUID; - -/** - * This mesage represents a chat message which originated on a Bukkit server. - * - * @author Alex Leigh - */ -public class ChatMessage { - private final UUID playerId; - private final String playerName; - private String message; - - public ChatMessage(UUID playerId, String playerName, String message) { - this.playerId = playerId; - this.playerName = playerName; - this.message = message; - } - - /** - * Convert this chat message into {@link EO} form and return it. The message will be created in accordance - * with the {@link ChatMessageElementDAO} schema. - */ - public EO getAsEO() { - EO msg = ChatMessageElementDAO.create(); - ChatMessageElementDAO.setSrcId(msg, playerId); - ChatMessageElementDAO.setSrcName(msg, playerName); - ChatMessageElementDAO.setMsg(msg, message); - return msg; - } -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/event/MoveEvent.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/event/MoveEvent.java deleted file mode 100644 index 0b6d0200473a77412b46815fab0840e5d547fa2a..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/event/MoveEvent.java +++ /dev/null @@ -1,18 +0,0 @@ -package lc.minecraft.link.event; - -import java.util.UUID; - -public class MoveEvent { - private final UUID entityId; - private final double oldX, oldY, oldZ, newX, newY, newZ; - - public MoveEvent(UUID entityId, double oldX, double oldY, double oldZ, double newX, double newY, double newZ) { - this.entityId = entityId; - this.oldX = oldX; - this.oldY = oldY; - this.oldZ = oldZ; - this.newX = newX; - this.newY = newY; - this.newZ = newZ; - } -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/faction/Faction.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/faction/Faction.java deleted file mode 100644 index ca08c212a2fecb84c99e2860aa0962f53794d26e..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/faction/Faction.java +++ /dev/null @@ -1,22 +0,0 @@ -package lc.minecraft.link.faction; - -public class Faction { - public final static int ID_LEIGHCO = 1; - public final static int ID_ISO = 2; - public final static int ID_RETURNER = 3; - public final static int ID_ENDER = 4; - - public String getDisplayText(int fid) { - switch (fid) { - case 1: - return "LEIGH&CO"; - case 2: - return "Isolationists"; - case 3: - return "Returners"; - case 4: - return "Ender-people"; - } - return "Unknown"; - } -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/faction/Reputation.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/faction/Reputation.java deleted file mode 100644 index 813ff9dcb76d631870b69af998f0d480d3bee4e5..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/faction/Reputation.java +++ /dev/null @@ -1,182 +0,0 @@ -package lc.minecraft.link.faction; - -import com.mchange.v2.c3p0.ComboPooledDataSource; -import lc.mecha.cred.Credential; -import lc.mecha.cred.CredentialConnection; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; - -import java.io.FileInputStream; -import java.io.IOException; -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Properties; -import java.util.UUID; - -/** - * This class manages faction reputation. Reputation is stored in MySQL in the lc_faction and lc_reputation - * tables. Reputation is associated with a given player via their UUID, and the tables are largely self - * explanatory. - * - * @author Alex Leigh - */ -public class Reputation { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(Reputation.class); - private final ComboPooledDataSource cpds; - private final ReputationEventHandler handler; - private final ReputationLevels levels = new ReputationLevels(); - private final Faction faction; - - public Reputation(CredentialConnection cred, ReputationEventHandler handler, Faction faction) { - this.handler = handler; - this.faction = faction; - cpds = new ComboPooledDataSource(); - cpds.setJdbcUrl(cred.getConnectionString()); - cpds.setUser(cred.getUsername()); - cpds.setPassword(cred.getPassword()); - } - - public static void main(String[] args) throws SQLException, IOException { - Properties p = new Properties(); - p.load(new FileInputStream("test.properties")); - - Reputation r = new Reputation(new CredentialConnection("jdbc:mysql://db1.leigh-co.com/neweden", - new Credential("neweden", p.getProperty("db1_neweden_password"))), new ReputationEventHandler() { - @Override - public void reputationChanged(UUID playerId, String factionDisplayName, int delta) { - logger.info("Reputation changed. [faction: {}] [delta: {}]", factionDisplayName, delta); - } - - @Override - public void reputationLevelChanged(UUID playerId, String factionDisplayName, String factionLevel) { - logger.info("Reputation changed. [faction: {}] [level: {}]", factionDisplayName, factionLevel); - } - }, new Faction()); - - UUID player = UUID.randomUUID(); - - r.adjustReputation(player, Faction.ID_LEIGHCO, 0); - r.adjustReputation(player, 1, 5000); - r.adjustReputation(player, 1, 10); - } - - /** - * Return the reputation for the given player with the given faction. If there is no faction in the database - * for this combination, 0 is returned instead. - *

- * This is an expensive synchronous call. - */ - public int getReputation(UUID playerId, int factionId) throws SQLException { - try (Connection con = cpds.getConnection()) { - try (PreparedStatement selectPs = con.prepareStatement("SELECT (standing) FROM lc_reputation WHERE player_uuid=? AND faction_id=?")) { - selectPs.setString(1, playerId.toString()); - selectPs.setInt(2, factionId); - try (ResultSet rs = selectPs.executeQuery()) { - if (rs.next()) { - return rs.getInt(1); - } else { - return 0; - } - } - } - } - } - - /** - * Increase or decrease standing with the given faction for the given player by the given amount. Do not - * call this method from within a tick, as it will crater TPS or lead to server instability. Call - * adjustReputationAsync() instead. - *

- * This method will not perform world-level business logic. - */ - private void adjustReputationSync(UUID playerId, int factionId, int amount) throws SQLException { - // We do this to avoid sending messages while in the txn - String levelChanged = null; - - try (Connection con = cpds.getConnection()) { - con.setAutoCommit(false); - try (PreparedStatement selectPs = con.prepareStatement("SELECT (standing) FROM lc_reputation WHERE player_uuid=? AND faction_id=?")) { - selectPs.setString(1, playerId.toString()); - selectPs.setInt(2, factionId); - - try (ResultSet rs = selectPs.executeQuery()) { - if (rs.next()) { - int oldAmt = rs.getInt(1); - int newAmt = oldAmt + amount; - - try (PreparedStatement insertPs = con.prepareStatement("UPDATE lc_reputation SET standing=? WHERE player_uuid=? AND faction_id=?")) { - insertPs.setInt(1, newAmt); - insertPs.setString(2, playerId.toString()); - insertPs.setInt(3, factionId); - insertPs.execute(); - } - - String oldLevel = levels.getDisplayText(oldAmt); - String newLevel = levels.getDisplayText(newAmt); - - if (!oldLevel.equals(newLevel)) { - levelChanged = newLevel; - } - } else { - try (PreparedStatement updatePs = con.prepareStatement("INSERT INTO lc_reputation (player_uuid,faction_id,standing) VALUES (?,?,?)")) { - updatePs.setString(1, playerId.toString()); - updatePs.setInt(2, factionId); - updatePs.setInt(3, amount); - updatePs.execute(); - } - - // If they had no rep before, but now do, we always announce it. - levelChanged = levels.getDisplayText(amount); - } - } - } - - con.commit(); - String factionName = faction.getDisplayText(factionId); - handler.reputationChanged(playerId, factionName, amount); - if (levelChanged != null) { - handler.reputationLevelChanged(playerId, factionName, levelChanged); - } - } - } - - /** - * Increase or decrease standing with the given faction for the given player by the given amount. This method - * is safe to call from within a tick. - *

- * This method will not perform world-level business logic. - */ - private void adjustReputationAsync(UUID playerId, int faction, int amount) { - // TODO Actually use a worker pool here - - new Thread(() -> { - try { - adjustReputationSync(playerId, faction, amount); - } catch (SQLException e) { - e.printStackTrace(); - } - }).start(); - } - - /** - * Adjust the reputation for the player, and perform world-specific business rules. - */ - public void adjustReputation(UUID playerId, int factionId, int amount) { - adjustReputationAsync(playerId, factionId, amount); - - int x = -amount / 2; - - if (x != 0) { - switch (factionId) { - case Faction.ID_LEIGHCO: - adjustReputationAsync(playerId, Faction.ID_RETURNER, x); - break; - case Faction.ID_RETURNER: - adjustReputationAsync(playerId, Faction.ID_LEIGHCO, x); - break; - } - } - } -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/faction/ReputationEventHandler.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/faction/ReputationEventHandler.java deleted file mode 100644 index 4f5c40e6bd046346a5fd0c21fe5d2929211acb7d..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/faction/ReputationEventHandler.java +++ /dev/null @@ -1,15 +0,0 @@ -package lc.minecraft.link.faction; - -import java.util.UUID; - -/** - * Classes implementing this interface can receive events when reputation changes occur for players. - * - * @author Alex Leigh - */ - -public interface ReputationEventHandler { - void reputationChanged(UUID playerId, String factionDisplayName, int delta); - - void reputationLevelChanged(UUID playerId, String factionDisplayName, String factionLevel); -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/faction/ReputationLevels.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/faction/ReputationLevels.java deleted file mode 100644 index 8d3430fe6890bdf3fe61b7c7798115f34342378f..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/faction/ReputationLevels.java +++ /dev/null @@ -1,17 +0,0 @@ -package lc.minecraft.link.faction; - -public class ReputationLevels { - public static int LEVEL_FRIENDLY = 3000; - public static int LEVEL_EXALTED = 43000; - - String getDisplayText(int amount) { - if (amount >= LEVEL_EXALTED) return "Exalted"; - if (amount >= 21000) return "Revered"; - if (amount >= 9000) return "Honored"; - if (amount >= LEVEL_FRIENDLY) return "Friendly"; - if (amount >= 0) return "Neutral"; - if (amount >= -3000) return "Unfriendly"; - if (amount >= -6000) return "Hostile"; - return "Hated"; - } -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/item/XPBottle.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/item/XPBottle.java deleted file mode 100644 index 37b93cdd585d95f8ae111947a663978cea6e5c49..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/item/XPBottle.java +++ /dev/null @@ -1,165 +0,0 @@ -package lc.minecraft.link.item; - -import lc.mecha.cli.CommandFrame; -import lc.mecha.cli.CommandHandler; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.NumberUtil; -import lc.minecraft.link.LCMessages; -import lc.minecraft.link.MinecraftLinkPlugin; -import lc.minecraft.link.bukkit.BukkitCommandState; -import lc.minecraft.link.bukkit.BukkitUtil; -import lc.minecraft.link.faction.Faction; -import lc.minecraft.link.faction.Reputation; -import lc.minecraft.link.faction.ReputationLevels; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.NamespacedKey; -import org.bukkit.entity.ExperienceOrb; -import org.bukkit.entity.Player; -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.persistence.PersistentDataType; - -/** - * This class contains routines for working with the LEIGHCO XP Bottles. The basic jist of this is that the XP - * bottle is a potion which has custom NBT tags on it identifying it as a LEIGH&CO potion bottle, and it stores some - * given number of points of XP. We provide an interact event handler to provide the effect when the player uses - * the bottle. The effect spawns an experience orb for the given number of points in front of the player. - * - * @author Alex Leigh - */ -public class XPBottle { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(XPBottle.class); - public static String ITEM_TYPE_KEY = "leigh.type"; - public static String XP_AMOUNT_KEY = "leigh.item.xpbottle.xp"; - public static String BOTTLE_TYPE = "leigh.item.xpbottle"; - // TODO: Set this to something proper - - private final NamespacedKey itemTypeKey; - private final NamespacedKey xpAmountKey; - private final CommandFrame xpFrame = new CommandFrame<>(); - - public XPBottle(MinecraftLinkPlugin plugin) { - itemTypeKey = new NamespacedKey(plugin, ITEM_TYPE_KEY); - xpAmountKey = new NamespacedKey(plugin, XP_AMOUNT_KEY); - - // TODO: It would be nice if the caller could craft multiple bottles at once. - - xpFrame.putCommand("display", new CommandHandler() { - @Override - public void handle(String[] cmd, BukkitCommandState state) throws Exception { - Player p = state.getPlayer(); - int currentExp = BukkitUtil.getPlayerExp(p); - p.sendMessage("Current experience: " + currentExp); - } - }); - - xpFrame.putCommand("craft", new CommandHandler() { - @Override - public void handle(String[] cmd, BukkitCommandState state) throws Exception { - logger.info("craft called. [len: {}] [cmd: {}]", cmd.length, cmd); - - if (cmd.length != 2) { - state.sendMessage("Usage: lcl xp craft [xp]"); - return; - } - - int amt; - try { - amt = Integer.parseInt(cmd[1]); - } catch (NumberFormatException e) { - state.sendMessage("Usage: lcl xp craft [xp]"); - return; - } - - // Check - Does the player have enough rep - Reputation rep = plugin.getReputation(); - int lcRep = rep.getReputation(state.getPlayer().getUniqueId(), Faction.ID_LEIGHCO); - if (lcRep < ReputationLevels.LEVEL_EXALTED) { - state.getPlayer().sendMessage("You must be Exalted with LEIGH&CO to craft XP bottles."); - return; - } - - // Check - Does the player have enough Xp - final Player p = state.getPlayer(); - int currentXp = BukkitUtil.getPlayerExp(p); - if (currentXp < amt) { - p.sendMessage("You have insufficient XP to craft the XP bottle. [remaining: " + currentXp + "]"); - return; - } - - // Check - Does the player have enough money - if (!BukkitUtil.chargeMoney(p, 100)) return; - - // We are all good! Process the change. - logger.info("give exp: {} {}", -amt, currentXp); - - p.giveExp(-amt); - BukkitUtil.giveItem(p, - getXPItem(amt), - LCMessages.LEIGHBOY); - } - }); - } - - public CommandFrame getCommandFrame() { - return xpFrame; - } - - public ItemStack getXPItem(int amt) { - ItemStack xp = new ItemStack(Material.POTION); - ItemMeta xpItem = xp.getItemMeta(); - - xpItem.getPersistentDataContainer().set(itemTypeKey, PersistentDataType.STRING, BOTTLE_TYPE); - xpItem.getPersistentDataContainer().set(xpAmountKey, PersistentDataType.INTEGER, amt); - - assert xpItem != null; - - // TODO: Human format the number - xpItem.setDisplayName(ChatColor.DARK_PURPLE + "XP (" + NumberUtil.humanSize(amt) + ")"); - xp.setItemMeta(xpItem); - - return xp; - } - - /** - * Returns true if this is a LEIGH&CO item of the given type. - */ - public boolean isItemType(ItemStack item, String type) { - String typ = item.getItemMeta().getPersistentDataContainer().get(itemTypeKey, PersistentDataType.STRING); - if (typ != null) { - return typ.equals(type); - } - return false; - } - - /** - * Call this on player use in case the use event is for an XP bottle. If it is, the mechanics will apply. If - * this was a handled event, the event will be cancelled by this method. - */ - public void playerConsumeEvent(PlayerItemConsumeEvent e) { - logger.info("XP bottle playerUseEvent called"); - if (e.getItem().getType() == Material.POTION) { - if (isItemType(e.getItem(), BOTTLE_TYPE)) { - logger.info("Determined bottle was a XP bottle"); - ExperienceOrb orb = e.getPlayer().getWorld().spawn(e.getPlayer().getLocation(), ExperienceOrb.class); - Integer amt = e.getItem().getItemMeta().getPersistentDataContainer().get(xpAmountKey, - PersistentDataType.INTEGER); - if (amt == null) { - logger.warn("Processed event for LEIGHCO XP Bottle, but no amount was stored in the bottle."); - return; - } - orb.setExperience(amt); - // Poof - // It is implied they consumed it from the hand - e.getPlayer().getInventory().setItem(EquipmentSlot.HAND, new ItemStack(Material.GLASS_BOTTLE)); - e.setCancelled(true); - } else { - logger.info("Determined bottle was not a LC bottle"); - } - } - } -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/land/Land.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/land/Land.java deleted file mode 100644 index b6f976e54a99b90da045e86bd67fc4f20d4637a4..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/land/Land.java +++ /dev/null @@ -1,6 +0,0 @@ -package lc.minecraft.link.land; - -public class Land { - public final static int MAX_Y = 319; - public final static int MIN_Y = -64; -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/quickshop/QuickShopReader.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/quickshop/QuickShopReader.java deleted file mode 100644 index e3df6463794e292bb91aa14852885182fba2ef9e..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/quickshop/QuickShopReader.java +++ /dev/null @@ -1,234 +0,0 @@ -package lc.minecraft.link.quickshop; - -import lc.eo.EO; -import lc.eo.EOLoop; -import lc.eo.json.JsonInput; -import lc.eo.yaml.YamlInput; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.minecraft.MarblesUtil; -import lc.minecraft.link.PlayerNameProvider; -import lc.minecraft.link.sdk.schema.v1.ShopElementDAO; -import lc.minecraft.link.sdk.schema.v1.ShopEnchantElementDAO; -import org.apache.commons.lang.WordUtils; - -import java.io.*; -import java.util.Locale; -import java.util.UUID; - - -/** - * This class reads a QuickShop exports file and converts it into EO format for transmission on the wire. - *

- * Note that this class does not produce the file; it must be created with the qs export command which - * may only be run from the Minecraft server console. - * - * @author Alex Leigh - * @author Brian Hair - */ -public class QuickShopReader { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(QuickShopReader.class); - public static final String PARAM_X = "x"; - public static final String PARAM_Y = "y"; - public static final String PARAM_Z = "z"; - public static final String PARAM_PRICE = "price"; - public static final String PARAM_OWNER = "owner"; - public static final String PARAM_TYPE = "type"; - public static final String PARAM_WORLD = "world"; - public static final String PARAM_MODERATORS = "moderators"; - - private final EOLoop shops = new EOLoop(); - - public QuickShopReader(File exports, PlayerNameProvider nameProvider) throws IOException { - InputStream is = new BufferedInputStream(new FileInputStream(exports)); - JsonInput jin = new JsonInput(is); - - int badCount = 0; - int items = 0; - - while (true) { - EO rawShop = jin.readEo(); - if (rawShop == null) break; - - logger.trace("Read raw shop: {}", rawShop); - - EO quickShop = ShopElementDAO.create(); - - ShopElementDAO.setX(quickShop, rawShop.get(PARAM_X).toString()); - ShopElementDAO.setY(quickShop, rawShop.get(PARAM_Y).toString()); - ShopElementDAO.setZ(quickShop, rawShop.get(PARAM_Z).toString()); - - ShopElementDAO.setPrice(quickShop, rawShop.get(PARAM_PRICE).toString()); - ShopElementDAO.setPriceLabel(quickShop, - MarblesUtil.formatGeneric(Double.parseDouble(rawShop.get(PARAM_PRICE).toString()))); - quickShop.setMetaValue(ShopElementDAO.KEY_PRICE, "currencyPrefix", "M", false); - ShopElementDAO.setWorld(quickShop, rawShop.get(PARAM_WORLD).toString()); - - String modsJson = rawShop.getValueString(PARAM_MODERATORS); - if(modsJson!=null) { - JsonInput ownerReader = new JsonInput(new StringBufferInputStream(modsJson)); - EO moderators = ownerReader.readEo(); - UUID id = UUID.fromString(moderators.getValueString(PARAM_OWNER)); - ShopElementDAO.setOwner(quickShop, id); - ShopElementDAO.setOwnerLabel(quickShop,nameProvider.getPlayerName(id)); - } - - // We allow this to bomb, because some malformed entries seem to. If-so, we just fail to emit them. - - try { - YamlInput yin = new YamlInput(new StringBufferInputStream(rawShop.getValueString("item"))); - EO obj = yin.readEo(); - items++; - EOLoop itemInfo = obj.getValueLoop("item"); - // It is not 1 object with 2 parameters, it is 2 objects with 1 - // parameter each. One pass gets the item name, other pass - // gets the enchantments if they exist. - for (EO itemObj : itemInfo) { - if (itemObj.contains("type")) { - String itemName = itemObj.getValue("type").toString().toLowerCase(Locale.getDefault()); - ShopElementDAO.setItem(quickShop, itemName); - ShopElementDAO.setItemLabel(quickShop, - WordUtils.capitalize(itemName.replace("_", " "))); - } else if (itemObj.contains("meta")) { - EOLoop meta = itemObj.getValueLoop("meta"); - for (EO metaObj : meta) { - EOLoop storedEnchants = null; - if (metaObj.contains("stored-enchants")) { - // Enchanted book - storedEnchants = metaObj.getValueLoop("stored-enchants"); - } else if (metaObj.contains("enchants")) { - // Other Items - storedEnchants = metaObj.getValueLoop("enchants"); - } else { - // No Enchants - continue; - } - - EOLoop shopEnchants = ShopElementDAO.getEnchants(quickShop); - - for (EO enchant : storedEnchants) { - for (String enchantName : enchant.getKeys()) { - EO storeEnchant = ShopEnchantElementDAO.create(); - ShopEnchantElementDAO.setName(storeEnchant, enchantName.toLowerCase(Locale.getDefault())); - ShopEnchantElementDAO.setNameLabel(storeEnchant, friendlyEnchantName(enchantName)); - ShopEnchantElementDAO.setLevel(storeEnchant, - Integer.parseInt(enchant.getValue(enchantName).toString())); - shopEnchants.add(storeEnchant); - } - } - } - } - } - - // NOTE! We cutely do this here to suppress the shop if it otherwise failed - shops.add(quickShop); - - } catch (Exception e) { - badCount++; - } - - int shopType = rawShop.getValueInteger("type"); - if (shopType == 0) { - quickShop.setValue(PARAM_TYPE, "sell"); - } else { - quickShop.setValue(PARAM_TYPE, "buy"); - } - } - - logger.debug("Parsed QuickShop file. [size: {}] [error: {}]", items, badCount); - } - - /** - * Convert a QuickShops enchantment name to a friendly name. The QS name seems to be the internal Minecraft name. - * An updated list of names can be found here: - * https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/enchantments/Enchantment.html - * which you can map to the friendly names here: - * https://minecraft.fandom.com/wiki/Enchanting - */ - private String friendlyEnchantName(String enchantName) { - switch (enchantName) { - case "ARROW_DAMAGE": - return "Power"; - case "ARROW_FIRE": - return "Flame"; - case "ARROW_INFINITE": - return "Infinity"; - case "ARROW_KNOCKBACK": - return "Punch"; - case "BINDING_CURSE": - return "Curse of Binding"; - case "CHANNELING": - return "Channeling"; - case "DAMAGE_ALL": - return "Sharpness"; - case "DAMAGE_ARTHROPODS": - return "Bane of Arthropods"; - case "DAMAGE_UNDEAD": - return "Smite"; - case "DEPTH_STRIDER": - return "Depth Strider"; - case "DIG_SPEED": - return "Efficiency"; - case "DURABILITY": - return "Unbreaking"; - case "FIRE_ASPECT": - return "Fire Aspect"; - case "FROST_WALKER": - return "Frost Walker"; - case "IMPALING": - return "Impaling"; - case "KNOCKBACK": - return "Knockback"; - case "LOOT_BONUS_BLOCKS": - return "Fortune"; - case "LOOT_BONUS_MOBS": - return "Looting"; - case "LOYALTY": - return "Loyalty"; - case "LUCK": - return "Luck of the Sea"; - case "LURE": - return "Lure"; - case "MENDING": - return "Mending"; - case "MULTISHOT": - return "Multishot"; - case "OXYGEN": - return "Respiration"; - case "PIERCING": - return "Piercing"; - case "PROTECTION_ENVIRONMENTAL": - return "Protection"; - case "PROTECTION_EXPLOSIONS": - return "Blast Protection"; - case "PROTECTION_FALL": - return "Feather Falling"; - case "PROTECTION_FIRE": - return "Fire Protection"; - case "PROTECTION_PROJECTILE": - return "Projectile Protection"; - case "QUICK_CHARGE": - return "Quick Charge"; - case "RIPTIDE": - return "Riptide"; - case "SILK_TOUCH": - return "Silk Touch"; - case "SOUL_SPEED": - return "Soul Speed"; - case "SWEEPING_EDGE": - return "Sweeping Edge"; - case "THORNS": - return "Thorns"; - case "VANISHING_CURSE": - return "Curse of Vanishing"; - case "WATER_WORKER": - return "Aqua Affinity"; - default: - return enchantName; - } - } - - public EOLoop getShops() { - return shops; - } -} diff --git a/lc-minecraft-link/src/main/java/lc/minecraft/link/test/MockPlayerNameProvider.java b/lc-minecraft-link/src/main/java/lc/minecraft/link/test/MockPlayerNameProvider.java deleted file mode 100644 index 11e35529a61261de9228718a0a2e0d0ce20a118e..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/java/lc/minecraft/link/test/MockPlayerNameProvider.java +++ /dev/null @@ -1,44 +0,0 @@ -package lc.minecraft.link.test; - -import lc.minecraft.link.PlayerNameProvider; - -import java.util.Objects; -import java.util.UUID; - -/** - * Mock implementation of {@link PlayerNameProvider} which is useful for testing outside of the Bukkit environment. - * - * @author Alex Leigh - */ -public class MockPlayerNameProvider implements PlayerNameProvider { - private final String fakeName; - - public MockPlayerNameProvider(String fakeName) { - this.fakeName = fakeName; - } - - @Override - public String getPlayerName(UUID playerId) { - return fakeName; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - MockPlayerNameProvider that = (MockPlayerNameProvider) o; - return Objects.equals(fakeName, that.fakeName); - } - - @Override - public int hashCode() { - return Objects.hash(fakeName); - } - - @Override - public String toString() { - return "MockUsernameProvider{" + - "fakeName='" + fakeName + '\'' + - '}'; - } -} diff --git a/lc-minecraft-link/src/main/resources/config.yml b/lc-minecraft-link/src/main/resources/config.yml deleted file mode 100644 index 3e7f05bb98633b70ea5b6b452ae24f4fb122b8d8..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/resources/config.yml +++ /dev/null @@ -1,9 +0,0 @@ -# Set this to the KABE URL -kabeUrl: https://leigh-co.com - -# Set this to the URI you wish to expose -svcUri: /minecraft/INSTANCEHERE/link - -reputationUrl: jdbc:mysql://db1.leigh-co.com/neweden -reputationUser: neweden -reputationPassword: pw \ No newline at end of file diff --git a/lc-minecraft-link/src/main/resources/plugin.yml b/lc-minecraft-link/src/main/resources/plugin.yml deleted file mode 100644 index 37038900f9d34d0a775f493f0cd7264642a0a6c5..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/main/resources/plugin.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: MinecraftLink -main: leigh.minecraft.link.MinecraftLinkPlugin -version: 1.0 -api-version: 1.17 -depend: [ WorldGuard,Vault,Quests ] -commands: - lc: - description: LEIGH&CO - usage: /lc \ No newline at end of file diff --git a/lc-minecraft-link/src/test/java/lc/minecraft/link/QuickShopReaderTest.java b/lc-minecraft-link/src/test/java/lc/minecraft/link/QuickShopReaderTest.java deleted file mode 100644 index 810c9ba7e713b40d8726a468150ba288eb3f6a58..0000000000000000000000000000000000000000 --- a/lc-minecraft-link/src/test/java/lc/minecraft/link/QuickShopReaderTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package lc.minecraft.link; - -import lc.eo.EO; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.minecraft.link.quickshop.QuickShopReader; -import lc.minecraft.link.test.MockPlayerNameProvider; - -import java.io.File; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.fail; - -public class QuickShopReaderTest { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(QuickShopReaderTest.class); - - public void testThing() throws Exception { - String currentDir = System.getProperty("user.dir"); - logger.info("CWD: {}", currentDir); - - //QuickShopReader reader = new QuickShopReader(new File("/Users/aleigh/massive/export.txt")); - QuickShopReader reader = new QuickShopReader(new File("quickshops.txt"), - new MockPlayerNameProvider("junit")); - - // Size check - Test file has 448 entries but some known malformed ones. - // 442 is the expected number of good values from 'export.txt'. - logger.info("Asserting number of shops"); - assertEquals(442, reader.getShops().size()); - - // Check that enchantment names have been converted to friendly text - // by checking the second character of the enchant string is lowercase. - logger.info("Asserting all enchantment names converted to friendly text."); - for (EO shop : reader.getShops()) { - if (shop.contains("enchants")) { - logger.debug("ITEM TYPE: {}", shop.getValueString("item")); - for (EO enchant : shop.getValueLoop("enchants")) { - logger.debug("ENCHANT: {}", enchant.getValueString("name")); - if (Character.isUpperCase(enchant.getValueString("name").charAt(1))) { - fail("Enchant name not converted to friendly text"); - } - } - } - } - - // Check that item names have a friendly name and it's Title Case. - logger.info("Asserting all items have a friendly name."); - for (EO shop : reader.getShops()) { - logger.debug("ITEM TYPE: {}", shop.getValueString("item")); - if (shop.contains("itemDisplayName")) { - logger.debug("ITEM FRIENDLY NAME: {}", shop.getValueString("item_friendly")); - String friendlyItemName = shop.getValueString("itemDisplayName"); - if (!Character.isUpperCase(friendlyItemName.charAt(0)) || !Character.isLowerCase(friendlyItemName.charAt(1)) ) { - fail("Friendly item name not title case for [" + friendlyItemName + "]"); - } - } else { - fail("No friendly name found for [" + shop.getValueString("item") + "]"); - } - } - } -} diff --git a/lc-minecraft-worldguard/build.gradle b/lc-minecraft-worldguard/build.gradle deleted file mode 100644 index 4a1597ebcc79143911ace913099d96038fb816fd..0000000000000000000000000000000000000000 --- a/lc-minecraft-worldguard/build.gradle +++ /dev/null @@ -1,22 +0,0 @@ - -plugins { - id 'java' - id 'java-library' - id 'application' -} - -group 'leigh' -version '1.0' -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -repositories { - mavenCentral() - mavenLocal() -} - -dependencies { - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' - api 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.11.2' - implementation project(':lc-mecha') -} \ No newline at end of file diff --git a/lc-mud/.gitignore b/lc-mud/.gitignore deleted file mode 100644 index ede7310f5aa22a8bb16f7393dedac5d9b0cba2c9..0000000000000000000000000000000000000000 --- a/lc-mud/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -kabe.log -velocity.log -.DS_Store -statistic.xml -.gradle -/*/build/ -/build/ -gradle-app.setting -!gradle-wrapper.jar -.gradletasknamecache -.idea/ -*.iml -out/ -.cache -node_modules -/*/.idea -.vi -/*/graph.eo -.vai -graph.bak -.idea -tests.vai -vds.log -hosts.json -tests.vai.old \ No newline at end of file diff --git a/lc-mud/LICENSE.md b/lc-mud/LICENSE.md deleted file mode 100644 index 226d1f25b12e58e21c29a6c1869d1ec05095d443..0000000000000000000000000000000000000000 --- a/lc-mud/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-mud/build.gradle b/lc-mud/build.gradle deleted file mode 100644 index 7b353a90521167b605da1c89e6d30692642a6460..0000000000000000000000000000000000000000 --- a/lc-mud/build.gradle +++ /dev/null @@ -1,23 +0,0 @@ -plugins { - id 'java' - id 'java-library' -} - -group 'leigh' -version '15.0' - -repositories { - mavenCentral() -} -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -dependencies { - api project(':lc-continuity') - api "org.apache.commons:commons-csv:1.5" - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/lc-mud/circle/README b/lc-mud/circle/README deleted file mode 100644 index 8fac82699e178a299408966a3e2c5c5ca83fd61e..0000000000000000000000000000000000000000 --- a/lc-mud/circle/README +++ /dev/null @@ -1,24 +0,0 @@ -Getting To Know Your "lib" Directory ------------------------------------------------------------------------------- - -etc/ Files maintained by the game which you should never touch while - the game is running. - -house/ Crash-save files for player houses. - -misc/ Miscellaneous database files such as fight messages, invalid names, - and socials. - -plralias/ All of your player's aliases are stored here in the same - three letter encoding scheme as the plrobjs/ directory. - -plrobjs/ The hierarchy containing player object files (i.e. crash files, - rent files, cryo-rent files, etc.). - -text/ Files meant to be directly read by players such as MOTD (message of - the day), help files, and the immortal handbook. You can change - these files while the game is running, and then have the mud re-read - them using the 'reboot' command. - -world/ The hierarchy of the world files (mobiles, objects, shops, rooms, - and zones). diff --git a/lc-mud/circle/etc/README b/lc-mud/circle/etc/README deleted file mode 100644 index adb56c9d1f08547026270721f7e8c63b1b83f2ca..0000000000000000000000000000000000000000 --- a/lc-mud/circle/etc/README +++ /dev/null @@ -1,8 +0,0 @@ - -/etc directory ------------------------------------------------------------------------------ - -These files are maintained by the game; you should never try to modify them -while the game is running. If you know what you're doing, you can safely -alter them when the game is down. - diff --git a/lc-mud/circle/etc/hcontrol b/lc-mud/circle/etc/hcontrol deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lc-mud/circle/etc/players b/lc-mud/circle/etc/players deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lc-mud/circle/etc/plrmail b/lc-mud/circle/etc/plrmail deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lc-mud/circle/etc/time b/lc-mud/circle/etc/time deleted file mode 100644 index 5cb81869d5c53ef486c6a14d1ddb07f8c720399d..0000000000000000000000000000000000000000 --- a/lc-mud/circle/etc/time +++ /dev/null @@ -1 +0,0 @@ -650336715 diff --git a/lc-mud/circle/house/README b/lc-mud/circle/house/README deleted file mode 100644 index 654b02aa4b8524cb6b751abdd05a5e893196ffe7..0000000000000000000000000000000000000000 --- a/lc-mud/circle/house/README +++ /dev/null @@ -1 +0,0 @@ -This directory is to save objects in player houses. diff --git a/lc-mud/circle/misc/bugs b/lc-mud/circle/misc/bugs deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lc-mud/circle/misc/ideas b/lc-mud/circle/misc/ideas deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lc-mud/circle/misc/messages b/lc-mud/circle/misc/messages deleted file mode 100644 index 8e288c7cdb989a816fb0ecee8f30245060ba072d..0000000000000000000000000000000000000000 --- a/lc-mud/circle/misc/messages +++ /dev/null @@ -1,887 +0,0 @@ -* Note: all lines between records which start with '*' are comments and -* are ignored. Comments can only be between records, not within them. -* -* This file is where the damage messages go for offensive spells, and -* skills such as kick and backstab. Also, starting with Circle 3.0, these -* messages are used for failed spells, and weapon messages for misses and -* death blows. -* -* All records must start with 'M' in the first column (for 'Message'). -* The next line must contain the damage number (defined in spells.h), -* then the messages (one per line): -* Death Message (damager, damagee, onlookers) -* Miss Message (damager, damagee, onlookers) -* Hit message (damager, damagee, onlookers) -* God message (damager, damagee, onlookers) -* -* All messages must be contained in one line. They will be sent through -* act(), meaning that all standard act() codes apply, and each message will -* automatically be wrapped to 79 columns when they are printed. '#' can -* be substituted for a message if none should be printed. Note however -* that, unlike the socials file, all twelve lines must be present for each -* record, regardless of any '#' fields which may be contained in it. - -*************************************************************************** -* Offensive Spells * -*************************************************************************** - -* Burning Hands -M - 5 -You have burned $N to death! -You have been burned to death by $n! -$n has burned $N to death! -You miss $N with your burning hands. -$n reaches for you with burning hands, but misses! -$n tries to burn $N, but $E escapes! -You burn $N with your hot little hands! -You cry out in pain as $n grabs you with burning hands! -$N cries out as $n burns $M! -Your attempt to burn $N nears BLASPHEMY!!! -The pitiful creature before you tries to burn you. -Unaware of the risks, $n tries to burn $N. - -* Call Lightning -M - 6 -Your lightning bolt kills $N! -You are electrocuted to death by a lightning bolt sent by $n! -The dead body of $N sizzles in the heat from a lightning bolt sent by $n! -Your lightning bolt scores the ground in front of $N, a misser! -The ground before you is scored as $n misses you with lightning! -$N jumps backwards in time to avoid lightning sent by $n! -You hit $N with your lightning, bullseye! -You are hit by lightning sent by $n, OUCH! -$N screams in pain as lightning from $n penetrates $M! -$N stops your lightning with a single gesture, BEWARE!!! -You stop $n's lightning with a sure hand, no time for children's games... -$n's lightning disappears as $N makes a simple gesture. - -* Chill Touch -M - 8 -You chill $N, remember to put flowers on $S grave... -You feel chilled by $n and then you feel no more -- R.I.P. -$n touches $N who slumps to the ground as a dead lump, rather chilly isn't it? -The atmosphere turns chilly as you miss $N! -You dodge $n and $s chill touch! -$n tries unsuccesfully to chill $N! -You chill $N! -You feel your life flowing away as $n chills you! -$n chills $N who suddenly seem less lively! -Are you trying to chill $N? -- what a joke!! -$n tries to chill you, what a laugh... -$N starts to laugh as $n turns chilly! - -* Color Spray -M - 10 -YOU KILLED $N!!! -- don't you feel ashamed... -Your head is filled with all the colors of the rainbow before it bursts! -$n makes $N into a colorful corpse! -Your spray of color misses $N -- what a dull world... -$n unsuccesfully tries to add color to your life! -$n splashes color everywhere except $N. -Your own private rainbow hits $N in the face -- WOWIE!! -A sudden burst of colors sends you reeling! -$n throws colors at $N who in vain tries to escape! -Your spray of colors turn into butterflies as $N frowns. -Your frown is enough to turn $n's color spray into little butterflies. -The air is filled with butterflies as $N frowns at $n's color spray. - -* Dispel Evil -M - 22 -$N is dissolved by your goodness. -$n dissolves you, you regret having been so evil, and die... -$n completely dissolves $N! -$N is unaffected by your goodness! -$n thinks that $e is really good, and tries to dispell you. -$N laughs at $n as $e tries to dispell $M! -$N shivers and suffers from $S evilness! -$n makes your soul hurt and suffer! -$n makes $N's evil spirit shiver and suffer! -Did you really expect $M to suffer? -$n unfruitfully tries to dispell you. -$n is stupid... - -* Earthquake -M - 23 -The earth opens beneath $N's feet and swallows $M whole! -The earth opens beneath your feet and swallows you whole! -The earth opens beneath $N's feet and swallows $M whole! -$N desperately tries to keep $S balance as the earth shakes beneath $S feet! -You desperately try to keep your balance as the earth shakes beneath your feet! -$N desperately tries to keep $S balance as the earth shakes beneath $S feet! -$N falls down and hurts $Mself! -You fall down and hurt yourself! -$N falls down and hurts $Mself! -$N gracefully levitates as the earth shifts beneath $S feet under $M. -You gracefully levitate as the earth shifts underneath you. -$N gracefully levitates as the earth shifts beneath $S feet under $M. - -* Energy Drain -M - 25 -$N crumples as you kill $M by draining $S energy! -As $n drains your last energy you look forward to the peace of the graveyard... -$n drains the energy of $N who crumples as a lifeless cocoon! -You need more draining lessons... -Luckily for you $n slept during draining-lessons! -$n fails to drain $N -- what a waste of energy! -You drain $N of some of $S energy! -You feel less energic as $n drains you! -$n drains $N -- what a waste of energy! -You waste energy trying to drain $N! -How amusing -- $n tries to drain you! -$N's eyes twinkle with laughter as $n tries to drain $M. - -* Fireball -M - 26 -Your fireball hits $N with full force, causing an immediate death! -As you burst into flames of death $n grins evilly... -The heat from a fireball from $n turns $N into a charred corpse! -Your fireball blooms few feet before $N who claps $S hands in wonder. -$n aims a fireball at you but it blooms few feet before you; you clap your hands at the show. -A fireball from $n misses $N -- what great fireworks around here!! -You throw a fireball at $N and have the satisfaction of seeing $M enveloped in flames! -You are enveloped in flames from a fireball sent by $n -- OUCH!! -$n smirks as $s fireball explodes into the face of $N! -How shameful to throw fireballs at a GOD!!! -You choose to ignore $n's shameful attempt to fireball you. -$n's fireball is tactfully ignored by $N. - -* Harm -M - 27 -As you finish the incantation of the spell, $N falls dead due to the amount of harm $E takes! -You feel light headed as $n completes a spell which causes you so much harm that you just snuff it. -As $n touches $M, $N takes the full brunt of a harm spell and collapses. Dead. -Swinging out at $N, you miss and your harm spell goes off harmlessly. -You duck out of the way of $n and $s harm spell misses you. -Showing remarkable dexterity, $N avoids $n's reach and subsequent harm spell. -You watch the pained expression on $N's face as you hit $M with your harm spell. -You grimace in pain as $n's harm spell strikes you. -A large grin crosses $n's face as $s harm spell causes $N grievous pain. -Harm a god? Are you serious? Of course $N avoids it casually. -$n tries to harm you. Poor sod. -What a buffoon! $n looks somewhat perturbed as $N ignores the recently cast harm spell. - -* Lightning Bolt -M - 30 -Your lightning bolt shatters $N to pieces! -You feel enlightened by the lightning bolt $n sends, and then all is darkness -- R.I.P.! -$N recieves the full blast of a lightning bolt from $n... and is no more. -Your aim goes from bad to worse, and your lightning bolt misses $N! -$n has bad aim and $s lightning bolt misses you! -$n tries to hit $N with a lightning bolt but only hits the sky! -The lightning bolt hits $N with full impact! -YOU'RE HIT! A lightning bolt from $n has reached its goal! -$N wavers under the impact of the lightning bolt sent by $n! -Your lightning bolt is extinguished as mighty $N moves $S ears! -You move your ears to extinguish $n's lightning bolt. -$N moves $S ears and $n's lightning bolt is extinguished! - -* Magic Missile -M - 32 -The magic missile tears away the remaining life of $N! -You only have time to notice $n uttering strange sounds before everything is dark! -The magic missile sent by $n causes $N to stagger and collaps in a lifeless heap! -The magic missile penetrates the air miles above $N. -You don't even have to duck as $n sends a magic missile way over your head. -$n tries in vain to correct the course of the magic missile meant to hit $N. -You watch with selfpride as your magic missile hits $N! -You stagger as a magic missile from $n hits you! -$n throws a magic missile at $N who staggers under the blow! -Your magic missile makes $N roar with laughter. -You can't help laughing as $n sends a magic missile at you. -$N starts to roar with laughter as $n sends a magic missile at $M. - -* Shocking Grasp -M - 37 -$N dies while looking rather shocked! -$n shocks you. Unfortunately your heart can't stand it... -$n reveals with a shock that $N has left $S body! -$N rather shockingly evades your grasp! -You nimbly dodge a shocking grasp from $n! -$N shockingly evades the grasp of $n! -You get a good hold of the shocked $N! -You get a shock as $n gets too close to you! -$N looks shocked as $n grasps at $M! -You shockingly realize you can't shock $N... -These puny creatures are shocking at times... -The atmosphere gets loaded as $n tries to shock $N! - -* Dispel Good -M - 46 -$N is dissolved by your evil. -$n dissolves you -- the price paid for leading a good life -- you die... -$n completely dissolves $N! -$N is unaffected by your evil! -$n thinks that $e is really evil, and tries to dispell you. -$N laughs at $n as $e tries to dispell $M! -$N shivers and suffers from $S goodness! -$n makes your soul hurt and suffer! -$n makes $N's good spirit shiver and suffer! -Did you really expect $M to suffer? -$n unfruitfully tries to dispell you. -$n is stupid... - -*************************************************************************** -* Offensive Skills * -*************************************************************************** - -* Backstab -M - 131 -$N makes a strange sound but is suddenly very silent as you place $p in $S back. -Suddenly $n stabs you in the back, R.I.P.... -$n places $p in the back of $N, resulting in some strange noises, a lot of blood, and a corpse. -$N quickly avoids your backstab and you nearly cut your own finger! -$n tries to backstab you, but you avoid $m! -$n tries to backstab $N but nearly cuts $s own finger! -$N makes a strange sound as you place $p in $S back! -Suddenly $n stabs you in the back! -$n places $p in the back of $N, resulting in some strange noises and some blood! -$N sends you a look that makes you forget all about backstabbing. -$n tries to backstab you, but changes $s mind. -$n tries to backstab $N, but changes $s mind. - -* Bash -M - 132 -$N doesn't recover from your bash! -- $E is dead. -As $n bashes at you, you give up living and die... -$N dies after $n has bashed $M! -As $N avoids your bash, you topple over and fall to the ground! -You dodge a bash from $n who loses $s balance and falls! -$N avoids being bashed by $n who loses $s balance and falls! -Your bash at $N sends $M sprawling! -$n sends you sprawling with a powerful bash! -$n sends $N sprawling with a powerful bash! -Your effort to bash $N sends YOU sprawling on the ground. -$n fruitlessly tries to bash you and is sent sprawling. -$n dares a bash at $N and is sent sprawling without touching $M. - -* Kick -M - 134 -Your kick at $N's kidneys made $M die. -$n kills you by kicking your kidneys in! -$N dies from $n's last kick in $S kidneys! -Your beautiful full-circle kick misses $N by a mile. -$n makes a nice balletstep which plants $s foot a mile above your head. -$n makes a nice balletstep which plants $s foot a mile above $N's head. -Your boots need polishing again -- blood all over them... -$n wipes $s boots in your face! -$n wipes $s boots in the face of $N! -$N makes you kick at a huge stone appearing from nowhere -- OUCH! -You make $n kick a huge stone appearing from nowhere -- *giggle* -$n starts kicking a huge stone which suddenly appears. -M - 134 -Your kick at $N's face splits $S head open -- yummy! -$n aims a kick at your face which splits your head in two! -$n neatly kicks $N's head into pieces -- YUMMY! -You miss your kick at $N's groin, much to $S relief... -$n misses a kick at your groin, you breathe lighter now... -$n misses a kick at $N's groin, much to $N's relief... -Your kick hits $N in the solar plexus! -You're hit in solar plexus, wow, this is breathtaking!! -$n kicks $N in solar plexus, $N is rendered breathless! -You attempt to kick $N but lose your balance and fall face down in some mud that has suddenly appeared. -When $n tries to kick you, you quickly make him fall in some mud you have created. -$n falls face down in some mud created by $N. - -*************************************************************************** -* Weapon Attacks * -*************************************************************************** - -* Hit -M - 300 -You punch $N's head with a blow that crushes $S skull! -$n punches your head with a blow that crushes your skull! -$n punches $N's head so hard that $S skull cracks open! -You swing your fist at $N, but miss $M! -You barely avoid $n's fist as $e takes a swing at you! -$N barely avoids a blow from $n! -# -# -# -Your fist flops as your body refuses to fight the mighty $N. -$n seems to be having trouble getting $s body to fight you!! -$n's body rebels against $m when $e tries to punch $N. -M - 300 -You punch $N in $S kidneys resulting in $S immediate death! -You recieve a punch in your kidneys which ends your worldly misery -- R.I.P.! -$n punches $N in the kidneys causing immediate death! -You wildly punch at the air, missing $N. -$n misses a wild punch at you. -$n practices shadow-boxing while $N takes a break. -# -# -# -Instead of letting you punch $M, $N forces you to play Punch and Judy!!! -You convince $n of playing Punch and Judy instead of punching you. -$N convinces $n that no punching is necessary. -M - 300 -You hit $N with such force that $S neck snaps in two! -$n hits you with such force that your neck snaps in two! -$N's neck is snapped in two by a powerful blow from $n! -You try to hit $N who easily avoids the blow. -$n tries to hit you but you easily avoid the blow. -$n tries to hit $N who easily avoids the blow. -# -# -# -You try to hit $N but hit yourself instead! -$n tries to hit you but you hits $mself instead! -$n tries to hit $N but hits $mself instead! -M - 300 -You hit $N with a blow that breaks $S spine! -$n hits you with a blow that breaks your spine! -$n hits $N with a blow that breaks $S spine! -$N ducks under your fist as you try to hit $M. -You duck under $n's fist as $e takes a swing at you. -$N ducks under $n's fist as $e takes a swing at $M. -# -# -# -It isn't polite to swing at a GOD! -$n tries to take a swing at you -- how pathetic! -$n pathetically tries to take a swing at $N - ha! - -* Sting -M - 301 -You drive a sting directly into the heart of $N, killing $M! -With a powerful driving force, $n's sting tears right through your chest causing instant death! -$n drives $s sting through $N's chest, killing $M! -You miss $N with your stinging blow! -$n drives $s stinging blow at you, barely missing! -You watch in fright as $n stings at $N, missing by mere inches! -# -# -# -Sting -- God... What are you thinking? -$n tries to sting you, somewhat comical to tell the truth. -$n stings at $N, then looks horrified as $N grins at $m! -M - 301 -You violently sting $N repeatedly, causing $S death! -You die a horrid death as $n stings you repeatedly all over your body! -As $n stings $N all over the place, $N falls lifeless to the ground. -You sting towards $N, but miss $M! -$n misses you with $s sting! -You watch on as $n stings at $N, but misses! -# -# -# -You sting at $N, and all that happens is that $E slaps himself as if a mosquito bit $M. -Was that a bee you just felt? Oh.. wait, it was just $n. -$N begins to slap at $Mself as $n tries to sting $M. - -* Whip -M - 302 -You whip $N's head right off of $S body! -$n whips your head right off of your body! -$n whips $N's head right off of $S body! -You crack your whip at $N but it hits you in the face! -$n cracks $s whip at you and it hits $m in the face! -$n cracks $s whip at $N but only hits $mself in the face! -# -# -# -You'd better stop before $N whips your butt. -Pathetic little $n is trying to whip you... how cute. -$n tries to whip $N - isn't he cute? -M - 302 -Your dextrous whip messily tears $N's torso right off! -$n's whip messily tears you right in half! -With an evil grin, $n messily whips $N in half! -You try to whip $N but whip the ground instead! -$n tries to whip you but whips the ground instead! -$n tries to whip $N but whips the ground instead! -# -# -# -Don't try to whip $N. -$n is trying to whip you. Yawn. -$n tries to whip $N - yawn. - -* Slash -M - 303 -You beautifully slash $N into two parts -- both dead. -Your upper body is disconnected from your legs as $n slashes at you -- R.I.P.! -$N is slashed in two by a masterful stroke of $n! -Your desperate slash at $N is easily avoided by $M. -You easily avoid a slash from $n. -$N nimbly avoids $n's slash. -# -# -# -Your cunning slash at $N is fruitless. -You nimbly stop a slash from $n. -$N stops a cunning slash from $n who looks disappointed. -M - 303 -Your slash at $N results in a pool of blood and $S immediate death! -Blood spurts all over as $n slashes at you. You die... -$n slashes at $N who colors everything red with blood from $S lethal wound. -You miss $N by an inch, curse that brat! -You manage to dodge $n's slash and laugh, HA! -$n's slash misses $N who laughs in sheer delight, HA! -# -# -# -Come on, what makes you think you can slash at a GOD?! -You barely register the puny creature before you... -The great $N seems to ignore $n's slashes. -M - 303 -$N cries out in agony as you slash $S ribcage open! -Your ribcage is slashed open by $n -- R.I.P.! -$n nicely dissects $N's ribcage with a single slash! -You try to slash $N but miss by a mile. -$n's slash misses you by a mile. -$n's slash at $N misses $M by a mile. -# -# -# -It's rude to try to slash a GOD, you know. -$n tries to slash you -- how rude! -$n tries to slash $N -- how rude! -M - 303 -Your powerful slash cleanly cuts off $N's head, which rolls away with a look of horror on it. -You briefly feel the sensation of flight as $n slices your head cleanly off! -$n cleanly slices off $N's head which rolls away with a look of horror on it! -$N is cooled by the breeze of your missed slash at $M. -$n cools you with the breeze of $s missed slash at you. -$n cools $N with the breeze of $s missed slash. -# -# -# -Yeah, right. -$n tries to slash you... yeah, right. -$n tries to slash $N... yeah, right. - -* Bite -M - 304 -You sink your teeth deep into $N's neck -- blood sprays everywhere! -$n sinks $s teeth deep into your neck, tearing your jugular vein to bits! -$n sinks $s teeth deep into $N's neck, tearing $S jugular vein to bits! -You snap your teeth at $N but miss him. -$n snaps $s teeth at you fiercly but misses. -$n fiercly snaps $s teeth at $N but misses the mark. -# -# -# -You attempt to bite $N. Ouch! That hurt! -$n tries to bite you, how funny. -$n tries to bite $N - funny, huh? -M - 304 -You bite $N through $S ribcage and into $S heart -- $e falls to the ground in agony. -$n bites you right through your ribcage and into your heart -- you fall to the ground writhing in agony... -$n's powerful jaw bites through $N's ribcage into $S heart -- $E falls to the ground writhing in agony! -You try to bite $N but bite your tongue instead. -$n tries to bite you but bites $s tongue instead! -$n tries to bite $N but bites $s own tongue instead! -# -# -# -Aren't you trying to bite off more than you can chew? -$n snaps at you but realizes $e is biting off more than $e can chew. -$n stupidly tries to bite off more than $e can chew by snapping at $N. - -* Bludgeon -M - 305 -You forcefully bludgeon $N whose head suddenly cracks open like a walnut! -$n bludgeons your head which cracks open like a walnut! -$n ruthlessly bludgeons $N whose head cracks open like a walnut! -You fruitlessly try to bludgeon $N. -You easily dodge $n's attempt to bludgeon you. -$n tries to bludgeon $N who easily avoids the blow. -# -# -# -Your attempt to bludgeon $N fails, luckily for you $N has a good sense of humor! -Your patience is tried when $n tries to clobber you. -$N restrains $Mself from zapping $n when $e attempts to bludgeon the mighty one. -M - 305 -Your relentless bludgeoning of $N finally results in $S broken neck! -$n's relentless bludgeoning of you finally results in your broken neck! -$n's relentless bludgeoning of $N finally results in $N's broken neck! -You try to bludgeon $N who simply laughs at you. -$n tries to bludgeon you, but you avoid $m and laugh. -$N laughs at $n's attempt to bludgeon $M. -# -# -# -Your attempt to bludgeon $N fails, luckily for you $N has a good sense of humor! -Your patience is tried when $n tries to clobber you. -$N restrains $Mself from zapping $n when $e attempts to bludgeon the mighty one. - -* Crush -M - 306 -You crush $N right out of existence! -$n crushes you right out of existence! -$n crushes $N right out of existence! -You try to crush $N who jumps out of the way! -$n tries to crush you but you jump out of the way! -$n tries to crush $N who jumps out of the way! -# -# -# -A pox on thee and thy pitiful crush on $N! -$n seems to have a crush on you... -$n seems to have a crush on $N... -M - 306 -You crush $N's entire body, making a terrible mess! -$n crushes your entire body, making a terrible mess! -$n crushes $N's entire body, making a terrible mess! -You hopelessly try to crush $N. -$n hopelessly tries to crush you. -$n hopelessly tries to crush $N. -# -# -# -A pox on thee and thy pitiful crush on $N! -$n seems to have a crush on you... -$n seems to have a crush on $N... - -* Pound -M - 307 -You pound $N right into the ground! -$n pounds you six feet under. -$n pounds $N mightily on the head, crushing $S entire body! -You pound at the air as $N nimbly steps out of the way! -You jump out of the way in a panic as $n pounds at you! -$n looks perturbed as $s pound misses $N! -# -# -# -You pound $N! And $E thanks you for it? *boggle* -$n gives you a pound. Wonder what the exchange rate is... -$n starts giving pounds to $N who begins to count the money. -M - 307 -You pound on $N with reckless abandon when you realize that $E is dead. -With $s reckless pounding attacks, you succomb to death. -$N falls under $n's pounding blows, yet $n continues $s attack! -You hear the air whistle as you split the air with your pound! -$n pounds in your direction, causing a whistling sound! -With a loud whistle through the air, $n misses $s pounding attack upon $N! -# -# -# -Who are you trying to kid? -Hmmm... I think you missed the joke that $n was trying to tell you. -$N looks somewhat perplexed as $n tries to pound him! - -* Claw -M - 308 -You claw $N's face right off! -$n claws your face right off! -$n claws $N's face right off! -You try to claw at $N but miss! -$n tries to claw at you but misses by a hair! -$n tries to claw at $N, missing by a hair! -# -# -# -You dummy! Not the claw, the claw! -$n must be crazy - trying to claw at you! -$n must be crazy - trying to claw at $N! -M - 308 -Your razor-sharp claws rip $N wide open! -$n's razor-sharp claws rip you wide open! -$n's razor-sharp claws rip $N wide open! -You try to claw at $N but almost nick yourself instead! -$n tries to claw at you but nearly nicks $mself instead! -$n tries to claw at $N but nearly nicks $mself instead! -# -# -# -You dummy! Not the claw, the claw! -$n must be crazy - trying to claw at you! -$n must be crazy - trying to claw at $N! - -* Maul -M - 309 -You maul $N across the chest and $E screams in pain as $E falls lifeless to the ground. -As $n mauls you in the chest, you feel a searing pain... then nothing. -With a brutal maul to the chest, $n slaughters $N! -You swing wildly with your maul, almost hitting yourself! -Phew! $n missed you with $s wild maul! -$n mauls at $N, missing wildly! -# -# -# -Mauling a God? What would your poor mother think? Of course, you probably wouldn't hesitate to maul her too. -$n tries to maul you, and as $e fails, looks quite horrified. How pleasant. -$N laughs as $n tries to maul $M. How comical. - -* Thrash -M - 310 -You bring $N within the thrashing of $S life, and then thrash $M one last time, killing $M. -$n thrashes you violently, and you die. -With a horrible thrashing, $N falls lifeless under $n's blows! -You miss your thrash against $N! -What a stroke of luck, $n seems to have missed you with $s thrash! -$n thrashes madly at $N, missing $M! -# -# -# -Thrash a God? More likely that $N would thrash you, don't you think? -What a fool, $n tried to thrash you. *sigh* -Looking rather silly, $n tries to thrash at $N. - -* Pierce -M - 311 -You succesfully pierce $N and $S dead body falls to the ground in a lifeless heap. -$n pierces you. You are no longer a living member of this world -- R.I.P.! -$n pierces $N whose suddenly lifeless body falls to the ground! -You try to pierce $N but pierce the air instead! -$n pierces holes in the air. -$n tries to pierce air instead of fighting $N. -# -# -# -The mighty $N begins to think you a nuisance!!! -Your patience is almost gone when you stare back at $n. -The air is loaded when $N angrily wards off a piercing attack from $n. -M - 311 -You pierce $N's heart, you heartbreaker you... -$n breaks your heart, goodbye cruel world... -$n pierces the heart of $N who falls to the ground clutching at the wound! -You lunge at $N without managing to pierce $M. -$n tries to pierce you but fails miserably. -$n lunges at $N but can't pierce $M. -# -# -# -The great $N sends you a piercing look, OOPS! -You return $n's pierce with a piercing look, hmmm... -$N returns $n's pierce with a piercing look, hmmm... - -* Blast -M - 312 -You blast $N with all of your might, killing $M! -With $s powerful blast, $n tears your life from your body! -$N falls lifeless as $n's blast rips $M apart! -You blast wildly, missing $N by a mere inch or two! -You skillfully avoid $n's wild blast! -$n misses $N with $s wild blast! What luck $N seems to have! -# -# -# -Are you kidding? What do you expect your feeble blast to do to $N? -Heh. $n tried to blast you. Good thing you have blastproof armour. -$n looks afraid of the consequences as $e tries fruitlessly to blast $N. - -* Punch -M - 313 -You punch at $N causing $S face to collapse under the blow, blood everywhere. Doesn't look like $N will recover. Ever. -$n's forceful punch causes you to see red, until you die shortly thereafter. -$n punches $N right in the face! There is blood everywhere, and $N seems to be dead! -You miss $N with your haymaker! -$n throws a haymaker at you which whistles by your ear! -$n just misses $N with a strong punch! -# -# -# -Punch a God? May be smarter to punch a wall for a bit. You might do more damage to it. -Is that a quiet whistling noise you hear as $n is swinging $s fist about? -$n looks like $e would prefer to have punched a wall rather than trying to punch $N. - -* Stab -M - 314 -You stab $N through the heart! Instant death! -$n drives a stab at you, it pierces your heart! RIP! -$n stabs brutally at $N, killing him as $N is impaled by $n! -You stab at $N, missing! -$n misses a particularily nasty stab in your direction! -$n stabs at $N! $e misses! -# -# -# -You stab at $N! Too bad $E's a god, huh? -$n stabs at you! Lucky for you that you are immune to this kind of thing. -You watch in pity as $n stabs towards $N missing in the most futile way possible! -M - 314 -You stab forth towards $N, hitting $M in the abdomen causing a messy but mortal wound! -$n stabs you in the stomach, and you watch your insides fall out as you die. -Making a mess of $N, $n kills $M with a stab to the midsection. -You stab at $N, barely missing $M! -$n stabs at you, missing by a good mile or so! -$N grins at $n as the stab sent by $n goes wide! -# -# -# -Gods can't be stabbed, did noone ever teach you that? And $N just so happens to be one. -It sure is nice being a god isn't it... especially since $n can't hit you with $s stabs. -$n stabs at $N only to discover $N's immunity to stabbing weapons. - -* Suffering -M - 399 -# -You feel wounded -- too wounded -- you die... -$N lies suffering on the ground until no blood is left in $S body. -# -suffer miss victim - should never see. -suffer miss room - should never see. -# -You lie on the ground suffering from your terrible wounds... -$N lies helplessly on the ground and suffers... -# -Suffer god victim - should never see. -Suffer god room - should never see. -M - 399 -# -You can only lie still as your last heartbeat ebbs... -$N suffers from bloodlack, and the lack of a beating heart... -# -suffer miss victim - should never see. -suffer miss room - should never see. -# -You lie on the ground suffering from bleeding wounds... -$N lies immobile on the ground, suffering... -# -Suffer god victim -- should never see. -Suffer god room -- should never see. - -* Poison -M - 33 -# -Poison burns intensely in your veins... you shiver... you die. -$N has a few cramps and dies, suffering. -# -suffer miss victim - should never see. -suffer miss room - should never see. -# -You feel burning poison in your blood, and suffer. -$N looks really sick and shivers uncomfortably. -# -You have become poisoned somehow. -$N has somehow become poisioned. - - -*************************************************************************** -* NPC Attacks * -*************************************************************************** - -* Fire Breath -M - 202 -$N is killed by fire breath. -You are burned to ash, as $n breathes on you. -$n makes $N to ash. -$N is missed by fire breath. -$n breathes fire at you, but you avoids it. -$N avoids $n's firebreath. -$N is hit by fire breath. -$n burns you. -$N is partly made ash, as $n breaths fire. -$N, being immortal, is just warmed. -$n warms you. -$n warms $N. - -* Gas Breath -M - 203 -$N is killed by gas breath. -You die from the gas $n breathes on you. -$n kills $N with a gas breath. -$N is missed by gas breath. -$n breathes gas at you, but it has no effect. -$N avoids $n's gas. -$N is hit by gas breath. -$n gasses you. -$N is gassed by $n. -$N is immortal, so can't be gassed. -$n wants to gas you, but can't. -$n tries to gas $N, but can't. - -* Frost Breath -M - 204 -$N is killed by frost breath. -You are frozen to ice, as $n breathes on you. -$n makes $N to ice. -$N is missed by frost breath. -$n breathes frost at you, but you avoid it. -$N avoids $n's frost breath. -$N is hit by frost breath. -$n freezes you with $s breath. -$N is partly made ice, as $n breathes frost. -$N is immortal, and thus avoids your frost breath. -$n supplies you with air conditioning. -$n supplies $N with air conditioning. - -* Acid Breath -M - 205 -$N is killed by your acid breath. -You are corroded to nothing, as $n breathes on you. -$n corrodes $N to nothing. -$N is missed by acid. -$n breathes acid at you, but you avoids it. -$N avoids $n's acidbreath. -$N is hit by acid. -$n corrodes you. -$N is corroded as $n breaths acid. -$N is immortal, and thus is immune to acid. -$n helps you clean your hands with a little acid. -$n helps $N cleaning. - -* Lightning Breath -M - 206 -$N is killed by your lightning breath. -You are killed by $n's lightning breath. -$n killes $N with a lightning breath. -$N is missed by your lightning breath. -$n breathes lightning at you, but you avoids it. -$N avoids $n's lightning breath. -$N is hit by your lightning breath. -$n hits you with a lightning breath. -$N is hit by $n's lightning breath. -$N is immortal and immune to lightning breath. -$n tries to breath lightning upon you. -$n tries to breath lightning upon $N. - -$ diff --git a/lc-mud/circle/misc/socials b/lc-mud/circle/misc/socials deleted file mode 100644 index 07d772c28440ad217eec688eaff01ece318d3269..0000000000000000000000000000000000000000 --- a/lc-mud/circle/misc/socials +++ /dev/null @@ -1,796 +0,0 @@ -accuse 0 5 -Accuse who?? -# -You look accusingly at $M. -$n looks accusingly at $N. -$n looks accusingly at you. -Accuse somebody who's not even there?? -You accuse yourself. -$n seems to have a bad conscience. - -applaud 0 0 -Clap, clap, clap. -$n gives a round of applause. -# - -beg 0 0 -You beg the gods for mercy. (No way you're gonna get it! :-)) -The gods fall down laughing at $n's request for mercy. -You desperately try to squeeze a few coins from $M. -$n begs you for money. You gratiously let $m peep at your fortune. -$n begs $N for a dime or two -- or twenty! -Your money-lender seems to be out for the moment. -How? - begging yourself for money doesn't help. -# - -bleed 0 0 -You bleed profusely, making an awful mess... -$n bleeds profusely, making an awful mess... -# - -blush 0 0 -Your cheeks are burning. -$n blushes. -# - -bounce 0 0 -BOIINNNNNNGG! -$n bounces around. -# - -bow 0 5 -You bow deeply. -$n bows deeply. -You bow before $M. -$n bows before $N. -$n bows before you. -Who's that? -You kiss your toes. -$n folds up like a jacknife and kisses $s own toes. - -brb 0 0 -Come back soon! -$n will be right back! -# - -burp 0 0 -You burp loudly. -$n burps loudly. -# - -cackle 0 0 -You cackle gleefully. -$n throws back $s head and cackles with insane glee! -# - -chuckle 0 0 -You chuckle politely. -$n chuckles politely. -# - -clap 0 0 -You clap your small hands together. -$n shows $s approval by clapping $s small hands together. -# - -comb 0 0 -You comb your hair -- perfect. -$n combs $s hair, what a dashing specimen! -You patiently untangle $N's hair -- what a mess! -$n tries patiently to untangle $N's hair. -$n pulls your hair in an attempt to comb it. -That person is not here. -You pull your hair, but it will not be combed. -$n tries to comb $s tangled hair. - -comfort 0 5 -Do you feel uncomfortable? -# -You comfort $M. -$n comforts $N. -$n comforts you. -Comfort who? -You make a vain attempt to comfort yourself. -# - -cough 0 0 -Yuck, try to cover your mouth next time! -$n coughs loudly. -# - -cringe 1 0 -You cringe in terror. -$n cringes in terror! -You cringe away from $M. -$n cringes away from $N in mortal terror. -$n cringes away from you. -I don't see anyone by that name here.. what are you afraid of? -I beg your pardon? -# - -cry 0 5 -Waaaaah.. -$n bursts into tears. -You cry on $S shoulder. -$n cries on $N's shoulder. -$n cries on your shoulder. -Who's that? -You cry to yourself. -$n sobs quietly to $mself. - -cuddle 1 5 -Who do you feel like cuddling today? -# -You cuddle $M. -$n cuddles $N. -$n cuddles you. -They aren't here. -You must feel very cuddly indeed. :) -# - -curse 0 0 -You swear loudly for a long time. -$n swears: #@*"*&^$$%@*&!!!!!! -# - -curtsey 0 0 -You curtsey to your audience. -$n curtseys gracefully. -# - -dance 1 8 -Feels silly, doesn't it? -$n tries to dance breakdance but nearly breaks $s neck! -You lead $M to the dancefloor. -$n sends $N across the dancefloor. -$n sends you across the dancefloor. -Eh, WHO? -You skip and dance around by yourself. -$n skips a light Fandango. - -daydream 1 0 -You dream of better times. -$n looks absent-minded, $s eyes staring into space. -# - -drool 1 0 -You start to drool. -$n starts to drool. -You drool all over $N. -$n drools all over $N. -$n drools all over you. -Pardon?? -Sure, go ahead and drool...yuk! -$n drools on $mself. What a sight. - -embrace 0 0 -You reach but come away empty. :( -$n reaches out for an embrace, but no one is there. -You embrace $M warmly. -$n embraces $N warmly. -$n embraces you warmly. -Alas, your embracee is not here. -You embrace yourself?? -$n wraps his arms around himself for a warm self-embrace. - -fart 0 0 -Where are your manners? -$n lets off a real rip-roarer! -# - -flip 0 0 -You flip head over heels. -$n flips head over heels. -# - -flirt 1 5 -You flirt outrageously. -$n flirts outragously. -You flirt outrageously with $N. -$n flirts outrageously with $N. -$n flirts outrageously with you. -Sorry, your dearly beloved is not around. -You flirt with yourself. Must look stupid. -$n thinks $e is the most wonderful person in the world. - -fondle 0 5 -Who needs to be fondled? -# -You fondly fondle $M. -$n fondly fondles $N. -$n fondly fondles you. -You fondly try to fondle someone not in the room, but who cares. -You fondly fondle yourself, feels funny doesn't it? -$n fondly fondles $mself -- this is going too far!! - -french 0 0 -French whom?? -# -You give $N a long and passionate kiss, it seems to take forever... -$n kisses $N passionately. -$n gives you a long and passionate kiss, it seems to take forever... -Your heart is filled with despair as that person is not here. -You gather yourself in your arms and try to kiss yourself. -$n makes an attempt at kissing $mself. - -frown 0 0 -What's bothering you? -$n frowns. -# - -fume 1 5 -Take it easy now! Count to ten, very slowly. -$n grits $s teeth and fumes with rage. -You stare at $M, fuming. -$n stares at $N, fuming with rage. -$n stares at you, fuming with rage! -Fume away.. they ain't here. -That's right - hate yourself! -$n clenches $s fists and stomps his feet, fuming with anger. - -gasp 0 0 -You gasp in astonishment. -$n gasps in astonishment. -# - -giggle 0 0 -You giggle. -$n giggles. -# - -glare 0 5 -You glare at nothing in particular. -$n glares around $m. -You glare icily at $M. -$n glares at $N. -$n glares icily at you, you feel cold to your bones. -You try to glare at somebody who is not present. -You glare icily at your feet, they are suddenly very cold. -$n glares at $s feet, what is bothering $m? - -greet 0 0 -Greet Who? -# -You greet $m with a light kiss on his cheek. -$n greets $N with a light kiss on its cheek. -$n greets you with a light kiss on your cheek. -Please -- try someone who is here? -So, you've finally discovered yourself! -$n greets $mself.. $e always was a strange one. - -grin 0 0 -You grin evilly. -$n grins evilly. -# - -groan 0 0 -You groan loudly. -$n groans loudly. -# - -grope 0 5 -Whom do you wish to grope?? -# -Well, what sort of noise do you expect here? -$n gropes $N. -$n gropes you. -Try someone who's here. -You grope yourself -- YUCK. -$n gropes $mself -- YUCK. - -grovel 1 0 -You grovel in the dirt. -$n grovels in the dirt. -You grovel before $M -$n grovels in the dirt before $N. -$n grovels in the dirt before you. -Who? -That seems a little silly to me.. -# - -growl 0 0 -Grrrrrrrrrr... -$n growls. -# - -hiccup 0 0 -*HIC* -$n hiccups. -# - -hug 1 5 -Hug who? -# -You hug $M. -$n hugs $N. -$n hugs you. -Sorry, friend, I can't see that person here. -You hug yourself. -$n hugs $mself. - -kiss 0 0 -Isn't there someone you want to kiss? -# -You kiss $M. -$n kisses $N. -$n kisses you. -Never around when required. -All the lonely people :( -# - -laugh 0 0 -You fall down laughing. -$n falls down laughing. -# - -lick 0 0 -You lick your mouth and smile. -$n licks $s mouth and smiles. -You lick $M. -$n licks $N. -$n licks you. -Lick away, nobody's here with that name. -You lick yourself. -$n licks $mself -- YUCK. - -love 0 0 -You love the whole world. -$n loves everybody in the world. -You tell your true feelings to $N. -$n whispers softly to $N. -$n whispers to you sweet words of love. -Alas, your love is not present... -Well, we already know you love yourself (lucky someone does!) -$n loves $mself, can you believe it? - -massage 0 0 -Massage what, thin air? -# -You gently massage $N's shoulders. -$n massages $N's shoulders. -$n gently massages your shoulders...ahhhhhhhhhh... -You can only massage someone in the same room as you. -You practise yoga as you try to massage yourself. -$n gives a show on yoga-positions, trying to massage $mself. - -moan 0 0 -You start to moan. -$n starts moaning. -# - -nibble 0 0 -Nibble on who? -# -You nibble on $N's ear. -$n nibbles on $N's ear. -$n nibbles on your ear. -Sorry, not here, better go back to dreaming about it. -You nibble on your OWN ear??????????????????? -$n nibbles on $s OWN ear (I wonder how it is done!!). - -nod 1 0 -You nod solemnly. -$n nods solemnly. -# - -nudge 0 0 -Nudge? Nudge??? The HELL you say!!!! -# -You nudge $M with your elbow. -$n nudges $N suggestively with $s elbow. -$n nudges you suggestively. You two have an understanding. -Eh? That person isn't here, you know. -Well, just nudge yourself, but how do you get your elbow in that position? -$n nudges $mself with $s elbows, making $m look like a large chicken. - -nuzzle 1 5 -Nuzzle who?? -# -You nuzzle $S neck softly. -$n softly nuzzles $N's neck. -$n softly nuzzles your neck. -No.. they aren't here.. -I'm sorry, friend, but that's impossible. -# - -pat 0 0 -Pat who?? -# -You pat $N on $S head. -$n pats $N on $S head. -$n pats you on your head. -Who, where, what?? -You pat yourself on your head, very reassuring. -$n pats $mself on the head. - -peer 1 0 -You peer around you, uncertain that what you see is actually true. -$n peers around, looking as if $e has trouble seeing everything clearly. -# - -point 1 0 -You point whereto? -$n points in all directions, seemingly confused. -You point at $M -- $E DOES look funny. -$n muffles a laugh, pointing at $N. -$n points at you... how rude! -You must have a VERY long index-finger... -You point at yourself. Insinuating something? -$n points at $mself, suggesting that the center of matters is $e. - -poke 0 0 -Poke who?? -# -You poke $M in the ribs. -$n pokes $N in the ribs. -$n pokes you in the ribs. -You can't poke someone who's not here! -You poke yourself in the ribs, feeling very silly. -$n pokes $mself in the ribs, looking very sheepish. - -ponder 1 0 -You ponder over matters as they appear to you at this moment. -$n sinks deeply into $s own thoughts. -# - -pout 0 0 -Ah, don't take it so hard. -$n pouts. -# - -pray 0 0 -You feel righteous, and maybe a little foolish. -$n begs and grovels to the powers that be. -You crawl in the dust before $M. -$n falls down and grovels in the dirt before $N. -$n kisses the dirt at your feet. -No such person around; your prayers vanish into the endless voids. -Talk about narcissism... -$n performs some strange yoga-exercises and mumbles a prayer to $mself. - -puke 0 0 -You puke. -$n pukes. -You puke on $M. -$n pukes on $N. -$n pukes on your clothes! -Once again? -You puke on yourself. -$n pukes on $s clothes. - -punch 0 0 -Punch the air? Sure, go ahead, fine by me... -$n starts shadow-boxing. -You punch $M right in the face! Yuck, the BLOOD! -$n punches weakly at $N, missing by miles. -$n tries a punch at you but misses by a good quarter-mile... -Punch who? -You punch yourself in the face resulting in your own nose being bloodied. -$n punches $mself in the face, looking kind of stupid. - -purr 0 0 -MMMMEEEEEEEEOOOOOOOOOWWWWWWWWWWWW. -$n purrs contentedly. -# - -roll 1 0 -You roll your eyes in disgust. -$n rolls $s eyes in disgust. -You look at $M and roll your eyes in disgust. -$n looks at $N in contempt and rolls $s eyes with disgust. -$n stares at you and rolls $s eyes in digust. -Um... who? -You roll your eyes, disgusted with your own incompetence. -$n rolls $s eyes, disgusted with $mself. - -ruffle 0 0 -You've got to ruffle SOMEONE. -# -You ruffle $N's hair playfully. -$n ruffles $N's hair playfully. -$n ruffles your hair playfully. -Might be a bit difficult. -You ruffle your hair, wondering how far you can go before the rest think you're crazy. -$n ruffles $s hair -- weirdo! - -scream 0 0 -ARRRRRRRRRRGH!!!!! -$n screams loudly! -# - -shake 0 5 -You shake your head. -$n shakes $s head. -You shake $S hand. -$n shakes $N's hand. -$n shakes your hand. -Sorry good buddy, but that person doesn't seem to be here. -You are shaken by yourself. -$n shakes and quivers like a bowlful of jelly. - -shiver 0 0 -Brrrrrrrrr. -$n shivers uncomfortably. -# - -shrug 0 0 -You shrug. -$n shrugs helplessly. -# - -sigh 0 0 -You sigh. -$n sighs loudly. -# - -sing 0 0 -You raise your clear (?) voice towards the sky. -SEEK SHELTER AT ONCE! $n has begun to sing. -# - -slap 0 0 -Normally you slap SOMEBODY. -# -You slap $N. -$n slaps $N. -You are slapped by $n. -How about slapping someone in the same room as you?? -You slap yourself, silly you. -$n slaps $mself, really strange... - -smile 1 0 -You smile happily. -$n smiles happily. -You smile at $M. -$n beams a smile at $N. -$n smiles at you. -There's no one by that name around. -You smile at yourself. -$n smiles at $mself. - -smirk 0 0 -You smirk. -$n smirks. -# - -snap 0 0 -PRONTO! You snap your fingers. -$n snaps $s fingers. -# - -snarl 0 0 -You snarl like a viscious animal. -$n snarls like a cornered, viscious animal. -You snarl at $M angrily. Control yourself! -$n snarls angrily at $N. $e$u seems incapable of controlling $mself. -$n snarls viciously at you. $U$s self-control seems to have gone bananas. -Eh? Who? Not here, my friend. -You snarl at yourself, obviously suffering from schizophrenia. -$n snarls at $mself, and suddenly looks very frightened. - -sneeze 0 0 -Gesundheit! -$n sneezes. -# - -snicker 0 0 -You snicker softly. -$n snickers softly. -# - -sniff 0 0 -You sniff sadly. *SNIFF* -$n sniffs sadly. -# - -snore 0 0 -Zzzzzzzzzzzzzzzzz. -$n snores loudly. -# - -snowball 0 0 -Who do you want to throw a snowball at?? -# -You throw a snowball in $N's face. -$n conjures a snowball from thin air and throws it at $N. -$n conjures a snowball from thin air and throws it at you. -You stand with the snowball in your hand because your victim is not here. -You conjure a snowball from thin air and throw it at yourself. -$n conjures a snowball out of the thin air and throws it at $mself. - -snuggle 1 5 -Who? -# -you snuggle $M. -$n snuggles up to $N. -$n snuggles up to you. -They aren't here. -Hmmm... -# - -spank 0 8 -You spank WHO? Eh? How? Naaah, you'd never. -$n spanks the thin air with a flat hand. -You spank $M vigorously, long and hard. Your hand hurts. -$n spanks $N over $s knee. It hurts to even watch. -$n spanks you long and hard. You feel like a naughty child. -Are you sure about this? I mean, that person isn't even here! -Hmm, not likely. -# - -spit 0 0 -You spit over your left shoulder. -$n spits over $s left shoulder. -You spit on $M. -$n spits in $N's face. -$n spits in your face. -Can you spit that far? -You drool down your front. -$n drools down $s front. - -squeeze 0 0 -Where, what, how, WHO??? -# -You squeeze $M fondly. -$n squeezes $N fondly. -$n squeezes you fondly. -Where, what, how, WHO??? -You squeeze yourself -- try to relax a little! -$n squeezes $mself. - -stare 0 5 -You stare at the sky. -$n stares at the sky. -You stare dreamily at $N, completely lost in $S eyes.. -$n stares dreamily at $N. -$n stares dreamily at you, completely lost in your eyes. -You stare and stare but can't see that person anywhere... -You stare dreamily at yourself - enough narcissism for now. -$n stares dreamily at $mself - NARCISSIST! - -steam 0 0 -You let out some steam, much to the others' relief (and your own!) -$n lets out a lot of steam, much to your relief. -# - -stroke 0 0 -Whose thigh would you like to stroke? -# -You gently stroke $S inner thigh. -$n gently strokes $N's inner thigh... hmm... -$n gently strokes your inner thigh with feathery touches. -That person is not within reach. -You are about to do something you would rather not be caught doing. -$n starts to do something disgusting and then stops. - -strut 0 0 -Strut your stuff. -$n struts proudly. -# - -sulk 1 0 -You sulk. -$n sulks in the corner. -# - -tackle 0 5 -You tackle the air. It stands not a chance. -$n starts running around $mself in a desparate attempt to tackle the air. -You ruthlessly tackle $M to the ground. -$n ruthlessly tackles $N, pinning $M to the ground. -$n suddenly lunges at you and tackles you to the ground! -That person isn't here (luck for them, it would seem...) -Tackle yourself? Yeah, right.... -$n makes a dextrous move and kicks $s left leg away with $s right. - -tango 0 8 -With whom would you like to tango? -$n puts a rose between $s teeth, but takes out it since noone joins $m. -You put a rose between your teeth and tango with $M seductively. -$n puts a rose between $s teeth and tangos with $N seductively. -$n puts a rose between $s teeth and tangos with you seductively. -That person isn't around. Better sit this one out. -Feels rather stupid, doesn't it? -$n puts a rose between $s teeth and tries to tango with $mself. - -taunt 0 0 -You taunt the nothing in front of you. -$n taunts something that seems to be right in front of $m. -You taunt $M, to your own delight. -$n taunts $N rather insultingly. $U$n seems to enjoy it tremendously. -$n taunts you. It really hurts your feelings. -Hmmmmmmm.....nope, no one by that name here. -You taunt yourself, almost making you cry...:( -$n taunts $mself to tears. - -thank 0 5 -Thank you too. -# -You thank $N heartily. -$n thanks $N heartily. -$n thanks you heartily. -No one answers to that name here. -You thank yourself since nobody else wants to! -$n thanks $mself since you won't. - -think 1 0 -You think about life, the universe and everything. -$n sinks deeply into thought about the meaning of life. -You think about what purpose $E has in relation to your part of life. -$n stops and thinks about $N, completely lost in thought. -Your ears burn as $n thinks about you.. you wonder what about. -You'd better think harder, if you hope to make contact! -You think about yourself (for once). -$n thinks about $mself for a change.....(?) - -tickle 0 0 -Who do you want to tickle?? -# -You tickle $N. -$n tickles $N. -$n tickles you - hee hee hee. -Who is that?? -You tickle yourself, how funny! -$n tickles $mself. - -twiddle 0 0 -You patiently twiddle your thumbs. -$n patiently twiddles $s thumbs. -# - -wave 0 0 -You wave. -$n waves happily. -You wave goodbye to $N. -$n waves goodbye to $N. -$n waves goodbye to you. Have a good journey. -They didn't wait for you to wave goodbye. -Are you going on adventures as well?? -$n waves goodbye to $mself. - -whine 0 0 -You whine pitifully. -$n whines pitifully about the whole situation. -# - -whistle 0 0 -You whistle appreciatively. -$n whistles appreciatively. -# - -wiggle 0 0 -Your wiggle your bottom. -$n wiggles $s bottom. -# - -wink 0 5 -Have you got something in your eye? -$n winks suggestively. -You wink suggestively at $N. -$n winks at $N. -$n winks suggestively at you. -No one with that name is present. -You wink at yourself?? -- what are you up to? -$n winks at $mself -- something strange is going on... - -worship 0 5 -You find yourself head-down in the dirt, worshipping. -$n starts worshipping nothing at all. -You fall to your knees and worship $M deeply. -$n falls to $s knees, worshipping $N with uncanny dedication. -$n kneels before you in solemn worship. -Uh.. who? They're not here, pal. -You seem sure to have found a true deity..... -$n falls to $s knees and humbly worships $mself. - -yawn 0 0 -Gosh, will you trade those teeth for mine?? -- you get my glasseyes in the bargain too! -$n yawns. -# - -yodel 0 0 -You start yodelling loudly and rather beautifully in your own ears. -$n starts a yodelling session that goes right to the bone. -# - -$ diff --git a/lc-mud/circle/misc/typos b/lc-mud/circle/misc/typos deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/lc-mud/circle/misc/xnames b/lc-mud/circle/misc/xnames deleted file mode 100644 index aa1c7dad9ae9052f418b25c2fc5b5c85caf98f23..0000000000000000000000000000000000000000 --- a/lc-mud/circle/misc/xnames +++ /dev/null @@ -1,24 +0,0 @@ -asshole -balls -bastard -basterd -basturd -bitch -cock -crap -cum -cunt -dick -fag -fuck -fuk -lick -orgasm -penis -piss -prick -pussy -shit -suck -twat -whore diff --git a/lc-mud/circle/plralias/A-E/00 b/lc-mud/circle/plralias/A-E/00 deleted file mode 100644 index 0805cef0b30c55fda9f7ce937d35fb3b280ba449..0000000000000000000000000000000000000000 --- a/lc-mud/circle/plralias/A-E/00 +++ /dev/null @@ -1 +0,0 @@ -This is a placeholder file so the directory will be created diff --git a/lc-mud/circle/plralias/F-J/00 b/lc-mud/circle/plralias/F-J/00 deleted file mode 100644 index 0805cef0b30c55fda9f7ce937d35fb3b280ba449..0000000000000000000000000000000000000000 --- a/lc-mud/circle/plralias/F-J/00 +++ /dev/null @@ -1 +0,0 @@ -This is a placeholder file so the directory will be created diff --git a/lc-mud/circle/plralias/K-O/00 b/lc-mud/circle/plralias/K-O/00 deleted file mode 100644 index 0805cef0b30c55fda9f7ce937d35fb3b280ba449..0000000000000000000000000000000000000000 --- a/lc-mud/circle/plralias/K-O/00 +++ /dev/null @@ -1 +0,0 @@ -This is a placeholder file so the directory will be created diff --git a/lc-mud/circle/plralias/P-T/00 b/lc-mud/circle/plralias/P-T/00 deleted file mode 100644 index 0805cef0b30c55fda9f7ce937d35fb3b280ba449..0000000000000000000000000000000000000000 --- a/lc-mud/circle/plralias/P-T/00 +++ /dev/null @@ -1 +0,0 @@ -This is a placeholder file so the directory will be created diff --git a/lc-mud/circle/plralias/U-Z/00 b/lc-mud/circle/plralias/U-Z/00 deleted file mode 100644 index 0805cef0b30c55fda9f7ce937d35fb3b280ba449..0000000000000000000000000000000000000000 --- a/lc-mud/circle/plralias/U-Z/00 +++ /dev/null @@ -1 +0,0 @@ -This is a placeholder file so the directory will be created diff --git a/lc-mud/circle/plralias/ZZZ/00 b/lc-mud/circle/plralias/ZZZ/00 deleted file mode 100644 index 0805cef0b30c55fda9f7ce937d35fb3b280ba449..0000000000000000000000000000000000000000 --- a/lc-mud/circle/plralias/ZZZ/00 +++ /dev/null @@ -1 +0,0 @@ -This is a placeholder file so the directory will be created diff --git a/lc-mud/circle/plrobjs/A-E/00 b/lc-mud/circle/plrobjs/A-E/00 deleted file mode 100644 index 0805cef0b30c55fda9f7ce937d35fb3b280ba449..0000000000000000000000000000000000000000 --- a/lc-mud/circle/plrobjs/A-E/00 +++ /dev/null @@ -1 +0,0 @@ -This is a placeholder file so the directory will be created diff --git a/lc-mud/circle/plrobjs/F-J/00 b/lc-mud/circle/plrobjs/F-J/00 deleted file mode 100644 index 0805cef0b30c55fda9f7ce937d35fb3b280ba449..0000000000000000000000000000000000000000 --- a/lc-mud/circle/plrobjs/F-J/00 +++ /dev/null @@ -1 +0,0 @@ -This is a placeholder file so the directory will be created diff --git a/lc-mud/circle/plrobjs/K-O/00 b/lc-mud/circle/plrobjs/K-O/00 deleted file mode 100644 index 0805cef0b30c55fda9f7ce937d35fb3b280ba449..0000000000000000000000000000000000000000 --- a/lc-mud/circle/plrobjs/K-O/00 +++ /dev/null @@ -1 +0,0 @@ -This is a placeholder file so the directory will be created diff --git a/lc-mud/circle/plrobjs/P-T/00 b/lc-mud/circle/plrobjs/P-T/00 deleted file mode 100644 index 0805cef0b30c55fda9f7ce937d35fb3b280ba449..0000000000000000000000000000000000000000 --- a/lc-mud/circle/plrobjs/P-T/00 +++ /dev/null @@ -1 +0,0 @@ -This is a placeholder file so the directory will be created diff --git a/lc-mud/circle/plrobjs/U-Z/00 b/lc-mud/circle/plrobjs/U-Z/00 deleted file mode 100644 index 0805cef0b30c55fda9f7ce937d35fb3b280ba449..0000000000000000000000000000000000000000 --- a/lc-mud/circle/plrobjs/U-Z/00 +++ /dev/null @@ -1 +0,0 @@ -This is a placeholder file so the directory will be created diff --git a/lc-mud/circle/plrobjs/ZZZ/00 b/lc-mud/circle/plrobjs/ZZZ/00 deleted file mode 100644 index 0805cef0b30c55fda9f7ce937d35fb3b280ba449..0000000000000000000000000000000000000000 --- a/lc-mud/circle/plrobjs/ZZZ/00 +++ /dev/null @@ -1 +0,0 @@ -This is a placeholder file so the directory will be created diff --git a/lc-mud/circle/plrobjs/purgedir b/lc-mud/circle/plrobjs/purgedir deleted file mode 100755 index fabb16be294d2bfc7a6a6a43d5e22a6de3d54222..0000000000000000000000000000000000000000 --- a/lc-mud/circle/plrobjs/purgedir +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -echo "Purging $1" -cd $1 -date >> deleted -../../../bin/delobjs ../../etc/players *.objs >> ../deleted -cd .. diff --git a/lc-mud/circle/plrobjs/purgeobjs b/lc-mud/circle/plrobjs/purgeobjs deleted file mode 100755 index a53bb7d30c9dba47602b252df56b0909fba832bd..0000000000000000000000000000000000000000 --- a/lc-mud/circle/plrobjs/purgeobjs +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -echo "Purging old rent files, please wait..." -purgedir A-E -purgedir F-J -purgedir K-O -purgedir P-T -purgedir U-Z -rm -f ZZZ/* -echo "Done." diff --git a/lc-mud/circle/plrobjs/searchfor b/lc-mud/circle/plrobjs/searchfor deleted file mode 100755 index 3e83cb9af3ff9541dcf08fedb448814db4f5f9f5..0000000000000000000000000000000000000000 --- a/lc-mud/circle/plrobjs/searchfor +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -../../bin/listrent A-E/* | fgrep -i $1 -../../bin/listrent F-J/* | fgrep -i $1 -../../bin/listrent K-O/* | fgrep -i $1 -../../bin/listrent P-T/* | fgrep -i $1 -../../bin/listrent U-Z/* | fgrep -i $1 diff --git a/lc-mud/circle/text/background b/lc-mud/circle/text/background deleted file mode 100644 index f4e22ef904f4f4e029e07ea4d8b99a44b0fa279d..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/background +++ /dev/null @@ -1,8 +0,0 @@ -(lib/text/background) - -There once was a guy who played MUDs -But the MUDs that he played were all duds - "I'll write one," said he. - And he brushed off his C. -And soon played his game with his buds. - diff --git a/lc-mud/circle/text/credits b/lc-mud/circle/text/credits deleted file mode 100644 index 063796cfc0a7d4edfd61a42a26836be776efe8a4..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/credits +++ /dev/null @@ -1,35 +0,0 @@ -(lib/text/credits) - - C I R C L E M U D 3 . 0 - - -CircleMUD was developed from DikuMUD (Gamma 0.0) by Jeremy "Ras" Elson at -Johns Hopkins University's Department of Computer Science. All code unique -to CircleMUD is protected under a copyright by the Trustees of the Johns -Hopkins University. Additional development coordinated by Alex Fletcher, -George Greer, and Daniel Koepke with feedback from CircleMUD mailing list. - -CircleMUD is freeware and can be downloaded via anonymous FTP from -ftp.circlemud.org or ftp2.circlemud.org in pub/CircleMUD. Its developers -can be contacted at cdev@circlemud.org. - -Type HELP CIRCLEMUD for more information. - -============================================================================ - - - - Original game idea, concept, and design: - - Katja Nyboe [Superwoman] (katz@freja.diku.dk) - Tom Madsen [Stormbringer] (noop@freja.diku.dk) - Hans Henrik Staerfeldt [God] (bombman@freja.diku.dk) - Michael Seifert [Papi] (seifert@freja.diku.dk) - Sebastian Hammer [Quinn] (quinn@freja.diku.dk) - ------------------------------------------------------------------------------- -Additional contributions from Michael Curran, Bill Wisner, Mads Haar, and -Stephan Dahl. - -Originally developed at: - DIKU - The Department of Computer Science at the University of Copenhagen. diff --git a/lc-mud/circle/text/greetings b/lc-mud/circle/text/greetings deleted file mode 100644 index cbe77d5176ddf15984d508aa9673f1c6c841feb0..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/greetings +++ /dev/null @@ -1,11 +0,0 @@ - Your MUD Name Here - lib/text/greetings - - Based on CircleMUD 3.1, - Created by Jeremy Elson - - A derivative of DikuMUD (GAMMA 0.0), - created by Hans-Henrik Staerfeldt, Katja Nyboe, - Tom Madsen, Michael Seifert, and Sebastian Hammer - -By what name do you wish to be known? diff --git a/lc-mud/circle/text/handbook b/lc-mud/circle/text/handbook deleted file mode 100644 index 02e41f388a766f4e7cb9d955de60cbc94c558e43..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/handbook +++ /dev/null @@ -1,7 +0,0 @@ -(lib/text/handbook) - -This is the immortal handbook. - -Right now it doesn't say anything particularly useful -- bug the higher-ups -to write their policies here. - diff --git a/lc-mud/circle/text/help/commands.hlp b/lc-mud/circle/text/help/commands.hlp deleted file mode 100644 index 15802d6ba09d8b0fd897ed2493a1a7b5e40c26e1..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/help/commands.hlp +++ /dev/null @@ -1,1426 +0,0 @@ -! ^ - -Use ! to repeat the last command typed at the keyboard. - -Use ^ to replace a string from the last command with a new string. The -syntax is the same as in csh: "^old-string^replacement" - -Examples: - - > tell rasmusse Hi there, how are you? - No-one by that name here. - - > ^rasmusse^rasmussen - You tell Rasmussen, 'Hi there, how are you?' - - > ^you^you doing^ - You tell Rasmussen, 'Hi there, how are you doing?' - -See also: ALIAS -# -ALIAS ALIASES - -Usage: alias [alias name] [command] - -An alias is a single command used to represent one or more other commands. -The ALIAS command can be used to manipulate your character's aliases. Type -ALIAS alone to see a list of your currently defined aliases. - - > alias - -Type ALIAS to create a new alias. The alias name must -be one word. The command can be any string. Aliases may not be nested or -used recursively. Any command may be overridden by an alias (other than the -ALIAS command itself, of course). - - > alias gbb get bread bag - > alias gac get all corpse - -Type ALIAS to delete an alias that has already been defined. - - > alias gbb - -A semicolon (";") can be used to define multiple actions to be taken with -a single alias. - - > alias eat get bread bag; eat bread - -Note that the 'eat' contained within the eat alias is interpreted as the MUD's -internal eat command; aliases may not be nested or used recursively. The -variables $1, $2, ... $9 may be used to represent arguments given with -an alias. - -Examples: - - > alias killem cast 'fireball' $1; cast 'harm' $2 - > killem fido mage - -Would cast fireball on fido, followed by casting harm on mage. Variables -may be used repeatedly and in any order: - - > alias helpem cast 'heal' $1; cast 'bless' $1; cast 'armor' $1 - -The special variable $* represents the entire input line after an alias: - - > alias tr tell rasmussen $* - > tr hi there, how are you today? - You tell Rasmussen, 'hi there, how are you today?' - -See also: ! ^ -# -ANSI COLOR - -Usage: color [off | sparse | normal | complete] - -If you have a color-capable terminal and wish to see useful color-coding -of information, use the COLOR command to set the level of coloring you see. - - > color off - This command disables all color. - - > color sparse - > color normal - > color complete - -These three commands turn color on to various levels. Experiment to see -which level suits your personal taste. - -'color' with no argument will display your current color level. - -Using color will slow down the speed at which you see messages VERY slightly. -The effect is more noticeable on slower connections. Even if you have -color turned on, non-colorized messages will not be slowed down at all. - -See also: COLORSPRAY, "COLOR SPRAY" -# -ASSIST - -Usage: ASSIST - -If Quifael is being beaten senseless by a warg and you feel brave enough -to help him, type ASSIST QUIFAEL to hit the warg. Note that the warg will -keep hitting Quifael; assist only makes you start to fight whomever the -person you're assisting is fighting. - - > assist Doctor - -See also: FLEE, KILL, RESCUE -# -AUCTION GOSSIP GRATS NOAUCTION NOGOSSIP NOGRATS - -Usage: auction - gossip - grats - -These are channels reserved for specific purposes. Messages on these -channels reach everyone who is monitoring them. You must be at least level -three to use these channels. - -Examples: - - > auction short sword -- minimum bid 100k - > gossip Hey, is that a short sword on your belt or are you happy to see me? - > grats LEVEL!!!!!!!! - > grats GRATS CATJE!!!!!!!! - -See also: EMOTE, GSAY, HOLLER, NOREPEAT, SAY, SHOUT -# -AUTOEXIT - -Usage: autoexit - -Toggles the automatic display of currently available exits. Not all -possible exits will be displayed, only those immediately available. -If a door is closed it will not show up as a possible exit. - -See also: TOGGLE -# -BACKSTAB - -Thief only. - -Backstab is a way to sneak up on a person and attempt to place your dagger -in his back, at exactly the point where it does most damage. A successful -backstab gives a damage multiplier, depending on level: - - Levels Multiplier - ------ ---------- - 1-7 2 - 8-13 3 - 14-20 4 - 21-30 5 - -The chance of successfully backstabbing a person depends on how well you -have practiced backstab at your guild. You can always backstab sleeping -people. -# -BANK WITHDRAW DEPOSIT BALANCE - -Commands to take money out of the bank, put money in the bank, or see how -much money you have in the bank. Can be used at any branch of the First -National Bank of CircleMUD (wherever you see an automatic teller machine). - -Examples: - - > deposit 400 - > withdraw 1000 - > balance - -See also: GOLD, SCORE -# -BASH - -Fighters only. - -The success of a bash depends upon how well you are learned. To bash someone -is to attempt to 'knock' that person over. If you succeed you will inflict -minor damage, and cause the victim to fall on it's rear. The victim will be -unable to issue any commands for 2 rounds of violence. If you miss you loose -your balance and fall. - -A bash makes you unable to type commands for 2 rounds of violence. - -Note that hitting a person who is resting/sitting will inflict 1.5 * damage. - -See also: KICK, RESCUE -# -BRIEF - -Usage: brief - -Toggle "brief mode". When in brief mode, you don't see the descriptions of -the room you are in; only the name of the room and the people and objects -there. Unless you're very familiar with the area in which you're traveling, -however, it is not advisable to use this command. Frequently, you will find -small but vital hints in the descriptions of the rooms: An extra peek at your -surroundings could mean the difference between life and death! - -If you explicitly type 'look', you will always see the full room description, -even in BRIEF mode. - -See also: COMPACT, LOOK -# -BUG TYPO IDEA - -Usage: bug - idea - typo - -For making useful suggestions and reporting problems to the Powers that Be. - -Examples: - - > bug the entire game crashes when I type 'put bag in bag' - > idea make a restaurant in Midgaard - > typo 'sence' should be spelled 'sense' -# -BUY - -Usage: buy - buy # - buy n. - buy n - buy n # - -If you'd like to purchase an item from a shop and have the money, you can buy -it. Items can be bought by name, or by their number in the shop listing, -and can be bought in quantity. - -Examples: - - > buy sword (buy the first sword on the list) - > buy #3 (buy the third item on the list) - > buy 4.sword (buy the fourth sword on the list) - > buy 10 bread (buy 10 pieces of bread) - > buy 10 #2 (buy 10 of the second item on the list) - -See also: LIST, SELL, SHOPS, VALUE -# -CLEAR CLS - -Clears the screen. -# -COMMANDS - -Usage: commands - -The COMMANDS command gives a canonical list of all the known verbs. - -Each command listed should have help available by typing "HELP ". - -See also: SOCIAL, SOCIALS -# -COMPACT - -Usage: compact - -This command toggles the extra blank line output to your screen after each -command. Useful if you have a small display. - -See also: BRIEF -# -CONSIDER - -Usage: consider - -This command will compare your Level with the level. You will then -receive a rough estimate, which is by no means exact. Consider does not take -hitpoints/special attacks/damage into account. - -Example: - - > consider fido - -See also: HIT, KILL -# -DIAGNOSE - -Usage: diagnose [character] - -The DIAGNOSE command tells you how wounded a character looks. If you are -fighting someone, you can use DIAGNOSE with no arguments to diagnose the -person you're fighting. - -Examples: - - > diagnose - > diagnose rasmussen - -See also: CONSIDER -# -DISPLAY PROMPT - -Usage: display < H | M | V | all | auto | off > - -Modify your prompt to show your hit points, mana, and/or movement points. - - > display hv Display hit points and movement points - > display off Return to normal display - > display all Display hit, mana, and move points - > display auto Display hit, mana, and move when they are below 30% - -See also: TOGGLE -# -DONATE - -Usage: donate - donate coins - - -This command takes an object that you no longer want and deposits it in the -donation room of Midgaard to assist newbies in getting started. There is -a 75% chance objects donated will wind up in a donation room in Midgaard, -and a 25% chance the item will be junked. - - > donate shield - > donate all.bread - > donate 500 coins - -See also: JUNK -# -DROP - -Usage: drop - drop all. - drop all - drop coins - -If you lose interest in a carried item, you can drop it on the ground. - - > drop bottle - > drop all.bread - > drop all - > drop 1000 coins - -See also: DONATE, GET, JUNK -# -EAT DRINK SIP TASTE - -Usage: eat - taste [from] - drink [from] - sip [from] - -If you're hungry or thirsty, these commands are for you! - - > eat bread - > taste bread - > drink from cup - > sip fountain -# -EMOTE : - -Usage: emote - : - -Show people what you're feeling. The shorthand is ":". - -"emote " will display your name, then the string. - -Example: - -If your name is "Helt", - - > emote is feeling very sad today. - -will display: - -Helt is feeling very sad today. - -See also: SOCIALS -# -ENTER - -Usage: enter [place] - -If you type 'enter' while you are outdoors, you'll enter any nearby shelter. -You can also follow 'enter' with an argument; for example, 'enter window'. -# -EQUIPMENT - -Usage: equipment - -Gives you a list of all the equipment you're wearing, holding, and wielding. - -See also: INVENTORY, REMOVE, WEAR -# -EXAMINE - -Usage: examine - -May give you some valuable information about an item or monster. - -See also: LOOK -# -EXITS - -Usage: exits - -Gives you a list of the obvious exits from your location. Of course, the less -obvious ones won't show up here - you have to THINK in order to locate those. - -See also: AUTOEXIT -# -FILL - -Usage: fill - -If you want to fill a container you're holding with liquid from a fountain -in the same room as you. - -Example: - - > fill canteen fountain - -See also: POUR -# -FLEE - -Usage: flee - -If you are in a fight and things are beginning to get a little uncomfortable -(maybe you are dying), just type 'flee', and presto! You are out of harms way -- that is, IF there is a suitable exit nearby, and IF that exit doesn't simply -bring you from the ashes to the fire... but then, who wants to live forever? - -See also: WIMPY -# -FOLLOW - -Usage: follow - -Use FOLLOW to automatically follow someone else. - -Examples: - - > follow ras - > follow self - -See also: GROUP, SNEAK -# -GET TAKE - -"Get" and "take" are exactly the same and can be used interchangeably. - -Usage: get | take - get | take all [object] - get | take all all. - get | take all. all. - -If you find something interesting on the ground, you may use 'get' to pick -it up. 'get' can also be used to extract items from containers. - -Examples: - - > get sword corpse - > get all corpse - > get all all.bag - > get all.bread all.bag - -See also: DROP, PUT -# -GIVE - -Usage: give - give coins - -If you feel benevolent, you may give some stuff to someone in need. - - > give all ras - > give bread doctor - > give all.bronze mirlen - > give 40000 coins nia -# -GOLD - -Usage: gold - -Displays how much gold your carrying. - -See also: BALANCE, DEPOSIT, WITHDRAW -# -GRAB HOLD - -Usage: grab - hold - -For getting a good grip on something; a torch, for example. - -Examples: - - > hold torch - > grab stone - -See also: EQUIPMENT, REMOVE, WEAR, WIELD -# -GROUP - -Usage: group [player] - group all - -GROUP with no arguments shows the status of your group. GROUP -adds or removes from your group. GROUP ALL adds everyone who is -following you to your group. - -If you are a group member, then you will share experience points for killing -monsters equally among the group. Experience points will only be shared among -group members that are in the same location, at the time of the killing -blow. Sharing is regardless of whether the group members have been -participating in the fight. - -Group with no argument shows a list of people with whom you are grouped. -"group all" groups all people who are following you. - -To make a group, a "leader" must be selected. All members of the group -must then "follow" the leader using the follow command. The leader should -NOT follow anyone at all! The leader can now toggle group membership for -each player in the group, by using "group ". The leader -should remember to include himself in the group. - -Example: - - Quifael and Redferne wishes to group with Dragon. - - Quifael : "follow dragon" - Redferne: "follow dragon" - (Dragon should be following no one but himself) - Dragon : "group dragon" - Dragon : "group redferne" - Dragon : "group quifael" - -Later when Dragon get upset at Quifael (because he is sleeping all the time) -he types : "Group Quifael" to kick Quifael out of the group. - -See also: EXPERIENCE, UNGROUP, XP -# -GSAY GTELL - -Usage: gsay - gtell - -Tell something to all the members of your group, even if they're not in the -room. - -See also: GROUP, TELL, SAY -# -HELP - -Usage: help [command] - -Help searches for a partial match of the entered word, including any -spaces that may follow the word. Help alone will give a list of the -most common commands in the game. - -Examples: - - > help magic mis - will find the help text for the magic missile spell. - - > help mag - will match 'magic user' or 'magic missile' depending on first - occurrence in the help file. - -See also: COMMANDS, SOCIALS -# -HIDE - -Thieves Only. - -When you type hide there is a chance that you hide in the room. If hidden -you can only be "sensed" by the "sense life" spell. Even if sensed your -identity will remain hidden. Hide is broken by pressing return, regardless -of whether you typed a command or not. - -Example: - - > hide - Ok. - > (you wait for ex. 5 mins and remain hidden for 5 mins) - - > (You pressed enter and no longer hide) - -See also: SNEAK -# -HOUSE - -The HOUSE command is used to add or remove guests from your house's guest -list. You must be standing in your house to use this command. Only the -primary owner of a house (not guests) may change the guest list using the -HOUSE command. - -Usage: house [] - -Typing 'house' with no arguments gives a list of the people currently on -your house's guest list. Typing 'house' with the name of a player will add -that player to your guest list if the player is not on the list, or will -remove the player from the guest list if the player is already on the list. -The player specified must be in the player database for the MUD, although -he or she does not necessarily have to be logged on at the time. - -Guests of your house will be able to enter your house until you remove them -from the guest list. - -See also: HOUSES -# -INFO NEWS POLICY VERSION - -These commands show you important information about CircleMUD. It is a good -idea to read them every once in a while. - - info - useful information about the game for beginners - news - latest changes to the code and areas - policy - policies on topics like player killing - credits - the people who made CircleMUD possible! - version - displays the current CircleMUD version number -# -INVENTORY - -Usage: inventory - -If you're uncertain about what you're carrying, or simply want to check -that no thieves have got to your backpack. - -See also: EQUIPMENT, GRAB, HOLD, REMOVE, WEAR -# -JUNK - -Usage: junk - junk coins - -Use JUNK instead of DROP if you want to keep the world a little cleaner. If -you JUNK something, it will disappear and you'll get a few coins or experience -points, just as if you had dropped it in the dump. - -Examples: - - > junk cup - > junk all.bronze - > junk 500 coins - -See also: DONATE, DROP -# -KICK - -Fighters only. - -Usage: kick - -The success of a kick depends upon how well you are learned. The higher -level you reach the harder you kick. There is one small catch -- whenever -you kick (or miss) you will be unable to type any command for three -rounds of 'Violence' -- so be sure that you do not need to flee! - -See also: BASH, RESCUE -# -KILL HIT - -Usage: kill - hit - -A good way to start a fight. Not a good idea to hit other players. - -See also: FLEE, WIMPY -# -LEAVE - -Usage: leave - -If you feel claustrophobic, typing 'leave' will make you use the nearest -obvious exit to the outside. -# -LEVELS - -Usage: levels - -Lists the levels of your class and the experience required to attain each -level. -# -LIST - -Usage: list [item type] - -If you'd like to see what items a shop has for sale, take a look at the -list. The list contains all of the items currently for sale and in -what quantity. The price for each item is also listed. If you are -interested in a particular type of item, you can specify which items to -list. - -Examples: - - > list (list all items for sale) - > list sword (list all swords for sale) - -See also: BUY, SELL, SHOPS, VALUE -# -LOOK - -Usage: look - look [in | at] [the] - look - -For studying your surroundings. - -Examples: - - > look - > look AT the angel - > look IN the bag - > look south (May give some information as to what is south) - -Note that if you LOOK AT CORPSE you will not see its inventory. -To see what's inside a container (i.e. a corpse) use LOOK IN . - -See also: EXAMINE, GET, READ, TAKE -# -CHECK MAIL RECEIVE - -Usage: check - mail - receive - - -The commands used by the Midgaard Mail System (MMS) are MAIL, CHECK, and -RECEIVE. These commands can only be used while in an Official MMS Post -Office. You must be at least second level in order to use the MMS. - -Examples: - - To check and see if you have any mail waiting: - > check - - To write mail to Niandra: - > mail Niandra - - To ask the Postmaster to give you your mail, if you have any waiting: - > receive - -Stamps cost 150 coins. -# -MOTD - -Usage: motd - -Displays the message of the day. Contains important information -regarding the status of the MUD. You should be sure to read it -when you login. If you miss it at login, just use this command! -# -MURDER - -Usage: murder - -Kill command to hit another player. To avoid accidental flagging (i.e. -trying to type "kiss Nia" but accidentally typing "kill Nia"). - -Note that it is illegal to kill other players. If you try you will get -a KILLER flag. If you are flagged as a killer, you are unable to do -damage and other players will be allowed to use the MURDER command to -kill you without being flagged themselves. - -See also: FLAGS -# -NOREPEAT - -Usage: norepeat - -This command toggles whether or not you see your communication echoed -back to you (i.e., from commands such as SAY, SHOUT, HOLLER, GOSSIP, etc.) -Useful if you have a slow connection or if it just annoys you. - -See also: TOGGLE -# -NORTH SOUTH EAST WEST UP DOWN - -Usage: north - south - east - west - up - down - -To travel in a given direction. -# -NOSHOUT - -Usage: noshout - -NOSHOUT toggles whether or not you hear shouts. (deaf) will appear after -your name in the WHO list. - -See also: FLAGS, HOLLER, SHOUT, TOGGLE, WHO -# -NOSUMMON - -Usage: nosummon - -Due to problems we've had with players killing other players by summoning -them to Bad Places, all characters now have SUMMON PROTECTION turned on by -default. This prevents people from summoning you and gives you a warning -message if someone tries. If you want to let someone summon you (i.e. if -someone wants to summon you for a legitimate reason), type NOSUMMON to turn -off summon protection. You can then type NOSUMMON again to turn protection -back on. - -See also: SUMMON, TOGGLE -# -NOTELL - -Usage: notell - -Use NOTELL if you wish to prevent other players from using "tell" to -communicate with you. (notell) will appear after your name in the WHO -list if you have notell on. - -See also: FLAGS, TELL, TOGGLE, WHO -# -OFFER RENT - -Usage: offer - rent - -For use in the receptions of inns. - -Offer makes the innkeeper tell you the cost of storing your belongings -for one day. Rent stores you belongings and exits you from the game. -When you re-enter, you will start where you rented. - -There is a daily charge for rent. You may store your things at the -CRYOGENIC CENTER for a one-time charge of four days rent. See INNS -for details on the rent policy. - -See also: CRYOGENIC, INN, RECEPTION -# -OPEN CLOSE LOCK UNLOCK - -Usage: open | close | lock | unlock [direction] - -To open, close, lock, and unlock doors, of course. - -Examples: - - > open portal - > lock door - > unlock door south - > close gate - -See also: ENTER, LEAVE -# -ORDER - -Usage: order - order followers - -Used for ordering pets and charmed people to do your evil bidding. You -can order everyone under your command with "order followers". - -Examples: - - > order puppy eat bread - > order cityguard sleep - -See also: CHARM -# -"PICK LOCKS" - -Thieves only. - -Usage: pick [direction] - -For picking locks. Not all locks can be picked. - -Examples: - - > pick door south - > pick safe - -See Also : OPEN, CLOSE, LOCK, UNLOCK -# -POUR - -Usage: pour - pour out - -If you want to pour some liquid from one container to another. Pouring -out simply empties the contents of the container onto the ground. - -Examples: - - > pour canteen cup - > pour cup out - -See also: FILL -# -PRACTICE PRACTISE - -Usage: practice [skill or spell name] - -Practice is the way you improve your spells and skills. You can only do -so in your guild, where your guildmaster can help you train. Type -"practice " to improve your abilities while in your guild. You can -only practice a certain amount for each level you gain. Unused practice -sessions will accumulate for use in future levels. - -If you type practice anywhere other than in your guild, you will get a list -of all of the spells and skills you know and your level of proficiency at -each. -# -PUT - -Usage: put - put all. - put all - -For putting items into containers. - -Examples: - - > put bread bag - > put all.bread bag - > put all chest - -See also: GET -# -QSAY - -Usage: qsay - -To tell something to everyone on the current Quest. - -See also: QUEST -# -QUAFF POTION POTIONS - -Usage: quaff - -Quaff is used to "drink" a (magical) potion. The magic will take effect -immediately, for better or for worse... -# -QUEST - -Usage: quest - -This simple toggle command merely informs the Powers that Be that you -wish to participate in the currently running Quest. If an immortal -is running a Quest and needs to know who wishes to participate, he/she -will ask players to turn on their Quest flags using this QUEST command -if they are interested in the Quest. It also allows you to listen in on -the quest channel and receive information specific to the quest. - -See also: QSAY -# -QUI SHUTDOW - -Just to prevent accidental quittings and/or shutdowns. -This command doesn't DO anything, it simply is. - -Note to immortals: If you type QUI, you will quit and all your items will - drop to the ground. - -See also: QUIT -# -QUIT - -When you get tired of playing, you can leave the game by typing 'quit'. -Note that quitting this way may cause any items you might be carrying to -simply be left on the ground (Dependant upon how the game is currently -configured). If you wish to have your equipment stored, you may have to -find an inn and pay rent. - -See also: INN, OFFER, RENT -# -READ - -Usage: read - read - -When you want to read something. - -READ is also used to read messages on bulletin boards; type HELP BOARDS -for more information. - -Example: - - > read note - -See also: BOARDS -# -RECITE SCROLL SCROLLS - -Usage: recite [Target] - -Is used to "read" a magical scroll. Target can be an object, character or -nothing (which may be yourself). - -See also: SPELLS -# -REMOVE - -Usage: remove - remove all - remove all. - -If you tire of wearing some armor or wielding a weapon. - -Examples: - - > remove boots - > remove sword - > remove all - > remove all.bronze - -See also: GRAB, HOLD, WEAR, WIELD -# -REPLY - -Usage: reply - -This command will send a reply to the last person to send you a message -using TELL. It works just as if you had typed 'tell ' -but makes it a bit easier. It can also be very useful in case someone -invisible sends you a message. - -Example: - -Ras tells you, 'Hi!' -> reply hey -You tell Ras, 'hey' -> -Someone tells you, 'I am your secret admirer.' -> reply Who are you? -You tell someone, 'Who are you?' - -See also: TELL, NOTELL -# -REPORT - -Usage: report - -This command sends a report of your current health to the other people in -your group. -# -RESCUE - -Fighters Only. - -Usage: rescue - -This command is useful if you want to try and make an attacker hit you -instead of your poor friend who is being pummeled. You can only 'turn' -one monster for each rescue attempt. This is very useful when playing -in groups, of course. - -Example: - - > rescue Yankee -# -SAVE - -Usage: save - -Save your persona. This includes experience points, strength, gold, etc. -Your equipment is also saved in the (unlikely?) event of a crash. The -game periodically auto-saves you and your equipment, so it is not necessary -to have your client auto-save you as well. - -You CANNOT load a saved version if you die -- your persona still exists, -but you will lose experience, and all your objects stay in the game, with -your corpse. - -Note that the SAVE command only saves your equipment in the event of a -crash. If you are leaving the game normally, SAVE will NOT save your -equipment -- you must find an Inn to store your belongings. - -See also: INN, RENT -# -SAY TELL ASK WHISPER SHOUT YELL HOLLER ' - -Usage: say | shout | holler - tell | whisper | ask - -If you consider communicating with other beings, you might be understood -better if you start your sentences with either say, tell, whisper or shout. - -Examples: - - > say Hey, does anyone know how to get to Oz? - > tell catje hi, how are you? - -You can use ' as a shorthand for say, as in: - - > ' hello there. - -Shout broadcasts your message to everyone is your geographic zone. Holler -broadcasts to everyone in the game but costs 20 movement points. You must -be level 2 before you can use shout and yell. - -See also: AUCTION, GOSSIP, GSAY, NOREPEAT, QSAY, REPLY -# -SCORE - -Usage: score - -Provides useful information on your status such as age, hit points, -mana, movement points, armor class, alignment, experience points, gold -on hand, how long you've been playing, and your level. - -See also: AC, EXPERIENCE -# -SELL - -Usage: sell [#] - sell <#>. - -If you'd like to sell an item to a shopkeeper, trying selling it to them. -Most shops specialize in what they will buy, so you may have to look around -to find a buyer for your items. - -Examples: - - > sell sword (sell the first sword in your inventory) - > sell 3 sword (sell the first three swords in your inventory) - -See also: BUY, LIST, SHOPS, VALUE -# -SLEEP - -SLEEP is both a command and the name of a spell. - -The SLEEP command puts you to sleep, allowing you to regain your health more -quickly. You will be largely unaware of your surroundings while asleep. -You can awaken yourself with the WAKE command. - -The SLEEP spell forces the victim into a magical sleep such that they cannot -be awakened until the spell wears off. - -Usage : cast 'sleep' -Accumulative: Yes (Duration) -Duration : 4 hours + level/4 -Level : Mage level 8. - -If failing saving throw versus spell, the person will fall asleep. -A person who is affected by sleep can only be awakened if attacked. - -See also: WAKE -# -SNEAK - -Thieves Only. - -Usage: sneak - -Used for sneaking (moving in and out of rooms without anyone taking notice). -When you type sneak, there is no way to know if you're actually sneaking. -If you successfully sneak, then you'll continue to sneak for a little while. - -See also: HIDE -# -SPLIT - -Usage: split - -Split is used to split money among people in your group who are in the same -room as you. If you are in a group with 4 other people, all of whom are in -the same room with you, and you type SPLIT 100, you will give each of the -other 4 group members 20 coins each. (100 coins is split 5 ways; you keep -your share and give everyone else their share). - -See also: FOLLOW, GROUP -# -STEAL - -Thief Only. - -Usage: steal - -Use steal to steal gold or items from people. The chance of not getting -caught depends on how well you have practiced steal, and if the person -is asleep. - -Due to misuse of the steal command, it is now illegal to steal from other -players. Doing so will get you a flag for your trouble. - -Examples: - - > steal gold drunk - > steal sword mercenary - (If it's wielded, only possible if he is sleeping) - -See also: FLAGS -# -TIME - -Usage: time - -Gives you the current game time. Your initial reaction to the output of -this command may be one of surprise, but you'll get used to it. You'll -have to, at any rate, since certain things in the game depend on this -particular notion of time; the opening hours of the shops, for example. -# -TITLE - -Usage: title - -Sets the title people see on the WHO list and when you're in the room with -them. You can't use parentheses (the "(" and ")" characters) because those -are reserved for flags. - -Do not abuse this command; if you do, it will be taken from you. - -See also: FLAGS, WHO -# -TOGGLE - -Usage: toggle - -TOGGLE shows you the current values of various toggles available on the MUD. -This command CAN NOT be used to change these values (see related commands.) -All of these toggles remain the same until you change them; i.e. they are -saved when you quit or rent. - -See also: BRIEF, COMPACT, DISPLAY, NOSHOUT, NOSUMMON, NOTELL, QUEST - REPEAT, WIMP -# -TRACK - -Usage: track - -Used for finding the first step on the shortest route to a monster. - -Example: - - > track fido - You sense a trail south from here! -# -UNGROUP - -Usage: ungroup [group member] - -UNGROUP can be used by group leaders to disband the entire group, or -to kick a specific group member out of the group (and stop him/her from -following the leader). - -Examples: - - > ungroup - > ungroup homer - -See also: GROUP -# -USE WAND STAFF STAFFS WANDS - -Usage: use - use - -Using a staff will automatically target everybody (or everything) in a -room, except yourself. Therefore staffs are naturally very powerful, and -yet may be very dangerous to use around other players. - -Using wands require that you point it at a target, which can be either a -character or an object. - -Both staffs and wands must be HELD in the hand prior to use! (Use the -grab or hold commands). You must still supply the name of the staff or -wand to avoid confusion. - -See also: RECITE -# -VALUE - -Usage: value - -Before selling an item to a shop, you can ask the shopkeeper how much -he or she is willing to pay for it. - -Example: - - > value bread - -See also: BUY, LIST, SELL, SHOPS -# -VISIBLE - -Usage: visible - -Use this command to break your spell of invisibility before it expires. - -See also: INVISIBILITY -# -WAKE SLEEPING REST SIT STAND - -For changing your position. If you feel weary, it's probably a good idea -to sit and rest for a while, or maybe even take a nap. -# -WEAR - -Usage: wear [location] - -If you want to wear some clothes, armor or the likes. - -Also, to wear everything in your inventory (or at least try to, as wearing -things like loaves of bread is not a good way to win friends and influence -people) you can type "wear all". - -Optionally, you can specify what part of your body to wear the equipment on. - -Examples: - - > wear boots - > wear all.bronze - > wear all - > wear ring finger - -See also: EQUIPMENT, REMOVE -# -WEATHER - -Usage: weather - -If you're uncertain whether the sun is shining or the rain is pouring down. -You'll have to be outside in order to tell however. - -See also: "CONTROL WEATHER" -# -WHERE - -Usage: where - -Tells you the location of a monster, a player or an object. - -Mortals can only "where" monsters or players, and only from their own -zone. - -Immortals may type 'where' without arguments to see where everybody is. - -Example: - - > where - > where torch - > where dragon -# -WHO - -Usage: who [minlev[-maxlev]] [-n sname] [-c classlist] [-s] [-o] [-q] [-r] [-z] - -Lists the people currently in the game. Some people may be invisible. -Command-line options can be used to limit the listing. The parameters -can be specified on the command-line in any order. - -minlev, maxlev : list only people whose level is at or above minlev, and - optionally, at or below maxlev --n : list only people whose names or titles contain sname --c : list only people of a certain class, where classlist is any combination - of the letters w, m, c, and t --s : list names in the short form (4 columns of names, without titles or flags) --o : list only outlaws (i.e. people with a killer or thief flag) --q : list only people who are on the Quest --r : list only people who are in your room --z : list only people in your zone - -Examples: - - > who -c wc -s -l 20 - List, in short form, warriors and clerics at or above level 20 - - > who 15-25 -o -z - List all outlaws between levels 15 and 25 who are in your zone. -# -WHOAMI - -Usage: whoami - -Displays your character's name, if you want to be sure you are who you think -you are. -# -WIELD - -Usage: wield - -When you get tired of bashing monsters with your fists, you might consider -wielding a weapon. - -Example: - - > wield sword - > wield 3.sword (Wield the third sword in your inventory) - -See also: EQUIPMENT, REMOVE, WEAR -# -WIMPY - -Usage: wimpy [hp] - -Use the WIMPY command to automatically flee once your health drops below -a certain level. - -Examples: - - > wimpy 35 will make your character automatically flee a fight - if you have less than 35 hit points. - > wimpy 0 will turn off wimpy mode. - > wimpy will show you your current wimp status. - -See also: FLEE, TOGGLE -# -WIZLIST IMMLIST - -Usage: wizlist | immlist - -Lists the most powerful beings on the MUD. These are the people responsible -for administering the system. - -See also: IMPLEMENTOR -# -WRITE - -Usage: write - write - -In order to write a note, you need a piece of blank paper (or similar), and -a pen of some sort. You can then type something like "write on the paper with -the pen", whereupon you'll be asked to type in your note at the keyboard. - -WRITE is also used to post messages to bulletin boards. Type HELP BOARDS -for more information. - -See also: BOARDS, MAIL -# -$ diff --git a/lc-mud/circle/text/help/index b/lc-mud/circle/text/help/index deleted file mode 100644 index 29762b099d80ccb18b10d7b496473857894aee60..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/help/index +++ /dev/null @@ -1,6 +0,0 @@ -commands.hlp -info.hlp -socials.hlp -spells.hlp -wizhelp.hlp -$ diff --git a/lc-mud/circle/text/help/index.mini b/lc-mud/circle/text/help/index.mini deleted file mode 100644 index 29762b099d80ccb18b10d7b496473857894aee60..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/help/index.mini +++ /dev/null @@ -1,6 +0,0 @@ -commands.hlp -info.hlp -socials.hlp -spells.hlp -wizhelp.hlp -$ diff --git a/lc-mud/circle/text/help/info.hlp b/lc-mud/circle/text/help/info.hlp deleted file mode 100644 index fe223810b37b76216130a25fb8e168772db7fab2..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/help/info.hlp +++ /dev/null @@ -1,421 +0,0 @@ -AC - -"AC" is your armor class. It is a number from -10 to 10, roughly -defined as follows: - - - AC Roughly equivalent to ------------------------------------------------------------ - 10 Naked person - 0 Very Heavily armored (Plate mail, and "two shields") - -10 Armored battle tank - -The score command displays your armor class as a number such as 78/10; -this means 78 on a scale from -100 to 100 (i.e., 7.8 on the scale from --10 to 10.) - -See also: SCORE -# -AREAS - - This is a listing of the areas available for exploration on this -CircleMUD. - -Limbo -- DikuMud -River Island Of Minos -- Mahatma of HexOynx -God Simplex -- CircleMUD, modified by Taz of Tazmania -The Straight Path -- Steppin of ChicagoMUD -The High Tower Of Magic -- Skylar of SillyMUD* -Midgaard -- DikuMud -The Three Of Swords -- C.A.W. -Miden'Nir -- Copper II, modified by VampLestat of MercMUD* -The Chessboard -- Exxon of SillyMUD -Mount Moria -- Redferne of DikuMud* -The Great Eastern Desert -- Rorschach -The Drow City -- Rorschach -The City Of Thalos -- Rorschach -The Great Pyramid -- Andersen of HexOynx* -New Thalos -- Duke Of SillyMUD* -The Haon-Dor Forest -- Quifael of DikuMud, extended by by Derkhil - of CircleMUD -The Orc Enclave -- C.A.W. -Arachnos -- Mahatma of HexOynx -Rand's Tower -- C.A.W. -The Dwarven Kingdom -- Depeche of DikuMud -The Sewers -- Redferne of DikuMud -Redferne's Residence -- DikuMud, modified by Cyron of VieMud -Rome -- Onivel of JediMUD -King Welmar's Castle -- CircleMUD* -Newbie Zone -- Maynard of StrangeMUD - -All those marked with * have been heavily modified by Furry of VieMud -C.A.W. stands for the Curious Areas Workshop. For more information -mail <fletchra@qsilver.queensu.ca>. - -See also: CREDITS -# -BOARDS - -Bulletin boards are the forum of inter-player communication on the MUD. -There are different bulletin boards for different purposes -- for example, -a standard mortal board, a board for immortals, a board for fun "social" -messages, etc. Naturally, not all players may be allowed to read all -types of boards. - -Type "LOOK BOARD" to see the messages already posted on a board. Type -"WRITE <subject>" to post a message to a board; terminate a message with -a '@' as the first character on a line. Type "READ <number>" to read a -post. Type "REMOVE <number>" to remove your own messages. - -Example: - - > look at board - > write Am I using these boards correctly? - [writes the message; terminates with a '@'] - > look at board - > read 6 - > remove 6 - -See also: MAIL, READ, WRITE -# -CLERIC - -Clerics have an ancient belief in not carrying sharp weapons. Hence, they can -only wield bludgeoning weapons. This class gives you the wisdom of peace, -blessing and healing, though it is possible to learn more violent spells. - -You can improve your spells by using the practice command. - -See 'help spells' for a list of spells available. - -See also: PRACTICE, SPELLS -# -EXPERIENCE XP - -Whenever you kill a monster or a player, you earn experience points. When -enough experience points are earned, you raise a level. -Things you should know about experience points: - - * When damaging a monster, you get experience points. - - * If you kill a monster of higher level than yourself, you get bonus - experience points. If killing a monster of lower level you'll gain - less experience points - -See also: GROUP, SCORE -# -FLAGS - -Players sometimes have FLAGS after their names in the WHO list. These -flags are always in parentheses, not brackets or braces. - - FLAG MEANING - ----------- --------------------------------------------------------- - (KILLER) Player is trying to kill other players. That means you - can try to kill him/her without being flagged. - (THIEF) Player is trying to steal from other players. Fire away. - (invis) Player is invisible; you can see him/her because you are - sensitive to the presence of invisible things. - (writing) Player is writing on the board; do not disturb. - (mailing) Player is writing mail; do not disturb. - (deaf) Player has chosen not to hear shouts. - (notell) Player has chosen not to accept tells. - (quest) Player is participating in a quest currently being run by - the Gods. - -See also: NOSHOUT, NOTELL, QUEST, STEAL, VISIBLE -# -GUILD - -The Guildhouse is the place where mortals may go to escape the troubles and -perils of a cruel world. Each guild is heavily guarded, so that only members -may enter the building. Guilds are also the places where people come to -learn and practice the skills of their trade. - -See also: PRACTICE -# -HOUSES - -Houses have been implemented as of CircleMUD 3.0. A house entails two things: -access control and crash protection. Only you and your guests will be allowed -to enter the house. Your house will be crash-saved every five minutes. You -can force your house to save by typing 'save' while standing in your house. -In the event of a crash, the objects in your house as of the last crash-save -will be loaded back into your house when the MUD reboots. Also, if you own -a house, and quit from the game while standing in your house, you will be -loaded into your house next time you enter the game. - -Guests of your house can be defined using the HOUSE command. See HOUSE for -more information. - -Houses are an alternative to renting. You can simply enter your house and -quit; your objects will drop to the ground and be crash-saved for when you -return. There is currently no limit to the number of objects which can be -stored in your house. Of course, players must expect to pay a much higher -premium for the convenience of houses; contact your local Implementor for -a fee schedule. - -See also: HOUSE -# -IMPLEMENTOR - -The most powerful being in existence. -# -INN INNS CRYOGENIC CRYO RECEPTION - -Inns are places where the weary traveler may rest while the innkeeper looks -after his equipment and treasure. - -Specifically, the game will save your equipment while you are logged out. -There is a daily cost for renting, based on your equipment. Each item has -a per diem charge. The per diem charge is calculated to the nearest second, -however -- if you rent at the rate of 2400 coins per day, and you come back -39 hours later, you will be charged 3900 coins. - -A CRYOGENIC CENTER will store your items for a one-time charge of four -days rent. - -Rent files are deleted if you run out of money to pay the per diem charges -or after 30 days. Cryogenic-rent files are deleted after 60 days. - -See also: OFFER, RENT -# -LINK - -A lot of players have problems with their links to the game. This can be -very hazardous to your health in the middle of a battle, of course. - - I. If your link is broken, you will automatically attempt to flee each - time someone attempts to hit you. If you manage to flee, then you - will be saved by divine forces, and put in a safe place until you - reconnect to the game. - -II. If your link jams (freezes), you have a problem. The only solution we - can give is that you break your link as quickly as possible. By - breaking the link you can hope that the above procedure is initiated. - - Do not try to get out of a fight by breaking link. You will be not - reimbursed for any experience or equipment if you purposefully - cut your link. -# -"MAGIC USER" WIZARD MAGE - -This is the class of powerful and violent magic, but the magic user do not -control the nature, and can therefore not bless and such. - -You can improve your spells by using the practice command. - -See 'help spells' for a list of spells available. - -See also: PRACTICE, SPELLS -# -MANA - -Mana is used when casting spells. You must have a certain amount of mana -in order to cast any particular spell. If you do not have enough mana to -cast the spell you must rest until you gain enough points to cast. - -See also: SPELLS -# -MIDGAARD MAP - - Temple Altar - | - | - Reading -- Temple -- Donations - Room of - Midgaard Post Reception - | Office / - Cleric | | / - Guild----Temple Square----Grunting---Bar - (Fountain) Boar Inn - Magic | - Shop Bakery | Grocer Weaponsmith - | | | | | East - <---West-----+------+----Market----+--------+--------Gate---> - Gate | | Square | | | - | Mage Armory | Pet Warrior Wally's - (Wall Guild | Shop Guild World of Water - Road) | - | | Uncle Juans's - | | | - +-(Poor-Alley)-+----Square----+(Dark-Alley)-------+ - | | | | | | - | Grubby | Thieves Levee Warehouse - | Inn | Guild | - (Wall Dump | - Road) Sewers/ | - | | - | Midgaard - <=== [Bridge] =============================== River =============> - | - | - +(Concourse)+------------+-------------+----------+ - | | | | | - | + +----Cafe +---Penny | - | | Park--v | | Lane | - | City | +--+--+ | | - | Guard----+----+----+--o--+-----+----+---City | - | HQ | | Hall | - | + +--(Emerald)--+ | - (Concourse) | | (Concourse) - | +------(Park-+-Road)-------+ | - | | | | - | +--(Emerald)-+ +---Elm | - | | | Street | - | + + | - | | | | - +-----------+------(Concourse)---------+----------+ - | - Graveyard - Entrance -# -SHOPS - -Shops are places where the adventurer may purchase equipment for his quests, -and where he may sell his treasure if he should manage to survive the perils -with his life and sanity intact. Many shops trade only in a specific type of -merchandise. Thus, a baker may well refuse to buy your armor, even if it is -of high quality! - -To some people, the prospect of obtaining the entire inventory of a shop by -murdering the keeper may appear tempting - but beware: The shopkeepers are -often rugged, capable men; roughened by years of trading and, indeed, surviving -in a world where the only safe prospect is death in the end. - -See also: BUY, SELL, LIST, VALUE -# -SPELL SPELLS - - Magic User Cleric - - (1) Magic Missile (1) Armor - (1) - (1) Cure Light - - (2) Detect Magic (2) Create Water - (2) Detect Invisible (2) Create Food - - (3) Chill Touch (3) Detect Poison - (3) Infravision (3) - - - (4) Invisibility (4) Cure Blindness - (4) Armor (4) Detect Evil - (4) - (4) Detect Alignment - - (5) Burning Hands (5) Bless - - (6) Locate Object (6) Blindness - (6) Strength (6) Detect Invisible - - (7) Shocking Grasp (7) Infravision - - (8) Sleep (8) Protection From Evil - (8) - (8) Poison - - (9) Lightning Bolt (9) Cure Critical - (9) Blindness (9) Group Armor - - (10) Detect Poison (10) Summon - (10) - (10) Remove Poison - - (11) Color Spray (11) - - - (12) - (12) Earthquake - (12) - (12) Word of Recall - - (13) Energy Drain (13) - - - (14) Curse (14) Detect Evil - (14) Poison (14) Detect Good - (14) - (14) Dispel Evil - (14) - (14) Dispel Good - - (15) Fireball (15) Call Lightning - (15) - (15) Sanctuary - - (16) Charm Person (16) Heal - - (17) Sense Life (17) Control Weather - - (19) - (19) Harm - - (22) - (22) Group Heal - - (26) Enchant Weapon (26) Remove Curse -# -THIEF THIEVES - -Thieves are known to have very special qualities, that no other class offers. -Their specialty tends to be in the darker, sneakier art. Many of these -qualities can come in handy in many situations, such as picking locks. - -You can improve you skills by using the practice command. - -Skills available to thieves: - -sneak, hide, steal, backstab, pick lock, track - -See the help on each skill for more information. - -See also: PRACTICE -# -WARRIOR FIGHTER - -Warriors are known to have more strength than the average player. This makes -them better at hand-to-hand-combat, as they possess skills of violence and -fighting unequaled by the members of any other class. However, they lack the -ability to use magic of any sort. - -You can improve your skills by using the practice command. - -Skills available to warriors: - -kick, rescue, track, bash - -See also: PRACTICE -# -CIRCLE CIRCLEMUD CREDITS - C I R C L E M U D 3 . 0 - -CircleMUD was developed from DikuMud (Gamma 0.0) by Jeremy "Ras" Elson at -Johns Hopkins University's Department of Computer Science. All code unique -to CircleMUD is protected under a copyright by the Trustees of the Johns -Hopkins University. - -Many, many people contributed to CircleMUD in one way or another throughout -the course of its development. Although it's impossible for me to remember -them all, I'd like to extend special thanks to certain people: - - -- Jeff Fink and George Greer, for submitting a veritable mountain of - excellent code. - -- Chris Epler and Chris Herringshaw for extensive beta-testing and bug - reporting. - -- Furry (Alex Fletcher), for single-handedly managing Circle's world files. - -- Fred Merkel, Ryan Watkins, Jay Levino, and Sharon Goza, for other - code and area submissions. - -- Jean-Jack Riethoven for porting the code to the Amiga, David Carver - for porting it to OS/2, and Jack Patton and Steffen Haeuser for the - Amiga port. - -- Bill Bogstad and Tim Stearns for allowing Circle to exist at JHU. - -- The DikuMud folk, and the good old WhatMUD implementors Dave & Justin, - for starting the ball rolling. - -- Bryan Jolson, Steven Lacher, Cat Stanton, and Naved Surve, for being - there in the very early days of Circle's development. - -- Sharon, Ben, Erica, Aly, and Josh, for keeping me sane. - -- Jules (hamotek sheli) for being the greatest. - -...plus everyone else in the Circle community who has submitted material! -Thanks everyone! - - Anonymous FTP: ftp.circlemud.org or ftp2.circlemud.org in pub/CircleMUD - To report bugs: bugs@circlemud.org - To get help: help@circlemud.org - URL: http://www.circlemud.org/ - Mailing List: listserv@post.queensu.ca - (write "subscribe circle <first name> <last name>") - ---Jeremy Elson (jelson@circlemud.org) - -See also: AREAS -# -$ diff --git a/lc-mud/circle/text/help/screen b/lc-mud/circle/text/help/screen deleted file mode 100644 index 00a64506ab2c0cc28b296466f732df4076db5938..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/help/screen +++ /dev/null @@ -1,21 +0,0 @@ -------------------------------------------------------------------------------- -Movement: | Communication: -NORTH SOUTH EAST WEST UP DOWN | SAY GSAY SHOUT HOLLER TELL ASK WHISPER -LOOK EXITS ENTER LEAVE | MAIL RECEIVE CHECK GOSSIP GRATS AUCTION -SLEEP WAKE REST SIT STAND | NOTELL NOSHOUT NOGOSSIP NOGRATS NOAUCTION -(LOCK UNLOCK OPEN CLOSE) | -------------------------------------------------------------------------------- -Objects: | Information: -GET DROP JUNK DONATE PUT GIVE WEAR | SCORE HELP INFO WHO NEWS TIME WEATHER -GRAB INVENTORY EQUIPMENT REMOVE | WHERE CONSIDER LEVELS WIZLIST IMMLIST -EXAMINE EAT DRINK TASTE SIP POUR | CREDITS TOGGLE FLAGS WIZHELP -------------------------------------------------------------------------------- -Combat: | Utility: -KILL WIELD FLEE ASSIST TRACK | ! BUG IDEA TYPO QUIT SAVE BRIEF COMPACT -(KICK BASH RESCUE BACKSTAB CAST) | TITLE NOSUMMON COMMANDS SOCIALS DISPLAY -------------------------------------------------------------------------------- -Further information available by HELP <keyword>, keyword being a command or -(for example) one of the following: - - SOCIAL SHOPS INNS CLERIC WARRIOR THIEF MAGIC SPELLS LINK -------------------------------------------------------------------------------- diff --git a/lc-mud/circle/text/help/socials.hlp b/lc-mud/circle/text/help/socials.hlp deleted file mode 100644 index 26dca51fae60f84e3af5dd6636ef0798c871954e..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/help/socials.hlp +++ /dev/null @@ -1,35 +0,0 @@ -FRENCH - -Don't you know how they kiss in France?? -- try it! -# -KISS - -Well can't you guess? -# -SMILE - -Whenever you feel like smiling... -# -SOCIALS - -Usage: <social> [<victim>] - -Socials are commands used to show your affective state to others. The -actor, victim and bystanders may receive different messages. Generally, -social commands are used only to express emotion and not to take action, -but it is possible that some mobs (or players) will take action based on -the social. (Slap a dragon lately?) - -Example: - - > shake homer - > applaud marge - > stare - -The SOCIALS command generates a canonical listing of all available socials. - - > socials - -See also: EMOTE -# -$ diff --git a/lc-mud/circle/text/help/spells.hlp b/lc-mud/circle/text/help/spells.hlp deleted file mode 100644 index 9c072ea9a0e8a14eec770e3966f7e65bbf5aed79..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/help/spells.hlp +++ /dev/null @@ -1,557 +0,0 @@ -ARMOR - -Usage : cast 'armor' [target] -Accumulative: No -Duration : 24 Hours -Level : Mage level 4, Cleric level 1. - -The Armor spell will improve your AC by 2. - -See also: AC -# -BLESS - -Usage : cast 'bless' <victim | object> -Accumulative: No -Duration : 6 Hours, permanent for objects. -Level : Cleric level 5. - -Bless on a victim will improve the victims saving throw versus spells -by 1, and furthermore improve the hitroll by 2. - -Bless on an item currently has no defined action. It is only possible -to bless non-evil items, and the object blessed may weigh no more -than five pounds per level of caster. -# -BLINDNESS - -Usage : cast 'blindness' <victim> -Accumulative: No -Duration : 2 hours. -Level : Mage level 9, Cleric level 6. - -Blindness will blind a victim failing its saving throw. -A blinded person will have -4 penalty to both hitroll and AC. - -See also: AC -# -"BURNING HANDS" - -Usage : cast 'burning hands' <victim> -Accumulative: - -Duration : Instantaneous -Level : Mage level 5. -Save : Versus spell for half damage. - -This spell is more powerful than the chill touch spell. - -See also: "CHILL TOUCH" -# -"CALL LIGHTNING" - -Usage : cast 'call lightning' <victim> -Accumulative: - -Duration : Instantaneous -Level : Cleric level 15. -Save : Versus spell for half damage. - -This spell will use the "force of nature" to make a lightning -strike the victim. It is therefore only possible to call lightning -outside, and it has to be raining (or worse). - -See also: "CONTROL WEATHER", WEATHER -# -CAST - -Usage: cast '<spell name>' [target] - -For "magical" people. If you want to throw a spell at someone or something. - -Example: - - > cast 'burning hands' <player> - Note that the name of the spell must be enclosed by "'"s. - -See also: help on each individual spell: - -Examples: - - > help cure ligh - > help ventri - > help energy drain -# -"CHARM PERSON" - -Usage : cast 'charm person' <victim> -Accumulative: No -Duration : (432/Intelligence points of person) hours -Level : Mage level 16. - -Is is not possible to charm anyone that is already charmed, if -you're charmed yourself, or if the person is higher level than -yourself. The person will get a saving throw versus "paralysation". - -A charmed person will follow you, and not be able to attack you, you -can order the charmed person using the order command. - -See also: FOLLOW, ORDER -# -"CHILL TOUCH" - -Usage : cast 'chill touch' <victim> -Accumulative: - -Duration : Instantaneous -Level : Mage level 3. -Save : Versus spell for half damage. - -This spell is more powerful than the magic missile spell. -A victim failing its saving throw will get its strength -reduced by one. - -See also: "MAGIC MISSILE" -# -COLORSPRAY "COLOR SPRAY" - -Usage : cast 'color spray' <victim> -Accumulative: - -Duration : Instantaneous -Level : Mage level 11. -Save : Versus spell for half damage. - -This spell is more powerful than the lightning bolt spell. - -See also: "LIGHTNING BOLT" - -For help on actual color, see: ANSI -# -"CONTROL WEATHER" - -Usage : cast 'control weather' <'better' | 'worse'> -Accumulative: Yes -Duration : - -Level : Cleric level 17. - -This spell will change the "course" of the current weather. - -Example: - - > cast 'control wea' worse -# -"CREATE FOOD" - -Usage : cast 'create food' -Accumulative: - -Duration : Instantaneous -Level : Cleric level 2. - -This spell instantly creates a fresh waybread. The waybread will be -filling for the next (5+level) hours, up to a maximum of 24 hours. - -See also: "CREATE WATER" -# -"CREATE WATER" - -Usage : cast 'create water' <drink container> -Accumulative: No -Duration : Instantaneous -Level : Cleric level 2. - -Expect disastrous results if cast upon a drink container which contains -another liquid than water. Empty or water containers will be filled -depending on the level of the caster. - -Double amount of water will be created if it is raining (or worse). - -See also: "CREATE FOOD" -# -"CURE BLIND" - -Usage : cast 'cure blind' <victim> -Accumulative: No -Duration : Instantaneous -Level : Cleric level 4. - -This spell will cure a person blinded by the "blindness" spell, it -can not remove blindness caused by for example cursed items. -# -"CURE CRITIC" - -Usage : cast 'cure critic' <victim> -Accumulative: - -Duration : Instantaneous -Level : Cleric level 9. - -This spell cures 3d8+3 hitpoints of damage. -# -"CURE LIGHT" - -Usage : cast 'cure light' <victim> -Accumulative: - -Duration : Instantaneous -Level : Cleric level 1. - -Cures minor wounds and scratches. -# -CURSE - -Usage : cast 'curse' <victim | object> -Accumulative: Yes -Duration : 7 Days, permanent on objects. -Level : Mage level 14. - -Curse cast on a person that fails the saving throw, will reduce their -hitroll and damage roll both by one. It will also reduce the saving -throw versus paralysation by one. - -When cast upon an object, the object will become undropable. -# -"DETECT ALIGNMENT" - -Usage : cast 'detect alignment' -Accumulative: Yes (Duration) -Duration : 12 hours + level -Level : Cleric level 4. - -Allows the caster to detect the alignment of those around them. -Evil will show as a red aura, good in a blue aura. - -See also: "DETECT INVISIBILITY" -# -"DETECT INVISIBILITY" - -Usage : cast 'detect invisibility' [self] -Accumulative: Yes (Duration) -Duration : 12 hours + level/4 -Level : Mage level 2, Cleric level 6. - -This spell enables you to see invisible items and players. -# -"DETECT MAGIC" - -Usage : cast 'detect magic' [self] -Accumulative: Yes (Duration) -Duration : 12 hours + level -Level : Mage level 2. - -This spell will let you see the magical aura surrounding magical -objects. -# -"DETECT POISON" - -Usage : cast 'detect poison' <victim | food | drink> -Accumulative: No -Duration : Instantaneous -Level : Mage level 10, Cleric level 3. - -Cast on food or drinks (drink containers) you will be able to -sense if it is poisoned. - -Cast on a person you will be able to see if that person is -poisoned. -# -"DISPEL EVIL" - -Usage : cast 'dispel evil' <victim> -Accumulative: - -Duration : Instantaneous -Level : Cleric level 14. -Save : Special - -This spell will only affect evil creatures. An evil person of level -equal or less than caster will suffer 100 damage points. - -If the victim is higher level than caster, the spell will inflict -(caster_level)d4 damage points, saving throw versus half damage. - -See also: DISPEL GOOD -# -"DISPEL GOOD" - -Usage : cast 'dispel good' <victim> -Accumulative: - -Duration : Instantaneous -Level : Cleric level 14. -Save : Special - -This spell will only affect good creatures. A good person of level -equal or less than caster will suffer 100 damage points. - -If the victim is higher level than caster, the spell will inflict -(caster_level)d4 damage points, saving throw versus half damage. - -See also: DISPEL EVIL -# -EARTHQUAKE - -Usage : cast 'earthquake' -Accumulative: - -Duration : Instantaneous -Level : Cleric level 12. -Save : - - -This spell will damage everybody except the caster by -1d8+level_of_caster hitpoints. -# -"ENCHANT WEAPON" - -Usage : cast 'enchant weapon' <weapon> -Accumulative: No -Duration : Permanent -Level : Mage level 26. - -This spell will enchant non-magical (non-modifying) weapons only. -By non-modifying weapons we refer to weapons that might alter any -ability such as for example damage. The only way to know if a weapon -is suitable for enchantment is to fully identify it. - -The enchantment will modify the weapon as: - - Level Hit Roll Damage - - 0..17 +1 +1 - 18..19 +2 +1 - 20..20+ +2 +2 -# -"ENERGY DRAIN" - -Usage : cast 'energy drain' <victim> -Accumulative: - -Duration : Instantaneous -Level : Mage level 13. -Save : Versus spell for half damage. - -This spell does not give much damage, but victims failing their -saving throws will loose up to 40,000 XP points. You will gain -a quarter of this XP. - -Beware that this spell is evil. -# -FIREBALL - -Usage : cast 'fireball' <victim> -Accumulative: - -Duration : Instantaneous -Level : Mage level 15. -Save : Versus spell for half damage. - -This spell is the most powerful spell a magic user can cast. - -See also: "COLOR SPRAY" -# -HARM - -Usage : cast 'harm' <victim> -Accumulative: - -Duration : Instantaneous -Level : Cleric level 19. -Save : Versus spell for half damage. - -This spell removes all but 1d4 hitpoints from the victim. The -maximum number of damage points are 100. It is not possible to -kill using this spell (but almost). -# -HEAL - -Usage : cast 'heal' <victim> -Accumulative: No -Duration : Instantaneous -Level : Cleric level 16. - -Heal will heal all the hitpoints from a person, except 1d4 points. -Maximum 100 points can be healed. A victim who is blinded will also -be cured by the heal spell. - -See also: "CURE BLINDNESS" -# -INFRAVISION - -Usage : cast 'infravision' -Accumulative: Yes (Duration) -Duration : 12 hours + level -Level : Mage level 3, Cleric level 7. - -Allows the caster to detect the heat given off by objects giving them -the ability to have much better vision in dark conditions. - -See also: "DETECT INVISIBILITY" -# -INVISIBILITY - -Usage : cast 'invisibility' <victim | object> -Accumulative: Yes (Duration) -Duration : 24 hours, permanent on objects. -Level : Mage level 4. - -Makes the target of the spell invisible to everyone except those who have -the "detect invisibility" spell. - -Attacking while invisible will immediately break the spell. - -See also: "DETECT INVISIBILITY" -# -"LIGHTNING BOLT" - -Usage : cast 'lightning bolt' <victim> -Accumulative: - -Duration : Instantaneous -Level : Mage level 9. -Save : Versus spell for half damage. - -This spell is more powerful than the shocking grasp spell. - -See also: "SHOCKING GRASP" -# -"LOCATE OBJECT" - -Usage : cast 'locate object' <object> -Accumulative: - -Duration : Instantaneous -Level : Mage level 6. - -If possible you will know exactly where an object is, or the -name of the person using it. If more than one object by the -same name exists, you will get a listing of several objects. -The maximum number of objects you can simultaneously locate is -your level divided by 2. -# -"MAGIC MISSILE" - -Usage : cast 'magic missile' <victim> -Accumulative: - -Duration : Instantaneous -Level : Mage level 1. -Save : Versus spell for half damage. - -Causes a bolt of magical energy to be thrown from the casters hands at the -victim. -# -POISON - -Usage : cast 'poison' <victim | food | drink> -Accumulative: Yes on persons. -Duration : Level hours, or permanent on food and drinks. -Level : Cleric Level 8, Mage level 14. - -Casting poison on food or drink (containers) will poison it. Eating -poisoned food/drinks will poison the person eating or drinking. - -A person who is poisoned will suffer damage every hour, lose strength, and -gain less points than usual. - -See also: "REMOVE POISON", "DETECT POISON" -# -"PROTECTION FROM EVIL" - -Usage : cast 'protection from evil' [self] -Accumulative: Yes (Duration) -Duration : 24 hours -Level : Cleric level 8. - -The meaning of this spell is not yet fully defined. -# -"REMOVE CURSE" - -Usage : cast 'remove curse' <victim | object> -Accumulative: No -Duration : Instantaneous -Level : Cleric level 26. - -Will remove a curse on carried objects or any persons in the room. -# -"REMOVE POISON" - -Usage : cast 'remove poison' <victim | food | drink> -Accumulative: No -Duration : Instantaneous -Level : Cleric level 10. - -Will remove the affects of poison from a victim or an object. - -See also: POISON -# -SANCTUARY - -Usage : cast 'sanctuary' [self] -Accumulative: Yes (Duration) -Duration : 4 hours -Level : Cleric level 15. - -When protected by sanctuary you will only receive 1/2 the normal damage -caused by a particular blow. - -See also: ARMOR, BLESS -# -"SHOCKING GRASP" - -Usage : cast 'shocking grasp' <victim> -Accumulative: - -Duration : Instantaneous -Level : Mage level 7. -Save : Versus spell for half damage. - -This spell is more powerful than the burning hands spell. - -See also: "BURNING HANDS" -# -"SENSE LIFE" - -Usage : cast 'sense life' -Accumulative: Yes (Duration) -Duration : Level hours. -Level : Cleric level 5, Mage level 17. - -Allows the caster to sense the presence of a player or monster in the -room which is hiding. The true identity will remain hidden however. -Invisible persons are also considered hidden. - -See also: HIDE -# -STRENGTH - -Usage : cast 'strength' <victim> -Accumulative: Yes -Duration : Level/2 + 4 -Level : Mage level 6. - -A person will gain 1 strength point per spell (2 points if level of -caster is greater than 18). Maximum strength is 18/100. -# -SUMMON - -Usage : cast 'summon' <victim> -Accumulative: - -Duration : Instantaneous -Level : Cleric level 10. - -Will summon a person of the name spoken. It is not possible to -summon someone of three or more levels above yourself. -If you attempt to summon a monster, it will get a saving throw. - -See also: NOSUMMON -# -VENTRILOQUATE - -Usage : cast 'ventriloquate' <victim | object> <text> -Accumulative: - -Duration : Instantaneous -Level : Mage level 1. -Save : Versus spell victim only sees attempted cast. - -For all people in the same room as the caster that fail a saving throw, the -spell will make the object or victim appear to say the text written. - -Example: - - > cast 'vent' Mirlen I got 399,823 coins, don't even consider killing me! -# -"WORD OF RECALL" - -Usage : cast 'word of recall' -Accumulative: - -Duration : Instantaneous -Level : Cleric level 12. - -The caster will be transferred back to his hometown sanctuary (usually the -Temple of Midgaard). -# -$ diff --git a/lc-mud/circle/text/help/wizhelp.hlp b/lc-mud/circle/text/help/wizhelp.hlp deleted file mode 100644 index 6a50c8e6606e25aa6c5cd583f59e83f3a9b6a87f..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/help/wizhelp.hlp +++ /dev/null @@ -1,728 +0,0 @@ -ADVANCE - -Usage: advance <victim> <level> - -ADVANCE moves a player to a new level. If used to promote a player to an -immortal level, and if you have the autowiz program installed, the wizlist and -immlist will automatically be recreated. - -Example: - - > advance rasmussen 34 - -See also: SET -# -WIZAT - -Usage: at <room VNUM | item | mob | player name> <command> <arguments> - -AT can be used to perform an action in a location other than where you are -standing. The first argument can be a virtual room number or the name of a -character or object. The remainder of the line is passed to the command -interpreter. - -Examples: - - > at 3001 look - > at fido kill fido - > at 3.corpse get all corpse - > at catje wave catje - -See also: GOTO -# -BAN UNBAN - -Usage: ban [<all | new | select> <site>] - unban <site> - -These commands prevent anyone from a site with a hostname containing the -site substring from logging in to the game. You may ban a site to ALL, NEW -or SELECT players. Banning a site to NEW players prevents any new players -from registering. Banning a site to ALL players disallows ANY connections -from that site. Banning a site SELECTively allows only players with site-ok -flags to log in from that site. Ban with no argument returns a list of -currently banned sites. - -Unban removes the ban. - -Examples: - - > ban all whitehouse.gov - > unban ai.mit.edu - -See also: WIZLOCK -# -DATE - -Shows the current real time. (Not a social) -# -DC - -Usage: dc <descriptor number> - -DC (DisConnect) is used to disconnect a socket. If used on a playing socket, -the player will lose his/her link, but, unlike PURGE, will not extract the -player or dump the player's inventory on the ground. - -DC is also useful for disconnecting people who have accidentally left -themselves at the main menu, or connections sitting in the "Get name" state. - -See also: USERS -# -ECHO GECHO QECHO SEND - -Usage: echo <message> - gecho <message> - send <victim> <message> - qecho <message> - -ECHO displays a string to everyone in your room. -GECHO displays the string to everyone in the game. -QECHO displays the string to everyone with the QUEST flag. -SEND displays the string to a particular person. - -Examples: - - > echo Hi, everyone in the room. - > gecho Hi, everyone in the game, isn't this annoying? - > send rasmussen You are being watched. -# -FORCE - -Usage: force <victim | all> <command> <arguments> - -FORCE forces a character, either monster or player, to perform a certain -action. FORCE ALL forces everyone in the game; FORCE ROOM forces everyone in -your room. - -Example: - - > force fido drop meat - > force all save - > force room look fido - -If you are invisible to the one being forced, the force will be performed -silently. -# -FREEZE THAW - -Usage: freeze <victim> - thaw <victim> - -FREEZE, originally invented here at CircleMUD (we think), is used to prevent -a player from playing. If frozen, the game will ignore all commands entered -by the player, including QUIT, until the player is unfrozen with THAW. - -Obviously, this command should only be used in extreme disciplinary -circumstances. - -See also: SET -> FROZEN -# -GOTO TRANS WIZTELEPORT - -Usage: goto <location> - trans <victim> - teleport <victim> <location> - -These commands are used to transports yourself and others to different rooms. -GOTO allows you to go to other rooms; TRANS transports a person from wherever -they are to the room YOU are in; TELEPORT transports your victim to some other -location. - -For both GOTO and TELEPORT, the location specifier can be either a virtual -room number, or the name of a character or object. - -Examples: - - > goto 3001 - > goto rasmussen - > trans fido - > teleport fido 3001 - > teleport fido 2.fido - -See also: POOFIN, POOFOUT, SET -> ROOM, WIZAT -# -HANDBOOK - -Usage: handbook - -Guidelines for having an Immortal character -- you should read it. -# -HCONTROL - -Usage: hcontrol build <house vnum> <exit dir> <player name> - hcontrol destroy <house vnum> - hcontrol pay <house vnum> - hcontrol show - -House control, controls the addition, removal, and payments of houses. -Hcontrol show will show all the houses currently defined in the game -along with their last 'rent' payment date. - -See also: HOUSE, HOUSES -# -HOLYLIGHT - -Usage: holylight - -A toggle which allows you to see: - Invisible people and objects, even if you don't have 'detect invisibility' - Hidden people, even if you don't have 'sense life' - Dark rooms, even if you don't have a light - -It is expected most immortals will keep HOLYLIGHT on most of the time; -it exists so that you have the ability to see what mortals see for -debugging purposes. -# -IMOTD - -Usage: imotd - -Displays the Immortal message of the day. This file usually contains -new information on commands recently added, new features and other -important information that immortals should be aware of. - -See also: MOTD -# -INVIS - -Usage: invis [level] - -INVIS sets your invisibility level. With no argument, invis toggles between -making you fully visible and fully invisible. If you specify a level, only -people at and above the level you specify will be able to see you. - -Examples: - - > invis - > invis 31 - -See also: VISIBLE -# -LAST - -Usage: last <player_name> - -For checking the last time a person logged on, their sitename, and their -ID number. - -Example: - - > last ras - [ 24] [14 Cl] Ras : somesite.edu : Tue May 16 22:07:09 1995 - -See also: STAT -# -LOAD - -Usage: load <mob | obj> <virtual number> - -LOAD is used to create mobiles and objects. The first argument specifies if -you are trying to load a mobile or an object; the second is the virtual -number. - -Example: - - > load obj 3099 - You create a bulletin board. - - > load mob 3005 - You create the receptionist. - -See also: VNUM -# -MUTE - -Usage: mute <victim> - -MUTE is used to shut a player up. When muted, a player will not be able to -use most communication channels until he/she is unmuted. - -See also: FLAGS -# -NOHASSLE - -Usage: nohassle - -Toggles a flag to prevent aggressive monsters from attacking. -# -NOTITLE - -Usage: notitle <vicitim> - -Prevent players from being able to set their own titles; i.e., if the -player consistently has an offensive title. The definition of offensive -is left as an exercise for the reader. - -See also: TITLE -# -NOWIZ - -Usage: nowiz - -Allows you to hear or ignore messages coming over the wiznet. - -See also: WIZNET -# -OLC - -Usage: olc { . | set | show | obj | mob | room} [args] - - .: Repeat last modification command - set: Set OLC characteristics -show: Show OLC characteristics - obj: Modify an object - mob: Modify a mob -room: Modify a room - -OnLine Creation. A feature which will eventually allow the creation -of areas ONLINE, without having to reboot the system. - -See also: SHOW->ZONES, ZRESET -# -PAGE - -Usage: page <player | all> <message> - -PAGE is used to send a message, along with a beep, to another player. Use -PAGE ALL to send a message and a beep to everyone in the game. - -Examples: - - > page rasmussen Hey, are you still at the keyboard? - > page all GAME WILL BE SHUTTING DOWN IN 10 MINUTES - -Do not abuse this command. -# -PARDON - -Usage: pardon <victim> - -Removes killer and thief flags from a player. -# -POOFIN POOFOUT - -Usage: poofin <message> - poofout <message> - -Sets the message seen by players when you use GOTO to move to a different -room. POOFIN with no argument resets your poofin to the default "appears with -an ear-splitting bang"; POOFOUT with no argument defaults to "disappears in -a puff of smoke." - -See also: GOTO -# -PURGE - -Usage: purge [name] - -Purge destroys things. If used with no arguments, it will clear a room of all -mobiles and objects, but will not harm players. If the argument is an object, -that object (and all of its contents, if any) will be destroyed. If the -argument is a mobile, the mobile will be destroyed, leaving its inventory and -equipment lying on the ground. - -If the argument is the name of a player, the player's inventory and equipment -will drop on the ground and the player will lose his/her connection. For this -reason, PURGE should only be used on players in disciplinary situations. - -Examples: - - > purge - > purge Pom - > purge sword - > purge dragon - -See also: DC -# -RELOAD - -Usage: reload < '*' | all | file > - -Reload is used to reload text files such as the MOTD from disk into memory. -reload * reloads all the text files below. - -Valid files are: - - background (/mud_dir/lib/text/background) - credits (/mud_dir/lib/text/credits) - greetings (/mud_dir/lib/text/greetings) - handbook (/mud_dir/lib/text/handbook) - help (/mud_dir/lib/text/help) - immlist (/mud_dir/lib/text/immlist) - imotd (/mud_dir/lib/text/imotd) - news (/mud_dir/lib/text/news) - motd (/mud_dir/lib/text/motd) - info (/mud_dir/lib/text/info) - policy (/mud_dir/lib/text/policies) - wizlist (/mud_dir/lib/text/wizlist) - xhelp (/mud_dir/lib/text/help/*) -# -REROLL - -Usage: reroll <player> - -REROLL gives a player new stats (i.e., Str, Int, Wis, Dex, Con, and Cha) - -See also: STAT -# -RESTORE - -Usage: restore <player | mobile> - -RESTORE restores a player or mobile to full hit, mana, and movement points. -If used on immortals, it also sets all skill levels to 100%. -# -RETURN - -Usage: return - -RETURN returns you to your regular body if you are switched into a mob. - -See also: SWITCH -# -ROOMFLAGS - -Usage: roomflags - -Toggles a flag which causes the virtual room number and room flags, if any, -to be displayed next to room names. -# -SET - -Usage: set [ file | player ] <character> <field> <value> - -SET is an extremely powerful command, capable of setting dozens of aspects of -characters, both players and mobiles. - -SET PLAYER forces set to look for a player and not a mobile; useful for -players with names such as 'guard'. - -SET FILE lets you change players who are not logged on. If you use SET FILE -on a player who IS logged on, your change will be lost. If you wish to set -a player who is in the game but is linkless, use set twice -- once with the -FILE argument, and once without -- to make sure that the change takes. - -For toggled fields (BINARY), the value must be ON, OFF, YES, or NO. - -The following are valid fields: - -Field Level Required Who Value Type Decription ------------------------------------------------------------------------------ -age LVL_GRGOD BOTH NUMBER Character's age -brief LVL_GOD PC BINARY Brief mode -invstart LVL_GOD PC BINARY Invisible @ Start -title LVL_GOD PC MISC Player's title -nosummon LVL_GRGOD PC BINARY NOSUMMON flag -maxhit LVL_GRGOD BOTH NUMBER Max HP -maxmana LVL_GRGOD BOTH NUMBER Max mana -maxmove LVL_GRGOD BOTH NUMBER Max movement -hit LVL_GRGOD BOTH NUMBER Current HP -mana LVL_GRGOD BOTH NUMBER Current mana -move LVL_GRGOD BOTH NUMBER Current movement -align LVL_GOD BOTH NUMBER Alignment -str LVL_GRGOD BOTH NUMBER Strength -stradd LVL_GRGOD BOTH NUMBER Additional STR (18/xx) -int LVL_GRGOD BOTH NUMBER Inteligence -wis LVL_GRGOD BOTH NUMBER Wisdom -dex LVL_GRGOD BOTH NUMBER Dexterity -con LVL_GRGOD BOTH NUMBER Constitution -cha LVL_GRGOD BOTH NUMBER Charisma -sex LVL_GRGOD BOTH MISC Sex -ac LVL_GRGOD BOTH NUMBER Armor class -gold LVL_GOD BOTH NUMBER Gold (On hand) -bank LVL_GOD PC NUMBER Gold in bank -exp LVL_GRGOD BOTH NUMBER Experience points -hitroll LVL_GRGOD BOTH NUMBER To-Hit modifier -damroll LVL_GRGOD BOTH NUMBER Damage modifier -invis LVL_IMPL PC NUMBER Invisible (level) -nohassle LVL_GRGOD PC BINARY NOHASSLE flag -frozen LVL_FREEZE PC BINARY FROZEN flag -practices LVL_GRGOD PC NUMBER # of practices -lessons LVL_GRGOD PC NUMBER # of practices -drunk LVL_GRGOD BOTH MISC Drunkeness -hunger LVL_GRGOD BOTH MISC Hrs to hunger -thirst LVL_GRGOD BOTH MISC Hrs to thirst -killer LVL_GOD PC BINARY KILLER flag -thief LVL_GOD PC BINARY THIEF flag -level LVL_IMPL BOTH NUMBER Level -room LVL_IMPL BOTH NUMBER Move to room -roomflag LVL_GRGOD PC BINARY ROOMFLAGS flag -siteok LVL_GRGOD PC BINARY SITEOK flag -deleted LVL_IMPL PC BINARY DELETED flag -class LVL_GRGOD BOTH MISC Class (W/T/C/M) -nowizlist LVL_GOD PC BINARY Not Wizlistable flag -quest LVL_GOD PC BINARY QUESTING flag -loadroom LVL_GRGOD PC MISC Room to load in (#/off) -color LVL_GOD PC BINARY COLOR flag -idnum LVL_IMPL PC NUMBER ID Number -passwd LVL_IMPL PC MISC Player password -nodelete LVL_GOD PC BINARY Undeletable flag - -See also: STAT -# -SHOW - -Usage: show <mode> [argument] - -Valid Modes: - -death errors godrooms houses -player rent shops stats -zones - -The SHOW command displays information. Some modes of show require additional -information, such as a player name. - - death: Shows all death traps in the game. - errors: Shows errant rooms. -godrooms: Shows the rooms in the 'god zone'. - houses: Shows the houses that are currently defined. - player: Shows player summary information, simply provide a player name. - rent: Shows the filename and path to a players rent file. - shops: Shows all the shops in the game and their buy/sell parameters. - stats: Shows game status information including players in game, mobs etc. - zones: Shows all the zones in the game and their current reset status. - An age of -1 means it is in the 'to be reset next' queue. - -See also: STAT, ZRESET -# -SHUTDOWN - -Usage: shutdown [reboot | die | pause] - -SHUTDOWN shuts the MUD down. The SHUTDOWN command works in conjunction with -CircleMUD's 'autorun' script. If you are not using autorun, the arguments are -meaningless. If you are using autorun, the following arguments are available: - -REBOOT Pause only 5 seconds instead of the normal 40 before trying to - restart the MUD. - -DIE Kill the autorun script; the MUD will not reboot until autorun is - explicitly run again. - -PAUSE Create a file called 'paused' in Circle's root directory; do not - try to restart the MUD until 'paused' is removed. -# -SKILLSET - -Usage: skillset <name> '<skill>' <value> - -Sets the specified skill to the specified value. - -See also: SET -# -SLOWNS - -Usage: slowns - -Toggles whether or not IP addresses are resolved into readable site names. -If slow nameserver is enabled, USERS will show only IP addresses. -(128.123.222.111 etc). - -See also: USERS -# -SNOOP - -Usage: snoop [player] - -Snoop allows you to listen in on another player's session; everything the -player sees or types will be displayed on your terminal preceded by a '%'. - -Obviously, there are many ethical considerations to the use of this command; -snoop should be used minimally, and only for disciplinary purposes. - -Type snoop <your name> or just snoop to stop snooping. -# -SNOWBALL - -Snowball is just a social -- it prints a funny message, and nothing more. -# -STAT - -Usage: stat [player | object | mobile | file] <name> - -Gives information about players, monsters, and objects in the game. The type -argument is optional. - -STAT PLAYER will search only for players; useful for statting people with -names such as Red or Cityguard. - -STAT OBJECT will search only for objects. - -STAT MOBILE will search only for monsters. - -STAT FILE is used to stat players who are not logged in; the information -displayed comes from the playerfile. - -Examples: - - > stat fido - > stat player red - > stat mobile red - > stat file niandra - > stat object thunderbolt - -See also: VSTAT -# -STRING - -Usage: string <type> <name> <field> [<string> | <keyword>] - -For changing the text-strings associated with objects and characters. The -format is: - -Type is either 'obj' or 'char'. - -Field is one of the following(the names may be abbreviated): - -Name (the call-name of an obj/char - kill giant) -Short (for inventory lists (obj's) and actions (char's)) -Long (for when obj/character is seen in room) -Title (for players) -Description (For look at. For obj's, must be followed by a keyword) -Delete-description (only for obj's. Must be followed by keyword) - -Where a string is expected as the last argument, a newline will make you enter -a string mode, and the game will prompt you for new lines to the string until -you exceed the maximum length for the string or you end a line with a '@'. - -Mobiles and objects currently cannot be strung. -# -SWITCH - -Usage: switch <monster> - -SWITCH is used to take over the body of mobiles; useful for interactive -adventures. If the monster in which you are switched is killed you will be -returned to your own body. - -See also: RETURN -# -SYSLOG - -Usage: syslog [off | brief | normal | complete] - -The SYSLOG command controls how detailed of an on-line system log you see. -Messages surrounded by '[' and ']' are syslog messages and are in green -if you have color on. - -The messages you receive are level dependent. - -Examples: - - > syslog complete - > syslog off - -See also: COLOR -# -UNAFFECT - -Usage: unaffect <victim> - -Removes all affections (i.e., spell effects) from a player. - -See also: STAT -# -UPTIME - -Usage: uptime - -Displays when the game was booted and calculates how long ago that was. -# -USERS - -Usage: users [switches] - -USERS gives a list of all sockets (i.e., connections) currently active on the -MUD. The multi-column display shows the socket number (used by DC), class, -level, and name of the player connected, connection state, idle time, and -hostname. - -The following switches are available: - --k or -o Show only outlaws (killers and thieves). --p Show only sockets in the playing sockets. --d Show only non-playing (deadweight) sockets. --l min-max Show only sockets whose characters are from level min to max. --n <name> Show the socket with <name> associated with it. --h <host> Show all sockets from <host>. --c list Show only sockets whose characters' classes are in list. - -See also: DC, SLOWNS -# -VNUM - -Usage: vnum <mob | obj> <name> - -Gives a list of the virtual numbers of objects or mobiles which have the -specified name. - -Examples: - - > vnum obj ring - 1. [ 904] a platinum ring - 2. [ 2543] a seashell ring - 3. [ 2588] a small emerald ring - - > vnum mob dragon - 1. [ 1] Puff - 2. [ 908] the dragon turtle - 3. [ 2548] the Master of Illusions -# -VSTAT - -Usage: vstat < mob | obj > <virtual number> - -Used to stat a prototypical mobile or object by virtual number. - -Examples: - - > vstat obj 3000 - > vstat mob 3001 - -See also: LOAD, STAT, VNUM -# -WIZHELP - -Usage: wizhelp - -Gives a list of the special commands available at your level. -# -WIZLOCK - -Usage: wizlock [value] - -WIZLOCK allows you to restrict the game. WIZLOCK 1 prevents new characters -from being created. WIZLOCK n, 2 <= n <= 34, prevents new characters and -allows only characters level n and above to log on. WIZLOCK with no argument -displays the current WIZLOCK level. - -See also: BAN -# -WIZNET ; - -The immortal communication channel. - -Usage: wiznet [ '@' | '+' | '-' | '#' ] [<text>] - -Examples: - - >; <text> - just sends text - >; @ - shows all gods that are on and visible to you - - also shows if the gods who are visible to you are writing - -This code was provided by Gnort. - -See also: NOWIZ -# -ZRESET - -Usage: zreset < zone | '*' | '.' > - -Used to force a zone to reset. '*' forces all zones to reset. '.' forces -the zone you are in to reset. - -See also: SHOW -> ZONES -# -$ diff --git a/lc-mud/circle/text/immlist b/lc-mud/circle/text/immlist deleted file mode 100644 index 0ed9fc2feaa314540325069d28708ad17449bebb..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/immlist +++ /dev/null @@ -1,9 +0,0 @@ - ************************************************************************* - * The following people have reached immortality on CircleMUD. They are * - * to be treated with respect and awe. Occasional prayers to them are * - * advisable. Annoying them is not recommended. Stealing from them is * - * punishable by immediate death. * - ************************************************************************* - - Immortals - ~~~~~~~~~ diff --git a/lc-mud/circle/text/imotd b/lc-mud/circle/text/imotd deleted file mode 100644 index bff0d7292b2f0090d9bc7f603343dea6c17e5dc5..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/imotd +++ /dev/null @@ -1,18 +0,0 @@ -(lib/text/imotd) - -Welcome to the long-awaited, oft-belated, highly-rated CircleMUD 3.1! - -This is the immortal MOTD -- the file that immortals will see when they -log in to the game. You should change it to something more interesting -when you get a chance (as well as most of the other files in lib/text.) - -If you need help with CircleMUD, please write to help@circlemud.org - -If you would like to report a bug, please write to bugs@circlemud.org - -For all other general discussion, you might want to join the CircleMUD -Mailing List. If you wish to subscribe to the mailing list, send mail -to <listserv@post.queensu.ca> with: - subscribe circle <first name> <last name> -in the body of the message. - diff --git a/lc-mud/circle/text/info b/lc-mud/circle/text/info deleted file mode 100644 index 30f2cf198ea67d453c8f1a7f5b7ca3e1957dd39d..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/info +++ /dev/null @@ -1,46 +0,0 @@ -(lib/text/info) - -[Note: Further information can be gained on the capitalized words by using the -HELP-command] - -Classes, skills, and guilds: - -When you enter the game the first time, you are asked to select a class; either -THIEF, WARRIOR, CLERIC, or MAGIC user. Characters belonging to each of these -classes have their own qualities, abilities, and handicaps. - It is not unusual that people belonging to different classes, by joining -their efforts and combining their skills, find their chances of survival and -progress greatly improved. Indeed, a team consisting of members from all four -classes can be an extremely powerful unit; capable of opening doors without -keys, creating food supplies out of nothing, and destroying an enemy in -several different ways. It is not advisable for a new player to offend the -members of such a group! - -In order to learn the tricks of your specific trade, you need to find your -GUILD, which may take a little exploring. However, you can usually find a -guild in any reasonably populated city. Once you've found it, you need to -look up your guildmaster and PRACTICE. - -Equipment: - -It is never wise to travel without the proper equipment. You may purchase this -in the SHOPS found in any larger city, or you may be lucky and find some left -around, dropped by someone who doesn't need it anymore, for one reason or -another. - -About Staying Fit - Eating and Drinking: - -At one time or another, you'll see the message "You are hungry". This means -that it's time to find something edible before too long. People don't starve -to death in this world, so have no fear. However, when you are hungry, you do -not build up lost energy, so eventually you'll be unable to do anything but sit -around and feel sorry for yourself, until someone comes by. Then, you can only -hope that it's a benevolent person, rather than a greedy thief or a warrior -lusting for blood. - -General hints: - - See help on the group command. - See help on the consider command. - See help on resting. - See help on your class (magic user, cleric, warrior or thief). diff --git a/lc-mud/circle/text/motd b/lc-mud/circle/text/motd deleted file mode 100644 index d7c59e4428e0eb51e79158f6400b65c17ea24c20..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/motd +++ /dev/null @@ -1,8 +0,0 @@ -(lib/text/motd) - - Welcome to - - C I R C L E M U D 3 . 0 - "We addict players for their own enjoyment." - Created by Jeremy Elson (jelson@circlemud.org) - diff --git a/lc-mud/circle/text/news b/lc-mud/circle/text/news deleted file mode 100644 index fd0ec9807cba28e23c4127ead680594b8cd2598a..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/news +++ /dev/null @@ -1,63 +0,0 @@ -(lib/text/news) - - THE CIRCLEMUD HERALD - "We addict players for their own enjoyment." - September 19, 1993 - - -NEW COMMANDS AND NEW MUD BEHAVIOR: ---------------------------------- - -** Your character no longer gains move points with age. However, age - does still affect your HMV gains. Also, move point modifier objects - now work correctly. - -** You can now use "all" and "all.x" very generally with the get, put, - drop, junk, donate, give, wear and remove commands. Type HELP GET - for more info. - -** The "track" function will show you the first step on the shortest - path to anyone in the game. - -** If you drop your link for more than 1 hour, you will be force-rented - at 25% greater than normal rent prices. If you don't have enough - money to rent with, your most valuable items will be junked until - the money you have can cover your items. - -** You can now remove your own messages from the board. Also, if you - put someone else's name in parentheses in the message header, they - will be able to remove the message too. - -** The MIDGAARD MAIL SYSTEM is now complete. The Post Office is north - of the entrance to the Grunting Boar inn. Stamps cost 150 coins. - -** Fountains have now been implemented. You can drink from fountains - or fill containers from fountains using the FILL command. - -** The SHOUT command, as always, only reaches people in your zone (you - can see who these people are by typing WHERE). The HOLLER command - reaches everyone in the game but costs 10 movement points. - -** When you are writing a message, you will now not be interrupted - by tells, shouts, emotes, socials, and even people talking in the - same room. - -** The WIMPY command has been upgraded so you can set at how many hit - points you flee. Type HELP WIMPY for more info. - -***************************************************************************** - IF YOU LEAVE THE GAME FOR MORE THAN AN HOUR, either by renting or plain - quitting, your hit points, move points, and mana will be fully restored - when you come back! This doesn't work if you're poisoned. -***************************************************************************** - -** Use the ASSIST command to engage in mortal combat with someone in the - room who is getting pummeled. - -** Use the SPLIT command to split gold among the members of your group - (including yourself) who are in the room. i.e. If you are in a group - with 4 other people who are in the room with you, type "SPLIT 100" - to give each of them 20 coins. - -** You can use the VISIBLE command to break a spell of invisibility before - it expires. diff --git a/lc-mud/circle/text/policies b/lc-mud/circle/text/policies deleted file mode 100644 index fa57ee21340739f2c14fd645e900a11cfa1b8b2e..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/policies +++ /dev/null @@ -1,9 +0,0 @@ -(lib/text/policies) - -This file should list, in no uncertain terms, the policies you must abide -by on this MUD. - -Bug the higher-ups to make some policies and write them in this file, lest -a political disaster ensue... - - diff --git a/lc-mud/circle/text/wizlist b/lc-mud/circle/text/wizlist deleted file mode 100644 index 667729754e840bf02edd66a168e5cb4bcf6c49b3..0000000000000000000000000000000000000000 --- a/lc-mud/circle/text/wizlist +++ /dev/null @@ -1,16 +0,0 @@ - ************************************************************************* - * The following people have reached immortality on CircleMUD. They are * - * to be treated with respect and awe. Occasional prayers to them are * - * advisable. Annoying them is not recommended. Stealing from them is * - * punishable by immediate death. * - ************************************************************************* - - Implementors - ~~~~~~~~~~~~ - - Greater Gods - ~~~~~~~~~~~~ - - Gods - ~~~~ - diff --git a/lc-mud/circle/world/README b/lc-mud/circle/world/README deleted file mode 100644 index 59a9d00dd513f0ca8c1594ddbb5294ff3afb7f99..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/README +++ /dev/null @@ -1,35 +0,0 @@ -CircleMUD - World Files - - Contained in this lovely archive is the present shape of the world -for Circle. Everything should be in the form of ASCII flags for easy -addition and removal of flags. All of the shop files are in the -CircleMUD style (and they make good examples since there is a bit of -everything, from wandering shops through to shops that dislike certain -alignments or classes). - - Feedback on the world is more than welcome. This includes -listing things that people like and things that people do not -like. Why do you like it or dislike it? - - The zone files have been formatted into a consistent format -with comments and ordering. This allows readers of the files to -have a much quicker grasp of what is going on in the file. All -of the world files have been indented with three (3) characters -to begin all paragraphs. This makes the overall format of the -world much more similar. - - If you are comparing the world to the CircleMUD 2.x world, you -will notice that some areas have been removed, others have been -added, and some have been shifted about a little bit. - - Also, please note the 'zone.lst' file in this directory, which -shows all of the zone numbers that are currently in use, and what -is using them. Finally, full credit should be in all of the zone -files (please leave it there in case you ever release your mud code -and world), and can also be found in 'info.hlp' under 'AREAS ZONES' -which gives a current list of zones used in CircleMUD. Please ensure -that all credits in there remain, and if you add new areas, please -credit them properly. - -Furry/Alex Fletcher -<furry@circlemud.org> diff --git a/lc-mud/circle/world/README.CAW b/lc-mud/circle/world/README.CAW deleted file mode 100644 index b3f30210a526519335c190dfee1f3c0355c983bc..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/README.CAW +++ /dev/null @@ -1,42 +0,0 @@ -C.A.W. - -The Curious Area Workshop was created for the creation and -distribution of DikuMud areas to the public. - -Why? - -The individuals involved in the initial creation of C.A.W. were tired -of seeing their work disappear on muds that come and go as quickly as -a summer rain. C.A.W. gives them, and others, the chance to -distribute their efforts to the general community -- a chance to give -back to the mudding community in a small way. - -Would you like to see us personally on your mud? You won't. We don't -want free wizzes/favors for our work here. In fact, we will state -categorically that if anyone comes on your mud claiming to be -associated with us, they aren't. - -There is one exception, one only. Caw exists as an entity on VieMud -mud, our pre-release testing grounds. If you need to get in contact -with us for any reason, you can reach us on VieMud, directly at -<fletchra@qsilver.queensu.ca>, or at our web page at: -http://qsilver.queensu.ca/~fletchra/Caw/ - -We welcome criticism, ideas, challenges, bug/typo reports, and advice. -If you use one of our areas in your mud, and want to be put on our -mailing list for updates, announcements, and errata, drop us a line! - -------------------------------------------------- -Legal Matters - -All files mentioned in the section, 'Manifest', have been copyrighted -as per United States copyright laws. - -Permission is given to modify, change, and otherwise make use of these -files in any manner desired, as long as proper credit for the original -concept, design, and work is given to the Curious Area Workshop -(C.A.W.) and C.A.W. is notified of such use. Redistribution of the -files must contain at least this file however, and C.A.W. must be -notified if this occurs. - -------------------------------------------------- diff --git a/lc-mud/circle/world/mob/0.mob b/lc-mud/circle/world/mob/0.mob deleted file mode 100644 index 3614a34ee729834712c3e66feaee0b490862fc2a..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/0.mob +++ /dev/null @@ -1,65 +0,0 @@ -#1 -Puff dragon fractal~ -Puff~ -Puff the Fractal Dragon is here, contemplating a higher reality. -~ -Is that some type of differential curve involving some strange, and -unknown calculus that she seems to be made out of? -~ -anopqr dkp 1000 E -26 1 -1 5d10+550 4d6+3 -10000 155000 -8 8 2 -BareHandAttack: 12 -E -#10 -clone~ -the clone~ -A boring old clone is standing here. -~ -This clone is nothing to look at. No, really, it is quite boring. -~ -b 0 0 S -1 0 0 1d1+1 1d1+1 -0 0 -8 8 0 -#11 -zombie undead humanoid~ -the zombie~ -A strange humanoid is here. How odd, its flesh seems to be falling off! -~ -This strange humanoid is moving rather slowly, and appears to be -a corpse, a walking corpse! It must be a zombie or something of -the sort. -~ -b 0 0 E -1 0 0 1d1+1 1d1+1 -0 0 -8 8 0 -BareHandAttack: 7 -E -#19 -aerial servant shape~ -the aerial servant~ -An amorphous shape is floating in the air. -~ -As you stare at this amorphous shape, it begins to appear to take -the shape of a cloud-like humanoid. -~ -b 0 0 S -1 0 0 1d1+1 1d1+1 -0 0 -8 8 0 -#20 -elemental~ -the elemental~ -An elemental is standing patiently here. -~ -This creature is the essence of the elements, and appears to be -waiting patiently for something to occur. -~ -b 0 0 S -1 0 0 1d1+1 1d1+1 -0 0 -8 8 0 -$ diff --git a/lc-mud/circle/world/mob/12.mob b/lc-mud/circle/world/mob/12.mob deleted file mode 100644 index 3b3a55948f60a46d2ba0a269c0f8d6078812d06d..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/12.mob +++ /dev/null @@ -1,37 +0,0 @@ -#1200 -innkeeper~ -the Immortal Innkeeper~ -The Immortal Innkeeper is organizing her books here. -~ -She appears to be having no problem tallying things up. -~ -ab p 0 S -30 0 -10 1d49+901 4d8+5 -0 0 -8 8 2 -#1201 -postmaster master post~ -the Immortal Postmaster~ -The Immortal Postmaster is hard at work here. -~ -Scary... a postal worker... working? -~ -ab p 0 S -30 0 -10 1d49+901 4d8+5 -0 0 -8 8 2 -#1202 -being amorphous spirit wandering~ -the wandering spirit~ -A strange amorphous being wanders these halls eternally cleaning. -~ -This spirit, having lived out its days in the mortal world, now -works off its final sins by doing menial labour in this realm's -purgatory. In this case, those chores seem to be cleaning up -after the immortals of the land. -~ -acgq dkps 0 S -30 0 -10 1d49+901 4d8+5 -0 0 -8 8 0 -$ diff --git a/lc-mud/circle/world/mob/120.mob b/lc-mud/circle/world/mob/120.mob deleted file mode 100644 index a1c8e2c6293e88af5e09766f33263a835d3faed0..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/120.mob +++ /dev/null @@ -1,489 +0,0 @@ -#12000 -judge adjudicator~ -the adjudicator~ -An adjudicator is watching the games intently. -~ -The adjudicator is a retired gladiator and scars cover all exposed parts of -his body. Although he is getting on in years, he remains healthy and fit. -~ -bl h 100 S -12 9 2 3d7+140 1d7+4 -2000 13000 -8 8 1 -#12001 -scorekeeper~ -the scorekeeper~ -A scorekeeper has one eye on his stopwatch and the other on a clipboard. -~ -The scorekeeper is a young man of about 25 years of age and is very intently -studying his clipboard. -~ -bl 0 100 S -7 14 4 3d5+80 1d4+3 -500 2250 -8 8 1 -#12003 -spectator fan~ -the spectator~ -A spectator is here watching the games. -~ -The spectator is filthy, half drunk and screaming his head off. -~ -b 0 -100 S -5 16 5 2d6+65 2d4+0 -100 900 -6 6 0 -#12004 -noble nobleman~ -the nobleman~ -A nobleman stands here looking aloof. -~ -The nobleman is dressed in fine clothes and jewelry and has a very snobbish -attitude. While he is getting old and his hair and beard are streaked with -gray, he is by no means an easy target. -~ -bhl d 500 S -12 9 2 4d6+140 1d7+5 -3500 13000 -8 8 1 -#12005 -slave~ -the slave~ -A slave stands here, wishing that she was free. -~ -A very pretty young woman who was captured instead of being killed when -the Roman legions subjugated her land. -~ -b 0 0 S -3 18 7 3d6+30 1d7+0 -10 350 -8 8 2 -#12006 -gladiator~ -the gladiator~ -There is a gladiator standing here. -~ -A well muscled man who is very heavily armored and armed to the teeth. He -lives for combat. -~ -b 0 -250 S -14 5 0 4d7+150 1d8+6 -700 19500 -8 8 1 -#12007 -driver~ -the chariot driver~ -There is a chariot driver here. -~ -You see a very slight and small individual whose whole life is centered around -nothing but horses and speed. -~ -b 0 100 S -10 11 2 3d7+120 2d6+1 -1200 9000 -8 8 1 -#12008 -coach trainer~ -the coach~ -There is a coach standing here, going over last minute strategy. -~ -As you try to look over his shoulder and listen in on his mumbling, -he looks up at you and gives you a glare that chills you to the -bone. -~ -bl 0 0 S -11 10 2 4d5+130 2d6+1 -500 11000 -8 8 1 -#12009 -healer~ -the healer~ -A healer is standing here. -~ -You see a young man, still learning about magical healing, wearing a white -coat and using a stethoscope. -~ -abel d 900 S -14 7 1 2d7+170 1d7+6 -1500 18000 -8 8 1 -#12010 -herbalist young lady beautiful~ -the herbalist~ -There is a beautiful young lady here, carrying herbs to help the healer with. -~ -The herbalist is a very beautiful young lady who is about 22 years old. She -has deep brown eyes and shoulder-length chestnut hair. Her body is perfectly -proportioned and she stands about 5' 5" tall. -~ -bhl d 1000 S -10 11 2 3d4+110 1d7+4 -500 8000 -8 8 2 -#12011 -shopkeeper~ -Titus' shopkeeper~ -Titus' shopkeeper is here, minding the store. -~ -The shopkeeper is an older man in his middle to late fifties and looks like -he enjoys the quiet life. There is a long scar running from the edge of his -mouth to his right ear, making it look like he is always smiling. -~ -bl hd 750 S -23 0 -2 4d10+400 3d8+12 -5000 80000 -8 8 1 -#12012 -peddler~ -the peddler~ -A poor peddler is standing here, trying to support his meager existence. -~ -You see a small, dirty man who doesn't look very healthy. -~ -bghn 0 250 S -4 17 6 3d4+40 1d8+0 -100 600 -8 8 1 -#12013 -page~ -the page~ -A page stands here, waiting to run an errand. -~ -You see a young boy who looks very strong and very fast. He has the look of -a scholar about him. -~ -b 0 0 S -6 15 4 3d6+75 2d4+1 -0 1600 -8 8 1 -#12014 -plaintiff~ -the plaintiff~ -The plaintiff stands here, pleading his case. -~ -He looks pitiful. Absolutely pitiful. -~ -b 0 0 S -11 10 2 3d6+140 2d6+3 -1000 12000 -8 8 1 -#12015 -master~ -the ticket master~ -A ticket master is here, looking at you expectantly. -~ -He seems to be waiting for you to either buy a ticket or to get out -of his way so that he can sell tickets to people that actually want -them. -~ -bl 0 100 S -17 4 1 4d8+210 1d6+11 -4000 28000 -8 8 1 -#12016 -vendor~ -the stadium vendor~ -A stadium vendor is walking here, selling overpriced hotdogs and beer. -~ -The vendor is a scruffy looking man who isn't afraid of a fight and looks -like he has had just about enough of smart-mouthed spectators. -~ -g 0 -150 S -8 13 3 2d4+13000 2d5+15 -500 3700 -8 8 1 -#12017 -citizen~ -the citizen~ -A citizen of Rome is standing here. -~ -It appears to be your ordinary citizen going about his business. -~ -gl 0 900 S -5 16 5 1d4+85 1d8+1 -100 1000 -8 8 1 -#12018 -gateguard guard~ -the gateguard~ -A gateguard stands here, tending the gate. -~ -You see a strong, loyal public defender. -~ -abcel 0 1000 S -11 10 2 3d6+130 1d6+5 -500 11000 -8 8 1 -#12019 -soldier~ -the soldier~ -A soldier on leave is walking around looking for entertainment. -~ -You see a member of one of the Emperor's elite legions. He looks VERY strong. -You have this vague feeling that his entertainment isn't going to be a very -wholesome activity. -~ -gl 0 300 S -17 4 -1 3d5+220 1d6+9 -1281 28000 -8 8 1 -#12020 -emperor julius caesar~ -Julius Caesar~ -Julius Caesar, the Emperor of Rome, is sitting here. -~ -You see a man who is dressed in the finest of clothes, has eaten the best of -foods and lived in the most opulent palace that Rome has ever known. -~ -abl dhp 990 S -27 0 -7 10d5+650 3d7+15 -24763 150000 -8 8 1 -#12021 -guard royal bodyguard~ -the royal bodyguard~ -There is a royal bodyguard here, ready to die for the Emperor, if necessary. -~ -The bodyguard is dressed in the finest of armor and wields only the -deadliest of weapons. He is very strong and would put up one hell -of a fight. He has been trained to be suspicious of all but the -most innocent visitors, and likely to take offense of anyone with -less than pure intentions. -~ -abikl d 990 E -18 2 0 3d6+220 1d6+6 -5000 35000 -8 8 1 -BareHandAttack: 6 -Str: 18 -StrAdd: 90 -E -#12022 -judge justice~ -the judge~ -A judge is standing here, reading a case. -~ -He seems to be quite interested in the case, perhaps you shouldn't -disturb him now, later would probably be a better time. -~ -bl 0 990 S -21 0 -1 20d5+260 1d7+11 -5000 50000 -6 6 1 -#12023 -master scheduler~ -the master scheduler~ -The master scheduler is here, writing in an appointment book. -~ -As you look at him, he looks up at you and asks, 'Do you have an -appointment?' He waits for a few seconds and then asks, 'Would -you like one?' -~ -bl 0 900 S -17 3 0 4d4+210 1d6+9 -3000 28000 -8 8 1 -#12024 -slimeball slime ball green~ -the slimeball~ -A green ball of slime is hanging over you, oozing downward. -~ -There is a green 'ball' of slime oozing from the coating on the walls. -~ -bcfqr dfk -500 E -12 9 2 3d4+145 2d6+2 -0 13000 -8 8 0 -BareHandAttack: 9 -Int: 1 -E -#12025 -froboz wizard~ -Froboz~ -Froboz the wizard is standing here, working on a new spell. -~ -You see a middle-aged man whose knowledge of magic, both offensive and -defensive, is legendary. He literally glows with a pink aura. -~ -abelno dh 300 S -23 0 -3 5d10+425 1d8+14 -32000 95000 -8 8 1 -#12026 -titus andronicus~ -Titus Andronicus~ -Titus Andronicus is standing here, polishing a few swords. -~ -As you look at him, he suddenly swings a newly sharpened sword -at you! Watch out! -~ -beflno dh 500 E -24 0 -5 1d5+450 1d8+14 -31000 85000 -8 8 1 -BareHandAttack: 3 -E -#12027 -senator~ -the senator~ -A senator is here, waiting for debate to begin. -~ -He seems to be quite bored and is playing with the edge of his toga. -~ -bl 0 350 S -10 11 2 3d5+120 2d6+1 -500 9000 -8 8 1 -#12028 -bailiff~ -the bailiff~ -The bailiff stands here, keeping order in the courtroom. -~ -He is a very stern man and insists on absolute quiet in his courtroom -unless the judge has given someone permisson to speak. -~ -bl d 900 S -16 5 1 1d5+200 2d7+4 -1000 24000 -8 8 1 -#12029 -defendant~ -the defendant~ -The defendant stands here, pleading her case. -~ -She looks to be well organized and full of confidence. -~ -bl 0 200 S -11 9 1 3d6+130 2d7+1 -500 11000 -8 8 2 -#12030 -jupiter king god~ -Jupiter~ -Jupiter, King of the Gods, is watching over his realm here. -~ -He is the strongest of the Gods, and certainly no easy mark! His powers -transcend the plane of the physical, and could easily kill an unprepared -mortal. -~ -abeilnopqr dhkp 1000 E -34 0 -10 20d15+950 8d6+50 -250000 550000 -8 8 1 -BareHandAttack: 10 -Str: 25 -Int: 25 -Wis: 25 -Dex: 25 -Con: 25 -Cha: 25 -E -#12031 -venus goddess~ -Venus~ -Venus, the Goddess of Beauty and Knowledge, is resting here. -~ -Venus is probably one of the most beautiful women you have ever seen -if not THE most beautiful. She is very powerful and tough under that -outer image of beauty. -~ -abelnopqr dhkp 1000 E -28 0 -6 5d10+650 6d6+12 -80000 310000 -5 5 2 -BareHandAttack: 12 -Str: 20 -Int: 20 -Wis: 20 -Dex: 20 -Con: 20 -Cha: 25 -E -#12032 -mars god~ -Mars~ -Mars, the God of War and State, is sitting down here. -~ -Mars is a tall God with burning, hateful eyes and a large scowl on -his face. -~ -abelnopqr dhkp 1000 E -27 0 -9 15d10+630 8d6+14 -60000 200000 -6 6 1 -BareHandAttack: 7 -Str: 25 -Int: 20 -Wis: 20 -Dex: 20 -Con: 20 -Cha: 20 -E -#12033 -mercury messenger god~ -Mercury~ -Mercury, the messenger of the Gods, is standing here. -~ -Mercury is a handsome, youthful God and wears a large grin on his face. -~ -belnopqr dkp 1000 E -26 0 -10 5d10+550 4d6+8 -25000 155000 -8 8 1 -BareHandAttack: 13 -Str: 20 -Int: 20 -Wis: 20 -Dex: 25 -Con: 20 -Cha: 23 -E -#12034 -shopkeeper~ -Froboz' shopkeeper~ -Froboz' shopkeeper is here, minding the store. -~ -The shopkeeper is an older man in his middle to late fifties and looks like -he enjoys the quiet life. There is a long scar running from the edge of his -mouth to his right ear, making it look like he is always smiling. -~ -blno dh 650 S -23 0 -2 4d10+400 1d8+14 -5000 80000 -8 8 1 -#12035 -executioner~ -the executioner~ -The executioner stands here, waiting to torture some sorry soul. -~ -You see a burly man who is wearing a black hood that obscures his face. He -has a very sadistic attitude and clearly loves his work. -~ -bcfno d -1000 S -20 1 0 2d6+260 2d2+14 -1000 40000 -8 8 1 -#12036 -baker~ -the baker~ -The baker looks at you calmly, wiping flour from his face with one hand. -~ -A fat, nice looking baker. But you can see that he has many scars on his -body. -~ -bl d 900 S -33 0 -10 6d10+30000 2d8+22 -2000 80000 -8 8 1 -#12037 -grocer~ -the grocer~ -A grocer stands at the counter, with a slightly impatient look on his face. -~ -A tall grocer, who moves two 200 pounds bag of flour around on his shoulders. -~ -bl d 900 S -33 0 -10 1d1+30000 2d8+22 -20000 80000 -8 8 1 -$ diff --git a/lc-mud/circle/world/mob/15.mob b/lc-mud/circle/world/mob/15.mob deleted file mode 100644 index 9557d34f9700ef9fe91a8e075645518b27679455..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/15.mob +++ /dev/null @@ -1,309 +0,0 @@ -#1500 -allah god yahweh~ -Allah~ -You resist the urge to avert your eyes from the sight of the one true God. -~ -The sight is for each man a different, a mirror into the true nature of -each person's body and soul. At first a proud, bitter old man, but just -as easily a gentle extended hand, a smile, and gardens... gardens. -~ -beilnopqr h 1000 S -30 -10 -10 1d1+2999 8d8+9 -0 400000 -8 8 1 -#1501 -michael angel archangel~ -Michael~ -The archangel Michael turns and begins to look you over. -~ -At first you see nothing but a bright and comforting glow; then the -image sharpens suddenly, and you see a face, eyes, hands, but then -that too fades, and you see nothing. -~ -bl h 1000 S -29 -6 -7 1d100+1900 6d7+7 -0 280000 -8 8 1 -#1502 -gabriel angel archangel~ -Gabriel~ -The archangel Gabriel smiles, and begins to tell you something. -~ -Known as the Messenger, it is this angel that has brought the Divine Word -to the chosen prophets, and in turn brought the Seal of the Prophets on a -miraculous journey to the holy city of Jerusalem. -~ -bl h 1000 S -29 -6 -7 1d100+1900 6d7+7 -0 280000 -8 8 1 -#1503 -raphael angel archangel~ -Raphael~ -The archangel Raphael looks up and frowns at you in disapproval. -~ -It is impossible to get a solid glance at the archangel. He is nothing -that is human, and with a mere whisper, he dispels every image that you -attempt to create in your mind. -~ -bl h 1000 S -29 -6 -7 1d100+1900 6d7+7 -0 280000 -8 8 1 -#1504 -uriel angel archangel~ -Uriel~ -Uriel, the angel of darkness, stands here guarding the way forward. -~ -After the Fall of the bringer of light, the Lord had need for the -service of a fourth, and it was this angel, Uriel, that rose to the -highest ranks. -~ -bl h 1000 S -29 -6 -7 1d100+1900 6d7+7 -0 280000 -8 8 1 -#1505 -cherub cherubin cherubim~ -the cherubin~ -The cherubin of the blazing sword looks at you and begins to chuckle. -~ -The monster before you seems to be nothing more than a baby or young -child, wrapped in a glowing white cloth, but as you try to walk past, -the beast grins and cackles, drawing its sword and blocking the way. -~ -bf h 0 S -17 1 0 10d5+260 3d6+4 -0 40000 -8 8 0 -#1506 -jester~ -the jester~ -A mad, drunken jester is sitting here, lost in his deepening stupor. -~ -He is dimly aware of your gaze. Chuckling softly, you hear him mutter -something obscure: dragons, the temple, the falling of great empires. -He laughs at you and takes another drink. -~ -b 0 -300 S -13 6 1 10d2+180 2d8+2 -3450 21000 -6 6 1 -#1507 -jinn sprite~ -the jinn~ -One of the jinn dances in and out of the air before your eyes, taunting you. -~ -You have heard legends of these creatures, the mischievous little demons -said to be trapped in lamps and bottles, capable of granting all kinds of -powerful wishes. To you, it looks like nothing more than an annoying little -sprite. -~ -cg b 0 S -23 0 -2 25d2+400 3d9+3 -0 70000 -8 8 0 -#1508 -man old~ -the slumped old man~ -A slumped, shaking old man stands up and begins to yell at the world. -~ -He wears a faded uniform, decorated with honors of his own creation, -slackened jaws and pasty white bags sagging under his ugly, hating eyes. -A tuft of reckless dark hair scatters across his forehead, and his right -hand shakes and shakes. -~ -bf dk -1000 S -26 -4 -5 4d10+840 4d9+6 -34000 180000 -8 8 1 -#1509 -caliph hakim al-hakim~ -al-Hakim~ -The mad Caliph al-Hakim is here, dissecting a young boy. -~ -The darkest skin, and eyes so white. Covered only in a shoddy woolen -tunic, he has not bathed in months nor eaten in days, and yet his smile, -so charming. -~ -bf dk -1000 S -26 -4 -5 4d10+840 4d9+6 -34000 180000 -8 8 1 -#1510 -judas escariot apostle~ -Judas Escariot~ -The wayward apostle approaches slowly, extending his arms in a hug. -~ -You see nothing but the sadness of a man who would sell his own God. -~ -bc dk -1000 S -25 -3 -4 5d10+650 4d6+5 -1 145000 -8 8 1 -#1511 -pharoah~ -Pharoah~ -Pharoah has been sent here in retribution for a lifetime of evils. -~ -Richly clothed and postured in arrogance and love of power, he looks at -you with nothing more than a smirk of contempt. -~ -b dk -1000 S -25 -3 -4 5d10+650 4d6+5 -25000 145000 -8 8 1 -#1512 -abu bakr first caliph~ -Abu Bakr~ -Abu Bakr, first of the Rashidun, mourns over the death of the Prophet. -~ -You see a simple man, dressed in dark and unadorned robes, bent over and -pensive, reliving the memories of a man he never thought would die. -~ -b dk 1000 S -25 -3 -4 5d10+650 4d6+5 -25000 145000 -8 8 1 -#1513 -umar second caliph~ -Umar~ -You see Umar, second of the Rashidun, the successors of the Prophet. -~ -You are amazed at the piety of the man. He looks at you in sadness, -saying: "I do not wish to fight you, but if you refuse the truth of -the Word, then I must." -~ -b dk 1000 S -25 -3 -4 5d10+650 4d6+5 -25000 145000 -8 8 1 -#1514 -uthman third caliph~ -Uthman~ -The third of the rightly-guided Caliphs, Uthman, stands before you. -~ -He was chosen as leader by a clique of jealous rivals who could agree -upon no other. The memory of the Prophet fading quickly from the minds -of the faithful, he could do little, and was in the end killed by his -enemies. -~ -bf dk 1000 S -26 -4 -5 4d10+840 4d9+6 -34000 180000 -8 8 1 -#1515 -ali fourth last caliph~ -Ali~ -You have come before Ali, fourth and last of the Rashidun. -~ -Some view him as the closest to God among all of the Caliphs, the one -most deserving of our respect and reverence. Still others saw him as -a schismatic, a heretic, one to be killed and forgotten. To look at -him now is for you to decide for yourself. -~ -bf dk 1000 S -26 -4 -5 4d10+840 4d9+6 -34000 180000 -8 8 1 -#1516 -angel beautiful iblis~ -Iblis~ -You gaze in awe at the most beautiful of all angels, Iblis, the Fallen. -~ -He smiles calmly, and begins to tell you of the time when he would not -kneel, would not prostrate himself before the first human beings. And -then he gestures at you, smiling, and conjures an image of all the -temptations that will be yours if you in turn but follow him. -~ -bcf dk -1000 S -25 -3 -4 10d5+650 4d6+5 -25000 145000 -8 8 1 -#1517 -iblis satan devil voice~ -the Temptation~ -You pause nervously as a voice whispers at you from over your shoulder. -~ -There is no physical figure attached to the presence that dominates this -place, just tormented laughter, moaning, screaming, and begging. -~ -bcf dk -1000 S -25 -3 -4 10d5+650 4d6+5 -25000 145000 -8 8 1 -#1518 -serpent dragon devil iblis~ -the raging dragon~ -A raging dragon turns to you in violent lust for your soul. -~ -The serpent of babylon, the aged and violet hued monster that has -watched all of mankind succumb before its power, turns to you as -its last victim. -~ -bcf dk -1000 S -27 -4 -5 75d2+825 4d8+5 -40000 180000 -8 8 1 -#1519 -demon fire~ -the demon~ -The hell-fire around you is dominated by a massive, burning demon. -~ -You see nothing but the inexorably red and burning anger of the -lord of the underworld that you fear to be your fate. -~ -bcf dk -1000 S -27 -4 -5 75d2+825 4d8+5 -40000 180000 -8 8 1 -#1520 -baby innocent~ -the innocent baby~ -Lying on the ground wrapped in blankets is the most innocent of babies. -~ -The baby is barely aware of your presence, lost in a sleepy and -contented yawn. -~ -b dk 1000 S -22 -3 -4 5d10+150 4d6+4 -20000 145000 -4 4 1 -#1521 -boy teenage~ -the teenage boy~ -You stop in surprise at the sight of a teenage boy staring off to the distance. -~ -He is young, and has not yet seen the bloodiness of this world. You follow -his gaze and notice that he is gazing in wonderment at the fullness of the -moon. -~ -b dk 1000 S -24 -3 -4 5d10+680 4d6+5 -22000 145000 -8 8 1 -#1522 -man~ -the man~ -A middle-aged man is here, kneeling in prayer. -~ -He is tired, the lines of age marking his face, but in his robe, -kneeling, he is the image of perfect contentment. -~ -bl dk 1000 S -26 -4 -5 75d2+820 4d8+5 -40000 180000 -5 5 1 -#1523 -soul~ -the bodyless soul~ -You are overwhelmed by the presence of a soul that has transcended its body. -~ -You sense certain tastes and smells, the winds through the gardens. -Nothing can explain or describe this perfection, this utter bliss. -~ -bf dk 1000 S -28 -4 -5 100d2+820 4d8+5 -0 190000 -8 8 1 -$ diff --git a/lc-mud/circle/world/mob/150.mob b/lc-mud/circle/world/mob/150.mob deleted file mode 100644 index a3c00471fe3bdc49710211acfa4e85fc7e4c1f7c..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/150.mob +++ /dev/null @@ -1,424 +0,0 @@ -#15000 -gwydion guard royal~ -Gwydion~ -Gwydion the Royal Guard is here on duty. -~ -As all members of the Guard, Gwydion wears the chain mail required -of them as uniform. He seems very well trained, and moves like an -experienced fighter. -~ -abg 0 800 S -11 9 2 3d6+130 1d8+4 -400 11000 -8 8 1 -#15001 -king welmar~ -King Welmar~ -The wise King Welmar sits here in his throne. -~ -In his later middle-age, with his beard starting to grey, King Welmar -is still very powerfully built, and wouldn't take kindly to an attack. -Despite that, you know he is well-loved throughout the land, and has -a reputation as a wise and just ruler. -~ -ab dh 1000 S -33 0 -10 3d60+1480 4d8+16 -35000 1000000 -6 8 1 -#15002 -ghost horrible~ -the horrible ghost~ -You hear a frightening wail, and see a horrible ghost approaching. -~ -The ghost is almost translucent, and looks really SCARY! -~ -bcefnopqr dks -700 S -15 6 -6 9d6+150 2d8+2 -3000 22000 -8 8 0 -#15003 -jim guard royal~ -Jim~ -Jim the Royal Guard is here on duty. -~ -As all members of the Guard, Jim wears the chain mail required of -them as uniform. He seems very well trained, and moves like an -experienced fighter. -~ -ag 0 800 S -11 9 2 3d6+130 1d8+4 -400 11000 -8 8 1 -#15004 -brian guard royal~ -Brian~ -Brian the Royal Guard is here, training with the Master. -~ -As all members of the Guard, Brian wears the chain mail required of -them as uniform. He seems very well trained, and moves like an -experienced fighter. -~ -abg 0 800 S -11 9 2 3d6+130 1d8+4 -400 11000 -8 8 1 -#15005 -mick guard royal~ -Mick~ -Mick the Royal Guard is here, training with the Master. -~ -As all members of the Guard, Mick wears the chain mail required of -them as uniform. He seems very well trained, and moves like an -experienced fighter. -~ -abg 0 800 S -11 9 2 3d6+130 1d8+4 -400 11000 -8 8 1 -#15006 -matt guard royal~ -Matt~ -Matt the Royal Guard is here on duty. -~ -As all members of the Guard, Matt wears the chain mail required of -them as uniform. He seems very well trained, and moves like an -experienced fighter. -~ -ag 0 800 S -11 9 2 3d6+130 1d8+4 -400 11000 -8 8 1 -#15007 -jochem guard royal~ -Jochem~ -Jochem the Royal Guard sits here, off duty. -~ -As all members of the Guard, Jochem wears the chain mail required of -them as uniform. He seems very well trained, and moves like a fighter -who has seen more than one battle, and longs to see the next! -~ -ag 0 900 S -13 7 2 3d6+150 1d8+5 -400 16000 -6 6 1 -#15008 -anne guard royal~ -Anne~ -Anne the Royal Guard is here on duty. -~ -As all members of the Guard, Anne wears the chain mail required of -them as uniform. She seems very well trained, and moves like a fighter -who has seen more than one battle, and longs to see the next! -~ -ag 0 900 S -13 7 2 3d6+150 1d8+5 -400 16000 -8 8 2 -#15009 -andrew guard royal~ -Andrew~ -Andrew the Royal Guard is here on duty. -~ -As all members of the Guard, Andrew wears the chain mail required of -them as uniform. He seems very well trained, and moves like a fighter -who has seen more than one battle, and longs to see the next! -~ -ag 0 900 S -13 7 2 3d6+150 1d8+5 -400 16000 -8 8 1 -#15010 -bertram bert guard royal~ -Bertram~ -Bertram the Royal Guard is here on duty. -~ -As all members of the Guard, Bertram wears the chain mail required of -them as uniform. He seems very well trained, and carries his scars -with pride. This guy seems tough... -~ -ag 0 900 S -15 5 1 3d6+175 1d8+7 -400 21000 -8 8 1 -#15011 -jeanette guard royal~ -Jeanette~ -Jeanette the Royal Guard is here on duty. -~ -As all members of the Guard, Jeanette wears the chain mail required of -them as uniform. She seems very well trained, and carries her scars -with pride. This girl could be nasty if she wanted to... -~ -ag 0 900 S -15 5 1 3d6+175 1d8+7 -400 21000 -8 8 2 -#15012 -peter captain guard royal~ -Peter, the Captain of the Royal Guard~ -Peter, the Captain of the Royal Guard, walks around inspecting. -~ -As all members of the Guard, Peter wears the chain mail required of -them as uniform. Even though all the other guards seem well trained, -you realise none of them would stand a chance against this man in a -fight. He stands at least two metres tall, but still moves with an -almost feline grace. He actually radiates strength and confidence, -and you have to fight a sudden urge to come to attention as you see -him. -~ -ag 0 900 S -19 1 -1 3d6+240 2d6+8 -1000 35000 -8 8 1 -#15013 -master trainingmaster~ -the Training Master~ -The Training Master is here, supervising. -~ -Aged, but experienced, the Training Master is skilled in the use -of virtually every weapon type invented by Man. -~ -abg 0 950 S -18 1 1 2d6+220 1d8+8 -1000 30000 -8 8 1 -#15014 -herald royal~ -the Royal Herald~ -The Royal Herald is standing here. -~ -This is a young, powerfully built man, whose primary function -is to make Royal Announcements. -~ -0 0 800 S -18 1 -1 3d6+220 1d8+9 -500 30000 -8 8 1 -#15015 -ergan murderer~ -Ergan the Murderer~ -Slumped in a corner you see Ergan, aka the Murderer of Townsbridge. -~ -You remember a time almost a decade ago, when the news of the day -was how this man had slaughtered the entire population of the little -village of Townsbridge. He was imprisoned, and here he is - a shadow -of the undoubtedly great warrior he once was, but still to be reckoned -with. -~ -acefhno sp -1000 S -13 8 2 3d6+155 2d8+2 -0 18000 -6 6 1 -#15016 -butler james~ -James the Butler~ -James the Butler is standing here, looking pompous. -~ -The typical perfect butler: upper middle age, a bit bald and with -an impressive belly. -~ -ag 0 500 S -8 13 3 1d6+100 1d9+2 -200 3750 -8 8 1 -#15017 -woman cleaning~ -the Cleaning Woman~ -There is a Cleaning Woman here, trying not be noticed. -~ -Although she has a menial job, she seems to like it. -~ -ag 0 800 S -1 20 9 4d6+1 1d5+0 -10 100 -8 8 2 -#15018 -cockroach roach~ -the cockroach~ -A large cockroach is crawling by the wall. -~ -Very large indeed, and they say cockroaches are hard to kill... -~ -eqr 0 -250 S -4 20 3 2d6+120 1d3+0 -5 750 -8 8 0 -#15019 -astrologer~ -the Astrologer~ -The Astrologer is sitting here, studying a book. -~ -He is old and white-haired, with a long beard. As you see him, -you can almost believe the rumours about stars deciding Fate, -and that astrology is capable of seeing the future. -~ -abelno 0 900 S -23 0 -2 1d1+30000 3d8+30 -2000 80000 -6 6 1 -#15020 -tim guard lifeguard~ -Tim, the King's Lifeguard~ -Tim, the King's Lifeguard, is standing here. -~ -This guy looks just like his twin, Tom. There seems to be no -doubt that he is completely prepared to give his life for the -King, if necessary. -~ -ab d 900 S -17 4 1 3d6+205 1d8+8 -1000 28000 -8 8 1 -#15021 -tom guard lifeguard~ -Tom, the King's Lifeguard~ -Tom, the King's Lifeguard, is standing here. -~ -This guy looks just like his twin, Tim. There seems to be no -doubt that he is completely prepared to give his life for the -King, if necessary. -~ -ab d 900 S -17 4 1 3d6+205 1d8+8 -1000 28000 -8 8 1 -#15022 -chef cook~ -the Chef~ -The Chef is here, shouting orders to the other cooks. -~ -It seems he has been tasting his own food a bit too enthusiastically. -He is, in other words, a bit fat. -~ -behlno 0 500 S -19 4 -1 2d6+1283 4d4+14 -1000 40000 -8 8 1 -#15023 -cook~ -the cook~ -There is a cook here, making himself busy with a pot. -~ -A junior cook, eager to do the Chef's bidding. -~ -bh 0 300 S -4 17 6 2d7+46 1d8+0 -50 600 -8 8 1 -#15024 -david man guard~ -David~ -David, a big, mean-looking man, stands here, guarding the door. -~ -He really is big, and you get the feeling he wouldn't take kindly -to an attempt to get past him. -~ -ab d 250 S -19 2 0 2d6+235 1d7+10 -2000 35000 -8 8 1 -#15025 -dick man guard~ -Dick~ -Dick, a big, mean-looking man, stands here, guarding the door. -~ -He really is big, and you get the feeling he wouldn't take kindly -to an attempt to get past him. -~ -ab d 250 S -19 2 0 2d6+235 1d7+10 -2000 35000 -8 8 1 -#15026 -jerry guard royal~ -Jerry~ -Jerry the Royal Guard is here off duty, playing dice. -~ -As all members of the Guard, Jerry wears the chain mail required -of them as uniform. He seems very well trained, and moves like -an experienced fighter. -~ -ag 0 800 S -11 9 2 3d6+130 1d8+4 -400 11000 -5 5 1 -#15027 -michael guard royal~ -Michael~ -Michael the Royal Guard is here off duty, playing dice. -~ -As all members of the Guard, Michael wears the chain mail required -of them as uniform. He seems very well trained, and moves like an -experienced fighter. -~ -ag 0 800 S -11 9 2 3d6+130 1d8+4 -400 11000 -5 5 1 -#15028 -hans guard royal~ -Hans~ -Hans the Royal Guard is here on duty. -~ -As all members of the Guard, Hans wears the chain mail required -of them as uniform. He seems very well trained, and moves like -a fighter who has seen more than one battle, and longs to see -the next! -~ -ag 0 900 S -13 7 2 3d6+150 1d8+5 -400 16000 -8 8 1 -#15029 -boris guard royal~ -Boris~ -Boris the Royal Guard is here on duty. -~ -As all members of the Guard, Boris wears the chain mail required of -them as uniform. He seems very well trained, and carries his scars -with pride. This guy seems tough... -~ -ag 0 900 S -15 5 1 3d6+175 1d8+7 -400 21000 -8 8 1 -#15030 -zombie villager~ -the zombie~ -A zombie is shambling over some corpses here, moving quite silently. -~ -It is entirely possible that this zombie was once one of the villagers -of Townsbridge who has been brought to an undead life by a fuelling -desire for revenge. -~ -befnpr dfks 0 S -11 6 3 4d4+95 2d4+8 -0 10000 -8 8 0 -#15031 -skeleton villager~ -the skeleton~ -A skeleton is moving about with a loud clatter here, climbing over corpses. -~ -It is entirely possible that this skeleton was once one of the villagers -of Townsbridge who has been brought to an undead life by a fuelling desire -for revenge. -~ -befnpr dfk 0 S -10 8 3 4d4+80 2d3+6 -0 8000 -8 8 0 -#15032 -pit fiend demon~ -the pit fiend~ -A large demon surrounded by flames rises out of the dark pool. -~ -It is a horrifying thing, this demonic creature from the depths of the -Abyss. It glares down at you through blood-red eyes, and bares its huge -white fangs and its razor-sharp talons. -~ -abeflnopqr dfhk 1000 S -33 0 -10 3d60+1480 4d8+16 -35000 1000000 -6 8 1 -$ diff --git a/lc-mud/circle/world/mob/186.mob b/lc-mud/circle/world/mob/186.mob deleted file mode 100644 index beaf49417c078c7842f229fa990b84596cd6cfdf..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/186.mob +++ /dev/null @@ -1,192 +0,0 @@ -#18601 -pitbeast pit-beast~ -the pit beast~ -The big, ugly pit-beast is standing here sizing you up. -~ -Ick... what a disgusting creature! It is black and green and slimy -and it is drooling everywhere... looks mean too. -~ -6 0 -750 S -5 17 5 4d6+42 1d5+1 -100 1200 -8 8 0 -#18602 -newbie monster~ -the newbie monster~ -The newbie monster stands here looking confused. Kill him! Kill him! -~ -What an odd looking little beast. He looks harmless, but you never can -tell. He is only about 4 feet tall, but he pretty muscular looking... -maybe you should ask if he needs help? Nah... kill him. -~ -68 0 0 S -2 19 9 2d4+16 1d4+1 -250 400 -8 8 1 -#18603 -dragon baby~ -the baby dragon~ -Someone's little pet dragon has gotten loose, and is sniffing about here. -~ -Awwww... how cute! A little baby dragon. He's about 3 feet long and you -just want to cuddle him to death... no, you really want to kill him to tell -the truth. But, remember, even a little dragon can be a big problem. -~ -0 0 100 S -4 17 6 1d4+50 1d6+1 -0 1000 -8 8 1 -#18604 -keeper guard monster~ -the Newbie Guard~ -The Newbie Guard is here wondering where that dragon went. -~ -The Guard also had the job of taking care of the Alchemist's pet dragon, -but he doesn't seem to be doing a good job of it. He looks at you and -says, 'Have you seen that dragon? Master will have my head if I don't find -him.' -~ -2 0 0 S -3 18 7 2d6+34 1d7+0 -500 800 -8 8 1 -#18605 -alchemist newbie~ -the Newbie Alchemist~ -The Newbie Alchemist is here trying to make something. -~ -He is a funny looking, furry little dude. He looks really busy trying to -mix up a batch of something or other. -~ -2 0 0 S -5 16 5 4d6+38 2d4+0 -1000 1200 -8 8 0 -#18606 -crawler creepy bug thing~ -the creepy crawler~ -A creepy little crawling thing is scuttling along the floor at your feet. -~ -Yuck! If they'd ever clean this place maybe it wouldn't attract vermin -like this disgusting, little, six-legged, brown bug. -~ -64 0 -250 S -1 20 10 1d4+8 1d4+0 -0 100 -8 8 0 -#18607 -newbie zombie~ -the zombiefied newbie~ -A VERY gaunt looking newbie... it looks like a zombie! -~ -This guy has been lost in here too long... it is more zombie than man -now. You would feel sorry for it, but it is moving in to attack! -~ -100 0 -500 S -4 17 5 1d8+46 2d4+0 -300 600 -8 8 0 -#18608 -quasit imp thing~ -the quasit~ -A funny little imp-like thing (a quasit perhaps?) is sneaking about here. -~ -Little green, vaguely humoniod shaped creature, with a long pointed tail. -It is hard to say because before you ever get a good look at it, it darts -back into the shadows. -~ -228 0 -800 S -3 19 7 1d10+30 1d4+1 -0 300 -8 8 1 -#18609 -minotaur~ -the massive Minotaur~ -The Great Minotaur is wondering just what you'll taste like. -~ -A massive man, with the head of a bull. He looks as strong as bull too, -but not nearly as smart. Actually, now that you consider it... he looks -a heck of a lot meaner than any bull you have ever seen... and he is -coming this way! -~ -1600 0 -1000 S -7 15 5 3d5+85 2d4+1 -1000 3000 -8 8 1 -#18610 -spectre ghost~ -the dark spectre~ -The dark spectre is lurking in the shadows. -~ -The soul of a long since passed on adventurer... it lurks here waiting for -a chance to bring death to any who cross its path. -~ -2122 524298 -850 S -6 16 3 3d5+62 2d4+0 -0 1600 -8 8 0 -#18611 -newbie annoying jerk~ -the annoying newbie~ -A newbie is here annoying the hell out of you. -~ -What a jerk! He won't shut up, and he keeps making the most irritating -comments about everything. Better silence him with cold, tempered steel -MUHAHAHAHAHAHAHAHAHAHA! -~ -68 0 -500 S -2 18 10 2d4+20 1d3+1 -250 500 -8 8 1 -#18612 -newbie clueless moron~ -the clueless newbie~ -A newbie is here looking terribly confused. -~ -What a moron! Every question that is answered in the help files, he will -ask and he will probably ask 2 or 3 times too. This guy just doesn't get -it, best put him out of his misery. -~ -68 0 0 S -1 20 10 1d1+19 1d3+1 -50 220 -8 8 1 -#18613 -newbie talkative~ -the talkative newbie~ -A newbie is here talking a lot. -~ -Well, at least this gal seems pretty cool. Talks a lot, but she's a -friendly, interesting sort. Seems to have a clue what she's doing also, -unlike some others you might see. -~ -64 0 100 S -3 18 8 6d5+22 1d7+1 -700 600 -8 8 2 -#18614 -newbie lost~ -the lost newbie~ -A newbie is here wandering about aimlessly. -~ -Hmmm... looks like he has been around a while, but he wandered a little -too far from home this time. Don't think he knows quite where he is, -maybe you should help him out? -~ -64 0 300 S -4 17 6 8d5+20 1d6+1 -250 500 -8 8 1 -#18615 -newbie smart~ -the smart newbie~ -A newbie is here, and he looks quite sure of himself. -~ -Here is a guy who has it all together. Nice equipment too, must have read -the help files, Eh? -~ -68 0 500 S -5 15 9 10d5+20 2d3+2 -1100 1000 -8 8 1 -$ diff --git a/lc-mud/circle/world/mob/25.mob b/lc-mud/circle/world/mob/25.mob deleted file mode 100644 index 6763a8c7faf5acf9a937470d527c183da2e4ffb0..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/25.mob +++ /dev/null @@ -1,769 +0,0 @@ -#2500 -shadow guardian~ -the shadow guardian~ -A shadow guardian screams a challenge and attacks. -~ -It seems to be made of nothing more than darkness... -~ -cfglmnopqr dfks -350 S -9 10 1 9d9+90 2d5+5 -100 4000 -8 8 0 -#2501 -adventurer~ -the lost adventurer~ -An emaciated adventurer is here looking lost and hopeless. -~ -He looks haggard and sickly; no doubt he's been lost here for quite some time. -~ -ah k 400 S -8 12 6 10d10+10 2d4+4 -286 1500 -6 8 1 -#2502 -edgar~ -Edgar~ -Edgar the Human Swordpupil is standing here, looking quite lost. -~ -Edgar says 'pardon me, can you tell me where to buy cups?' - -You see before you, one of Midgaard's finest fighting elite, the mighty -bunny slayer himself, Edgar the Horrible! -~ -ch k 1000 S -1 20 10 3d9+10 1d8+1 -23 100 -8 8 1 -#2503 -diamond golem~ -the diamond golem~ -A huge diamond golem is standing guard here. -~ -It looks quite strong. -~ -beglnopqr dk 500 S -23 5 -10 23d23+230 3d6+15 -985 15000 -8 8 0 -#2504 -mage young~ -the mage~ -A young mage wanders about, oblivious to all. -~ -He seems to be contemplating life, love and the mysteries of the universe. -Then again, he may just have a headache. -~ -agh dk 450 S -10 10 -1 10d10+100 1d8+8 -436 3500 -8 8 1 -#2505 -strick bartender~ -Strick the bartender~ -Strick is here levitating drinks to his customers. -~ -He looks rather harmless, but then again so does a sleeping dragon. -~ -b dk 750 S -25 1 -6 1d1+30000 3d7+20 -2000 20000 -8 8 1 -#2506 -tatorious wizard~ -Tatorious~ -Tatorious the wizard is here counting his earnings. -~ -Tatorious winks at you mischievously. -~ -b dk 900 S -25 0 -8 1d1+30000 3d7+21 -5000 24000 -8 8 1 -#2507 -ezmerelda cook~ -Ezmerelda~ -Ezmerelda the cook is here stirring a large pot of something. -~ -She does not look like the typical cook you would find in a kitchen, -but she certainly fits what you would expect in a tower fulls of -mages. -~ -ab dk -500 S -20 6 -1 20d20+200 3d4+8 -1092 31300 -8 8 2 -#2508 -assistant mage cook~ -the cook's assistant~ -The cook's assistant is here assisting the cook. -~ -This young man is busy adding strange ingredients to the large pot. -~ -abghm dk -200 S -11 8 1 11d11+110 3d4+4 -116 4600 -8 8 1 -#2509 -prisoner~ -the prisoner~ -A prisoner is chained to the wall here. -~ -Though his clothes are all in rags, you can see that at one time they -must have been fine garments. A metal muzzle has been fitted over the -poor wretch's mouth, whether to keep him from screaming, or to silence -his spell casting you cannot tell. - -He looks quite mad, no doubt he has been mistreated horribly. -~ -bgh 0 100 S -16 6 2 3d30+30 2d4+9 -0 1800 -8 8 1 -#2510 -jailor mage~ -the Jailor~ -The Jailor is here enjoying a comfortable nap. -~ -He looks rather dirty. -~ -ab dk 100 S -17 5 -3 17d17+170 3d5+10 -1326 12000 -4 4 1 -#2511 -broom~ -the broom~ -A straw broom is here leaning against the wall. -~ -The broom screams 'Take that you lout!' -~ -abefgnopqr dfk 50 S -7 10 2 7d7+70 2d4+4 -0 1600 -8 8 0 -#2512 -lesser guardian hands~ -the pair of disembodied hands~ -A pair of disembodied hands floats in the air here. -~ -The hands twitch with anticipation of strangling someone. -~ -fgpqr dfk -400 S -9 7 -5 9d9+90 2d4+5 -0 3100 -8 8 0 -#2513 -guardian greater eyes~ -the pair of disembodied eyes~ -A pair of disembodied eyes floats here glaring at you. -~ -The eyes smoulder with hatred. -~ -fgpq dfk -600 S -15 5 -9 15d15+150 3d4+8 -0 9100 -8 8 0 -#2514 -mage visitor~ -the mage~ -A visiting mage is here snoring away in peaceful slumber. -~ -He looks quite sleepy. -~ -abcgh dk 250 S -12 8 -2 12d12+120 2d4+5 -726 6200 -4 4 1 -#2515 -apprentice young~ -the young apprentice magic user~ -A young apprentice magic user is here doing magical studies. -~ -She looks quite intent on her studies. -~ -abcgh dk 400 S -7 7 2 7d6+25 2d4+5 -369 2950 -6 6 2 -#2516 -apprentice young~ -the young apprentice~ -A young apprentice is here mumbling words of magic to himself. -~ -He looks to be oblivious to all but the spell he is memorizing. -~ -abcgh dk 380 S -7 6 2 7d6+25 2d4+5 -487 2750 -8 8 1 -#2517 -apprentice young~ -the young apprentice~ -A young apprentice is sleeping here. -~ -He seems to be dreaming. -~ -abcgh dk 350 S -7 7 2 7d6+25 2d4+4 -211 2650 -4 4 1 -#2518 -apprentice young~ -the young apprentice~ -A young apprentice is here teasing a cornered kitten. -~ -He looks like a mischievous youth. -~ -abcgh dk -200 S -7 7 1 7d6+25 2d4+5 -382 2300 -8 8 1 -#2519 -kitten~ -the small kitten~ -A small kitten is here meowing in terror. -~ -The little ball of fur looks very unhappy. Singed fur and a few minor -burns mark its mottled coat. -~ -bcgh dk 500 S -1 20 1 1d1+10 1d4+1 -0 11 -8 8 2 -#2520 -student~ -the student~ -A student of spells is here looking quite bored. -~ -The student yawns. -~ -abcgh dk 350 S -8 9 1 8d8+80 2d4+6 -263 3000 -6 6 1 -#2521 -instructor teacher mage~ -the instructor of magic~ -The instructor screams at your interruption and attacks you. -~ -He looks quite angry at your interruption. -~ -abfh dk 300 S -14 6 -2 14d14+140 3d4+8 -880 18500 -8 8 1 -#2522 -student~ -the student of spells~ -A student of spells is here trying to master invisibility. -~ -He blinks in and out of existence, trying to master the spell. -~ -abcgh bdk 400 S -8 8 -2 8d8+80 2d4+6 -198 2200 -8 8 1 -#2523 -teacher mage~ -the spell teacher~ -A spell teacher screams at your interruption and attacks. -~ -The teacher is quite fierce and rather frightening. -~ -abfh dk 300 S -15 5 -4 15d15+150 3d4+9 -1256 20500 -8 8 1 -#2524 -student~ -the student of spells~ -A student of spells has fallen asleep at her desk here. -~ -She looks to have collapsed from sheer boredom. -~ -abcgh dk 400 S -9 11 -2 9d9+90 2d4+7 -567 3800 -4 4 2 -#2525 -wizard speaker mage~ -the wizard~ -An old wizard is here making a speech here. -~ -This wizzened old man looks like he could easily pass for the oldest -living man. Of course, having heard stories about some of the magic -available to the people living here, and what toll the magic draws... -this man might be as young as you. -~ -abcgh dk 400 S -18 4 -5 18d18+180 3d4+8 -2468 31000 -8 8 1 -#2526 -mage young~ -the young mage~ -A young mage is here learning hand to hand combat. -~ -This young fellow looks quite confident in his abilities to defend -himself. -~ -abcgh dk 300 S -9 11 -1 9d9+90 2d4+8 -695 3800 -8 8 1 -#2527 -mistress battle~ -the battle mistress~ -The battle mistress is here teaching the fine uses of a dagger. -~ -She looks quite rugged. In fact, she more resembles a warrior than a magic -user. -~ -abfhlq dk 200 S -17 2 -2 17d17+170 3d5+8 -3211 23050 -8 8 2 -#2528 -mage teacher~ -the spell teacher~ -A spell teacher is here relaxing. -~ -The teacher looks to be worn out by a long day of magic working, difficult -spells, and inattentive students. -~ -abg dk 200 S -15 5 1 15d15+150 3d4+4 -1002 15800 -5 5 1 -#2529 -wizard~ -the aged wizard~ -An aged wizard is sleeping here. -~ -Dreams of magic and power are probably flowing through his head right -now, better not wake him up. -~ -afgh dk 350 S -20 5 -5 20d20+200 3d4+9 -1567 37500 -4 8 1 -#2530 -scribe mage~ -the scribe~ -A scribe is here working on some manuscripts. -~ -He appears to be copying out some spell ingredients or components right -now. -~ -abcgh dk 400 S -14 6 -1 14d14+140 3d4+4 -312 14850 -8 8 1 -#2531 -scribe mage~ -the scribe~ -A scribe is here working diligently on some translations. -~ -She is quite cute. Too bad her only interest seems to be the words of -lore she is translating. -~ -abcgh dk 500 S -15 6 -1 15d15+150 2d4+10 -684 16550 -8 8 2 -#2532 -master scribe~ -the Master Scribe~ -The Master Scribe is here looking a little upset -~ -He seems to be so old, his skin has become nothing but a giant wrinkle. -The master scribe screams 'How dare you interrupt my important work???' -~ -abfgh dk 100 S -22 4 -5 22d22+220 3d5+8 -5634 29500 -8 8 1 -#2533 -assistant scribe~ -the scribe's assistant~ -The scribe's assistant is here folding parchments. -~ -You can tell that he isn't trusted with the more important documents, -since those ones are rolled and sealed with wax. -~ -abfgh dk 100 S -16 6 -2 16d16+160 3d4+6 -1050 21300 -8 8 1 -#2534 -master enchanter mage~ -the Enchanter~ -The Enchanter is here placing a dweomer upon well made sword. -~ -The Enchanter is hard at work, concentrating on a spell which could -either destroy the weapon or make it many times more powerful than -it already is. -~ -abfh dk -200 S -23 4 -5 23d23+230 3d5+6 -6812 30500 -8 8 1 -#2535 -sword dancing~ -the dancing sword~ -A well crafted sword lies on the work table here. -~ -It looks quite sharp. -~ -bfhlnopqr dk -500 S -10 1 -10 10d10+100 3d5+5 -0 4000 -8 8 0 -#2536 -alchemist~ -the Mad Alchemist~ -The Mad Alchemist babbles something incomprehensible and attacks. -~ -He looks like he has been quaffing too many potions. His eyes dart -around wildly, and he starts to drool. - -The Mad Alchemist throws back his head and cackles with insane glee! -~ -abfgh dk 150 S -24 4 -4 24d24+240 3d5+10 -2346 31500 -8 8 1 -#2537 -master summoner~ -the Master Summoner~ -The Master Summoner is here holding gateways open to other planes. -~ -The Summoner looks to be hard at work, concentrating on keeping control -over the gateway before he loses his soul to the creatures on the other -side of it. -~ -abfgh dk -200 S -22 5 -2 22d22+220 3d5+6 -1019 27050 -8 8 1 -#2538 -master charmer~ -the Master Charmer~ -The Master Charmer utters the words, 'uuuzzldctz'. -~ -The Master Charmer sizes you up, always looking for a new pet. -~ -abf dk -400 S -23 4 -4 23d23+230 3d5+10 -4672 31050 -8 8 1 -#2539 -golem wooden~ -the wooden golem~ -A wooden golem stands a silent vigil here, guarding the stairs. -~ -He looks flammable. -~ -bfgmnopqr dk 100 S -16 7 -5 16d16+160 1d10+10 -1000 17500 -8 8 0 -#2540 -master spellbinder~ -the Master Spellbinder~ -The Master Spellbinder is here re-charging a blackened wand. -~ -The Master Spellbinder snarls at you and attacks. -~ -abfgh dk -500 S -23 5 -4 23d23+230 3d5+8 -2315 30500 -8 8 1 -#2541 -master maker~ -the Golem Maker~ -The Golem Maker is here chiseling some stone. -~ -The Golem Master appears to be very meticulous about his work, to -the point of fussing over it. -~ -abfh dk 300 S -21 6 -2 21d21+210 3d5+5 -2678 26850 -8 8 1 -#2542 -golem granite~ -the granite golem~ -A granite golem stands here waiting to do its master's bidding. -~ -It looks like a statue, until you see it shamble towards you. -~ -bfgmnopqr dk 300 S -20 7 -6 20d20+200 4d5+10 -0 25600 -8 8 0 -#2543 -golem bronze~ -the bronze golem~ -A bronze golem stands here shining in the light. -~ -He looks rather dim witted. -~ -bfgmnopqr dk 350 S -18 8 -3 18d18+180 4d5+5 -0 22350 -8 8 0 -#2544 -golem flesh~ -the flesh golem~ -A flesh golem stands guard here -~ -It looks to be made of a potpourri of different body parts; some don't -even resemble anything human. -~ -bfgmnopqr dk 200 S -12 9 -1 12d12+120 4d4+4 -0 8520 -8 8 0 -#2545 -golem cloth~ -the cloth golem~ -A cloth golem wanders around here. -~ -It looks like a bunch of old rags, quite surprising it can actually walk. -~ -bfgmnopqr dk 350 S -8 10 1 8d8+80 3d4+1 -0 2100 -8 8 0 -#2546 -golem adamantite~ -the adamantite golem~ -An adamantite golem stands here looking very dangerous. -~ -It seems to be forged of dark metal. It looks strong and durable, -but somewhat un-intelligent. -~ -bfgmnopqr dk 350 S -25 0 -10 25d25+250 3d7+3 -10000 35650 -8 8 0 -#2547 -golem clay~ -the clay golem~ -A clay golem stands guard here. -~ -This large golem almost looks like it is made of dirt. -~ -bfgmnopqr dk 200 S -15 5 -1 15d15+150 4d5+3 -0 18320 -8 8 0 -#2548 -master illusionist mage dragon~ -the Master of Illusions~ -An enormous multi-colored three-headed dragon growls at you. -~ -The image of an ugly dragon flickers slightly, and where the dragon -was now stands a small harmless looking old man. -~ -abcgh dk 150 S -21 6 -4 21d21+210 3d5+5 -2345 26450 -8 8 1 -#2549 -necromancer master~ -the Necromancer~ -The Necromancer is here raising undead servants. -~ -Attired all in black, the Necromancer is tall and gangly, but still quite -an imposing figure. A dark cowl shrouds most of his face, but two blazing -embers which serve as eyes can be seen through the shadow. -The Necromancer shrieks some obscenities and orders his minions to attack. -~ -abfgh dk -950 S -25 0 -8 25d25+250 3d7+7 -11684 35250 -8 8 1 -#2550 -skeleton undead~ -the animated skeleton~ -An animated skeleton screams silently and attacks. -~ -It feels no pain, and hacks at you ruthlessly. -~ -bfhnopr dk -500 S -15 5 -2 15d15+150 3d4+10 -0 16500 -8 8 0 -#2551 -undead giant~ -the undead giant~ -An undead giant lumbers towards you. -~ -This thing seems to be the reanimated corpse of a giant, creating an -enormous zombie. -~ -cfgnopr dk -500 S -18 5 -4 18d18+180 3d5+10 -0 22000 -8 8 0 -#2552 -witch hag~ -the ugly witch~ -An ugly witch is here scrying out secrets. -~ -She has no face at all, just blank skin, rather disturbing. From about -where her mouth should be, comes a disgusting giggling sound that makes -your skin crawl with revulsion. -~ -acfg dk -450 S -20 5 -2 20d20+200 3d6+5 -2150 26850 -8 8 2 -#2553 -librarian mage~ -the Librarian~ -The Librarian has fallen asleep at his desk here. -~ -He looks like a rather peaceful old man. -~ -abfgh dk 450 S -23 3 -6 23d23+230 3d6+5 -1287 29500 -4 8 1 -#2554 -apprentice~ -the Master's apprentice~ -The Master's apprentice leaps to halt your passage. -~ -A powerful wizard in his own right, the apprentice of the master of balance -has given up his station in the mage guild hierarchy in order to serve the -Great Master in hopes of gleaning secrets one could never hope to uncover -alone. -~ -abcfg dhk 0 S -24 -3 -12 24d24+240 3d6+6 -6723 30750 -8 8 1 -#2555 -cat grey familiar~ -the grey cat~ -A grey cat is lounging lazily here. -~ -The grey cat cocks an ear towards you, sensing your scrutiny, then purrs -contentedly. It looks rather harmless, until you notice its very large -claws. -~ -bg dks 0 S -15 5 -5 15d15+150 5d5+5 -0 18750 -8 8 2 -#2556 -master guildmaster grey~ -the Master of Neutrality~ -The Master of Neutrality is here contemplating the balance of the Universe. -~ -He looks quite peaceful. -~ -abcgijl dkh 0 S -30 -10 -20 30d30+300 2d5+20 -15350 150000 -8 8 1 -#2557 -apprentice black~ -the black robed apprentice~ -A black robed apprentice jumps from the shadows and attacks. -~ -She bears a wicked looking scar down the side of her face, though once -she must have been beautiful, now the scar combined with what seems to -be a permanent scowl make her looks quite fearsome. -~ -abcfg dk -750 S -20 2 -6 20d20+200 3d6+6 -13876 27800 -8 8 2 -#2558 -cat black familiar~ -the black cat~ -A black cat with its fur up hisses at you. -~ -It looks both mean and dangerous. Petting seems to be completely out of -the question. -~ -bg dks -800 S -16 5 -4 16d16+160 3d7+3 -0 19950 -8 8 0 -#2559 -master guildmaster black~ -the Master of the Black Robes~ -The Master of the Black Robes is here plotting vile deeds. -~ -The Master glares at you. -~ -abcgjkl dkh -1000 S -30 -10 -20 30d30+300 2d5+20 -22100 150000 -8 8 1 -#2560 -apprentice white~ -the white robed apprentice~ -A white robed apprentice screams at your desecration of goodness. -~ -He looks like a fanatic. -The white robed apprentice screams 'Thou art unworthy of this honour!' -~ -abcfh dk 750 S -20 2 -6 20d20+200 3d6+6 -7400 27850 -8 8 1 -#2561 -cat white familiar~ -the white cat~ -A white cat is here preening its fur. -~ -It seems to be nothing more than a large ball of fluff with claws. -~ -bg dks 800 S -15 4 -4 15d8+10 3d7+3 -0 7950 -8 8 0 -#2562 -master guildmaster white~ -the Master of Goodness~ -The Master of Goodness is here frowning at your intrusion. -~ -He looks like a self-righteous bastard. -~ -abcgikl dkh 1000 S -30 -10 -20 30d30+300 2d5+20 -21900 150000 -8 8 1 -#2563 -cat calico familiar~ -the calico cat~ -A large calico cat is lounging about here. -~ -It looks incredibly large for a cat, no doubt a giant of its species. -A beautiful jewel encrusted collar about its neck is its only adornment. -~ -bg dks 0 S -25 1 -9 25d25+250 5d5+10 -0 30000 -8 8 0 -#2564 -guildmaster grand mistress~ -the Grand Mistress~ -The Grand Mistress of Magic is sitting here. -~ -She looks quite comfortable on her emerald throne. Amazingly young and -pretty for one of such stature in the guild, no doubt she has kept her -youthful appearance through the use of strong magics. -The Grand Mistress pets her familiar and smiles at you in confidence. -~ -abcgl dkh 0 S -50 -20 -30 50d50+500 3d4+20 -50000 500000 -8 8 2 -$ diff --git a/lc-mud/circle/world/mob/30.mob b/lc-mud/circle/world/mob/30.mob deleted file mode 100644 index f0d20ddd733b8ab63e98028b2b8e51fa8b1e438a..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/30.mob +++ /dev/null @@ -1,528 +0,0 @@ -#3000 -wizard~ -the wizard~ -A wizard walks around behind the counter, talking to himself. -~ -The wizard looks old and senile, and yet he looks like a very powerful -wizard. He is equipped with fine clothing, and is wearing many fine -rings and bracelets. -~ -ablno d 900 S -33 2 2 1d1+30000 2d8+18 -30000 160000 -8 8 1 -#3001 -baker~ -the baker~ -The baker looks at you calmly, wiping flour from his face with one hand. -~ -A fat, nice looking baker. But you can see that he has many scars on his -body. -~ -ablno d 900 S -33 0 -10 1d1+30000 2d8+18 -100 160000 -8 8 1 -#3002 -grocer~ -the grocer~ -A grocer stands at the counter, with a slightly impatient look on his face. -~ -A tall grocer, who moves two 200 pounds bag of flour around on his shoulders. -~ -ablno d 900 S -33 0 -10 1d1+30000 2d8+18 -30000 160000 -8 8 1 -#3003 -weaponsmith~ -the weaponsmith~ -A weaponsmith is standing here. -~ -He is a young weaponsmith, who still has lots to learn but he is still -eager to sell you his latest implements of carnage and destruction. -~ -ablno d 900 S -33 0 -10 1d1+30000 2d8+18 -30000 160000 -8 8 1 -#3004 -armourer~ -the armourer~ -An armourer stands here displaying his new (and previously owned) armours. -~ -An old but very strong armourer. He has made more suits of armour in his -life than you have ever seen. -~ -ablno d 900 S -33 0 -10 1d1+30000 2d8+18 -28500 160000 -8 8 1 -#3005 -receptionist~ -the receptionist~ -A receptionist is standing behind the counter here, smiling at you. -~ -You notice a tired look in her face. She looks like she isn't paid well -enough to put up with any crap from mud players with attitudes. -~ -abelnop dfp 900 S -33 0 -10 1d1+30000 2d8+32 -0 0 -8 8 2 -#3006 -captain stolar~ -Captain Stolar~ -A retired captain stands here, selling boats. -~ -This captain has eaten more sharks than you have killed peas. -~ -ablno d 900 S -33 2 2 1d1+30000 2d8+12 -2000 160000 -8 8 1 -#3007 -sailor~ -the sailor~ -A sailor stands here, waiting to help you. -~ -He looks like a strong, fit sailor. -~ -blno 0 900 S -33 0 -10 1d1+30000 2d8+12 -2000 160000 -8 8 1 -#3008 -uncle juan~ -Uncle Juan~ -Uncle Juan is here ready to take your order. -~ -He looks like he may or may not have a green card. -~ -ablno 0 900 S -33 0 -10 1d1+30000 2d8+18 -2000 160000 -8 8 1 -#3009 -wally watermaster~ -Wally the Watermaster~ -Wally the Watermaster is standing behind the counter. -~ -Wally is a bit pudgy but looks very strong. He has a glass of Midgaard -Natural Spring Water in his hand. When he notices you, he proudly -displays his fine collection of contemporary waters. -~ -ablno d 800 S -33 0 -10 1d1+30000 1d8+18 -1000 160000 -8 8 1 -#3010 -postmaster post master~ -the postmaster~ -The head postmaster is standing here, waiting to help you with your mail. -~ -The Postmaster seems like a happy old man, though a bit sluggish. He -worries about the reputation of the MMS (Midgaard Mail Service), as many -people seem to think that it is slow. Perhaps if he were to brush the -cobwebs from his uniform it would help to make a better impression. -~ -ablnopr dp 1000 S -33 0 -10 1d1+30000 1d8+18 -2000 0 -8 8 1 -#3020 -guildmaster master mage~ -the mages' guildmaster~ -Your guildmaster is studying a spellbook while preparing to cast a spell. -~ -Even though your guildmaster looks old and tired, you can clearly see the -vast amount of knowledge she possesses. She is wearing fine magic clothing, -and you notice that she is surrounded by a blue shimmering aura. -~ -abelnop dh 1000 S -34 0 -10 6d10+640 1d8+24 -18794 100000 -8 8 2 -#3021 -guildmaster master priest~ -the priests' guildmaster~ -Your guildmaster is prayer to your God here. -~ -You are in no doubt that this guildmaster is truly close to your God; he -has a peaceful, loving look. You notice that he is surrounded by a white -aura. -~ -abelnop dh 1000 S -34 0 -10 6d10+640 1d8+24 -18794 100000 -8 8 1 -#3022 -guildmaster master beggar thief~ -the thieves' guildmaster~ -A beggar is sitting here, could she be a guildmaster? -~ -You realize that whenever your guildmaster moves, you fail to notice it - -the way of the true thief. She is to be dressed in poor clothing, having -the appearance of a beggar. -~ -abelnop dh 1000 S -34 0 -10 6d10+640 1d8+34 -18794 100000 -8 8 2 -#3023 -guildmaster master~ -the fighters' guildmaster~ -Your guildmaster is standing here sharpening an axe. -~ -This is your master. Big and strong with bulging muscles. Several scars -across his body proves that he was using arms before you were born. He -has a calm look on his face. -~ -abelnop 0 1000 S -34 0 -10 6d10+740 1d8+34 -18794 100000 -8 8 1 -#3024 -sorcerer~ -the sorcerer~ -A sorcerer is guarding the entrance. -~ -He is an experienced mage who has specialized in the field of Combat Magic. -He is here to guard the Mage's Guild and his superior knowledge of offensive -as well as defensive spells make him a deadly opponent. -~ -ablnop dh 900 S -33 0 -5 6d10+990 1d8+22 -2000 60000 -8 8 1 -#3025 -knight templar~ -the knight templar~ -A knight templar is guarding the entrance. -~ -He is a specially trained warrior belonging to the military order of the -Faith. His duty is to protect the faithful from persecution and infidel -attacks and his religious devotion combined with his superior skill makes -him a deadly opponent. -~ -ablnop dh 1000 S -33 0 -5 6d10+990 1d8+22 -2000 160000 -8 8 1 -#3026 -assassin~ -the assassin~ -An assassin is guarding the entrance. -~ -He is a thief who has specialized in killing others as effectively as -possible, using all sorts of weapons. His superior knowledge of how -and where to use them combined with his extraordinary stealth makes -him a deadly opponent. -~ -ablnop dfhst 400 S -33 0 -10 6d10+990 1d8+25 -2000 160000 -8 8 1 -#3027 -knight~ -the knight~ -A knight is guarding the entrance. -~ -He is an expert warrior who has attained knighthood through countless -chivalrous deeds. His duty is to protect the Guild of Swordsmen and his -extreme skill combined with his experience in warfare makes him a deadly -opponent. -~ -ablnop dh 800 S -33 0 -8 6d10+990 1d8+40 -2000 160000 -8 8 1 -#3040 -bartender~ -the bartender~ -A bartender watches you calmly, while he skillfully mixes a drink. -~ -A tired looking Bartender who hates trouble in his bar. -~ -bno 0 900 S -24 2 2 6d10+390 1d8+12 -2000 80000 -8 8 1 -#3041 -waiter~ -the waiter~ -A waiter is going around from one place to another. -~ -A tired looking waiter. -~ -bno 0 900 S -23 2 2 6d10+390 1d8+12 -2000 80000 -8 8 1 -#3042 -waiter~ -the waiter~ -A man now leads a quiet, peaceful life as a waiter is standing here. -~ -This man was obviously a famous sorcerer in his younger days as you -instantly recognize his face. -~ -bno 0 600 S -23 1 2 6d10+390 1d8+12 -2000 80000 -8 8 1 -#3043 -waiter~ -the waiter~ -A waiter who seems to have reached contact with his God is standing here. -~ -This waiter almost makes you feel like you should drop to your knees -and begin to worship your God. Naaah. -~ -bno 0 600 S -23 1 2 6d10+390 1d8+12 -2000 80000 -8 8 1 -#3044 -waiter~ -the waiter~ -A waiter who knows where all his customers keep their money is standing here. -~ -Hmmm... wonder where he got that coin he is playing with. -~ -bno 0 600 S -23 1 2 6d10+390 1d8+12 -2000 80000 -8 8 1 -#3045 -waiter~ -the waiter~ -A waiter is here. -~ -This guy looks like he could easily kill you while still carrying -quite a few firebreathers. -~ -bno 0 600 S -23 1 2 6d10+390 1d8+12 -2000 80000 -8 8 1 -#3046 -filthy~ -Filthy~ -Filthy is standing here, eager to serve you a special drink. -~ -Filthy looks real, ehm, dirty. He likes to keep his customers happy, -but do not mess with him or else he'll get upset. -~ -belno d 600 S -33 1 -10 1d1+30000 1d8+22 -2000 80000 -8 8 1 -#3059 -keeper peacekeeper~ -the Peacekeeper~ -A Peacekeeper is standing here, ready to jump in at the first sign of trouble. -~ -He looks very strong and wise. Looks like he doesn't answer to ANYONE. -~ -aeglm d 1000 E -17 3 0 5d6+225 3d3+13 -2500 30000 -8 8 1 -BareHandAttack: 10 -E -#3060 -cityguard guard~ -the cityguard~ -A cityguard stands here. -~ -A big, strong, helpful, trustworthy guard. -~ -aglm d 1000 S -10 10 1 1d12+123 1d8+5 -500 9000 -8 8 1 -#3061 -janitor~ -the janitor~ -A janitor is walking around, cleaning up. -~ -What a tough job he has. -~ -agl 0 800 S -1 20 9 2d6+10 1d5+0 -34 100 -8 8 1 -#3062 -fido dog~ -the beastly fido~ -A beastly fido is mucking through the garbage looking for food here. -~ -The fido is a small dog that has a foul smell and pieces of rotted meat -hanging around his teeth. -~ -afghq p -200 E -0 20 10 1d6+4 1d4+0 -0 25 -8 8 1 -BareHandAttack: 4 -E -#3063 -mercenary~ -the mercenary~ -A mercenary is waiting for a job here. -~ -He looks pretty mean, and you imagine he'd do anything for money. -~ -bl 0 -330 S -5 15 5 2d6+60 1d6+1 -87 900 -8 8 1 -#3064 -drunk~ -the drunk~ -A singing, happy Drunk. -~ -A drunk who seems to be too happy, and to carry too much money. -~ -b 0 400 S -2 19 8 2d6+22 1d6+0 -53 200 -8 8 1 -#3065 -beggar~ -the beggar~ -A beggar is here, asking for a few coins. -~ -The beggar looks like she is fed up with life. -~ -b 0 400 S -1 20 9 2d6+10 1d5+0 -0 100 -8 8 2 -#3066 -odif yltsaeb~ -the odif yltsaeb~ -An odif yltsaeb is here, walking backwards. -~ -The odif is a small god that has been reversed by some dog. -~ -afghq p -200 E -0 20 10 1d6+4 1d4+0 -0 25 -8 8 1 -BareHandAttack: 4 -E -#3067 -cityguard guard~ -the cityguard~ -A cityguard is here, guarding the gate. -~ -A big, strong, helpful, trustworthy guard. -~ -abglm 0 1000 S -10 10 1 1d12+123 1d8+5 -500 9000 -8 8 1 -#3068 -green gelatinous blob~ -the green gelatinous blob~ -An oozing green gelatinous blob is here, sucking in bits of debris. -~ -A horrid looking thing; it is huge, greenish, and looks like the blob. -~ -aeghlnopqr d 0 E -20 0 0 1d11+325 3d6+5 -1000 40000 -8 8 0 -BareHandAttack: 6 -E -#3089 -pet shop boy~ -the Pet Shop Boy~ -There is a Pet Shop Boy standing here cuddleing something furry in his hands. -~ -As you look at him, he opens his hands to reveal a rat! -~ -blno 0 1000 S -10 10 1 1d1+30000 20d4+10 -500 9000 -8 8 1 -#3090 -kitten~ -the kitten~ -A small loyal kitten is here. -~ -The kitten looks like a cute, little, fierce fighter. -~ -bco 0 0 E -1 20 9 1d6+11 1d4+0 -0 100 -8 8 0 -BareHandAttack: 8 -E -#3091 -puppy~ -the puppy~ -A small loyal puppy is here. -~ -The puppy looks like a cute, little, fierce fighter. -~ -bco 0 0 E -1 20 9 1d6+13 1d4+0 -0 125 -8 8 0 -BareHandAttack: 8 -E -#3092 -beagle~ -the beagle~ -A small, quick, loyal beagle is here. -~ -The beagle looks like a fierce fighter. -~ -bco 0 0 E -2 19 8 1d12+22 1d6+0 -0 200 -8 8 0 -BareHandAttack: 4 -E -#3093 -rottweiler~ -the rottweiler~ -A large, loyal rottweiler is here. -~ -The rottweiler looks like a strong, fierce fighter. -~ -bco 0 0 E -3 18 7 1d12+35 1d7+0 -0 800 -8 8 0 -BareHandAttack: 4 -E -#3094 -wolf~ -the wolf~ -A large, trained wolf is here. -~ -The wolf looks like a strong, fearless fighter. -~ -bco 0 0 E -4 17 6 1d12+47 1d8+0 -0 1600 -8 8 0 -BareHandAttack: 4 -E -#3095 -cryogenicist cryo~ -the cryogenicist~ -The cryogenicist is here, playing with a canister of liquid nitrogen. -~ -You notice a tired look in her face. She looks like she isn't paid well -enough to put up with any crap from mud players with attitudes. -~ -ablno dfp 900 S -33 0 -10 1d1+30000 2d8+32 -0 0 -8 8 2 -$ diff --git a/lc-mud/circle/world/mob/31.mob b/lc-mud/circle/world/mob/31.mob deleted file mode 100644 index a3441891fd00ce8b238d12e2bcf246d267411fdb..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/31.mob +++ /dev/null @@ -1,126 +0,0 @@ -#3100 -maid~ -the Maid~ -The Maid is waiting for your order. -~ -She is very beautiful with golden hair, and deep blue eyes. A good reason -for coming here more often, you think to yourself. -~ -ablno d 1000 S -33 0 -10 1d1+30000 1d8+22 -2000 80000 -8 8 2 -#3101 -sexton~ -the Sexton~ -A Sexton is sitting here, drinking hot tea. -~ -The Sexton looks like he is relaxing after another gravedigging job. -~ -b 0 800 S -3 18 7 2d6+35 1d7+0 -13 300 -6 6 1 -#3102 -chief guard~ -the Chief Guard~ -The Chief Guard is looking very upset. -~ -A very angry chief. -~ -bcf d 800 S -17 3 1 1d12+210 1d8+18 -0 28000 -8 8 1 -#3103 -cityguard guard~ -the upset cityguard~ -A cityguard stands here, looking very upset. -~ -A big, strong, angry guard. -~ -bcf 0 1000 S -10 10 2 1d12+123 1d8+3 -0 9000 -8 8 1 -#3104 -secretary~ -the Secretary~ -A secretary is sitting at the desk, typing away on the typewriter. -~ -She looks very busy. - -The Secretary says 'Sorry, but the Mayor is extremely busy today.' -The Secretary says 'Please sit down and have a seat in the meantime.' -~ -b 0 900 S -12 9 2 1d12+148 2d7+1 -100 13000 -8 8 2 -#3105 -mayor~ -the Mayor~ -The Mayor is sitting in his huge chair, snoring loudly. -~ -He is a stocky, middle-aged man with thin, grey hair. -~ -ablno d 1000 S -24 0 -4 6d10+790 1d8+18 -1000 130000 -4 4 1 -#3106 -crier~ -the Town Crier~ -The Town Crier is here, weeping quietly. -~ -He is very good at his job - completely dissolved in tears. -~ -h 0 900 S -1 20 9 2d6+10 1d5+0 -34 100 -8 8 1 -#3120 -swan~ -the swan~ -A swan is swimming around in the pond. -~ -The white swan is very elegant. -~ -b 0 1000 S -1 20 9 2d6+10 1d5+0 -0 100 -8 8 0 -#3121 -duckling~ -the duckling~ -A duckling is swimming around in the pond. -~ -The duckling is adorable, it looks most of all like a tiny furball. -~ -b 0 1000 S -0 20 10 1d1+0 1d1+0 -0 1 -8 8 0 -#3122 -sparrow~ -the sparrow~ -A sparrow is flapping around on the ground. -~ -The sparrow looks like it is enjoying life. -~ -gh 0 1000 S -0 20 10 2d6+0 1d3+0 -0 25 -8 8 0 -#3123 -duck~ -the duck~ -A duck is here, quacking happily. -~ -The duck is quite fat. It looks like it is enjoying life. -~ -g 0 1000 S -1 20 10 2d6+5 1d4+0 -0 75 -8 8 0 -$ diff --git a/lc-mud/circle/world/mob/33.mob b/lc-mud/circle/world/mob/33.mob deleted file mode 100644 index 58c6df344232dbd9b526adee274d048569f7da7b..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/33.mob +++ /dev/null @@ -1,278 +0,0 @@ -#3300 -farmer~ -the farmer~ -A farmer walks around, looking for something to do. -~ -This farmer is a resident of Stanneg by the Mountains, -and as such, is one of the most boring people on earth. -~ -cgh 0 500 S -7 14 4 3d5+83 2d4+1 -1000 2250 -8 8 1 -#3301 -storekeeper~ -the storekeeper~ -A bored storekeeper waits for you to do something. -~ -The bored storekeeper keeps a lazy eye on you as he -waits for you to buy something. Whee. -~ -b 0 750 S -20 1 -40 3d5+245 3d6+6 -10000 40000 -8 8 1 -#3302 -cowgirl~ -the cowgirl~ -A cowgirl stand here ready to defend her horses... -~ -This woman seems ready for anything you might do... -she is truly a woman to be reckoned with... -~ -blm dst 750 S -20 1 -60 3d5+245 3d6+4 -8000 40000 -8 8 2 -#3303 -horse~ -the horse~ -A horse does horsely things here. -~ -This horse looks like a nice horse. It looks at you -with soft brown eyes and you want to give it a carrot. -~ -b 0 250 E -5 16 5 1d10+60 2d4+0 -0 1000 -8 8 1 -BareHandAttack: 4 -E -#3304 -farmer's wife~ -the farmer's wife~ -A farmer's wife offers you some vegetables. -~ -This woman has many different types of fruits and -vegetables for you to buy. She looks bored, though. -~ -b 0 500 S -20 1 -40 3d5+245 3d6+6 -10000 40000 -8 8 2 -#3305 -aglandiir dragon~ -Aglandiir~ -The Dragon Prince, Aglandiir, sits here looking at you curiously. -~ -Aglandiir is a prince of his kind, and he didn't get where -he is today by letting people steal from his horde! -~ -beflnopqr dh 750 E -30 0 -100 1d1+1499 8d5+5 -500000 1000000 -8 8 1 -BareHandAttack: 8 -Str: 25 -Int: 25 -Wis: 25 -Dex: 25 -Con: 25 -Cha: 16 -E -#3306 -cyclops~ -the Cyclops~ -A Cyclops is here, trying to judge range with no depth perception. -~ -This Cyclops throws rocks real good. With one eye though, -hitting the target is another matter. He looks at you and -growls as he misses again! -~ -bcflnq 0 -500 E -16 8 0 3d5+295 2d8+2 -10000 24000 -8 8 1 -BareHandAttack: 13 -E -#3307 -salle woman~ -Salle~ -A woman ignores you completely, so intent is she upon her sword. -~ -She is a stunning woman, all hair and eyes, it seems. -Her clothing is of the same tawny brown of her skin and -hair. Her blue eyes look at you appraisingly, seemingly -to show great intelligence. Her mouth twitches into a -sneer... -~ -bm 0 -600 S -15 6 -30 3d5+200 2d6+6 -6500 24000 -8 8 2 -#3308 -duwick man~ -Duwick~ -A truly immense man laughs at you, and draws his knife! -~ -This has to be one of the biggest men you've ever seen. He is -a full seven feet toe to head, and weighs a good three hundred -pounds -- mostly on his biceps and pectorals it appears. An -ornate scabbard slaps by his side, with the pommel of a silvered -dagger sticking out... a tiny weapon for such a large man! -~ -bm 0 -900 S -22 0 -70 3d5+400 3d6+10 -15000 70000 -8 8 1 -#3309 -receptionist~ -the Receptionist~ -A receptionist offers you a room. -~ -He looks like a retired farmer now making an honest living in an inn. -More power to him! -~ -b 0 400 S -12 9 -30 3d5+140 2d7+1 -8000 8000 -8 8 1 -#3310 -innkeeper~ -the innkeeper~ -An aged innkeeper greets you as you enter. -~ -He is old and greying, but seems to have been able to -keep his mental faculties through the years. A large -woolen sweater is wrapped about him for warmth. His -blue eyes dance with amusement as he notices your weapons, -but he doesn't seem too terribly startled. -~ -b 0 750 S -10 11 20 3d5+120 2d6+1 -2000 9000 -8 8 1 -#3311 -hunter~ -the hunter~ -A hunter walks through the town streets on his own time. -~ -He looks mean, as if the very personality of the mountains -had infected him with hardness. His stride is purposeful, -his face weathered, his eyes cold and dark. Others are -standing out of his way as he walks on by. -~ -cgm 0 500 S -11 10 -20 3d5+133 2d6+2 -1200 11000 -8 8 1 -#3312 -waiter~ -a waiter~ -A waiter rushes by, intent on his business. -~ -He looks harried from the way he hastily takes orders and -rushes in the back to get food, and to the bar for drinks. -He doesn't even spare you a glance as he passes by. -~ -b 0 0 S -5 16 70 3d5+60 2d4+0 -500 850 -8 8 1 -#3313 -waitress~ -a waitress~ -A waitress rushes by, intent on her business. -~ -She looks harried from the way she hastily takes orders and rushes -in the back to get food, and to the bar for drinks. She doesn't -even spare you a glance as she passes by. -~ -b 0 0 S -5 16 70 3d5+60 2d4+0 -500 850 -8 8 2 -#3314 -bartender~ -a bartender~ -A bartender washes a glass idly here. -~ -He nods, smiles, and asks you what you would like to drink. -As you decide, he slowly polishes a glass with an old bar -rag. The glass is completely clean, but he polishes it anyway. -Go figure. -~ -b 0 200 S -15 6 10 3d5+180 2d8+2 -10000 21000 -8 8 1 -#3315 -bandit~ -the bandit~ -A bandit springs into action upon seeing you. -~ -Whew! Has this guy ever seen a bath? His face, hands, arms... -nearly every bit of him is covered with grime, dust, dirt and -decay. His sword is polished and cleaned though... -~ -chjk 0 -500 S -16 5 -20 3d5+195 2d8+3 -1000 25000 -8 8 1 -#3316 -bandit guard~ -the bandit guard~ -A bandit guard stands at attention here. -~ -He may be a bandit, but he's no slacker. You wonder -who would be able to keep these bandits in line enough -to pull a good guard duty... - -(boy is this guy DIRTY!!!) -~ -bjk 0 -500 S -18 3 -30 3d5+220 3d6+2 -2400 32000 -8 8 1 -#3317 -miner worker slave~ -the slave~ -A slave here is mining out a new passageway. -~ -The slave looks up at you with pleading eyes. He -wants his freedom. The chains around his ankles are -tight, and you wonder if you should set him free, and -if you even can. -~ -bh 0 1000 S -6 15 100 3d5+70 1d8+1 -0 1500 -8 8 1 -#3318 -farmer~ -the farmer~ -A farmer walks around, looking for something to do. -~ -This farmer is a resident of Stanneg by the Mountains, -and as such, is one of the most boring people on earth. -~ -bcgh 0 500 S -7 14 4 3d5+83 2d4+1 -1000 2250 -8 8 1 -#3319 -hunter~ -the hunter~ -A hunter walks through the town streets on his own time. -~ -He looks mean, as if the very personality of the mountains -had infected him with hardness. His stride is purposeful, -his face weathered, his eyes cold and dark. Others are -standing out of his way as he walks on by. -~ -bcgm 0 500 S -11 10 -20 3d5+133 2d6+2 -1200 11000 -8 8 1 -$ - diff --git a/lc-mud/circle/world/mob/35.mob b/lc-mud/circle/world/mob/35.mob deleted file mode 100644 index 5ed7fd0e41611f8c0f1b9b51220df9abbb084f7e..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/35.mob +++ /dev/null @@ -1,98 +0,0 @@ -#3500 -wyvern~ -the wyvern~ -A monstrous wyvern slowly circles just above your head. -~ -This huge winged creature looks really menacing as it circles only inches -above your head, flapping its wings and squawking very loudly. -~ -bgjq 0 -700 S -8 13 3 2d10+90 2d6+1 -0 3575 -8 8 0 -#3501 -goblin mountain~ -the goblin~ -A mountain goblin is wandering around mumbling to himself... -~ -You see before you a small and twisted creature with knotted muscles and -disgustingly green skin. Doesn't look like the type you'd invite to dinner. -~ -fglm k -250 S -4 17 6 1d1+55 1d8+0 -50 600 -8 8 1 -#3502 -goblin lieutenant~ -the goblin lieutenant~ -A goblin lieutenant stands here, attempting to get his men in order. -~ -The goblin lieutenant is rather angry, and looking for one of his men to -beat up upon, but maybe you will do just fine... -~ -gjlm dk -600 S -7 15 3 1d12+100 2d5+1 -300 2000 -8 8 1 -#3503 -goblin leader~ -the goblin leader~ -The goblin leader surveys the room. -~ -The leader doesn't look too happy that you have found him here. He grabs -for his shortsword and lunges for your neck. -~ -bcjlm dk -900 S -9 10 1 1d12+120 2d5+3 -1000 8000 -8 8 1 -#3504 -boy small~ -the small boy~ -A small boy sits here, licking his wounds. -~ -The poor boy has numerous cuts and scratches, but appears to be all right. -He is apparently the only survivor of the ambush. -~ -bh 0 500 S -4 17 6 1d12+47 1d8+0 -0 600 -5 5 1 -#3505 -innkeeper~ -the Innkeeper~ -The Innkeeper stands here, cleaning glasses. -~ -The Innkeeper now spends most of his days waiting for customers, while the -nights are spent watching out for goblins. His inn is no longer the happy -place that is used to be in days past. -~ -bglm 0 400 S -10 8 1 1d12+200 2d8+1 -1500 7000 -8 8 1 -#3506 -bard~ -the bard~ -A sullen bard is here, drinking away his problems. -~ -You can smell the alcohol on his breath from across the room. This poor -bard has been sitting here quite a while, drinking himself into oblivion. -~ -bglm d 600 S -8 13 3 1d12+110 2d6+0 -1500 3750 -6 6 1 -#3507 -horseman dark~ -the dark horseman~ -A dark horseman is here, mounted on his black steed. -~ -The man is obviously an outlaw, and has no qualms about slashing you into -little bits. -~ -ghm sp -900 S -8 12 4 1d12+97 1d5+7 -1000 4000 -8 8 1 -$ diff --git a/lc-mud/circle/world/mob/36.mob b/lc-mud/circle/world/mob/36.mob deleted file mode 100644 index 987a7233d9fb141e33cac42293ab4a7227cb433d..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/36.mob +++ /dev/null @@ -1,149 +0,0 @@ -#3600 -black pawn~ -the Pawn of the Black Court~ -You see a pawn standing here waiting for orders. -~ -The Black Pawn looks quite like a small knight without his powerful steed. -His armor is shiny and black. He stands ready to give his life for the -Crown. -~ -bcgh d -400 S -6 2 5 5d4+50 2d4+2 -500 1000 -8 8 1 -#3601 -white pawn~ -the Pawn of the White Court~ -You see a pawn standing here waiting for orders. -~ -The White Pawn looks quite like a small knight without his powerful steed. -His armor is spotless and white. He stands ready to give his life for the -Crown. -~ -bcgh d 400 S -6 2 5 5d4+50 2d4+2 -500 1000 -8 8 1 -#3602 -black rook castle~ -the Black Rook~ -In the corner you see a large, black, stone castle on wheels. -~ -The Black Rook is a very large man-made tomb on wheels. Just -from the looks of it, it will probably be YOUR tomb. -~ -bpqr d -600 S -27 11 1 2d6+500 3d8+5 -5000 85000 -8 8 0 -#3603 -white rook castle~ -the White Rook~ -In the corner you see a large, white, stone castle on wheels. -~ -The White Rook is a very large man-made tomb on wheels. Just -from the looks of it, it will probably be YOUR tomb. -~ -bpqr d 600 S -27 11 1 2d6+500 3d8+5 -5000 85000 -8 8 0 -#3604 -black knight~ -the Black Knight~ -Here stands a magnificent knight of the dark realm. -~ -The Black Knight is here, riding his ebony black war horse. His eyes -flash behind his visor in vengence. -~ -bf d -400 S -18 8 0 4d8+350 2d8+1 -3000 22500 -8 8 0 -#3605 -white knight~ -the White Knight~ -Here stands a magnificent knight of the light realm. -~ -The White Knight is here, riding his ivory white war horse. His eyes -gleam behind his visor in joy. -~ -bf d 400 S -18 8 0 4d8+350 2d8+1 -3000 22500 -8 8 0 -#3606 -black bishop priest~ -the Black Bishop~ -A dark priest stands here. -~ -The Black Bishop seems willing to help you straight into your grave so -he can bless you properly. -~ -b d -500 S -24 11 1 2d5+350 3d6+13 -4000 43500 -8 8 0 -#3607 -white bishop priest~ -the White Bishop~ -A light priest stands here. -~ -The White Bishop seems willing to help you in any possible so that he can -attain a higher spirituality. -~ -b d 500 S -24 11 1 2d5+350 3d6+13 -4000 43500 -8 8 0 -#3608 -black queen~ -the Black Queen~ -The Black Queen stands here. -~ -The Black Queen is a strikingly beautiful woman with pale skin and a -mass of dark hair that crowns her head like a black cloud. If looks -could kill, you would already be dead. -~ -bcfl dh -750 S -32 11 -3 5d10+900 4d6+13 -10000 200000 -8 8 0 -#3609 -white queen~ -the White Queen~ -The White Queen stands here. -~ -The White Queen is a stunningly beautiful woman with dark skin and a mass -of light hair that frames her head like the sun. This is surely love at -first sight for you. -~ -bcfl dh 750 S -32 11 -3 5d10+900 4d6+13 -10000 200000 -8 8 0 -#3610 -black king~ -the Black King~ -The Black King stands here. -~ -The Black King is a menacing figure. You can easily understand why he -is the king and you are not. -~ -bcefl dh -999 S -36 14 -6 10d10+2000 5d8+20 -20000 300000 -8 8 0 -#3611 -white king~ -the White King~ -The White King stands here. -~ -The White King is a stately figure. You can easily understand why he -is the king and you are not. -~ -bcefl dh 999 S -36 14 -6 10d10+2000 5d8+20 -20000 300000 -8 8 0 -$ diff --git a/lc-mud/circle/world/mob/40.mob b/lc-mud/circle/world/mob/40.mob deleted file mode 100644 index 2f624533f07b64c7cd563cfa5399b8264724fb58..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/40.mob +++ /dev/null @@ -1,257 +0,0 @@ -#4000 -snake large~ -the snake~ -A large dreadful snake is at your feet, hissing at you. -~ -It looks hungry. -~ -abf dk -200 S -11 7 4 5d10+50 3d6+0 -0 12000 -8 8 0 -#4001 -snake green~ -the green snake~ -A small green snake is here, and it doesn't look too friendly... -~ -It looks harmless. -~ -ab 0 -100 S -7 12 4 3d10+30 2d6+1 -0 2500 -8 8 0 -#4002 -centipede~ -the centipede~ -A small centipede is here, making its way across the floor. -~ -It looks completely harmless. -~ -b 0 100 S -3 20 6 2d10+20 1d6+0 -0 400 -8 8 0 -#4003 -kobold~ -the kobold~ -An ugly kobold is here, searching for dinner. -~ -It looks ugly. -~ -cg k -100 S -4 16 5 2d10+40 1d8+1 -50 800 -8 8 0 -#4004 -orc~ -the orc~ -The orc walks around, looking for someone to kill. -~ -You notice an evil look in its eyes... -~ -cfg k -400 S -5 15 5 2d10+60 2d4+0 -100 900 -8 8 0 -#4005 -orc large~ -the orc~ -A large orc is here, looking really mean. -~ -He looks dreadful. -~ -cg k -500 S -7 11 2 3d20+75 2d6+2 -200 3000 -8 8 1 -#4050 -warrior~ -the warrior~ -A tall warrior is here. He has more scars than anyone you have ever seen. -~ -He seems to be a strong, brainless fighter. -~ -bcfg k -300 S -12 8 4 10d10+50 2d8+1 -1000 12000 -8 8 1 -#4051 -warrior~ -the warrior~ -A tall warrior is here. -~ -He seems to know his way with weapons. -~ -cfg k -400 S -7 13 5 3d10+80 2d5+0 -200 2500 -8 8 1 -#4052 -hobgoblin~ -the hobgoblin~ -A small hobgoblin stands here. -~ -The hobgoblin looks quite lost. -~ -cg k -300 S -6 12 6 3d8+70 2d4+0 -100 1500 -8 8 1 -#4053 -snake~ -the snake~ -A brown snake watches you. -~ -The snake looks quite mean. -~ -abf k -600 S -10 10 4 4d10+60 3d5+1 -0 12000 -8 8 0 -#4054 -centipede~ -the centipede~ -A white centipede is here. -~ -The centipede doesn't really seem to notice you. -~ -b 0 -100 S -5 17 5 1d10+50 1d7+0 -0 1000 -8 8 0 -#4055 -hobgoblin~ -the hobgoblin~ -A large hobgoblin is here. -~ -The hobgoblin looks quite dangerous. -~ -cg k -500 S -10 8 2 1d16+120 2d6+3 -300 10000 -8 8 1 -#4056 -orc~ -the orc~ -An orc is here, looking for something (or perhaps someone?) to eat. -~ -Well, he doesn't seem to be friendly. -~ -cfg k -800 S -8 13 2 3d10+100 2d5+2 -150 4000 -8 8 1 -#4057 -lion mountain~ -the mountain lion~ -A mountain lion is here, growling at you viciously. -~ -The lion looks very nasty with huge claws and big teeth. -~ -fg k -100 S -5 16 5 1d10+60 2d4+0 -0 900 -8 8 1 -#4058 -giant hill~ -the hill giant~ -A hill giant is here, tossing some rocks around. -~ -The hill giant looks like he's about 9 feet tall. By his actions you -quickly come to the conclusion that he isn't very intelligent. -~ -gq k 0 S -13 8 2 1d10+160 2d10+0 -1000 16500 -8 8 1 -#4100 -mage~ -the mage~ -A small intelligent looking mage is standing here. -~ -His IQ makes almost any normal person look stupid... -It looks like he knows his way with magic. -~ -abcf dk -100 S -13 10 2 3d20+100 2d6+0 -2500 21000 -8 8 1 -#4101 -troll~ -the troll~ -A large mean-looking troll is here. -~ -Well, it looks dangerous! -~ -bcf k -800 S -12 8 1 2d10+100 2d7+1 -500 13000 -8 8 1 -#4102 -snake~ -the snake~ -A large green snake is here, looks like a guardian for an evil force. -~ -You see a evil creature. -~ -abcf k -700 S -10 8 5 6d10+50 3d5+2 -0 9000 -8 8 1 -#4103 -thief~ -the thief~ -A thief is here, all dressed in black. -~ -He seems to be counting a handful of coins. Maybe you ought to count YOUR -gold too... -~ -acg dkst -400 S -8 13 3 1d10+100 2d5+2 -100 4000 -8 8 1 -#4104 -orc ugly~ -the orc~ -A ugly orc is standing here. -~ -It is quite disgusting to look at. -~ -cfgh dkp -200 S -7 14 4 1d5+90 2d4+1 -200 2250 -8 8 1 -#4105 -centipede~ -the centipede~ -A small harmless centipede is here. -~ -Well it doesn't seem to pay any attention to you. -~ -b 0 300 S -6 15 4 3d10+50 1d8+1 -0 1500 -8 8 0 -#4106 -warrior~ -the warrior~ -A human warrior is here. He has a evil grin in his face. -~ -He doesn't look friendly at all... -~ -cfg k -300 S -9 10 3 3d10+100 2d6+2 -500 9000 -8 8 1 -#4107 -kobold~ -the kobold~ -A green kobold is here. -~ -It looks slimy.. -~ -cfg k -100 S -7 14 4 4d10+25 1d9+1 -20 3000 -8 8 1 -$ diff --git a/lc-mud/circle/world/mob/50.mob b/lc-mud/circle/world/mob/50.mob deleted file mode 100644 index ee47775428f67964e91a497011083a870c375e93..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/50.mob +++ /dev/null @@ -1,198 +0,0 @@ -#5000 -dervish raggity~ -the dervish~ -A raggity dervish walks on aimlessly. -~ -Dressed in loose fitting rags, this man looks like he could use some rest. -~ -cgh st 900 S -5 15 5 1d10+60 2d4+0 -70 1000 -8 8 1 -#5001 -dervish large~ -the dervish~ -A large dervish watches for signs of trouble. -~ -Dressed in loose fitting rags, this man looks like he could use LOTS of -rest. -~ -fg st 650 S -8 12 3 2d6+100 2d6+1 -150 7000 -8 8 1 -#5002 -snake coral~ -the coral snake~ -A brightly colored snake slithers along the sands. -~ -This relatively harmless snake has bright alternating bands of red, yellow -and black. -~ -g 0 -10 S -4 17 4 1d6+40 1d9+0 -0 600 -8 8 0 -#5003 -scorpion small~ -the small scorpion~ -A small, red scorpion scuttles away at your approach. -~ -The little tail is mighty dangerous for such a small creature. -~ -g 0 -50 S -3 17 1 1d6+40 1d8+0 -0 500 -8 8 0 -#5004 -worm giant purple~ -the sand worm~ -A giant, purple sand worm thrusts up out of the sand and attacks! -~ -He's big, mean, and purple. Watch out! -~ -abeflpr dfk -300 S -21 0 3 2d10+320 3d7+14 -2540 65000 -8 8 0 -#5005 -dragon brass~ -the brass dragon~ -A very large brass dragon steps out of the darkness and says 'Hello.' -~ -Then adds to it, 'Prepare to die, have a nice day!' -~ -abefq dhkp 950 S -20 1 0 2d6+500 3d6+4 -1500 45000 -8 8 2 -#5006 -nomad leader~ -the nomad leader~ -The nomad leader sits silently in prayer. -~ -He is clad in silk robes lined with gold thread. At his side is a large, -engraved cutlass. He has an especially haughty air about him. -~ -bhl d 950 S -14 7 0 2d6+170 2d8+5 -1000 18000 -6 6 1 -#5007 -nomad commander~ -the nomad commander~ -The nomad commander stands here staring at you suspiciously. -~ -This is the nomad leader's second in command. His clothes are richly woven -of silk and gold thread. A nasty cutlass hangs at his side. -~ -bhl 0 900 S -12 8 1 2d6+135 2d5+3 -600 14000 -8 8 1 -#5008 -nomad warrior~ -the nomad warrior~ -A proud nomad warrior stands here. -~ -This warrior is dressed in typical nomad clothing and looks quite mean. -~ -b 0 700 S -10 11 2 1d6+105 2d6+1 -300 7000 -8 8 1 -#5009 -slave young~ -the slave~ -A young slave sits here staring at you with pleading eyes. -~ -She looks quite thin and weak. -~ -bh 0 1000 S -3 18 9 1d4+25 1d5+0 -0 300 -5 5 2 -#5010 -dracolich lich~ -the dracolich~ -A pile of bones rises up to form a skeletal dracolich. -~ -The dracolich is now only bone with pieces of flesh hanging from it. -Obviously it no longer fears death. -~ -abeflnopq bdfhkp -1000 S -24 0 -6 1d12+520 3d5+35 -75000 125000 -8 8 0 -#5011 -drider~ -the drider~ -The drider looks at you viciously while it draws its sword. -~ -This half-spider, half-drow creature is a formidable opponent. -~ -fg dkp -1000 S -8 12 2 1d6+95 2d6+2 -200 4000 -8 8 0 -#5012 -duergar dark dwarf~ -the dark dwarf~ -A duergar is here mining precious stones with his pick. -~ -The duergar could probably crush your head as easily as he does those -rocks. -~ -fg dkp -850 S -5 16 3 1d11+60 2d5+1 -170 1250 -8 8 1 -#5013 -myconoid~ -the myconoid~ -A myconoid lumbers along peacefully. -~ -The myconoid looks something like a giant mushroom (and probably has the -same effect). -~ -gh dk 850 S -6 15 4 1d12+68 2d7+0 -50 600 -8 8 1 -#5014 -myconoid shaman~ -the myconoid shaman~ -A rather large myconoid stands here chanting in a strange tongue. -~ -The shaman shoots spores into the air. -~ -acil dhk 950 S -14 7 1 1d12+173 2d7+2 -2500 18000 -8 8 1 -#5015 -dustdigger oasis~ -the dustdigger~ -A small oasis invites you to dive in. -~ -Looking a little closer at this oasis, you begin to wonder why -it seems to be moving about... -~ -bcfqr 0 -200 S -7 10 1 1d6+85 3d4+0 -450 2250 -8 8 0 -#5017 -camel~ -the camel~ -A very dangerous creature, a camel, snorts at you. -~ -It is advisable not to mess with this creature. After all, you -have heard many a horror story about experiences with camels. -Bad experiences. -~ -bfq 0 -351 S -5 12 6 1d6+60 2d4+3 -270 900 -8 8 0 -$ diff --git a/lc-mud/circle/world/mob/51.mob b/lc-mud/circle/world/mob/51.mob deleted file mode 100644 index 9a71f4a0e1180627d636f10d6981d85ab6e98ccd..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/51.mob +++ /dev/null @@ -1,133 +0,0 @@ -#5100 -goblin slave~ -the goblin slave~ -A goblin slave lies here asleep. -~ -The defenseless goblin begs for mercy. -~ -bh 0 350 S -1 20 9 1d11+11 1d5+0 -0 100 -4 4 1 -#5101 -drow commoner~ -the Drow commoner~ -A drow commoner is here, walking around on guard duty. -~ -I doubt he is the type to give directions. -~ -fglm dk -1000 S -10 12 0 1d10+130 13d1+3 -300 10750 -8 8 1 -#5102 -drow noble warrior~ -the drow warrior~ -A drow warrior stands here guarding his home. -~ -He looks kind of annoyed! -~ -bflm dk -1000 S -12 9 0 1d5+160 14d1+7 -1000 15000 -8 8 1 -#5103 -drow noble mage~ -the drow mage~ -A drow mage is here protecting his home. -~ -The mage prepares to cast a spell... at you!! -~ -abflm dk -1000 S -15 8 2 1d12+190 8d2+2 -2000 21000 -8 8 1 -#5104 -drow priestess~ -the drow priestess~ -A drow priestess is here shouting orders. -~ -I wouldn't want go get on her bad side! -~ -abflm dk -1000 S -17 5 0 1d11+205 14d1+4 -4000 28000 -8 8 2 -#5105 -drow master~ -the drow master~ -A drow master stares at you angrily. -~ -The drow master is ALWAYS ready for a fight. -~ -bflm dk -1000 S -21 0 0 1d12+248 18d1+4 -10000 60000 -8 8 1 -#5106 -drow weaponsmaster~ -the weaponsmaster~ -A drow weaponsmaster is here shadow boxing. -~ -He definitely know his way around in combat. -~ -bflm dkp -1000 S -23 0 -2 1d25+405 12d2+4 -15000 80000 -8 8 1 -#5107 -drow matron mother~ -the Matron Mother~ -The Matron Mother of the house is standing here. -~ -She looks really and truly annoyed that you have found your way here. -~ -abfl dhkp -1000 S -24 0 -3 1d50+450 15d2+4 -30000 130000 -8 8 2 -#5108 -drow matron mother~ -the Matron Mother~ -The Matron Mother of the first house is waiting for you. -~ -She looks like she is about to rip your head of and eat it. -~ -abfl dhkp -1000 S -25 0 -4 5d10+350 12d2+24 -40000 150000 -8 8 2 -#5109 -drider~ -the drider~ -The drider looks at you viciously while it draws its sword. -~ -This half-spider, half-drow creature is a formidable opponent. -~ -fgno dkp -1000 S -8 12 2 1d6+195 2d6+2 -200 4000 -8 8 0 -#5110 -drider~ -the drider~ -The drider looks at you viciously while it draws its sword. -~ -This half-spider, half-drow creature is a formidable opponent. -~ -bfgno dhkp -1000 S -11 10 0 1d6+295 3d6+8 -0 7000 -8 8 0 -#5111 -yochlol~ -the yochlol~ -A yochlol forms out of a swirling mist... -~ -The yochlol is not in a good mood. -~ -beflnoqr dfhkp -1000 S -23 0 -6 25d2+450 15d2+30 -60000 80000 -8 8 2 -$ diff --git a/lc-mud/circle/world/mob/52.mob b/lc-mud/circle/world/mob/52.mob deleted file mode 100644 index 1d5df102d6eab6ff1c5b4bae057e322290793068..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/52.mob +++ /dev/null @@ -1,123 +0,0 @@ -#5200 -beholder~ -the mighty beholder~ -You meet a beholder's deadly gaze! -~ -It has a large central eye that projects an anti-magic ray and ten -eyestalks atop the round body which can do anything from charm you -to disintegrate you. Beholders are not known for their personality. -~ -abflnoq dhkp -870 S -25 6 0 1d14+450 6d9+5 -28560 134000 -8 8 0 -#5201 -lamia beast~ -the lamia~ -A strange lamia stands here waiting for her next meal. -~ -This is a creature with the upper torso of a beautiful woman, but the lower -body of a four-legged beast. She licks her lips as she looks at you greedily. -~ -acgj 0 -1000 S -12 12 3 1d10+120 2d5+1 -1500 10500 -8 8 2 -#5202 -mimic chest~ -the mimic~ -A strong chest lies in one corner of the room. -~ -A strong, wooden chest bound with iron straps and a heavy padlock on the -front. -~ -bqr 0 10 S -11 10 1 1d20+130 2d7+0 -0 13000 -8 8 0 -#5203 -mimic boulder skeleton skeletons~ -the mimic~ -Two skeletons lie crushed under a large boulder. -~ -This large boulder seems to have been dropped here at some point, since -there aren't any boulders native to this area. The two skeletons beneath -it are simply that, bones... no rags or anything else appears to be -attached to them. -~ -bqr 0 -10 S -14 7 1 3d15+150 3d5+1 -0 20000 -8 8 0 -#5204 -mimic floor~ -the mimic~ -The stone floor of this house has been ripped apart. -~ -What a mess, you wonder to yourself what could have caused this rampant -destruction. -~ -bqr 0 -140 S -11 11 3 2d6+110 2d6+0 -0 10500 -8 8 0 -#5205 -mimic pottery shards~ -the mimic~ -Some broken shards of pottery lie strewn about the floor. -~ -The pottery shards appear to have been part of a large vase at one point, -probably before the city fell. -~ -bqr 0 200 S -11 14 0 1d8+100 2d5+3 -0 9800 -8 8 0 -#5206 -mimic planks wooden~ -the mimic~ -A few wooden planks lie stacked on a low shelf. -~ -The fact that these planks still rest on this shelf leads you to believe -that someone has been here before you... -~ -bqr 0 0 S -11 9 0 1d12+110 4d3+1 -0 12000 -8 8 0 -#5207 -lizard horned~ -the horned lizard~ -A small horned lizard flicks his tongue and slithers away. -~ -A cute little lizard -- that is, if you like reptiles! -~ -h 0 300 S -3 17 4 1d14+30 2d4+0 -0 500 -8 8 0 -#5208 -golem stone~ -the stone golem~ -In the corner you see a large, stone golem faithfully standing watch. -~ -It is a big chunk of rock that has been magically formed into a giant stone -creature. He stands here still guarding the city. -~ -bilnopqr dfk 800 S -25 0 -5 6d6+500 4d7+3 -4250 145000 -8 8 0 -#5209 -lamia beast~ -the lamia~ -A strange lamia stands here waiting for her next meal. -~ -This is a creature with the upper torso of a beautiful woman, but the lower -body of a four-legged beast. She licks her lips as she looks at you greedily. -~ -abfg f -500 S -9 10 3 1d12+120 1d4+5 -1500 7000 -8 8 2 -$ diff --git a/lc-mud/circle/world/mob/53.mob b/lc-mud/circle/world/mob/53.mob deleted file mode 100644 index 52355ab866b0aabe6e010f92ffbea1104b414b7f..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/53.mob +++ /dev/null @@ -1,236 +0,0 @@ -#5300 -asp snake~ -the horrible asp~ -A small, poisonous asp slithers over your feet. -~ -The asp is a small, smooth-scaled snake the color of worn pottery. -The poison bite of this snake has felled many a mighty pharoah. -~ -afg 0 0 S -5 14 8 5d5+50 1d6+1 -10 1000 -8 8 0 -#5301 -cobra snake~ -the hooded cobra snake~ -A cobra snake rears up and opens its fearsome hood. -~ -The cobra snake waves back and forth before you, its hood displaying brilliant -colors designed to serve notice to its prey that it is about to strike. -~ -afg 0 0 S -7 13 7 7d7+70 2d4+2 -25 2000 -8 8 0 -#5302 -mongoose~ -the wily little mongoose~ -A small mongoose slinks along the ground, hunting snakes. -~ -The mongoose is a wily rodent, a quick hunter of nasty poisonous snakes. -She sniffs you and appears to be looking for food in your hand. -~ -fg k 10 S -11 10 6 11d11+110 3d5+3 -100 10000 -8 8 2 -#5303 -pyramid watcher~ -the pyramid watcher~ -The pyramid watcher protects the tombs from intruders. -~ -The pyramid watcher has made a pledge to destroy any would-be looters of -the tombs of the pharoahs. He is clad from head to foot in utilitarian -sand-colored clothing. -~ -bem p 250 S -8 12 5 8d8+80 2d6+2 -200 3750 -8 8 1 -#5304 -thief tomb~ -the tomb thief~ -A sneaky tomb thief moves about in search of treasure. -~ -The thief brushes against you briefly, then slinks back into the shadows. -~ -agh pst -250 S -10 10 5 10d10+100 2d6+3 -500 9000 -8 8 1 -#5305 -ali baba thief~ -Ali Baba~ -Ali Baba is here, hunting for the pharoah's tomb. -~ -You see a tall, full-bearded man with a mischevious glint in his eye. Ali Baba -has made his life from stealing things from others, including many items stolen -recently from under the nose of the hapless guardians of this pyramid. Someday -he might get caught, but not today... -~ -acegl ps -300 S -18 2 0 18d18+180 3d8+2 -1000 30000 -8 8 1 -#5306 -magic carpet~ -the magic carpet~ -A small woven carpet lies under your feet. -~ -The carpet is simply beautiful, made from intricately woven silken material. -It seems to rise up at the touch of your feet. Wait, it is rising, a few feet -above the ground! In fact, it seems to be ALIVE! -~ -belnopqr dkp 500 S -9 11 7 9d9+90 2d5+2 -250 6000 -8 8 0 -#5307 -mummy corpse~ -the mummy~ -A mummy reaches for you, disturbed by your presence. -~ -You only see the disfigured, rotting features of decaying human flesh, -animated by the distempered spirit of a long-deceased person. -~ -fgnopr dfkp -600 S -12 8 4 12d12+120 1d6+6 -750 15000 -8 8 0 -#5308 -sand man sandman~ -the sandman~ -A sandman rises up from the desert floor. -~ -The sandman is exactly that -- some sort of strange being formed from the sands -of the desert floor. It seems quite large and strong and at home in the heat -and sandy winds. -~ -efglnopr dkp 0 S -14 6 2 14d14+140 2d7+4 -1500 18000 -8 8 1 -#5309 -efreeti efreet~ -the efreeti~ -The efreeti stands here, sheathed in a column of fire. -~ -The efreeti is a mighty being formed from living fire. He gazes down at -you with disdain and scorn, arms folded across his mighty chest. -~ -abeflnopqr dkp -600 S -20 0 -1 20d20+200 4d6+4 -11000 40000 -8 8 1 -#5310 -caryatid column~ -the caryatid~ -A sandstone column stands here, carved into a feminine figure. -~ -The column has been carved into a set of four shapely women, each facing -outward into the room. The sandstone of the caryatid is smooth with age, -but you can still make out a deadly stone sword in the hands of each figure. -~ -belmnopqr kp 0 S -24 -4 -3 24d24+240 4d6+8 -35000 100000 -8 8 2 -#5311 -djinn genie~ -the djinn~ -The djinn issues forth from the confines of a small lamp. -~ -The djinn is a mighty being formed from the air itself and frequently -imprisoned in a small lamp, used to do the bidding of those who find him. -He smiles down at you congenially, arms folded across his blue-tinged -skin, and strokes his goatee. -~ -abelnopqr dkp 600 S -28 -8 -6 28d28+280 6d6+12 -60000 310000 -8 8 1 -#5312 -hieracosphinx sphinx~ -the hieracosphinx~ -A hieracosphinx looks at you cunningly. -~ -The hieracosphinx are cunning, small, but nasty creatures, having the heads -of birds, mighty wingspans, and a full set of four paws to rend their victims -to pieces. They tend to be quite jealous of the sharper wits of their older -cousins. -~ -efglnoq kkp -200 S -15 5 3 15d15+150 1d10+5 -7500 21000 -8 8 0 -#5313 -gynosphinx sphinx~ -the gynosphinx~ -A gynosphinx sits here, befuddled by a riddle. -~ -The gynosphinx is a crafty but gentle creature, having the body of a -beautiful dark-skinned woman from the waist up, a feathery set of wings -and the hind legs of a mighty cat. Right now she is confused, having -just heard a puzzling riddle from a cousin criosphinx. -~ -abelnoq dkp 100 S -19 1 0 19d19+190 2d10+10 -10000 35000 -8 8 2 -#5314 -criosphinx sphinx~ -the criosphinx~ -A criosphinx calmly watches you. -~ -The criosphinx is a calm and friendly creature, having the head of a ram atop -the body of a well-furred feline with eagle-like wings. He delights in riddles, -and in poking occasional fun at his easily confused lesser cousins. -~ -abelnoq dkp 300 S -23 -3 -2 23d23+230 3d10+15 -25000 80000 -8 8 1 -#5315 -androsphinx sphinx~ -the androsphinx~ -A mighty androsphinx tosses its lion-like mane. -~ -The mighty androsphinx is a huge creature, with the body of a lion whose -face is quite man-like, perhaps even handsome, and a massive pair of feathered -wings. Tales are told of pharoahs that were rendered permanently deaf by the -mighty roar of this sphinx. -~ -abelnoq dkp 400 S -27 -7 -6 27d27+270 4d10+20 -50000 200000 -8 8 0 -#5316 -great sphinx~ -the great sphinx~ -A mighty sphinx rests here in the sand, dormant now for centuries. -~ -The great sphinx towers tens of feet above you, resting here in a state of -dormancy. It has become almost indistinguishable from the sand that surrounds -it, although you can still make out the features of the handsome face that once -advised many rulers. -~ -abelnopqr dhkp 500 S -41 -21 -20 41d41+410 5d10+25 -125000 1500000 -8 8 0 -#5317 -ramses mummy~ -Ramses the Damned~ -You have awakened the mighty servant to the pharoahs, Ramses. -~ -As your light spills over his face and body, you can see his features -begin to fill out, swell, and harden, until an apparently healthy man -stands before you, clad only in the raiments he was left in when he last -slept. His hair is a soft black, his skin a deep chocolate, and his -tall frame is totally still, his chest not even moving to breathe. -~ -abelnopr dhkp 150 S -38 -18 -18 38d38+380 8d5+40 -88000 1000000 -8 8 1 -$ diff --git a/lc-mud/circle/world/mob/54.mob b/lc-mud/circle/world/mob/54.mob deleted file mode 100644 index 40d90abaaa4b336225906c4e1071618d3e8b4eda..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/54.mob +++ /dev/null @@ -1,1047 +0,0 @@ -#5400 -mage guildmaster~ -the guildmaster~ -Your guildmaster stands here. -~ -An old man peering through ancient tomes rests here. -~ -blno dhk 1000 S -16 -10 -10 1d1+10000 5d5+5 -1 0 -8 8 1 -#5401 -cleric guildmaster~ -the guildmaster~ -Your guildmaster stands here. -~ -An older man wrapped in purple, long-flowing robes meditates here. -~ -blno dhk 1000 S -16 -10 -10 1d1+10000 5d5+5 -1 0 -8 8 1 -#5402 -warrior guildmaster~ -the guildmaster~ -Your guildmaster stands here. -~ -A smaller man dressed in black robes stands here waiting to train you. -~ -blno dhk 1000 S -16 -10 -10 1d1+10000 5d5+5 -1 0 -8 8 1 -#5403 -thief guildmaster~ -the guildmaster~ -Your guildmaster stands here. -~ -A small human dressed in black rests in the corner. As you enter he grabs -a knife and throws it at you. It lands in the wall next to your left ear. -'We will now begin', is all he says. -~ -blno dhk 1000 S -16 -10 -10 1d1+10000 5d5+5 -1 0 -8 8 1 -#5404 -receptionist woman~ -the receptionist~ -A dark skinned, veiled woman greets you from behind the desk. -~ -This Arabian beauty is obviously the daughter of some high ranking -official. As you attempt to sneak a peek under her veil you notice -a small moon-shaped birthmark on her left cheek. -~ -ablno d 800 S -10 -10 -10 1d1+1871 10d20+10 -1 5000 -6 6 2 -#5405 -bartender man mage old~ -the old withered man~ -An old withered man leans against the bar. -~ -He looks distracted as he pours five drinks at once without error. -~ -blno d 0 S -35 9 -1 1d1+12000 1d5+3 -1 1000 -8 8 1 -#5406 -john brother singer lead~ -Brother John~ -Brother John, lead singer for the Lokettes stands on stage. -~ -You see the lead singer of the Lokettes lip synching to an old Zochan -tune. -~ -bg 0 0 S -15 4 0 3d5+150 2d5+3 -21 1350 -8 8 1 -#5407 -panhandler~ -the panhandler~ -A panhandler rests here. -~ -A small skinny man rests here hoping to find a warm heart. -~ -cgh 0 -20 S -2 19 10 10d1+1 1d4+2 -1 5 -5 5 1 -#5408 -panhandler~ -the panhandler~ -A panhandler rests here. -~ -A small skinny man rests here staring at your clothes. -~ -cgh 0 -20 S -3 19 10 10d1+1 1d3+3 -1 5 -5 5 1 -#5409 -beggar~ -the beggar~ -A grubby beggar sits here in the filth. -~ -This poor soul seems down on his luck, perhaps you might spare a dime? -~ -cgh 0 -20 S -1 19 10 10d1+1 1d2+2 -1 0 -8 8 1 -#5410 -baker~ -the baker~ -The baker stands here playing solitaire. -~ -You see a large man in a white apron covered in flour from head to toe. -~ -blno d 100 S -35 0 0 1d1+30000 2d10+2 -1 2000 -8 8 1 -#5411 -shopkeeper~ -the shopkeeper~ -The shopkeeper stands here. -~ -You see a half-elf sitting on a stool behind his counter. -~ -blno d 100 S -35 0 0 1d1+30000 2d10+2 -1 2000 -8 8 1 -#5412 -banker~ -the banker~ -A banker stands here waiting to help you. -~ -This small halfling seems adept at counting money. -~ -blno d 0 S -10 1 0 1d1+30000 3d6+2 -1 0 -8 8 1 -#5413 -ahkeem tailor~ -Ahkeem the tailor~ -Ahkeem the tailor welcomes you to his store. -~ -This middle-aged man looks over you with disdain and quickly suggests a -new wardrobe. -~ -blno d 0 S -35 10 5 1d1+30000 1d5+5 -1 200 -8 8 1 -#5414 -vera lady~ -Vera the veggie lady~ -Vera the veggie lady beems as you look over her stand. -~ -A tall slender woman stands before you smiling broadly. -~ -blno d 0 S -35 10 5 1d1+30000 1d5+5 -1 2000 -8 8 2 -#5415 -butch~ -Butch the meatcutter~ -Butch the meatcutter stands here in his bloodied apron. -~ -This stocky dwarf has a mad glint in his eye as he twirls his clever -carelessly into the air. -~ -blno d 0 S -35 10 5 1d1+30000 1d5+5 -1 2000 -8 8 1 -#5416 -abdul armorer~ -Abdul the armorer~ -Abdul stands here, waiting to help you. -~ -Abdul returns your gaze with a steady eye. You quickly glance away -under his cold stare and place your order. -~ -blno d 0 S -35 10 5 1d1+30000 1d5+5 -1 2000 -8 8 1 -#5417 -igor weaponsmith~ -Igor the weaponsmith~ -Igor stands here doing... something. -~ -You see a small dwarf with a large hump on his left shoulder. -~ -blno d 0 S -35 10 5 1d1+30000 1d5+5 -1 2000 -8 8 1 -#5418 -cassandra~ -Cassandra~ -Cassandra stands proudly over her selection. -~ -You see a happy weather-worn face whose lines suggest many years on -the open sea. It is only through years of fishing that she is able -to withstand the smell that permeates the air. -~ -blno d 0 S -35 0 0 1d1+30000 1d5+5 -1 2000 -8 8 2 -#5419 -foreman man~ -the foreman~ -The foreman stands here screaming at the workers. -~ -A worried working dwarf stands here constantly making notes in his -book and looking at his watch. -~ -bg 0 0 S -15 6 -2 3d10+40 1d8+2 -1 100 -8 8 1 -#5420 -construction worker~ -the construction worker~ -A construction worker steadily works here. -~ -A large sweaty looking man doesn't even return your glance. -~ -bg 0 10 S -10 12 0 3d8+35 2d5+2 -1 50 -8 8 1 -#5421 -statue brahman~ -the statue of Brahman~ -The statue of Brahman stands here. -~ -The statue made of solid marble depicts the mighty God defeating Siva -in magical combat. -~ -abelnopqr dhk 1000 S -15 -10 -10 1d1+1200 6d10+10 -1200 12000 -8 8 0 -#5422 -statue siva~ -the statue of Siva~ -The statue of Siva stands here. -~ -The statue of the High Lord of Destruction stands here beings attacked -by Brahman in magical combat. -~ -abelnopqr dhk -1000 S -15 -10 -10 1d1+1200 6d10+10 -1200 12000 -8 8 0 -#5423 -statue indra~ -the statue of Indra~ -The statue of Indra stands here. -~ -This statue looks like an enormous elephant. -~ -abelnopqr dhk 1000 S -15 -10 -10 1d1+1200 6d10+10 -1200 12000 -8 8 0 -#5424 -statue yama~ -the statue of Yama~ -The statue of Yama stands here. -~ -This is a statue of the God of Death. It is covered with odd runes. -~ -abelnopqr dhk 0 S -15 -10 -10 1d1+1200 6d10+10 -1200 12000 -8 8 0 -#5425 -statue surya~ -the statue of Surya~ -The statue of Surya stands here. -~ -The statue of Surya, the God in charge of the Sun, almost glows -with a firey aura. -~ -abelnopqr dhk 1000 S -15 -10 -10 1d1+1200 6d10+10 -1200 12000 -8 8 0 -#5426 -statue kali~ -the statue of Kali~ -The statue of Kali stands here. -~ -The statue of the Black Mother, Kali, is made of black marble and -is covered with silver runes. -~ -abelnopqr dhk -1000 S -15 -10 -10 1d1+1200 6d10+10 -1200 12000 -8 8 0 -#5427 -statue brihaspati~ -the statue of Brihaspati~ -The statue of Brihaspati stands here. -~ -The statue of Brihaspati, the God of Scholars and Knowledge is made -of a weathered marble. -~ -abelnopqr dhk 0 S -15 -10 -10 1d1+1200 6d10+10 -1200 12000 -8 8 0 -#5428 -statue puchan~ -The statue of Puchan~ -The statue of Puchan stands here. -~ -The statue of Puchan, God of Travellers, is covered with dust and worn -as if it had been dragged a long way down a dusty road. -~ -abelnopqr dhk 1000 S -15 -10 -10 1d1+1200 6d10+10 -1200 12000 -8 8 0 -#5429 -aziz human canon~ -Aziz~ -Aziz the Human Canon stands here. -~ -This big and burly man grins at you as he draws his sword. -~ -gh d 0 S -11 14 0 2d11+40 2d5+2 -1 384 -8 8 1 -#5430 -mustafah human robber~ -Mustafah~ -Mustafah the Human Robber stands here. -~ -This man is lithe and has an evil smirk upon his face. -~ -gh d 0 S -7 17 30 3d8+41 2d4+1 -1 99 -8 8 1 -#5431 -fatima elf invoker~ -Fatima~ -Fatima the Elven Invoker stands here. -~ -This female elf has dusky skin and black hair. A combination you don't -see very often on elves. -~ -gh d 0 S -9 18 50 2d6+25 3d3+0 -1 93 -8 8 2 -#5432 -kareem dwarf mercenary~ -Kareem~ -Kareem the Dwarven Mercenary stands here. -~ -This short stocky fellow has a chest the girth of a barrel. -~ -gh d 0 S -12 9 0 4d4+50 2d6+5 -1 939 -8 8 1 -#5433 -nomad merchant~ -the nomad merchant~ -A nomad merchant looks you over. -~ -This robust fellow returns your gaze with a smile, but something inside -tells you not to trust him very far. -~ -cghlmno 0 -100 S -35 11 20 1d1+1500 1d8+2 -15000 800 -8 8 1 -#5434 -bodyguard guard~ -the Sultan's Bodyguard~ -A bodyguard sizes you up. -~ -The large half-orc quickly glances you over and returns to his duties. -~ -abeflm dk 0 S -12 10 3 3d10+100 1d6+3 -1 400 -8 8 1 -#5435 -kid thief~ -the skinny kid~ -A skinny kid wanders around. -~ -This small child sees you looking at him and quickly looks away. -~ -ch 0 100 S -7 12 1 14d1+1 2d5+1 -1 100 -8 8 1 -#5436 -dockworker~ -the dockworker~ -A strong dockworker walks by moving crates. -~ -Although seemingly dull witted, this hulking mass carries the huge -crates from the boats like it was a box of lilies. -~ -g 0 0 S -12 9 20 3d5+65 1d8+5 -1 550 -8 8 1 -#5437 -man taxcollector~ -the taxcollector~ -A small man walks around scribbling in a notebook. -~ -The city's taxcollextor walks from store to store collecting the -Sultan's fee for living in his grand city. -~ -gh 0 0 S -5 16 50 10d2+45 2d3+1 -15 431 -8 8 1 -#5438 -gord~ -Gord~ -Gord the Rogue stand here. -~ -~ -ch dhk 1000 S -15 0 -3 5d3+105 2d6+4 -1 1000 -8 8 1 -#5439 -chulainn knight~ -Chulainn~ -Chulainn the Knight stands here. -~ -This large man does not seem to be surprised at your approach and -looks at you quizically. -~ -chlm dk 800 S -15 0 -10 4d1+231 2d8+5 -650 8700 -8 8 1 -#5440 -daghdha~ -Daghdha~ -Daghdha the Arch-Magi stands here. -~ -This man is dressed in long brown robes and has a penetrating gaze. -~ -ag dhk 200 S -15 5 3 5d2+180 1d6+2 -0 8700 -8 8 1 -#5441 -curley greenleaf~ -Curley GreenLeaf~ -Curley GreenLeaf stands here. -~ -~ -ch 8 0 S -15 0 0 3d5+120 3d4+1 -1 1000 -8 8 1 -#5442 -man wandering prophet~ -the wandering prophet~ -A small grey-haired man walks around spouting gospel. -~ -This sad case may have been an evangelist in another lifetime. He is known -to stand on corners and accost passers-by with his doomsday preaching. -~ -h 0 0 S -7 16 50 1d1+1 1d5+1 -1 10 -8 8 1 -#5443 -alley cat~ -the alley cat~ -A small harmless feline searches for food. -~ -You see a small starved cat. -~ -h 0 -10 S -2 18 70 1d2+5 2d2+1 -1 0 -8 8 1 -#5444 -vulture~ -the vulture~ -A vulture circles above you. -~ -As you look up at this bird, you see the only thing it wants is a corpse. -~ -gh 0 -200 S -2 18 7 1d3+1 1d6+1 -1 10 -8 8 1 -#5445 -old man~ -the old man~ -An old man sits here playing chess. -~ -He seems intent on winning. -~ -h 0 200 S -4 17 80 2d3+1 1d3+1 -1 20 -6 6 1 -#5446 -lugh librarian~ -Lugh the Librarian~ -Lugh the Librarian sits behind a desk. -~ -The huge hulking mass rises as someone asks him a question. -~ -belno 0 300 S -10 1 0 10d10+430 3d6+5 -1231 23000 -6 6 1 -#5447 -dirt dust devil~ -the dirt devil~ -The wind kicks up some dust. -~ -What you see before you is really a baby air elemental. -~ -cf 0 -1000 S -1 19 90 2d2+1 2d3+1 -1 10 -8 8 1 -#5448 -lamia beast~ -the lamia~ -A strange lamia stands here waiting for her next meal. -~ -This is a creature with the upper torso of a beautiful woman, but the -lower body of a four-legged beast. She licks her lips as she looks at -you greedily. -~ -cj 0 -500 S -12 12 3 1d10+120 2d5+1 -1500 10500 -8 8 2 -#5449 -dervish~ -the raggety dervish~ -A raggety dervish stands here. -~ -This man looks like he could use a lot of rest. -~ -fg 32768 -750 S -8 12 3 4d4+20 2d6+1 -1 105 -8 8 1 -#5450 -sultan~ -the Sultan~ -The Sultan rests here on his throne. -~ -You see a large wealthy man in red robes smiling at you. -~ -beilno dhk 200 S -10 5 -4 6d6+830 1d6+0 -1200 25000 -5 5 1 -#5451 -harem girl~ -a harem girl~ -A lovely, veiled harem girl stands here. -~ -You see a dark skinned beauty, wearing almost transparent silks and -light blue veil. Her loyalty to the Sultan is unwavering. -~ -b 0 0 S -3 17 7 1d1+15 1d6+1 -0 40 -8 8 2 -#5452 -jailer~ -the jailer~ -The Jailer sleeps here, snoring loudly. -~ -You see a pathetic soul lying here. Probably some ex-nobleman that has -fallen out of grace with the Sultan. -~ -bch 0 -100 S -18 4 0 3d4+100 1d6+6 -157 1200 -4 4 1 -#5453 -eunich~ -a eunich~ -A eunich stands here watching over the girls. -~ -You see a large man whose only duty is to protect the harem. He has been -castrated for the ladies' safety. -~ -bf dk 0 S -12 8 0 5d1+130 2d4+4 -0 1300 -8 8 0 -#5454 -sultans favorite girl nichole~ -Nichole, the Sultan's favorite~ -Nichole, the Sultan's favorite girl rests on a mound of pillows. -~ -You see the most beautiful Arabian girl that has ever meet your eyes. -Too bad she is about to kill you. -~ -bf dk 100 S -10 3 -2 1d1+54 2d5+2 -0 150 -5 5 2 -#5455 -allah~ -Allah~ -Allah is here. -~ -You see the all-knowing Allah. -~ -abeiklnopqr dhks 1000 S -11 0 0 2d3+2300 2d20+20 -0 45000 -5 5 0 -#5456 -mage guildguard~ -the guildguard~ -The Guard for the Guild of Mages stand here. -~ -This man looks like a mage/warrior, I wouldn't mess with him. -~ -blno dhk 0 S -8 -1 -10 2d5+500 3d8+10 -0 500 -8 8 1 -#5457 -cleric guildguard~ -the guildguard~ -The Guard for the Guild of Clerics stands here. -~ -This man looks like a cleric/warrior, I wouldn't mess with him. -~ -blno dhk 0 S -8 -1 -10 2d5+500 3d8+10 -0 500 -8 8 1 -#5458 -warrior guildguard~ -the guildguard~ -The Guard for the Guild of Warriors stands here. -~ -The man looks like Conan's cousin, I wouldn't mess with him. -~ -blno dhk 0 S -8 -1 -10 2d5+500 3d8+10 -0 500 -8 8 1 -#5459 -thief guildguard~ -the guildguard~ -The Guard for the Guild of theives stands here. -~ -You see a thief dressed all in black, he quickly stands as you -enter and steps to bar your way. You notice his hands resting -on two sheathes. -~ -blno dhk -100 S -8 -1 -10 2d5+500 3d8+10 -0 500 -8 8 1 -#5460 -servant boy~ -the servant boy~ -A servant boy is here running errands. -~ -You see a small boy running around the halls of the palace. -~ -g 0 0 S -2 19 90 10d1+1 1d4+1 -1 10 -8 8 1 -#5461 -sultans guard~ -the Sultan's Guard~ -A guard stands here, protecting the innocent. -~ -You see a trained fighter, ready to help those in need. -~ -agh 0 1000 S -10 10 9 2d4+120 1d8+0 -150 2500 -8 8 1 -#5462 -sultans guard~ -the Sultan's Guard~ -A guard stands here, watching the gate. -~ -You see a trained fighter, ready to defend the city. -~ -abg 0 1000 S -10 10 8 2d4+120 1d8+1 -150 2500 -8 8 1 -#5463 -sultans guard chief~ -the Chief Guard~ -The Chief of the Sultan's Guard stands here. -~ -You see a large man skilled in hunting and killing. -~ -ag d 1000 S -15 0 0 4d5+251 2d8+1 -435 5000 -8 8 1 -#5464 -mercenary~ -the mercenary~ -A mercenary stands here waiting for a job. -~ -You see an assassin down on his luck looking to be freelanced out. -~ -g 0 0 S -5 15 9 1d8+14 1d4+2 -1 50 -8 8 1 -#5465 -shipwright captain~ -the shipwright~ -An old captain rests here carving on a stick. -~ -You see the shipwright of New Thalos, waiting to make someone a boat. He -beams a smile at you through his beard as you walk in. -~ -blno 0 0 S -35 0 0 1d1+30000 5d5+5 -1 2000 -8 8 1 -#5466 -blacksmith~ -the blacksmith~ -The blacksmith stands here pumping air into his fire. -~ -You see a large human, dripping in sweat, standing before you. He takes -a break from his swealtering work to bid you welcome. -~ -blno 0 0 S -35 0 0 1d1+30000 4d4+4 -1 2000 -8 8 1 -#5467 -horse~ -the horse~ -A horse stands here. -~ -You see one of the fine Arabian beasts known about the land. -~ -bgh 0 0 S -4 20 50 10d1+1 2d4+2 -0 10 -8 8 1 -#5468 -tourist~ -the tourist~ -A tourist stands here looking lost. -~ -You see a small, rotund man, with a strange object around his neck and -a nose guard. He is looking at a small map that he seems to be holding -upside down. -~ -cgh 0 0 S -5 18 80 2d10+15 1d8+2 -500 650 -8 8 1 -#5469 -ixitxachitl ray~ -the ixitxachitl~ -A very large ray with a wicked looking tail swims here. -~ -You see a large ray with sharp fangs and a barbed tail. -~ -bflpqr dgk -500 S -10 0 -5 3d3+120 3d4+1 -0 2000 -8 8 0 -#5470 -cryohydra~ -the cryohydra~ -The cryohydra stands here. -~ -A grey-brown reptillian creature with amber eyes stands before you. -~ -fglpq k 0 S -8 9 5 10d1+1 1d10+0 -0 100 -8 8 1 -#5471 -minotaur lizard~ -the minotaur lizard~ -the minotaur lizard stands here. -~ -A huge lizard like reptile with horns like a minotaur. -~ -fg k 0 S -8 8 5 1d10+55 3d5+0 -0 100 -8 8 1 -#5472 -dog death~ -the death dog~ -The death dog stands here. -~ -A large two-headed hound barks at you vicously. -~ -fgl k 0 S -4 19 7 1d15+76 1d10+1 -0 900 -8 8 0 -#5473 -lion spotted~ -the spotted lion~ -The spotted lion stands here. -~ -A large fierce dapple skinned lion glares at you. -~ -fg k 0 S -5 17 6 5d5+45 1d8+1 -0 1500 -8 8 1 -#5474 -behir~ -the behir~ -A behir slithers on the ground. -~ -You see a large snake-like reptile with more than a dozen legs. -~ -fglpq kp -300 S -12 9 4 4d3+146 2d8+4 -0 1000 -8 8 0 -#5475 -chimera creature lion goat dragon~ -the chimera~ -A creature with three heads: lion, goat, and dragon stands here. -~ -The chimera is still a mystery, better left unexplored. This creature -has the hindquarters of a goat, the forepaws of a lion and the body of -a red dragon. -~ -bflq dgkp -500 S -9 5 0 5d5+261 3d4+4 -0 3500 -8 8 0 -#5476 -couatl~ -the couatl~ -A couatl hovers here. -~ -A beautiful creature with the body of a serpent and feathered wings the -colour of the rainbow. -~ -belnoq dghkp 300 S -15 10 1 10d5+130 2d4+2 -0 2400 -8 8 0 -#5477 -giant hornet~ -the giant hornet~ -The giant hornet hovers here. -~ -It is a hornet, what else can be said? -~ -eqr dgk 300 S -5 15 4 1d1+5 1d4+0 -0 45 -8 8 0 -#5478 -pegasus~ -the pegasus~ -The pegasus stands here, flexing its wings. -~ -A magnificant winged steed, this horse looks much like the Arabian -thoroughbreds you have seen in stables. -~ -bglmpq dgk 1000 S -10 4 0 1d5+700 2d10+5 -0 6500 -8 8 0 -#5479 -elriva~ -Elriva~ -Elriva stands here mixing a love potion. -~ -You see a very healthy female dressed in black, with long flowing -hair to match her outfit. -~ -blno 0 0 S -35 10 0 1d1+30000 1d10+10 -1 2000 -8 8 2 -#5480 -braheem~ -Braheem~ -Braheem stands here talking to the walls. -~ -You see a powerful but slighty insane mage. -~ -blno 0 0 S -35 -10 -10 1d1+30000 10d10+40 -1 2000 -8 8 1 -#5481 -high priest~ -the high priest~ -The high priest rests here meditating, well he WAS meditating. -~ -He does NOT look real happy that you have disturbed him. -~ -bgh dhk 1000 S -8 2 0 10d5+1200 2d8+5 -15000 35000 -8 8 1 -#5482 -royal guard elite~ -the Royal Guard~ -An Elite Royal Guard stands here smiling happily. -~ -You see one of the Royal Guards of New Thalos who seems to have undergone -some heavy training. -~ -abelmno dhk 1000 S -15 0 -6 5d20+900 1d10+6 -1500 25000 -8 8 1 -#5483 -patch bartender~ -Patch the bartender~ -A large half-orc with a patch over one eye pours beer behind the counter. -~ -You see a really big guy here who seems to have lost an eye in one manner -or another. -~ -blno d -500 S -35 0 -10 1d1+30000 3d8+10 -1 2000 -8 8 1 -#5484 -stitch~ -Stitch, the leather dude~ -Stitch, the leather dude reclines in his chair. -~ -You see a small hobbit with his feet kicked up on his desk waiting for -some sucker, uhm, customer to walk in his store. -~ -blno d -500 S -35 -10 -5 1d1+30000 3d6+6 -1 2000 -8 8 1 -#5485 -gardener elf~ -the gardener~ -A small elf stands here tending the garden. -~ -A young elf stands here in dirt covered overalls. He seems to be -weeding his garden. -~ -b 0 0 S -10 10 6 5d5+100 2d8+2 -56 1500 -8 8 1 -#5486 -nightmare demon horse~ -the nightmare~ -A large horse, black as night, stands here. -~ -You see the largest horse you have ever seen before. Standing 10' -at the shoulder it breathes flame from his nostrils and leaps to -attack you. -~ -blno dfghkps 1000 S -10 0 -5 3d9+300 3d5+7 -0 5500 -8 8 0 -#5487 -wolverine wolf~ -the wolverine~ -A large wolf like creature leaps out from the darkness. -~ -You see a half wolf, half human beast wearing a glove with long thin -blades on it. -~ -bf kps -351 S -15 0 0 10d2+230 2d10+10 -0 5000 -8 8 0 -#5488 -mimic painting~ -the mimic~ -You see an incredibly life-like painting of the Sultan's mother. -~ -Boy is she ugly. -~ -b 0 0 S -10 10 0 5d8+321 2d8+4 -0 6000 -8 8 1 -#5489 -mayor rabbit~ -the mayor~ -The Mayor of New Thalos stands here. -~ -You see a chubby rabbit dressed in his best suit. -~ -g 0 1000 S -10 0 0 2d8+600 3d6+6 -1200 15675 -8 8 1 -#5490 -chef~ -the chef~ -The chef stands here making dinner. -~ -You see a very large human who seems to taste everything he makes. -~ -b 0 400 S -14 6 6 10d2+5 2d10+5 -16 40 -8 8 1 -$ diff --git a/lc-mud/circle/world/mob/60.mob b/lc-mud/circle/world/mob/60.mob deleted file mode 100644 index aea7e341cae537cf98559d1996d977b7996bb09b..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/60.mob +++ /dev/null @@ -1,238 +0,0 @@ -#6000 -john lumberjack~ -John the Lumberjack~ -John the Lumberjack is here, looking for some trees to chop down. -~ -He is six feet tall and looks quite strong, muscles bulging under his heavy, -chequered shirt. His features are worn with hard work and his expression is -one of a peaceful man leading a simple life. -~ -cglm f 370 S -5 15 6 1d12+60 1d4+3 -100 1050 -8 8 1 -#6001 -rabbit small~ -the rabbit~ -A small rabbit is foraging in the bushes here. -~ -It is a small, furry creature with long ears and big feet. -~ -g 0 0 S -0 20 6 1d4+1 1d4+0 -0 60 -8 8 0 -#6002 -bear brown~ -the brown bear~ -A big, brown, angry-looking bear is here. -~ -The bear is a big, brown, furry animal with very large claws and very sharp -teeth. It doesn't resemble those cute little dolls from toy shops at all. -~ -fg 0 -50 S -8 13 3 1d12+98 2d6+2 -0 4000 -4 8 0 -#6003 -rabbit ferocious~ -the ferocious rabbit~ -A ferocious rabbit is here, glaring hungrily at you. -~ -This small, furry creature with long ears and big feet has been attacked -by the dreaded rabbit rabies, a horrible disease that turns helpless and -innocent rabbits into ferocious and bloodthirsty monsters. -~ -fg 0 -150 S -3 17 6 1d4+26 1d8+0 -0 350 -4 8 0 -#6004 -deer fallow~ -the fallow deer~ -A fallow deer is grazing peacefully here. -~ -She is a graceful creature on long, slender legs, and with large, brown eyes -looking back at you with an air of watchful interest. -~ -gh d 350 S -2 19 5 2d8+8 1d6+0 -0 230 -8 8 2 -#6005 -fox brown~ -the brown fox~ -A brown fox is stalking rabbits through the underbrush here. -~ -It is a large fox with beautiful, red-brown fur and a long, thick bushy tail. -~ -g 0 -50 S -2 18 6 1d4+18 1d6+0 -0 225 -8 8 0 -#6006 -bird large~ -the bird~ -A large bird with a broken wing has been cornered here. -~ -The bird isn't going to live much longer, by the looks of it. -~ -b 0 0 S -0 17 10 2d3+1 1d2+1 -0 25 -8 8 0 -#6007 -bobcat cat~ -the bobcat~ -A medium sized bobcat is stalking a bird here. -~ -The bobcat has sharp claws and teeth, and will probably eat you instead of -the bird if you give it the chance. -~ -bf dk -150 S -5 15 5 1d12+60 2d4+3 -0 1100 -8 8 0 -#6008 -sparrow~ -the sparrow~ -A sparrow is flapping around by the ground. -~ -The sparrow looks like it is enjoying life. -~ -g 0 200 S -0 20 9 3d3+1 1d4+0 -0 25 -8 8 0 -#6009 -robin~ -the robin~ -A robin is hopping around looking for bugs to eat. -~ -The robin looks quite intent on finding a bug or worm to eat. -~ -g 0 200 S -0 20 9 3d3+1 1d4+0 -0 25 -8 8 0 -#6010 -squirrel~ -the squirrel~ -A squirrel is here seeking refuge in its nest. -~ -It peers out of its nest at you anxiously, seeming to plead silently with -you to leave it alone. -~ -b st 200 S -1 20 8 1d7+9 1d5+0 -0 120 -8 8 0 -#6011 -badger~ -the sleepy badger~ -A furry brown badger is curled up under a log here. -~ -The badger is slowly awakening and peering up at you from its burrow. You -know that it won't be moving this slow for long. Its sharp claws and teeth -catch your attention when you consider killing it. -~ -b t 50 S -4 17 5 1d5+48 2d3+2 -0 650 -8 8 0 -#6012 -grey squirrel~ -the grey squirrel~ -A grey squirrel with a bushy tail is foraging for nuts here. -~ -This happy creature seems to pay you no heed as it goes about its search for -nuts among the leaves and twigs on the ground here. -~ -g s 150 S -2 19 8 1d12+22 1d6+0 -0 200 -8 8 0 -#6013 -chipmunk~ -the small chipmunk~ -A small brown-red chipmunk dashes from tree to tree here. -~ -The absolute zenith of hyperactivity, this small rodent seems to never tire -of running up, down, and around the trees in this area. If you could ever -catch it, you imagine it would make an easy meal. -~ -g s 170 S -0 20 5 2d5+3 1d4+0 -0 40 -8 8 0 -#6014 -crow black bird~ -the large black crow~ -A large black bird flits about here, picking at bits of carrion. -~ -The bird eyes you warily, but continues with its meal. -~ -bch 0 -20 S -2 19 8 1d12+22 1d5+1 -3 200 -8 8 0 -#6015 -grotesque vulture~ -the grotesque vulture~ -A grotesque vulture covered in blood and gore is here feeding madly. -~ -It sickens you to even look at this foul bird. Bits of dried gore stick to -its beak, and unidentifiable organs hang from its talons and feathers. -It sees you and attacks, protecting its horrible feast! -~ -bcf dhk -700 S -6 15 4 1d12+68 2d3+2 -14 1750 -8 8 0 -#6016 -buck deer~ -the young buck~ -A young 5-point buck is drinking from the lake here. -~ -This young male deer is drinking from the edge of the lake and watching you -warily. His antlers are not full size yet, and will no doubt be quite -impressive in a few years. -~ -bg d 350 S -4 17 4 1d12+48 1d5+3 -0 750 -8 8 1 -#6017 -fish~ -the fish~ -A fish is swimming about here. -~ -The fish looks about the right size for a meal. -~ -b g 100 S -0 20 10 2d5+0 1d3+0 -0 30 -8 8 0 -#6018 -duckling~ -the duckling~ -A duckling is swimming around in the pond. -~ -The duckling is adorable, it looks most of all like a tiny furball. -~ -b 0 1000 S -0 20 10 1d1+0 1d1+0 -0 1 -8 8 0 -#6019 -duck~ -the duck~ -A duck is here, quacking happily. -~ -The duck is quite fat. It looks like it is enjoying life. -~ -g 0 1000 S -1 20 10 2d6+5 1d4+0 -0 75 -8 8 0 -$ diff --git a/lc-mud/circle/world/mob/61.mob b/lc-mud/circle/world/mob/61.mob deleted file mode 100644 index 71aee82a8546cea959fea176f39183ef2a2de3b3..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/61.mob +++ /dev/null @@ -1,156 +0,0 @@ -#6100 -warg vicious~ -the vicious warg~ -A vicious warg is here, snarling angrily at you. -~ -It is an exceptionally large wolf with thick, black fur. Saliva is dripping -quickly from its long, white fangs. It looks quite dangerous and very angry. -~ -fg k -350 S -5 16 5 1d12+60 2d4+0 -0 1000 -8 8 0 -#6101 -warg ferocious~ -the ferocious warg~ -A ferocious warg is here, snarling angrily at you. -~ -It is an exceptionally large wolf with thick, black fur. Saliva is dripping -quickly from its long, white fangs. It looks quite dangerous and very angry. -~ -fg k -350 S -5 16 5 1d12+80 2d4+4 -0 1000 -8 8 0 -#6102 -wolf grey~ -the large, grey wolf~ -A large, grey wolf is here, glaring hungrily at you. -~ -The large, grey wolf eyes you with interest while licking its lips. -~ -fg k -150 S -3 18 7 1d12+35 1d7+0 -0 450 -8 8 0 -#6103 -wolf black~ -the large, black wolf~ -A large, black wolf is here, glaring hungrily at you. -~ -The large, black wolf eyes you with interest while licking its lips. -~ -fg k -150 S -3 18 7 1d12+45 1d7+3 -0 450 -8 8 0 -#6110 -tree ancient~ -the ancient tree~ -A huge, ancient tree towers above you. -~ -Its roots are extremely big and large parts of them are above ground. -Something about it makes you think that this is not a normal oak tree. - -The enormous grey trunk shivers slightly, as if sighing deeply. -~ -glnopqr dfkstp 0 S -30 0 -10 1d1+1299 4d4+22 -0 500000 -8 8 0 -#6111 -tree ancient~ -the ancient tree~ -A huge, ancient tree towers above you. -~ -Its roots are extremely big and large parts of them are above ground. -Something about it makes you think that this is not a normal oak tree. - -The enormous grey trunk emits a deep, moaning sound. -~ -glnopqr dfkstp 0 S -30 0 -10 1d1+999 4d4+18 -0 400000 -8 8 0 -#6112 -dragon green~ -the green dragon~ -A huge green dragon is here, its narrow yellow eyes glowing with rage. -~ -This enormous winged serpent has dark green scales covering most of its -colossal body. Numerous holes in its heavy wings tell of many fights as -does the nicks in the horns on its head. It smells as disgusting as only -dragons do. -~ -afgnoq dk -1000 S -20 1 0 1d12+248 2d6+9 -0 40000 -8 8 0 -#6113 -spider poisonous~ -the huge, poisonous spider~ -A huge, poisonous spider is here. -~ -This disgusting creature is at the size of a human crawling on all four. It -has eight hairy legs that gives it a tremendous speed on almost any surface -and sharp poisonous fangs to paralyze or kill its prey. -~ -abfg dk -350 S -8 13 2 1d12+98 2d5+1 -0 4000 -8 8 0 -#6114 -queen spider~ -the Queen spider~ -The huge, bulky Queen spider is here. -~ -This disgusting creature is at the size of a small elephant. It has eight -huge, hairy legs that would give it a tremendous speed on almost any surface -if it wasn't so immensely fat. Its large, bulbous eyes stare back at you. -~ -abgjl dfkp -1000 S -15 6 1 1d12+185 2d8+3 -0 31000 -8 8 2 -#6115 -shargugh brownie~ -Shargugh~ -Shargugh the Forest Brownie is here, grinning broadly at you. -~ -This little fellow is only three foot tall with wild matted brown hair and -long tangled brown beard. He wears ragged brown and green clothing and looks -as if he is having great fun. -~ -acghl bdfgkstp 1000 S -10 1 -10 1d12+47 1d8+0 -1000 11000 -8 8 1 -#6116 -elder druid~ -the Elder druid~ -The Elder druid is here. He looks very upset about your presence in his home. -~ -The druid looks quite old. You would think of him as venerable but yet you -know he would be a tough foe. -~ -abij dfk 0 S -19 2 0 1d12+236 3d6+4 -5000 45000 -8 8 1 -#6117 -isha elf~ -Isha the Dark Elf~ -Isha the Dark Elf is here, observing you silently. -~ -She is no less than beautiful, skin as dark as the night and hair -shining like silver in the moonlight. Her slender body is adorned -with a sleeveless shirt and a short skirt made from black scales -joined with silver threads. Her back is covered by a large, hooded -cloak as black as her skin and in her broad silver belt hangs a long, -slender sword in a silver scabbard. -~ -abml dks -1000 S -20 1 0 1d12+245 3d6+4 -5000 40000 -8 8 2 -$ diff --git a/lc-mud/circle/world/mob/62.mob b/lc-mud/circle/world/mob/62.mob deleted file mode 100644 index 6aa56a4bdc1a839f87bfddd0dedee0cbd109e28e..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/62.mob +++ /dev/null @@ -1,170 +0,0 @@ -#6200 -deer~ -the deer~ -A deer looks at you with fear in its eyes. -~ -That is one nice looking deer! -~ -h 0 0 S -3 18 10 3d5+33 1d7+0 -0 350 -8 8 0 -#6201 -rabbit~ -the rabbit~ -A small rabbit nibbles at a leaf here. -~ -It is a small, furry rodent with big ears. -~ -h 0 0 S -0 20 30 1d5+3 1d3+0 -0 25 -8 8 0 -#6202 -squirrel~ -the squirrel~ -A squirrel spots you and runs around a tree! -~ -It is a small, brown squirrel. Kind of like a -fuzzy high-tension spring. -~ -h 0 0 S -0 20 -10 1d3+0 1d1+1 -0 10 -8 8 0 -#6203 -orc hunter~ -the orc hunter~ -An orc hunter looks at you with hateful eyes. -~ -He looks angry, desperate, and maybe a little sick. -His green skin is definitely mottled, and he seems to -limp a little bit... -~ -fm k -350 S -7 14 50 3d5+83 2d3+2 -0 2250 -8 8 1 -#6204 -orc chief~ -the orc chief~ -An orc chief growls at you! -~ -He wears a crown of oak leaves to show he is a leader. He -carries a club to show he is a warrior. You wonder how good -he is at both. -~ -bflm k -600 S -10 11 20 3d5+120 2d7+2 -17 9000 -8 8 1 -#6205 -orc woman~ -the orc woman~ -An orc woman stands here, frightened of you. -~ -As you stare her down, she raises her hands slowly, as if to -say, 'Don't kill me'. -~ -h k -50 S -5 16 70 3d5+58 2d4+0 -0 900 -8 8 2 -#6206 -orc child~ -the orc child~ -An orc child frantically searches for her mother. -~ -She is raggedy, and seems to be covered with sores. -~ -h k 50 S -3 18 90 3d5+30 1d7+0 -0 350 -8 8 2 -#6207 -orc woman~ -the orc woman~ -A pregnant orc woman tries to stand to flee from you. -~ -She is too far gone to move very quickly. You could -kill her easily. -~ -bh k -50 S -5 16 100 3d5+58 1d4+0 -0 750 -6 6 2 -#6208 -orc mutant mutated~ -the mutant orc~ -A mutant orc lies here, barely alive. -~ -Its body has been twisted beyond all hope. It is dying, and -nothing will stop that. -~ -0 k 0 S -6 20 100 1d1+0 1d1+0 -0 1 -5 5 0 -#6209 -orc mutant mutated~ -the mutant orc~ -A horribly mutated orc stands here, gibbering. -~ -It doesn't even appear to have registered your arrival... it is -just talking to itself. Its body is a twisted wreck of orc, man, -beast, and what-not. -~ -0 k 0 S -6 20 100 3d5+60 1d1+0 -0 10 -8 8 0 -#6210 -wizard elf elven Elstar~ -Elstar~ -An elven wizard is here. He looks angry. -~ -He looks at you archly as he wonders why you have -invaded his domain. No matter... it shouldn't be -too hard for him to destroy you, no? -~ -bfl dk -1000 S -15 6 -75 3d5+183 2d8+2 -10000 21000 -8 8 1 -#6211 -child elf elven apprentice~ -the elven child~ -An elven child casts his fishing pole into the river. -~ -He looks young and innocent. You wonder what he is doing here. -~ -b k 600 S -3 18 60 3d5+35 2d4+0 -0 400 -8 8 1 -#6212 -mutant thing~ -the mutant thing~ -A mutant... thing rushes at you! -~ -It might've been an orc, once. Now it is a living terror, -pushing everything out of its way to get at you. -~ -fl k -800 S -12 9 -20 3d5+170 2d7+4 -0 15000 -8 8 0 -#6213 -mutant thing~ -the mutant thing~ -A mutant... thing tries to get you, but cannot move into range! -~ -It might have been an orc, once. Now it is a living terror, -pushing everything out of its way to get at you. -~ -bl k -800 S -12 9 -20 3d5+170 2d7+4 -0 15000 -8 8 0 -$ - diff --git a/lc-mud/circle/world/mob/63.mob b/lc-mud/circle/world/mob/63.mob deleted file mode 100644 index 9d5f4d6972af8a66c53f4850822a3c74cd6f9dcf..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/63.mob +++ /dev/null @@ -1,204 +0,0 @@ -#6301 -spider young~ -the young spider~ -The young spider is ballooning by you. -~ -He looks freshly hatched and sprightly. His young fangs are just -growing in as of late. -~ -cg dk 0 S -3 18 7 1d12+40 1d7+0 -80 350 -8 8 1 -#6302 -yevaud dragon usurper~ -Yevaud~ -Yevaud, the Usurper of Midgaard is here, grinning evilly at you. -~ -Old, scaly, but still with a lot of bite in him left. -~ -abcjkl dk -1000 S -24 0 -3 5d4+450 4d7+7 -20000 120000 -8 8 1 -#6303 -spider wolf~ -the wolf spider~ -The wolf spider is here, licking its bloody fangs. -~ -The wolf spider is hairy, very hairy. -~ -bf 0 -300 S -6 12 6 3d8+70 2d5+3 -1250 6000 -8 8 2 -#6304 -orc~ -the orc~ -The orc is stuck in the web and he can't get out. -~ -You notice an evil look in his eyes, but he seems quite drained of life, -and all he can do is glare at you while he's stuck in this web. -~ -b 0 -400 S -2 19 8 2d10+10 2d3+0 -10 300 -6 6 1 -#6305 -wasp queen~ -the queen wasp~ -The queen wasp is here, thinking how tasty you look. -~ -You notice a glazed look in her eyes. -~ -bf 0 -800 S -14 7 1 1d12+172 2d8+1 -2000 18000 -8 8 2 -#6306 -spider drone~ -the drone spider~ -A drone spider walks around doing its master's bidding. -~ -An ordinary drone spider. -~ -cg 0 -200 S -6 14 4 3d8+70 2d4+1 -200 1600 -8 8 0 -#6307 -spider ethereal~ -the ethereal spider~ -An ethereal spider strides here, traveling to different worlds. -~ -She winks in and out of reality. It looks like it'd be difficult to hit her -without a magical weapon. -~ -cg bcfgs 300 S -13 9 -2 1d12+163 2d4+4 -1250 16000 -8 8 2 -#6308 -slave human~ -the slave~ -A human slave of Arachnos works here relentlessly. -~ -The slave does not mind you, but will fight like a warrior if attacked. -He serves the spider Empress, Arachnos, though whether it is by choice -or because he was beguiled, you are not fully certain. -~ -cgl 0 -50 S -11 8 4 1d12+130 2d7+1 -1000 13500 -8 8 1 -#6309 -quasit~ -the quasit~ -A quasit blinks in and out, grinning at you. -~ -Demoniac in nature, but more mischievous. He twiddles his thumbs -and creates a magical treasure! -~ -acgh bdfs -300 S -10 1 -10 1d12+47 1d8+0 -1500 11000 -8 8 1 -#6310 -spider bird~ -the bird spider~ -The bird spider snaps its powerful jaws. -~ -The Bird Spider has very powerful jaws. -~ -bf dk -800 S -14 7 1 1d8+100 2d9+2 -1750 18000 -8 8 2 -#6311 -hermit~ -the hermit~ -The hermit sits here and warns, 'Go back before it is too late!' -~ -A dishevelled veteran warrior in disguise is what he is, but he -means well. -~ -bcl dk 750 S -7 13 4 3d10+90 2d5+2 -750 2500 -8 8 1 -#6312 -donjonkeeper keeper~ -the Donjonkeeper~ -The Donjonkeeper eyes you and wonders how pure your soul is. -~ -He delves deeper into you as you stare at him. Only those free of taint -will be allowed to remain here safely. -~ -abcil dk 1000 S -25 0 -1 1d12+600 2d8+8 -16000 125000 -8 8 1 -#6313 -guardian~ -the guardian~ -The guardian is obviously not doing his job. -~ -He looks like a lazy bum who sleeps half the time. -~ -fg dks 250 S -17 4 1 1d12+200 2d8+8 -1000 24000 -4 4 1 -#6314 -arachnos spider empress~ -Arachnos~ -Arachnos the Empress of Spiders welcomes you with an evil smile. -~ -She is a very attractive spider with an ornate gown. She tempts you -into being one of her many slaves. She does not possess the venomous -fangs of normal spiders, but then, as you realize, she does not need -them. -~ -abcjnolq dfhkp -1000 S -26 0 -2 6d10+650 1d8+25 -30000 155000 -8 8 2 -#6315 -ki-rin~ -the Ki-Rin~ -The Ki-Rin smiles good-naturedly to you. -~ -She is the last bastion of good in this realm. Her mission is to -someday free the slaves of the Empress. She has been trapped here for -time eternal, and now the evil power of Arachnos feeds upon her intense -magical energies. She will never give up here fight against evil, -though, and will continue her work in whatever manner presents itself. -~ -abcilno dk 1000 S -26 0 -4 10d8+2500 4d4+22 -15000 170000 -8 8 2 -#6316 -dragon wormkin young~ -the young wormkin~ -A wormkin with no teeth plays here. -~ -It is a rather small dragon, and you almost feel sad about killing it. -~ -b dk 50 S -9 12 3 5d4+110 2d5+2 -1000 6500 -8 8 1 -#6317 -dragon wormkin elder~ -the elder wormkin~ -A wormkin that has grown a bit stares at you inquisitively. -~ -A medium-sized dragon -- seems it hasn't killed anything yet by itself, -though there is a first time for everything... -~ -b dk -300 S -16 5 1 5d4+210 2d6+4 -5000 24000 -8 8 1 -$ diff --git a/lc-mud/circle/world/mob/64.mob b/lc-mud/circle/world/mob/64.mob deleted file mode 100644 index 5f6a1119bb394ca106eefd3e33735e93074518d8..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/64.mob +++ /dev/null @@ -1,81 +0,0 @@ -#6400 -goat mountain~ -the mountain goat~ -A mountain goat nibbles at a piece of grass here. -~ -This goat is acclimated to the rugged terrain of the -mountains. It looks at you and shies away a little. -~ -gh k 0 E -8 13 3 3d5+95 2d5+1 -0 4000 -8 8 1 -BareHandAttack: 4 -E -#6401 -demon decay~ -the Demon of Decay~ -A cloaked and clawed demon of decay comes at you viciously! -~ -This demon has pure malevolence for anything living. -Oops! You're living! I guess that means you! -~ -beflmnopr dk -1000 E -12 9 2 3d5+145 2d7+1 -0 10000 -8 8 0 -BareHandAttack: 8 -E -#6402 -book monster guardian~ -the Book Monster~ -A mound of books rise up into a human shape and tries to hit you! -~ -Ironically enough, the book-monster's head is War and -Peace. Hmm. -~ -beflmnopqr dk 0 S -14 7 1 1d1+199 2d8+2 -0 18000 -8 8 0 -#6403 -bad feeling~ -a Bad Feeling~ -A bad feeling chokes your throat. -~ -It resembles a lot of other bad feelings you've had, -but a lot more tangible... magic? -~ -beflmnopqr dk 0 S -18 3 0 1d1+249 3d8+0 -0 40000 -8 8 0 -#6404 -nightmare~ -Your Worst Nightmare~ -Your worst nightmare coalesces in front of you and attacks! -~ -It looks like you deepest, darkest fears personified. -Wait a minute! It IS your deepest, darkest fears -personified! -~ -beflmnopqr dk 0 S -19 2 0 1d1+299 3d8+2 -0 45000 -8 8 0 -#6405 -guardian~ -the Guardian~ -A guardian guards the door. It looks at you and attacks! -~ -The guardian guards the door. That's about all its -brain can handle: guarding. -~ -beflmnopr dk 0 E -18 3 0 1d1+249 3d6+2 -0 35000 -8 8 0 -BareHandAttack: 9 -E -$ - diff --git a/lc-mud/circle/world/mob/65.mob b/lc-mud/circle/world/mob/65.mob deleted file mode 100644 index f7052b9b5b5ac6c2b1300cf00548b7e6e9526696..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/65.mob +++ /dev/null @@ -1,166 +0,0 @@ -#6500 -guard dwarf dwarven~ -the dwarf guard~ -A dwarven guard is here. -~ -The guard looks very tough and mean. He wears his beard long, and he -smells like he hasn't bathed in over a month. -~ -ablm dhk 1000 S -21 0 -1 4d20+336 2d8+9 -10000 60000 -8 8 1 -#6501 -worker dwarf dwarven~ -the dwarf worker~ -A dwarven mining worker is here. -~ -He is very dirty, and looks extremely over-worked. -~ -glm 0 900 S -13 7 2 25d5+170 2d4+6 -3500 16000 -8 8 1 -#6502 -wraith~ -the wraith~ -A wraith is awaiting your first move here. -~ -A black, almost transparent wraith. -~ -abfnopr dfk -900 S -25 4 -6 9d7+500 4d5+25 -45708 125000 -8 8 1 -#6503 -storekeeper~ -the Hide & Tooth storekeeper~ -The Hide & Tooth storekeeper is standing here, waiting patiently. -~ -The storekeeper is very rotund, but looks in excellent condition. -~ -ablm d 1000 S -33 0 -10 1d1+30000 2d8+32 -33500 800000 -8 8 1 -#6504 -baker granite head~ -Granite Head the baker~ -Granite Head, the baker, is waiting for a customer here. -~ -Granite Head is covered with flour and grains. -~ -ablm d 900 S -33 0 -10 1d1+30000 2d8+22 -55000 800000 -8 8 1 -#6505 -lizard giant~ -the giant lizard~ -A giant lizard is foraging for food along the cavern floor here. -~ -This scaly creature looks like it is well adapted to its underground -habitat. He looks very powerful. -~ -g dk 100 S -21 0 1 4d20+340 3d7+4 -200 55000 -8 8 1 -#6506 -giant~ -the giant~ -A giant is wandering around the mountainside here. -~ -The giant is about 18 feet tall, with arms of steel, and looks in -excellent physical condition. -~ -gl k 600 S -19 2 0 4d20+300 3d3+8 -2000 45000 -8 8 1 -#6507 -mineworker dwarven dwarf miner worker~ -the dwarven mineworker~ -A dwarven mineworker is here. -~ -The mineworker is very tired, and very dirty, and he has bulging muscles. -~ -bl k 500 S -4 16 7 3d13+40 1d3+2 -600 700 -8 8 1 -#6508 -mineleader dwarven dwarf mine leader~ -the mine leader~ -A dwarven mine leader is here, supervising the work. -~ -The mine leader is very big and very strong, though he must be fairly -bright also, to have gotten this job. -~ -bl k 700 S -19 1 0 50d2+270 3d4+6 -18000 35000 -8 8 1 -#6509 -doctor dwarven healer~ -the dwarven doctor~ -The dwarven doctor is here, aiding the sick of his people. -~ -He is a very skilled healer, and extremely faithful to his god. -~ -abl dhk 999 S -22 0 -1 9d4+375 3d8+4 -20000 60000 -8 8 1 -#6510 -peon dwarven~ -the dwarven peon~ -A dwarven peon is awaiting help here. -~ -~ -bm k 500 S -3 18 7 10d3+35 2d3+2 -75 350 -8 8 1 -#6511 -dwarf~ -the Dwarf~ -A dwarf is here. -~ -~ -b k 500 S -6 15 4 1d15+70 3d3+1 -625 1500 -8 8 1 -#6514 -guard barrack~ -the barrack guard~ -A barrack guard is here, lounging around while off duty. -~ -~ -bm k 100 S -14 6 1 5d10+170 2d5+4 -1300 20000 -8 8 1 -#6516 -mazekeeper keeper~ -the mazekeeper~ -A mazekeeper is here. -~ -He looks VERY tough. -~ -abfl dhk -1000 S -29 0 -7 250d4+2000 4d3+5 -2000 1700000 -8 8 1 -#6517 -snake giant~ -the giant snake~ -There is a giant snake here. -~ -~ -bf k -1000 S -33 0 -10 300d6+600 4d4+22 -3000 800000 -8 8 1 -$ diff --git a/lc-mud/circle/world/mob/70.mob b/lc-mud/circle/world/mob/70.mob deleted file mode 100644 index af0b8b03aaeb9b022f31f8a3cfdb1dab6eba8f0a..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/70.mob +++ /dev/null @@ -1,234 +0,0 @@ -#7000 -mudmonster mud monster~ -the horrifying Mudmonster~ -A horrifying Mudmonster is slowly evolving from the mud... -~ -It sure looks like something out of a horror movie. It strongly resembles -a huge figure made up from mud alone, and it sure looks like it had human -flesh for breakfast and is strongly intent on having the same for dinner -- Perhaps you? -~ -gqr sk -250 S -12 9 2 4d6+140 2d5+3 -100 13000 -6 8 0 -#7001 -bat small fierce~ -the small bat~ -The small fierce-looking bat is hanging from the ceiling, obviously sleeping. -~ -You have never in your entire life seen such a mean looking small creature, -though it looks rather peaceful, hanging there, sleeping. The thought of -arousing this cruel creature doesn't sit well in your bones. -~ -fgr sk -500 S -1 20 5 5d2+6 1d5+0 -0 150 -4 8 0 -#7002 -rat sewer~ -the sewer rat~ -The huge hungry-looking sewer rat sits here. -~ -This creature is fairly large for a rat, but not so big that it could -be called a giant rat. Sewer water drips off of its grey fur as it -looks at you with black glistening eyes. -~ -f k -1000 S -5 16 5 1d12+48 2d4+0 -30 1000 -8 8 0 -#7003 -spider small hairy~ -the small Spider~ -The small hairy Spider is here, busy with its web. -~ -This small spider seems to pay you no attention at all as it builds -its intricately designed web. -~ -f sk -700 S -1 20 3 1d12+8 1d4+0 -1 100 -8 8 0 -#7004 -beetle giant earth~ -the giant earth beetle~ -The giant, mean-looking earth beetle is here. -~ -Now, you've seen beetles, but this one is enormous. It stretches -perhaps two feet from head to tail. As it notices you, it waves -its six legs about and makes some strange skittering noises at you. -~ -0 k -300 S -8 13 3 2d10+98 2d4+2 -1000 3750 -4 8 0 -#7005 -maggot giant~ -the maggot~ -The giant maggot is here, simply existing. -~ -This large mound of grotesque flesh is just lying here quivering, -almost as if it can sense your warm blood nearby. -~ -qr k 300 S -3 17 9 2d5+35 1d7+0 -2 350 -8 8 0 -#7006 -snake~ -the snake~ -The snake slithers towards you. It looks very mean. -~ -This snake is of a variety that you do not recall seeing recently. -It has near black skin with small white diamond shaped spots all -over its head and upper body. A thin green stripe stretches along -each side of its body. -~ -af k -500 S -4 16 7 2d5+40 1d9+0 -1 1000 -8 8 0 -#7007 -wanderer evil~ -the evil wanderer~ -The evil wanderer stares at you with a piercing gaze. -~ -The evil wanderer is very thin. He is dressed in a grey cloak. He -doesn't look like he'd be your first choice as a travelling companion. -~ -ch f -1000 S -10 11 2 4d10+100 2d6+1 -300 9500 -8 8 1 -#7008 -homunculus creature~ -the creature homunculus~ -The creature homunculus is here, looking at you with an evil look. -~ -The homunculus appears in a man-like form, about eighteen inches tall, -has a greenish, reptilian skin, leathery wings, and a batlike mouth, -with teeth dripping with a greenish sludge. -~ -nop df -780 S -11 10 1 6d3+130 2d6+2 -500 11500 -8 8 0 -#7009 -morkoth shadowy~ -the shadowy morkoth~ -The morkoth are standing here, waiting for someone to KILL! -~ -It is a five foot tall, shadow monster. This has the shape between -a human and a rat. It breaths very heavily while staring at you. -~ -afh f -900 S -10 12 3 1d20+120 2d6+0 -1 9000 -8 8 0 -#7010 -chr-eff'n chreffn~ -the evil chr-eff'n~ -The chr-eff'n are crawling here, looking around with its yellow eyes. -~ -The head and torso of a chr-eff'n is copper-covered, with yellow, -glowing eyes. The lower body is in an orange shading. -~ -ch dks -830 S -12 9 2 2d26+148 2d7+1 -1500 13000 -8 8 0 -#7040 -dragon red~ -the red dragon~ -The fierce-looking red dragon stares at you angrily. -~ -The red dragon stares at you, angrily, as it wakes when you arrive. -It says 'Oh, human YOU woke me up... Hsssss', while it moves closer, -'Can one NEVER sleep in peace... Hssss... ' -~ -befnoq dhkp -1000 S -19 2 0 5d4+230 3d6+3 -16842 40000 -8 8 0 -#7041 -hag sea~ -the sea hag~ -A sea hag is here, swimming around. -~ -The sea hag is so ghastly looking that you feel the deepest fear: Big -yellow eyes and sharp teeth. Its ears are very big, and it has small -sharp horns. This beast is obviously a hater of beauty. -~ -f k -800 S -14 7 1 1d8+172 2d8+1 -0 18000 -8 8 2 -#7042 -naga guardian~ -the guardian naga~ -The guardian naga looks kindly at you. -~ -The naga are a snake-liked creature. She is covered in green-gold scales -with silvery triangles along her back. Her eyes are golden. She notices -that you are staring at her, and she says 'Watch out. This way leads to -some evil creatures.' -~ -b k 700 S -12 9 2 1d18+148 2d7+1 -100 13500 -8 8 2 -#7043 -basilisk scaled~ -the scaled basilisk~ -The scaled basilisk crawls towards you slowly. -~ -The basilisk is a reptilian monster. It has eight legs, and a strong, -toothy jaws. It is dull brown with yellowish underbelly. Its eyes are -glowing pale green. -~ -c dfk -250 S -13 11 0 1d12+160 2d7+2 -350 16000 -8 8 0 -#7044 -lemure blob~ -the lemure~ -The lemure blob slithers towards you for an attack! -~ -This looks like a vaguely human blob. Big black yellow eyes, and a mouth -going a little bit out from the face. The lemure does not look interested -in you at all, but it attacks anyway. It looks like its mind has been -burned out. -~ -fnq k -500 S -5 16 6 3d5+57 2d4+0 -0 1000 -8 8 0 -#7045 -jones cruncher ettin~ -Jones 'cruncher' ettin~ -Jones is standing here glaring at you. -~ -At the first sight you thought Jones was an Orc, but when he came closer you -see his second head. He wears an animal skin dress, filthy and moth eaten. -Jones really stinks... -~ -c k -480 S -10 11 2 1d5+130 2d6+2 -60 11000 -5 5 1 -#7046 -herald mouse killer ettin~ -Herald 'the mouse-killer' ettin~ -Herald is standing here looking confused at you. -~ -When you look at Herald, you feel pity. His clothes are really poor, and -one of his heads hangs down. At the rope around his stomach hangs dead -mice and rats. He does not smell good. -~ -c k +200 S -6 14 4 3d5+70 1d8+0 -40 1500 -5 5 1 -$ diff --git a/lc-mud/circle/world/mob/72.mob b/lc-mud/circle/world/mob/72.mob deleted file mode 100644 index 765deade0a478f34c4956d5e7fe0cb1593bbb68d..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/72.mob +++ /dev/null @@ -1,64 +0,0 @@ -#7200 -mindflayer master mind~ -the master mindflayer~ -The master mindflayer is here, looking at you with an evil look. -~ -It is a seven foot tall humanoid dressed in a purple cloak, and swinging a -black and purple rod above its head as if it was going to attack you any -moment now. In the middle of its head are four tentacles with sharp points. -~ -aceflm dfk -800 S -14 7 0 1d10+170 3d4+4 -0 20000 -8 8 0 -#7201 -mindflayer senior mind~ -the senior mindflayer~ -The senior mindflayer walks around here, looking for something useful. -~ -This is a horrifying monster indeed, 6'6" high. Dressed in purple and black, -and carrying a large mace in its hand. In the center of its head are four -large tentacles with very sharp points. -~ -acejklm dfk -600 S -8 13 2 1d10+100 2d4+3 -400 4500 -8 8 0 -#7202 -mindflayer junior mind~ -the junior mindflayer~ -The junior mindflayer is here, watching you carefully from the corner. -~ -This mindflayer is six feet high. It has a small mace in its belt, and is -dressed in purple and black cloth. It has four small tentacles in the center -of its head. -~ -acehlm dfk -350 S -6 15 4 1d10+75 1d4+2 -200 1500 -8 8 0 -#7203 -wererat rat~ -the ugly wererat~ -An ugly wererat is here, looking at you with a strange flick in his eyes. -~ -The wererat is about four feet tall. It looks very much like rat, except -that it is standing. -~ -cgjlk k -700 S -6 15 3 4d6+69 2d4+2 -50 1500 -8 8 0 -#7204 -rat gigantic~ -the gigantic rat~ -There is a gigantic rat here, looking at you with a hungry look. -~ -The gigantic rat is about ten feet long from head to tail and has claws the -size of your head, looking very nasty. -~ -bf k -800 S -12 9 2 1d10+150 2d6+2 -2513 13000 -8 8 1 -$ diff --git a/lc-mud/circle/world/mob/79.mob b/lc-mud/circle/world/mob/79.mob deleted file mode 100644 index dbeefa50076c2c520aac3116846c6cfc3d53ee82..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/79.mob +++ /dev/null @@ -1,40 +0,0 @@ -#7900 -paladin grand knight~ -the Grand Knight of Paladins~ -The Grand Knight is standing here, waiting for someone to help. -~ -The Knight is standing here, smiling at you. He is dressed all in white, -blue and silver. He looks VERY strong, as he stands here, ready to help -the innocent. -~ -abcilno dhk 1000 S -26 0 -2 10d8+550 2d6+16 -31570 170000 -8 8 1 -#7901 -rat large~ -the large rat~ -There is a large rat here, poking through the foodstuffs lying around. -~ -The large rat is about two feet long from head to tail and has claws the -size of your fingers, looking very nasty. It seems to be quite occupied -with all the chewed open foodstuffs lying about the room. -~ -bf k -800 S -12 9 2 1d10+150 2d6+2 -2513 13000 -8 8 0 -#7902 -cleaver~ -the Cleaver~ -The Cleaver is here eyeing you hungrily in anticipation of its next meal. -~ -The Cleaver is a huge spidery chittinous creature with four large -spindly arms ending in cleaverlike talons that will surely cut you -to ribbons. -~ -efglnopqr dhkp 0 S -20 3 -1 5d8+340 8d4+4 -2000 65000 -8 8 0 -$ diff --git a/lc-mud/circle/world/mob/9.mob b/lc-mud/circle/world/mob/9.mob deleted file mode 100644 index 0c34df52a5786644d015ded3871de1c51718650d..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/9.mob +++ /dev/null @@ -1,136 +0,0 @@ -#900 -homba~ -the homba~ -The homba flits about. -~ -Part kestrel, part bear, part wolf. Parts is parts, and makes an ugly whole. -~ -bflm bdgkp -100 S -4 16 5 2d10+40 1d8+4 -100 1500 -8 8 0 -#901 -swordsman~ -the swordsman~ -The greatest swordsman in the land is standing here with a sneer on his face. -~ -This is the ultimate swordsman. -~ -bflm dkp -400 S -7 12 3 3d10+80 2d5+2 -250 3000 -8 8 1 -#902 -mummy rabscuttle~ -the Mummy of Rabscuttle~ -The Mummy of Rabscuttle wanders here, hands aloft, walking towards you. -~ -All bandages, no personality. -~ -bflm dkp -780 S -11 10 1 6d3+130 2d6+2 -750 10500 -8 8 0 -#903 -lizard giant~ -the giant lizard~ -A giant lizard is here. -~ -This scaly creature looks like it is well adapted to its underground -habitat. He looks very powerful. -~ -bflm dkp 100 S -16 6 2 10d2+220 3d4+5 -1200 26000 -8 8 1 -#904 -woundwort general demon~ -General Woundwort~ -General Woundwort, the dark demon of Minos, awaits to maul you to shreds. -~ -He looks vaguely like a rabbit, but sure doesn't act like one. -~ -bflm dhkp -1000 S -25 0 -1 10d8+520 3d5+12 -10000 120000 -8 8 1 -#905 -franz henchman~ -Franz the Henchman~ -Franz, Minos' henchman, is here ready to pump you up. -~ -Franz is no girlie man. He is very muscular and looks as if he could -squeeze your head like a grapefruit. -~ -bflm dhkp -300 S -12 7 4 5d10+120 2d8+4 -1000 14000 -8 8 1 -#906 -hanz henchman~ -Hanz the Henchman~ -Hanz is here flexing his muscles and squeezing grapefruits. -~ -Hanz is no girlie man. He is very muscular and looks as if he could -lift a large dragon. -~ -bflm dhkp -300 S -12 7 4 5d10+120 2d8+4 -1000 14000 -8 8 1 -#907 -minos king minotaur~ -King Minos the Minotaur~ -King Minos the Minotaur is ready and waiting to gore you to death. -~ -He smells something awful. -~ -bflmnoq dfhkp -1000 S -26 0 -2 12d8+590 4d6+10 -0 160000 -8 8 1 -#908 -turtle dragon~ -the dragon turtle~ -A large dragon turtle breaks the surface churning the water into huge waves. -~ -The turtle's shell is the size of a small house and looks as hard as rock. -~ -fgq dkp -200 S -22 4 -5 12d6+350 1d20+5 -10000 80000 -8 8 1 -#909 -hag sea~ -the sea hag~ -You notice the face of an ugly hag in the sea weeds. -~ -The sea hag is terribly fightful and has razor sharp teeth. -~ -fg dkp -700 S -4 16 6 4d4+35 2d5+0 -100 750 -8 8 2 -#910 -merman~ -the merman~ -There is a merman swimming here brandishing his trident at you! -~ -The merman has a powerful tail fin instead of legs. -~ -bflmnoq dkpst 350 S -5 14 5 5d5+65 2d4+2 -1500 1000 -8 8 1 -#911 -crab crusty~ -the crusty crab~ -A crusty looking crab is crawling around here searching for food. -~ -It looks like a crab... what more can be said? -~ -hfq dkp 0 S -2 18 4 5d2+25 1d5+0 -0 150 -8 8 0 -$ diff --git a/lc-mud/circle/world/mob/index b/lc-mud/circle/world/mob/index deleted file mode 100644 index 23944d104a9253cd31a024da7d83ab5ac104f3ed..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/index +++ /dev/null @@ -1,29 +0,0 @@ -0.mob -9.mob -12.mob -15.mob -25.mob -30.mob -31.mob -33.mob -35.mob -36.mob -40.mob -50.mob -51.mob -52.mob -53.mob -54.mob -60.mob -61.mob -62.mob -63.mob -64.mob -65.mob -70.mob -72.mob -79.mob -120.mob -150.mob -186.mob -$ diff --git a/lc-mud/circle/world/mob/index.mini b/lc-mud/circle/world/mob/index.mini deleted file mode 100644 index 571f6d9024a724fa7322e1663155ccae576dbf2d..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/mob/index.mini +++ /dev/null @@ -1,4 +0,0 @@ -0.mob -12.mob -30.mob -$ diff --git a/lc-mud/circle/world/obj/0.obj b/lc-mud/circle/world/obj/0.obj deleted file mode 100644 index aeb39dfcd8c4fc8d35bcfa1fdff6c8a1b11aec12..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/0.obj +++ /dev/null @@ -1,31 +0,0 @@ -#0 -bug~ -a bug~ -This object is BAD! If you see it, there must be a bug in the game. Please -report it immediately using the BUG command.~ -~ -13 0 0 -0 0 0 0 -0 0 0 -#1 -wings~ -a pair of wings~ -A pair of wings is sitting here.~ -~ -9 0 17 -6 0 0 0 -0 0 200 -#10 -waybread bread~ -a waybread~ -Some waybread has been put here.~ -~ -19 g 1 -24 0 0 0 -1 50 50 -E -waybread bread~ -The waybread is the traditional feed of elves when travelling, they -call it lembas. It is said to refresh the weary traveler greatly. -~ -$ diff --git a/lc-mud/circle/world/obj/120.obj b/lc-mud/circle/world/obj/120.obj deleted file mode 100644 index fecad923a03d7cca6efb839e52ee3f2978ee7e3d..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/120.obj +++ /dev/null @@ -1,387 +0,0 @@ -#12000 -ring pewter~ -a pewter ring~ -There is a pewter ring lying here.~ -~ -11 fg 3 -0 0 0 0 -5 15000 2500 -A -13 10 -A -2 1 -#12001 -belt bronze~ -a bronze belt~ -There is a bronze belt on the ground here.~ -~ -9 f 2049 -4 0 0 0 -5 10000 500 -A -1 -2 -A -18 1 -#12002 -helmet roman combat~ -a Roman combat helmet~ -A Roman combat helmet has been left here.~ -~ -9 a 17 -8 0 0 0 -25 12000 8000 -A -2 -2 -A -18 1 -#12003 -whistle coach~ -a coach's whistle~ -A coach's whistle has been left here.~ -~ -8 h 5 -0 0 0 0 -1 1000 200 -#12004 -stethoscope object~ -a stethoscope~ -There is an odd object laying on the ground here.~ -~ -11 i 5 -0 0 0 0 -1 15000 2000 -A -18 4 -A -19 -3 -#12005 -hairpin~ -a hairpin~ -A woman's hairpin is lying here.~ -~ -11 i 17 -0 0 0 0 -1 3000 500 -A -1 -1 -A -3 1 -#12006 -apple~ -an apple~ -A delicious looking apple has been left here.~ -~ -19 0 1 -4 0 0 0 -1 5 5 -#12007 -orange~ -an orange~ -A sun-ripened orange has been left here.~ -~ -19 0 1 -6 0 0 0 -1 6 6 -#12008 -sandals leather~ -a pair of leather sandals~ -A pair of leather sandals has been dropped here.~ -~ -9 0 65 -2 0 0 0 -2 250 41 -#12010 -hotdog frank dog~ -a hotdog~ -A hotdog loaded with chili and onions has been left here.~ -~ -19 0 1 -8 0 0 0 -1 11 11 -#12011 -bracelet silver gold~ -a silver and gold bracelet~ -A bracelet, made from silver and gold, has been carelessly left here.~ -~ -11 bh 4097 -0 0 0 0 -14 10000 8000 -A -12 25 -A -19 -3 -#12012 -ring sapphire~ -a sapphire ring~ -A sapphire ring has been left here.~ -~ -11 0 3 -0 0 0 0 -20 35000 5500 -A -18 2 -A -17 -10 -#12013 -pendant jade~ -a jade pendant~ -A beautiful jade pendant has been left here.~ -~ -11 0 5 -0 0 0 0 -30 16500 6000 -A -3 1 -A -4 2 -#12014 -robe froboz~ -Froboz' robe~ -Froboz' robe has been dropped here.~ -~ -11 0 1024 -0 0 0 0 -5 15000 2500 -A -17 -6 -A -24 -4 -#12015 -sword tempered~ -a tempered sword~ -A nasty looking tempered sword is lying here.~ -~ -5 bmn 8193 -0 3 8 3 -16 15000 5000 -A -18 -2 -#12016 -sword quenched~ -a quenched sword~ -A very bloody, but quenched, sword has been left here.~ -~ -5 fmn 24577 -0 3 5 3 -14 10000 4000 -#12017 -bracers moorish~ -a pair of Moorish bracers~ -A pair of Moorish bracers has been dropped here.~ -~ -9 a 257 -8 0 0 0 -15 25000 10000 -A -2 -2 -A -19 2 -#12018 -plate breast roman combat~ -a Roman combat breast plate~ -A piece of military combat plate has been left here.~ -~ -9 a 9 -8 0 0 0 -135 50000 9500 -A -2 1 -A -18 -2 -#12019 -boots combat~ -a pair of Roman combat boots~ -A pair of combat boots have been left here.~ -~ -9 a 65 -8 0 0 0 -45 8750 9000 -A -1 2 -A -19 -1 -#12020 -thunderbolt jupiter~ -Jupiter's Thunderbolt~ -Jupiter's Thunderbolt has been left here.~ -~ -5 bgkmn 8193 -0 4 6 6 -22 100000 25000 -A -18 3 -A -19 3 -#12021 -loincloth red mars~ -a red loincloth~ -Mars' red loincloth is resting here.~ -~ -9 bk 2049 -15 0 0 0 -30 100000 20000 -A -1 2 -A -2 2 -#12022 -necklace crystal venus~ -a crystal necklace~ -Someone has left the crystal necklace of knowledge here.~ -~ -11 b 5 -0 0 0 0 -35 50000 12000 -A -3 3 -A -4 2 -#12023 -sandals winged mercury~ -a pair of winged sandals~ -Mercury's winged sandals have been left here.~ -~ -9 al 65 -8 0 0 0 -14 75000 13000 -A -2 2 -A -14 100 -#12024 -scroll dark grey~ -a dark grey scroll~ -A scroll has been carelessly left here.~ -~ -2 fp 16385 -20 4 15 1 -2 5000 2000 -#12025 -scroll ornate~ -an ornate scroll~ -An ornate scroll has been left here.~ -~ -2 p 16385 -18 10 10 16 -2 7000 3000 -#12026 -scroll plain~ -a plain scroll~ -A plain scroll is lying on the ground.~ -~ -2 p 16385 -15 7 15 1 -2 8000 2200 -#12027 -bag herbs~ -a bag of herbs~ -There is a small, sweet-smelling bag here on the ground.~ -~ -3 b 16385 -30 4 4 43 -5 15000 2000 -#12028 -staff kodarta~ -a Kodarta staff~ -A Kodarta staff has been carelessly left here.~ -~ -4 0 16385 -17 3 3 15 -6 35000 4000 -#12029 -wand prototype~ -a prototype wand~ -There is a prototype of a new magical wand lying here.~ -~ -3 jfh 16385 -30 4 3 26 -26 20000 13000 -A -18 -3 -A -24 8 -#12030 -flask potion blaze orange~ -a flask~ -There is a flask, containing a blaze orange potion, resting here.~ -~ -10 0 1 -9 4 17 33 -8 1000 100 -#12031 -mace executioner~ -an executioner's mace~ -An executioner's mace is lying here.~ -~ -5 hmo 8193 -0 5 1 7 -13 3000 18 -A -2 -2 -A -1 -2 -#12032 -mug beer~ -a mug~ -A frosty mug has been left on the ground here.~ -~ -17 0 1 -3 3 1 0 -3 10 5 -#12033 -key rusted~ -a rusted key~ -There is a rusted key here.~ -~ -18 c 1 -12033 0 0 0 -1 0 0 -#12034 -key double~ -a double sided key~ -A double sided key has been left here.~ -~ -18 c 1 -12034 0 0 0 -10 0 0 -#12035 -key diamond~ -a diamond studded key~ -A diamond studded key is sitting on the ground.~ -~ -18 c 1 -12035 0 0 0 -30 0 0 -#12036 -key pearl~ -a key with a pearl handle~ -A key with a pearl handle is sitting on the ground.~ -~ -18 c 1 -12036 0 0 0 -10 0 0 -#12037 -key aquamarine~ -an aquamarine key~ -There is an aquamarine colored key here.~ -~ -18 c 1 -12037 0 0 0 -10 0 0 -#12038 -key opal~ -an opal key~ -An opal key has been left here.~ -~ -18 c 1 -12038 0 0 0 -20 0 0 -#12039 -key steel~ -a steel key~ -A steel key is lying on the ground.~ -~ -18 c 1 -12039 0 0 0 -1 0 0 -$ diff --git a/lc-mud/circle/world/obj/15.obj b/lc-mud/circle/world/obj/15.obj deleted file mode 100644 index 2f034321830aaa00c95cc2bc730f6e1ceca24528..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/15.obj +++ /dev/null @@ -1,223 +0,0 @@ -#1500 -scales justice scale~ -the Scales of Justice~ -Two beautiful plates shaped like scales have been left here.~ -~ -12 ak ao -0 0 0 0 -10 15000 2200 -A -3 1 -A -4 2 -E -scales justice scale~ -As you look at the scales, you notice that they seem to sway back and forth -of their own accord, as if weighing something that is to you still unseen. -~ -#1501 -scroll parchment~ -the Scroll of the Messenger~ -You see a solid and silver-lined scroll resting on the ground.~ -~ -12 g ao -0 0 0 0 -1 500 500 -A -14 15 -A -19 -1 -E -scroll parchment~ -It seems to be some sort of spell designed to transport its user across -vast distances, but how to make use of it is impossible to tell. -~ -#1502 -sword blazing~ -a blazing sword~ -You are startled by the sight of a sword that glows as you approach it.~ -~ -5 abgkn an -0 3 4 11 -10 5000 900 -A -13 -5 -E -sword blazing~ -The edge of the blade is lined with writing, religious verse apparently, in -a fine, silver-laced and flowing script. -~ -#1503 -protector faithful shield~ -the Protector of the Faithful~ -A weighty looking shield has been abandoned by one unworthy to hold it.~ -~ -9 kn aj -15 0 0 0 -20 5000 1500 -E -protector faithful shield~ -It evades your attempts to focus on it, deflecting your gaze as it deflects -the weapons that will try to kill you. -~ -#1504 -armband band faded~ -a faded armband~ -A ragged and faded looking piece of cloth has been left here, forgotten.~ -~ -12 j ai -0 0 0 0 -0 15 50 -A -6 2 -A -5 -1 -E -armband faded band~ -It has some sort of militia insignia on it, perhaps an indication of a rank -or award in some military order unknown to you. -~ -#1505 -scimitar jeweled~ -a jeweled scimitar~ -A stunning curved blade glistens on the ground.~ -~ -5 akn an -0 7 1 3 -5 5000 500 -E -scimitar jeweled~ -The entire rim and edge of the scimitar's handle is bedecked in a gorgeous -array of stones and precious metals. -~ -#1506 -ember charred~ -a charred ember~ -You glance briefly at a smouldering ember that rests at your feet.~ -~ -1 ajnop ao -0 0 -1 0 -0 5 2500 -A -18 2 -A -12 10 -E -ember charred~ -It glares back at you, almost angrily. -~ -#1507 -ethereal flame~ -an ethereal flame~ -The entire room is aglow from the flame at your feet.~ -~ -1 ajkop ao -0 0 -1 0 -0 5 2500 -A -12 8 -A -13 10 -E -ethereal flame~ -Even being near it fills you with a peaceful and comforted feeling. -~ -#1508 -key gates~ -the Key to the Gates~ -You have found at last the Key to the Gates of eternity.~ -~ -18 aikl ao -1508 0 0 0 -0 1000 500 -A -3 2 -E -key gates~ -There are no gates. They are inside of you. -~ -#1509 -history burnt book~ -a burnt history~ -You have found a burnt book, some forgotten history lying on the ground.~ -~ -13 0 ao -0 0 0 0 -2 10 500 -A -4 2 -E -history burnt book~ -So this is the jester's joke. All of our works have turned to dust, -and will end in nothing. It is for this that he laughs. -~ -#1510 -surah book~ -a surah of the book~ -You notice a thin parchment, with flowing script and rich decorative trim.~ -~ -1 dklmn ao -0 0 -1 0 -0 500 8000 -A -18 3 -A -19 3 -E -surah book~ -Al-Kafirun -Say: "Oh ye that reject the Faith, I do not worship what you worship, nor -do you worship what I worship. To you be your Way, and to me mine." -~ -#1511 -forge unity~ -the Forge of Unity~ -It is surely the best of men who has left these gloves to aid you.~ -~ -9 iklmn ah -5 0 0 0 -5 12000 4000 -A -19 2 -A -13 10 -#1512 -ankh~ -an Ankh~ -You see a beautiful pendant of ancient and noble craftsmanship.~ -~ -11 al ac -0 0 0 0 -3 5000 2000 -A -12 10 -A -12 5 -E -ankh~ -It is an even earlier version of the old Christian cross, an oval loop -above the crossed arms of white gold. -~ -#1513 -amulet ra~ -the Amulet of Ra~ -You have found a beautiful gleaming disc with a golden image of the sun god.~ -~ -11 ag ac -0 0 0 0 -5 7500 1500 -A -3 2 -A -4 2 -#1514 -image azathoth graven~ -a graven image of Azathoth~ -You frown in disgust at the hideous icon of a false god that you have found.~ -~ -1 jlq ao -0 0 0 0 -2 1000 500 -A -6 2 -$ diff --git a/lc-mud/circle/world/obj/150.obj b/lc-mud/circle/world/obj/150.obj deleted file mode 100644 index 7002902c6a699a42387695e09b1a370171283cc1..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/150.obj +++ /dev/null @@ -1,253 +0,0 @@ -#15000 -nothingness universal~ -Sapowox's Universal Nothingness~ -You are quite unable to perceive Sapowox's Universal Nothingness here.~ -~ -5 bcg 8193 -0 6 4 1 -40 0 200000 -E -nothingness universal~ -You are not sure, but you do not seem not able to figure out what -it isn't, because it doesn't much resemble anything you haven't -ever seen. You feel a bit of mortal confusion, but you notice a -small inscription on it. -~ -E -text writing inscription~ -It just says: ' (void *) ' -Not very enlightening, is it? -~ -A -18 2 -A -19 2 -#15001 -gold coins~ -the gold~ -A lot of gold is here.~ -~ -20 0 1 -32385 0 0 0 -0 32385 0 -#15002 -sceptre royal golden~ -a golden sceptre~ -A golden Royal sceptre lies on the ground.~ -~ -12 gk 16385 -0 0 0 0 -20 15000 3000 -A -18 2 -#15003 -crown golden~ -a golden crown~ -A magnificently jewelled golden crown has been left here.~ -~ -9 gk 17 -7 0 0 0 -40 12000 10000 -A -12 30 -A -3 1 -#15004 -apple golden~ -a golden apple~ -There is a golden apple here.~ -~ -1 gk 16385 -0 0 -1 0 -5 8000 400 -#15005 -telescope scope~ -a large telescope~ -There is a large telescope here, pointing at the sky.~ -~ -12 0 0 -0 0 0 0 -0 0 0 -E -telescope scope~ -A small sign says: - -Made in Siberia. - -~ -#15006 -sword training~ -a training sword~ -A training sword with blunt edges is leaned against a wall.~ -~ -5 0 8193 -0 1 4 3 -7 300 5 -A -18 -2 -#15007 -key huge~ -a huge key~ -There is a huge, heavy-looking key on the floor here.~ -~ -18 c 16385 -15007 0 0 0 -1 0 0 -#15008 -Verminator sword~ -Verminator~ -A strange looking sword is lying upon the ground here.~ -~ -5 adjmnoq 8193 -0 3 4 11 -2 1 4000 -E -verminator sword~ -This strange sword seems to be made of black metal, an eerie green glow -surrounds the blade. -~ -#15009 -key butlers butler~ -the Butler's key~ -The Butler's key is here.~ -~ -18 c 16385 -15009 0 0 0 -3 0 0 -#15010 -key small~ -a small key~ -A small key lies here.~ -~ -18 c 16385 -15010 0 0 0 -1 0 100 -#15011 -chest wooden~ -a large wooden chest~ -A large wooden chest stands here in a corner.~ -~ -15 0 1 -800 13 15010 0 -450 400 100 -E -chest~ -It is equipped with a small lock, that any self-respecting thief -should be able to pick. -~ -#15012 -vial large potion brown~ -a large vial~ -A large vial has been left here.~ -~ -10 g 1 -15 15 -1 -1 -14 2000 2000 -E -vial large brown potion~ -It is filled with a disgusting brown liquid. -~ -#15013 -banner royal~ -a royal banner~ -The royal banner has been firmly planted in the ground here.~ -~ -12 0 0 -0 0 0 0 -0 0 0 -E -banner royal standard~ -It is large and very heavy. On top of it flutters King Welmar's flag -proudly. -~ -E -flag~ -On the flag is the symbol of King Welmar's house, the rampant stag. -~ -#15014 -key~ -a key~ -A key lies on the floor.~ -~ -18 c 1 -15014 0 0 0 -13 0 0 -E -key~ -It has a finely carved letter 'W' inscribed on it. -~ -#15015 -hauberk mail chain~ -a guard's chain mail hauberk~ -A chain mail hauberk lies on the floor~ -~ -9 0 9 -5 0 0 0 -60 2000 500 -#15016 -broadsword sword large~ -a large broadsword~ -There is a large broadsword lying here.~ -~ -5 0 8193 -0 2 6 3 -14 1300 3000 -#15017 -key cell~ -the cell key~ -A key lies on the floor.~ -~ -18 c 1 -15017 0 0 0 -3 0 0 -E -key cell~ -This appears to be the key for the cells of the castle. -~ -#15018 -corpse~ -a corpse~ -There is a corpse lying in the middle of the floor of the building here.~ -~ -13 0 0 -0 0 0 0 -0 0 0 -#15019 -lobster~ -a delicious-looking lobster~ -A delicious-looking lobster is lying here, tempting your appetite.~ -~ -19 0 1 -7 0 0 0 -5 100 10 -#15020 -caviar~ -some Russian caviar~ -There is some delicious-looking Russian caviar here, making your mouth water.~ -~ -19 0 1 -2 0 0 0 -1 250 20 -#15021 -glow~ -the glow from the west~ -There is a strange glow coming from the west.~ -~ -13 0 0 -0 0 0 0 -0 0 0 -E -glow~ -The glow from the west appears to be quite strong, but it does not -give enough light to see by here, nor can you see the source of the -glow. -~ -#15022 -wail sound~ -the wailing sound from the east~ -There is an eerie wailing sound coming from the house to the east.~ -~ -13 0 0 -0 0 0 0 -0 0 0 -$ diff --git a/lc-mud/circle/world/obj/186.obj b/lc-mud/circle/world/obj/186.obj deleted file mode 100644 index 9eadd1609ed255ec796852a9e882ed99c011a8bc..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/186.obj +++ /dev/null @@ -1,141 +0,0 @@ -#18601 -sword newbie~ -a shiny newbie sword~ -A shiny newbie sword is lying here waiting to be possessed.~ -~ -5 65 8193 -0 1 5 3 -4 0 0 -A -19 1 -#18602 -vest newbie~ -a bright green newbie vest~ -A bright green newbie vest is lying here looking for a body to hug.~ -~ -9 0 9 -4 0 0 0 -4 0 0 -#18603 -helm helmet newbie~ -a bright newbie helm~ -A bright newbie helm is hoping a loose head will wander by.~ -~ -9 65 17 -3 0 0 0 -4 0 0 -A -5 1 -#18604 -cloak dark newbie~ -a dark newbie cloak~ -A dark newbie cloak is lying here hoping to smother you.~ -~ -9 65 1025 -0 0 0 0 -2 100 0 -A -17 -3 -A -4 1 -#18605 -ring signet newbie~ -a newbie signet ring~ -A newbie signet ring is lying in the dust here.~ -~ -9 96 3 -0 0 0 0 -1 500 0 -A -17 -2 -#18606 -dagger newbie~ -a shiny newbie dagger~ -A shiny newbie dagger is lying here looking for a back to stab.~ -~ -5 65 24577 -0 1 4 11 -1 0 0 -A -19 1 -#18607 -collar dragon~ -a pet dragon collar~ -Someone's pet dragon has escaped and left his collar here.~ -~ -9 64 5 -0 0 0 0 -1 0 0 -A -18 1 -A -17 -1 -#18608 -key newbie~ -a wee little key~ -A key with the newbie crest on it is here.~ -~ -18 4 1 -1 0 0 0 -1 0 0 -#18609 -light jar~ -a brightly glowing jar~ -A jar of glowing fluid wants to brighten your day.~ -~ -1 65 1 -0 0 -1 0 -2 0 0 -A -24 -1 -#18610 -horns horn~ -the horns of the Minotaur~ -The horns of the great Minotaur lie here.~ -~ -9 8192 17 -2 0 0 0 -8 100 0 -A -1 1 -#18611 -hide skin~ -the smelly hide of the Minotaur~ -The hide of the great Minotaur is lying here.~ -~ -11 8192 1033 -0 0 0 0 -6 100 0 -A -17 -6 -A -13 15 -#18612 -leggings newbie~ -some cool newbie leggings~ -A pair of neat looking leggings are here.~ -~ -9 0 33 -4 0 0 0 -4 200 0 -#18613 -sleeves newbie~ -some cool newbie sleeves~ -A set of nifty sleeves is here.~ -~ -9 0 257 -4 0 0 0 -3 400 0 -A -3 1 -#18614 -mace newbie~ -a glowing newbie mace~ -A finely crafted newbie mace is waiting for a worthy owner.~ -~ -5 65 8193 -0 2 6 7 -8 300 0 -A -17 -2 -$ diff --git a/lc-mud/circle/world/obj/25.obj b/lc-mud/circle/world/obj/25.obj deleted file mode 100644 index 48eca2bd92b48ea7fbdb834da95d066e6ced4194..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/25.obj +++ /dev/null @@ -1,907 +0,0 @@ -#2500 -key diamond~ -a diamond key~ -A glinting key of diamond has been left here.~ -~ -18 cdq 16385 -2500 0 0 0 -2 0 0 -#2501 -oven black~ -an oven~ -~ -~ -15 0 0 -1000 5 -1 0 -1000 1000 1000 -#2502 -locker~ -a meat locker~ -~ -~ -15 0 0 -1000 5 -1 0 -1000 1000 1000 -E -locker~ -You just had the horrid thought that a cadaver might be in there. -~ -#2503 -rack spice~ -a spice rack~ -~ -~ -15 0 1 -50 0 -1 0 -10 1500 500 -#2504 -slice bread traveller~ -a slice of traveller's bread~ -A slice of traveller's bread is here looking very tasty.~ -~ -19 0 1 -15 0 0 0 -1 12 3 -#2505 -chunk meat~ -a large chunk of meat~ -A large chunk of meat is here.~ -~ -19 0 1 -24 0 0 1 -2 20 5 -#2506 -sandwich~ -a finger sandwich~ -A finger sandwich is here.~ -~ -19 q 1 -20 0 0 0 -2 15 5 -E -sandwich finger~ -It would look quite tasty if someone had first removed the fingernails! -~ -#2507 -broom straw~ -a straw broom~ -A straw broom is here leaning against the wall.~ -~ -22 d 16385 -0 0 0 0 -5 5 600 -E -broom straw~ -A magical flying broomstick? Nah! Not here. -~ -#2508 -cabinet~ -a cabinet~ -A cabinet is here.~ -~ -15 0 0 -5000 5 -1 0 -10000 10 10 -#2509 -bar silver~ -a bar of silver~ -A bar of silver has been left here.~ -~ -8 0 1 -0 0 0 0 -10 1000 500 -#2510 -bar gold~ -a bar of gold~ -A bar of gold has been left here.~ -~ -8 0 1 -0 0 0 0 -11 2000 750 -#2511 -bar mithril~ -a bar of mithril~ -A bar of mithril has been left here.~ -~ -8 0 1 -0 0 0 0 -12 3000 950 -#2512 -bar adamantite~ -a bar of adamantite~ -A bar of adamantite has been left here.~ -~ -8 0 1 -0 0 0 0 -15 5000 1000 -#2513 -hammer mithril~ -a mithril hammer~ -a mithril hammer has been left here~ -~ -5 g 8193 -0 2 6 7 -19 10000 1000 -A -18 2 -A -1 1 -#2514 -chest~ -a chest~ -A chest is here.~ -~ -15 a 0 -5000 15 1316 0 -1000 1000 1000 -#2515 -key~ -a small key~ -A small key has been left here.~ -~ -18 cdq 1 -2515 0 0 0 -1 0 0 -#2516 -long sword~ -a long sword~ -A long sword has been left here.~ -~ -5 0 8193 -0 1 8 3 -8 10000 1000 -A -18 1 -A -19 2 -#2517 -dagger silver~ -a silver dagger~ -A finely crafted dagger made of silver is on the ground here.~ -~ -5 0 8193 -0 3 3 11 -5 15000 1200 -A -18 2 -A -19 2 -#2518 -scimitar~ -a curved scimitar~ -A curved scimitar is here in a jewel-covered sheath.~ -~ -5 0 8193 -0 2 7 3 -10 17500 1950 -A -13 3 -#2519 -staff wooden~ -a wooden staff~ -A wooden staff is against the wall here.~ -~ -5 0 8193 -0 1 4 8 -6 10 5 -#2520 -cabinet silver~ -a silver chased cabinet~ -A large cabinet with a silver finish is here.~ -~ -15 0 0 -5000 15 2523 0 -10000 1 1 -#2521 -cabinet silver~ -a silver chased cabinet~ -A large cabinet with a silver finish is here.~ -~ -15 0 0 -5000 15 2523 0 -10000 1 1 -#2522 -key old~ -an old key~ -An old key is here~ -~ -18 cdq 1 -2522 0 0 0 -1 0 0 -#2523 -key silvery~ -a silvery key~ -A silvery key has been left here.~ -~ -18 cdq 1 -2523 0 0 0 -1 0 0 -#2524 -key silvery~ -a silvery key~ -A silvery key has been left here.~ -~ -18 cdq 1 -2524 0 0 0 -1 0 0 -#2525 -staff red white~ -a red and white staff~ -a red and white staff is leaning against the wall here~ -~ -4 0 16385 -20 3 3 28 -8 5500 500 -#2526 -staff burnt~ -a burnt staff~ -A burnt staff is leaning against the wall here.~ -~ -4 0 16385 -20 4 4 4 -6 1100 600 -#2527 -rod black~ -a black rod~ -A black rod has been left here.~ -~ -3 0 16385 -20 3 3 22 -4 1200 200 -#2528 -wand wooden~ -a wooden stick~ -a wooden stick is here~ -~ -3 0 16385 -20 10 10 3 -4 600 60 -#2529 -wand metal~ -a metal wand~ -A metal wand is here.~ -~ -3 0 16385 -20 20 4 25 -5 2000 350 -#2530 -cauldron black~ -a black cauldron~ -A large black cauldron is here bubbling.~ -~ -15 0 0 -1000 0 -1 0 -5000 5000 500000 -#2531 -wings bat~ -a small pair of bat wings~ -A small pair of bat wings is here.~ -~ -13 0 1 -0 0 0 0 -2 1 1 -#2532 -eyeball eye~ -an eyeball~ -An eyeball has been left here~ -~ -13 0 16385 -0 0 0 0 -1 1 1 -#2533 -book tome~ -the book of magic~ -An enormous book is lying open here~ -~ -15 ag 0 -500 0 -1 0 -5000 0 0 -#2534 -spectacles glasses~ -a pair of spectacles~ -A pair of wire-rimmed spectacles has been left here.~ -~ -9 g 17 -0 0 0 0 -4 10000 5000 -A -3 1 -A -4 1 -#2535 -altar~ -a golden altar~ -~ -~ -15 0 0 -1000 5 -1 0 -5000 1 1 -#2536 -medallion heart~ -a heart shaped medallion~ -A heart shaped medallion is here.~ -~ -9 bdei 5 -0 0 0 0 -3 10000 1000 -A -4 2 -A -5 -1 -#2537 -chest~ -a large chest~ -A large chest is here.~ -~ -15 ag 0 -2000 15 2538 0 -5000 500000 5000000 -#2538 -key intricate~ -an intricately carved key~ -An intricately carved key has been left here.~ -~ -18 acdgq 16385 -2538 0 0 0 -1 0 0 -A -24 -1 -#2539 -a pile of coins~ -a pile of coins is here~ -A pile of coins is here.~ -~ -20 0 1 -23574 0 0 0 -23 23574 0 -#2540 -cloak brown~ -a brown cloak~ -A travel worn cloak has carelessly been left here.~ -~ -9 0 5 -0 0 0 0 -5 2000 250 -A -17 -5 -A -24 -3 -#2541 -chameleon poncho cloth~ -a chameleon poncho~ -Some multicolored cloth is on the ground here~ -~ -9 g 1025 -0 0 0 0 -4 15000 5000 -A -2 2 -A -17 -3 -#2542 -boots worn~ -a pair of old boots~ -A pair of old boots is here, they look very comfortable.~ -~ -9 g 65 -0 0 0 0 -2 3500 900 -A -14 15 -#2543 -ring seashell~ -a seashell ring~ -A small seashell has been left here.~ -~ -22 g 3 -0 0 0 0 -2 6500 1100 -#2544 -backpack leather~ -a leather backpack~ -A leather backpack is here.~ -~ -15 0 1025 -750 0 -1 0 -9 750 50 -#2545 -cup brew herbal tea~ -a herbal brew~ -A herbal brew is here.~ -~ -17 0 1 -5 5 11 1 -2 11 5 -#2546 -waybread~ -a waybread~ -A loaf of waybread has been left here.~ -~ -19 0 1 -32 0 0 0 -3 65 5 -#2547 -cleaver~ -a meat cleaver~ -A meat cleaver is sticking in the wall here.~ -~ -5 0 8193 -0 3 4 1 -8 600 100 -#2548 -shackles chain~ -some chain shackles~ -Some chain shackles have been discarded here~ -~ -13 gh 2049 -0 0 0 0 -15 750 1000 -A -12 -100 -A -14 -82 -#2549 -dagger silvery~ -a silvery dagger~ -A long dagger that seems to be made of silver is here.~ -~ -5 g 8193 -0 2 4 11 -5 1200 500 -A -18 1 -#2550 -scroll~ -a scroll~ -A scroll is here.~ -~ -2 0 16385 -21 4 17 38 -5 3000 1000 -#2551 -scroll bound~ -a bound scroll~ -A bound scroll is here blowing in the breeze.~ -~ -2 g 16385 -16 1 2 34 -3 9500 3000 -A -17 -6 -#2552 -tube cylinder~ -a long cylindrical tube~ -A long cylindrical tube is rolling around here.~ -~ -15 g 1 -100 5 -1 0 -8 500 50 -#2553 -scroll old~ -an old scroll~ -An old scroll has been left here.~ -~ -2 0 16385 -10 12 -1 -1 -2 500 100 -#2554 -scroll blue~ -a scroll written on blue paper~ -A blue scroll has been left here.~ -~ -2 g 16385 -24 24 -1 -1 -5 20000 15000 -#2555 -pouch leather~ -a leather pouch~ -A leather pouch is on the ground here.~ -~ -15 g 16385 -150 0 -1 0 -2 1750 50 -#2556 -spoon silver~ -a silver stirring spoon~ -A silver stirring spoon has been left here.~ -~ -12 g 16385 -0 0 0 0 -1 5650 900 -A -24 -1 -#2557 -potion blue~ -a blue potion~ -A blue potion is here.~ -~ -10 g 16385 -24 27 27 27 -2 9000 500 -#2558 -potion red~ -a bright red potion~ -A bright red potion is here.~ -~ -10 g 16385 -15 15 -1 -1 -2 1500 500 -#2559 -potion green~ -a green potion~ -A green potion is here.~ -~ -10 g 16385 -20 4 2 14 -2 1500 150 -#2560 -potion effervescent~ -an effervescent potion~ -An effervescent potion is bubbling away here~ -~ -10 g 16385 -16 18 19 20 -2 1000 150 -E -potion effervescent~ -Ahh! Schwepes Sparkling Soda a refreshing drink. -~ -#2561 -white milky potion~ -a milky white potion~ -A milky white potion is here.~ -~ -10 0 16385 -14 42 -1 -1 -2 750 50 -#2562 -staff black~ -a black staff~ -A black staff is leaning against the wall here.~ -~ -4 g 16385 -18 2 2 2 -5 500 50 -#2563 -flute golden~ -a golden flute~ -A golden flute has been left here.~ -~ -4 fg 16385 -22 1 1 7 -4 15000 5000 -A -3 -6 -#2564 -figurine humanoid small~ -a small figurine~ -A small figurine in the shape of a humanoid is standing here.~ -~ -4 g 16385 -21 10 10 32 -4 6000 650 -#2565 -belt holster~ -a holstered belt~ -A holstered belt is here.~ -~ -15 0 2049 -20 0 -1 0 -4 290 29 -#2566 -wand~ -a blackened wand~ -A blackened wand is here.~ -~ -3 g 16385 -17 5 1 26 -4 2500 500 -#2567 -chisel runed~ -a runed chisel~ -A runed chisel is here.~ -~ -5 ag 8193 -0 2 3 11 -6 1500 500 -A -2 1 -#2568 -pouch belt beltpouch~ -a beltpouch~ -A beltpouch is here.~ -~ -15 0 2049 -50 0 -1 0 -5 750 50 -#2569 -dust~ -some sparkling dust~ -Some sparkling dust is in a pile here.~ -~ -4 0 16385 -20 1 1 38 -2 1000 150 -#2570 -cowl dark~ -a dark cowl~ -A dark cowl is here.~ -~ -9 abgj 5 -0 0 0 0 -5 1200 400 -A -17 -8 -A -24 -3 -#2571 -wand ashen~ -an ashen wand~ -An ashen wand is here~ -~ -3 j 16385 -20 4 4 5 -4 2000 600 -#2572 -club spiked~ -a huge spiked club~ -A huge spiked club has been left here.~ -~ -5 0 8193 -0 3 5 8 -29 750 200 -#2573 -robe grey~ -a grey robe~ -A pile of grey cloth has been left here.~ -~ -15 gjk 1025 -50 0 -1 0 -8 5000 750 -A -17 -9 -A -24 -2 -#2574 -bracelet silver~ -a glinting silver bracelet~ -A glinting hoop of silvery metal is here.~ -~ -9 gjk 4097 -0 0 0 0 -5 5000 500 -A -17 -5 -#2575 -cloak grey~ -a long grey cloak~ -A pile of grey cloth has been left here.~ -~ -9 gjk 5 -0 0 0 0 -7 12000 1200 -A -17 -12 -A -24 -3 -#2576 -staff~ -an iron shod staff~ -A grey piece of wood shod in iron has been left here.~ -~ -5 gjk 8193 -0 2 7 8 -7 9000 3000 -A -18 3 -#2577 -minor ward cube clear~ -a ward minor~ -A small clear cube is sitting here.~ -~ -9 ag 16385 -0 0 0 0 -5 5000 1000 -A -17 -5 -#2578 -robe black~ -a black robe~ -A pile of black cloth is on the ground here.~ -~ -15 gjl 1025 -50 0 -1 0 -8 5000 750 -A -17 -9 -A -24 -2 -#2579 -bracelet onyx~ -an onyx bracelet~ -A hoop of black onyx is here.~ -~ -9 gjl 4097 -0 0 0 0 -6 8500 850 -A -19 2 -#2580 -cloak black dark~ -a dark black cloak~ -A pile of black cloth is on the ground here.~ -~ -9 gjl 5 -0 0 0 0 -8 9000 950 -A -17 -12 -A -24 -3 -#2581 -shard black obsidian~ -a sharp shard of obsidian~ -A piece of black glass is here.~ -~ -5 gjl 8193 -0 2 7 1 -8 12000 2000 -A -19 3 -#2582 -robe white~ -a white robe~ -A pile of white cloth is on the ground here.~ -~ -15 gkl 1025 -50 0 -1 0 -7 7500 750 -A -17 -9 -A -24 -2 -#2583 -bracelet white gold~ -a white gold bracelet~ -A hoop of silvery metal is here.~ -~ -9 gkl 4097 -0 0 0 0 -5 5000 1000 -A -18 2 -#2584 -cloak white~ -a white cloak~ -A pile of white cloth is on the ground here.~ -~ -9 gikl 5 -0 0 0 0 -7 9000 1500 -A -17 -12 -A -24 -3 -#2585 -ivory dagger~ -an ivory hilted dagger~ -An ivory hilted dagger has been left here~ -~ -5 gikl 8193 -0 2 6 11 -8 12000 1500 -A -18 1 -A -19 2 -#2586 -collar spiked~ -a spiked collar~ -A small spiked collar is here.~ -~ -9 g 5 -0 0 0 0 -9 10000 5000 -A -17 -2 -A -19 3 -#2587 -cloak shimmering~ -a shimmering cloak of many colors~ -A multi-colored pile of cloth is here.~ -~ -15 ag 5 -100 0 -1 0 -8 25000 5500 -A -17 -15 -A -24 -5 -#2588 -emerald ring~ -a small emerald ring~ -A small ring with a green gemstone is here.~ -~ -9 g 3 -0 0 0 0 -5 50000 10000 -A -12 20 -#2589 -bracelet emerald~ -an emerald bracelet~ -A beautifully crafted hoop of emerald is here.~ -~ -9 g 4097 -0 0 0 0 -5 30000 3500 -A -17 -5 -A -3 1 -#2590 -ward major clear crystal~ -a ward major~ -A large clear crystal cube is here.~ -~ -9 ag 16385 -0 0 0 0 -6 20000 2000 -A -17 -10 -A -24 -2 -#2591 -ebony kris~ -the ebony kris~ -A wavy bladed knife made of ebony is here.~ -~ -5 g 8193 -0 3 4 11 -9 60000 5000 -A -2 2 -A -19 5 -#2592 -green scale shirt~ -a tight fitting green dragon scale shirt~ -Some green dragon scales which have been sewn together are here.~ -~ -9 g 9 -10 0 0 0 -9 10000 1000 -E -green scale shirt~ -this Green dragon scale shirt was made from a poor unfortunate green dragon. -~ -A -2 3 -A -17 -5 -#2593 -key grey metal~ -a grey key~ -A key made of a strange grey metal has been left here.~ -~ -18 cdq 16385 -2593 0 0 0 -2 0 0 -#2594 -key black obsidian~ -a black key~ -A key made of black obsidian has been left here.~ -~ -18 cdq 16385 -2594 0 0 0 -2 0 0 -#2595 -key white ivory~ -a white key~ -A key made of white ivory has been left here.~ -~ -18 cdq 16385 -2595 0 0 0 -2 0 0 -$ diff --git a/lc-mud/circle/world/obj/30.obj b/lc-mud/circle/world/obj/30.obj deleted file mode 100644 index c74e67a1d98f5a37005cf6ac0ac9e6865d05fc0f..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/30.obj +++ /dev/null @@ -1,595 +0,0 @@ -#3000 -barrel beer~ -a barrel~ -A beer barrel has been left here.~ -~ -17 0 1 -50 50 1 0 -65 300 100 -#3001 -bottle beer~ -a bottle~ -A beer bottle has been left here.~ -~ -17 0 1 -8 8 1 0 -10 20 8 -#3002 -bottle dark ale~ -a bottle~ -A dark bottle of ale has been left here.~ -~ -17 0 1 -8 8 3 0 -10 10 3 -#3003 -bottle firebreather~ -a bottle~ -A bottle of firebreather has been left here.~ -~ -17 0 1 -8 8 7 0 -10 50 17 -#3004 -bottle local~ -a bottle~ -A dark bottle has been left here.~ -~ -17 0 1 -8 8 8 0 -10 20 7 -#3005 -key dull metal~ -a key of dull metal~ -A key made of a dull metal is lying on the ground here.~ -~ -18 cdq 16385 -3005 0 0 0 -1 0 0 -#3009 -waybread bread~ -a waybread~ -Some waybread has been put here.~ -~ -19 0 1 -24 0 0 0 -1 50 50 -E -waybread bread~ -The waybread is the traditional feed of elves when travelling, they -call it lembas. It is said to refresh the weary traveler greatly. -~ -#3010 -bread loaf~ -a bread~ -A loaf of bread has been left here.~ -~ -19 0 1 -12 0 0 0 -1 10 10 -#3011 -danish pastry~ -a danish pastry~ -A nice looking delicious danish pastry has been placed here.~ -~ -19 0 1 -5 0 0 0 -1 5 5 -#3012 -taco mexican~ -a Mexican taco~ -A tasty looking Mexican taco has been dropped here.~ -~ -19 0 1 -15 0 0 0 -1 15 15 -#3013 -burrito hot~ -a spicy hot burrito~ -A spicy looking burrito has been set here.~ -~ -19 0 1 -10 0 0 0 -1 10 10 -#3014 -nachos nacho~ -some nachos with cheese~ -Some nachos have been left here.~ -~ -19 0 1 -5 0 0 0 -1 5 5 -E -nachos nacho~ -They have cheese on them. Looks like one of Uncle Juan's specials. -~ -#3015 -meat chunk~ -a piece of meat~ -A rather dubious looking piece of meat is on the ground here.~ -~ -19 0 1 -14 0 0 0 -5 24 10 -E -meat chunk~ -It isn't so much that the meat looks poisoned or anything, but that you -just are not sure of its origins. You doubt that a hunter would drop a -side of venison or rabbit meat... what in the world could this meat have -come from, you wonder... -~ -#3020 -dagger~ -a dagger~ -A dagger with a long thin blade is here.~ -~ -5 n 8193 -0 1 4 11 -1 10 10 -#3021 -sword small~ -a small sword~ -A small sword lies here.~ -~ -5 n 8193 -0 1 6 11 -3 60 10 -E -sword small~ -The small sword seems to have an inscription of some sort inscription... -~ -E -inscription~ -It says: 'May this sword be a good companion.' -~ -#3022 -sword long~ -a long sword~ -A long sword has been left here.~ -~ -5 n 8193 -0 1 8 3 -8 600 10 -#3023 -club wooden~ -a wooden club~ -A simple looking wooden club is here.~ -~ -5 0 8193 -0 1 3 7 -3 12 10 -#3024 -warhammer hammer~ -a warhammer~ -A medium sized warhammer is here.~ -~ -5 0 8193 -0 1 5 7 -6 50 10 -#3025 -flail large~ -a flail~ -A large flail is here.~ -~ -5 0 8193 -0 2 4 7 -6 625 10 -#3030 -torch~ -a torch~ -A large torch.~ -~ -1 0 16185 -0 0 24 0 -1 10 10 -#3031 -lantern brass~ -a lantern~ -A brass lantern is here.~ -~ -1 0 16185 -0 0 96 0 -1 50 10 -#3032 -bag~ -a bag~ -A small bag is here.~ -~ -15 0 16385 -50 0 0 0 -2 20 10 -#3033 -box~ -a box~ -A small box is here.~ -~ -15 0 16385 -10 0 0 0 -5 50 10 -#3034 -atm teller bank machine~ -an automatic teller machine~ -An automatic teller machine has been installed in the wall here.~ -~ -12 cdeg 0 -0 0 0 0 -5000 0 0 -E -atm teller bank machine~ -There is a small note on the machine which says: - -To use, type 'BALANCE', 'WITHDRAW <amount>', or 'DEPOSIT <amount>'. -Please report any strange occurrences to the bank manager. - -~ -#3035 -fountain water~ -the large fountain~ -A large fountain carved from blue-streaked marble is here, bubbling merrily.~ -~ -23 cdeg 0 -9999 9999 15 0 -9999 0 0 -E -marble blue streaked~ -It is a well crafted fountain, carved from a single piece of very beautiful -white marble shot through with electric blue streaks that look almost like -lightning dancing along the sides of the fountain. It seems to be enchanted -in some manner, as the water level seems to never lower. -~ -#3036 -cashcard card atm~ -a cashcard~ -A handy dandy cashcard is sitting on the ground here.~ -~ -12 cdeg 16385 -0 0 0 0 -1 10000 10 -E -cashcard card atm~ -There is some writing on the back of the card which reads: - -To use, type 'BALANCE', 'WITHDRAW <amount>', or 'DEPOSIT <amount>'. -Please report any strange occurrences to the bank manager. - -~ -#3037 -candle~ -a candle~ -A candle lies here, unlit.~ -~ -1 0 16385 -0 0 4 0 -1 5 1 -E -candle~ -A home-made candle, how quaint! -~ -#3038 -nail~ -a nail~ -A penny nail lies in the dust.~ -~ -5 0 8193 -0 1 1 11 -1 5 1 -E -nail~ -Its a common iron nail, used for carpentry work. -~ -#3039 -pot~ -a pot~ -A cast-iron pot sits on the ground.~ -~ -15 0 1 -10 0 0 0 -10 100 20 -E -pot~ -It is a nice pot. You could use it, if you ever settled down. -~ -#3040 -plate breast~ -a breast plate~ -A breast plate is lying on the ground.~ -~ -9 0 9 -7 0 0 0 -100 18000 150 -#3041 -shirt chain mail~ -a chain mail shirt~ -A chain mail shirt is lying on the ground.~ -~ -9 0 9 -5 0 0 0 -60 2500 50 -#3042 -shield wooden~ -a shield~ -A small wooden shield is lying on the ground.~ -~ -9 0 513 -2 0 0 0 -3 100 10 -#3043 -jacket soft leather~ -a leather jacket~ -A soft leather jacket is lying on the ground.~ -~ -9 0 9 -2 0 0 0 -10 200 10 -#3044 -jacket studded leather~ -a studded leather jacket~ -A studded leather jacket is lying on the ground.~ -~ -9 0 9 -3 0 0 0 -20 500 10 -#3045 -jacket scale mail~ -a scale mail jacket~ -A scale mail jacket is lying on the ground.~ -~ -9 0 9 -4 0 0 0 -40 1000 10 -#3046 -plate bronze breast~ -a bronze breast plate~ -A bronze breast plate is lying on the ground.~ -~ -9 0 9 -6 0 0 0 -80 7000 100 -#3050 -scroll identify~ -a scroll of identify~ -A scroll has carelessly been left here.~ -~ -2 g 16385 -12 201 -1 -1 -1 2001 10 -E -scroll identify~ -The scroll has a magic formula drawn upon it: - - ??? - ? ? - ? - ? - ? - * - -~ -#3051 -potion yellow~ -a yellow potion of see invisible~ -A small yellow potion has carelessly been left here.~ -~ -10 g 16385 -12 19 -1 -1 -1 400 10 -E -potion yellow~ -The potion has a small label 'Detect The Invisible'. -~ -#3052 -scroll recall~ -a scroll of recall~ -A scroll has carelessly been left here.~ -~ -2 g 16385 -12 42 -1 -1 -4 2001 10 -E -scroll recall~ -The scroll has written a formulae of 'Word of Recall' upon it. -~ -#3053 -wand grey~ -a grey wand of invisibility~ -A grey wand has carelessly been left here.~ -~ -3 g 16385 -12 2 2 29 -2 4000 100 -E -wand grey~ -The wand is an old dark grey stick. You notice a small symbol etched at -the base of the wand. It looks like this: - - \ / - - O - - / \ - -~ -#3054 -staff gnarled~ -a gnarled staff~ -A gnarled staff has carelessly been left here.~ -~ -4 g 16385 -12 1 1 38 -17 7000 5000 -E -staff gnarled~ -The staff is made of old oak, and is around five feet long. It fits -perfectly into your hand. You notice a small symbol etched at the -base of the staff, it looks like: - - ZZZZZ - Z - Z - Z - ZZZZZ z z - -~ -#3055 -staff metal~ -a metal staff~ -A metal staff has carelessly been left here.~ -~ -4 g 16385 -10 8 8 15 -7 8500 300 -E -staff metal~ -The staff is made of metals unknown to you. -~ -#3060 -raft~ -a raft~ -A raft has been left here.~ -~ -22 0 1 -0 0 0 0 -75 400 10 -E -raft~ -The raft looks very primitive. -~ -#3061 -canoe~ -a canoe~ -A canoe has been left here.~ -~ -22 0 1 -0 0 0 0 -32 1000 100 -E -canoe~ -The canoe is fairly light. -~ -#3070 -gauntlets bronze~ -a pair of bronze gauntlets~ -A pair of bronze gauntlets is lying on the ground.~ -~ -9 0 129 -6 0 0 0 -8 1750 100 -#3071 -gloves leather~ -a pair of leather gloves~ -A pair of leather gloves is lying on the ground.~ -~ -9 0 129 -3 0 0 0 -3 75 10 -#3075 -helmet bronze~ -a bronze helmet~ -A bronze helmet is lying on the ground.~ -~ -9 0 17 -6 0 0 0 -8 3500 100 -#3076 -cap leather~ -a leather cap~ -A leather cap is lying on the ground.~ -~ -9 0 17 -3 0 0 0 -3 150 10 -#3080 -leggings bronze~ -a pair of bronze leggings~ -A pair of bronze leggings is lying on the ground.~ -~ -9 0 33 -6 0 0 0 -8 3500 100 -#3081 -pants leather~ -a pair of leather pants~ -A pair of leather pants is lying on the ground.~ -~ -9 0 33 -3 0 0 0 -8 150 10 -#3085 -sleeves bronze~ -a pair of bronze sleeves~ -A pair of bronze sleeves is lying on the ground.~ -~ -9 0 257 -6 0 0 0 -8 1750 100 -#3086 -sleeves leather~ -a pair of leather sleeves~ -A pair of leather sleeves is lying on the ground.~ -~ -9 0 257 -2 0 0 0 -4 75 10 -#3096 -board social bulletin~ -a social bulletin board~ -A large, sociable bulletin board is mounted on a wall here.~ -~ -13 0 0 -0 0 0 0 -0 0 0 -E -board~ -If you can read this, the board is not working. -~ -E -social bulletin~ -Use 'look board' to read the board. -~ -#3097 -board frozen bulletin~ -a frozen bulletin board~ -A large bulletin board is here, carved from a block of ice.~ -~ -13 0 0 -0 0 0 0 -0 0 0 -E -board~ -If you can read this, the board is not working. -~ -E -freeze bulletin~ -Use 'look board' to read the board. -~ -#3098 -board holy bulletin~ -a holy bulletin board~ -A large bulletin board is mounted on a wall here. It glows with a faint aura.~ -~ -13 0 0 -0 0 0 0 -0 0 0 -E -board~ -If you can read this, the board is not working. -~ -E -holy bulletin~ -Use 'look board' to read the board. -~ -#3099 -board bulletin~ -a bulletin board~ -A large bulletin board is mounted on a wall here.~ -~ -13 0 0 -0 0 0 0 -0 0 0 -E -board~ -If you can read this, the board is not working. -~ -E -bulletin~ -Use 'look board' to read the board. -~ -$ diff --git a/lc-mud/circle/world/obj/31.obj b/lc-mud/circle/world/obj/31.obj deleted file mode 100644 index 1532526fed849a1d10bed75a32bb335c69df7a82..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/31.obj +++ /dev/null @@ -1,225 +0,0 @@ -#3100 -cup tea~ -a cup~ -A cup has been set here.~ -~ -17 0 1 -8 8 11 0 -1 5 1 -E -cup~ -It is a small simple cup. -~ -#3101 -cup coffee~ -a cup~ -A cup has been set here.~ -~ -17 0 1 -8 8 12 0 -1 7 1 -E -cup~ -It is a small simple cup. -~ -#3102 -cup water~ -a cup~ -A cup has been set here.~ -~ -17 0 1 -12 12 15 0 -1 2 1 -E -cup~ -It is a large simple cup. -~ -#3103 -bottle water~ -a bottle~ -A bottle of Evian natural spring water is here.~ -~ -17 0 1 -24 24 15 0 -1 10 6 -E -label~ -You've been ripped off! It says here at the bottom of the label, in really -really small letters, 'Bottled in the Midgaard branch of Evian Inc. This -water is from the natural, mostly clean River of Midgaard.' -~ -E -bottle~ -It is a large, clean bottle. There is a large label pasted on the side. -~ -#3104 -canteen water~ -a canteen~ -A canteen has been set on the ground here.~ -~ -17 0 1 -80 80 15 0 -20 45 15 -E -canteen~ -It is a fairly big canteen. Looks like it can hold a lot of liquid. -~ -#3105 -key iron~ -an iron key~ -An iron key has been left here.~ -~ -18 c 1 -0 0 0 0 -1 0 10 -E -key iron~ -The iron key is not special. In fact, it is quite boring. -~ -#3106 -key rusty~ -a rusty key~ -A rusty key has been left here.~ -~ -18 c 1 -0 0 0 0 -1 0 10 -E -key rusty~ -The key is a fairly large rusty key. You notice a lot of dirt it. -~ -#3107 -key wooden~ -a wooden key~ -A wooden key has been left here.~ -~ -18 c 1 -0 0 0 0 -1 0 10 -E -key wooden~ -The wooden key is not special. In fact it is just about the most boring -key you've ever seen in your life. -~ -#3108 -key brass~ -a brass key~ -A brass key has been left here.~ -~ -18 c 1 -0 0 0 0 -1 0 10 -E -key brass~ -The brass key is small and looks like it fits a very complicated lock. -~ -#3109 -desk drawer~ -the desk~ -A desk is set against the western wall.~ -~ -15 0 0 -34 15 3107 0 -100 0 0 -E -desk~ -The desk looks very sparse, there is a drawer in the left side. -~ -E -drawer~ -You notice a keyhole in the drawer. -~ -#3110 -safe~ -the safe~ -A safe is placed in a dark corner of the room.~ -~ -15 0 0 -34 15 3108 0 -999 0 0 -E -safe~ -The safe is very heavy and has a keyhole. -~ -#3111 -bench~ -the Bench~ -A white-painted wooden bench is standing here.~ -~ -12 0 0 -0 0 0 0 -100 600 200 -E -bench~ -It is a quite heavy but very comfortable bench. It is placed with its front -towards the river so you can sit and watch the river and the houses on the -other side. -~ -#3112 -key city~ -the City Key~ -The very big City Key is lying here.~ -~ -18 c 1 -0 0 0 0 -30 10000 500 -E -key city~ -It is probably the biggest key you have seen in your life. It is made from -polished gold and has various patterns on it along with the Midgaard Coat of -Arms. -~ -#3113 -fountain water~ -a fountain~ -A small white fountain is standing here, gurgling happily.~ -~ -23 0 0 -999 999 15 0 -999 0 0 -E -fountain water~ -It is very nice. Made from fine white marble. -~ -#3114 -coins gold~ -a small pile of gold coins~ -A small pile of gold coins lies here.~ -~ -20 0 1 -37 0 0 0 -0 0 0 -#3115 -gold coins~ -the gold~ -A lot of gold is here.~ -~ -20 0 1 -32385 0 0 0 -0 32385 0 -#3116 -candlestick candle stick pewter~ -a candlestick~ -A pewter candlestick is standing here.~ -~ -1 0 16385 -0 0 24 0 -5 150 10 -E -candlestick~ -It is a rather old-looking three-armed candlestick made from pewter. Its -candles are a yellowish white color. -~ -#3117 -tree elm~ -an elm tree~ -An old elm tree grows here.~ -~ -13 0 0 -0 0 0 0 -0 0 0 -E -elm tree~ -The fresh young leaves of the elm tree wave gently in the wind. -~ -$ diff --git a/lc-mud/circle/world/obj/33.obj b/lc-mud/circle/world/obj/33.obj deleted file mode 100644 index 1c308bb71f3f9e08819a3d57c5c63d8b839f6229..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/33.obj +++ /dev/null @@ -1,303 +0,0 @@ -#3300 -orange~ -an orange~ -An orange lies on the ground here.~ -~ -19 0 1 -8 0 0 0 -1 8 8 -E -orange~ -You wonder how it got here, seeing how -oranges are non-migratory. -~ -#3301 -bale wheat~ -a bale of wheat~ -There is a bale of wheat here.~ -~ -19 0 1 -24 0 0 0 -100 1000 1000 -E -bale wheat~ -It doesn't look appetizing to you, but -a horse might enjoy this... -~ -#3302 -zither~ -a big zither~ -A HUGE zither made of gold rests in the corner~ -~ -8 0 1 -0 0 0 0 -40 200000 20000 -E -zither~ -Someone truly huge with big fingers might be -able to play this. You can't. -~ -#3303 -barrel perfume~ -a barrel of perfume~ -You can smell a barrel on the other side of the room from here.~ -~ -8 0 1 -0 0 0 0 -20 100000 10000 -E -barrel perfume~ -Smells good...the label reads: - - "Somewhere between GPA and MUD there lies... - OBSESSION" -~ -#3304 -statue~ -a statue~ -There is a statue of Aglandiir here, made of solid gold.~ -~ -8 0 1 -0 0 0 0 -30 150000 15000 -E -statue~ -He's a pretty striking chap, for a dragon. -~ -#3305 -halberd~ -a halberd~ -A runed halberd lies on the ground here.~ -~ -5 g 8193 -0 1 12 3 -16 10000 3000 -A -18 5 -E -halberd~ -The runes glow with a bright light, making you -think that this might be a pretty decent weapon. -~ -#3306 -potion protection dun vial~ -a potion of protection~ -A vial of a dun fluid is here.~ -~ -10 a 1 -20 36 1 3 -1 10000 2000 -E -potion protection dun vial~ -Looks thick, and brownish-grey (dun). Ick! -~ -#3307 -crown~ -a dragon's crown~ -Aglandiir's crown sits here, radiating a shield.~ -~ -8 a 0 -0 0 0 0 -400 0 0 -E -crown~ -The shield repulses you, making you wonder how -you're going to get your hands on this huge, valuble -chunk of gold... -~ -#3308 -apple~ -an apple~ -A scrawny red apple sits here.~ -~ -19 0 1 -4 0 0 0 -1 5 2 -E -apple~ -It is not wormy... yet. -~ -#3309 -bread loaf~ -a loaf of bread~ -A fresh loaf of bread lies here.~ -~ -19 0 1 -12 0 0 0 -1 10 5 -E -bread loaf~ -Mmmm... Rye! -~ -#3310 -melon~ -a melon~ -A melon sits here, discarded evidently.~ -~ -19 0 1 -8 0 0 0 -3 8 3 -E -melon~ -Wow! Look at the size of that melon! -~ -#3311 -knife~ -a knife~ -An exquisitely crafted knife rests here.~ -~ -5 dn 24577 -0 3 5 11 -8 1000000 20000 -E -knife~ -The craftsmanship... it takes your breath away! -This knife... it had to have been forged by the -legendary smith Gabadiel. It must be worth a -fortune! -~ -A -18 3 -A -2 2 -#3312 -sword long~ -a long sword~ -A superb long sword sticks in the earth.~ -~ -5 dmn 24577 -0 2 7 3 -15 750000 15000 -E -sword long~ -This sword is light, but the heft is perfectly -balanced. Such an incredible weapon can only have -be crafted by the legendary smith Gabadiel, and -as such be worth a fortune! -~ -A -18 2 -A -1 1 -#3313 -sword short~ -a short sword~ -A short sword lies here... a work of art!~ -~ -5 adimn 24577 -0 4 6 3 -10 10000000 30000 -E -sword short~ -It brings tears to your eyes. This must have -been Gabadiel the smith's masterpiece; his final -work. Simply invaluble. -~ -A -18 4 -A -2 3 -#3314 -corpse~ -a dismembered and burnt corpse~ -A dismembered and burnt corpse lies on the ground here.~ -~ -13 0 0 -0 0 0 0 -1 1 1 -E -corpse~ -It is still smouldering a little; the culprits can't -be far off! -~ -#3315 -scimitar~ -a scimitar~ -A scimitar as long as your arm lies here.~ -~ -5 0 8193 -0 1 7 3 -10 500 50 -E -scimitar~ -This weapon really isn't of too high a quality. -~ -#3316 -crate~ -a crate~ -A crate is stacked here.~ -~ -15 0 1 -200 5 0 0 -50 100 20 -E -crate~ -It's a standard wooden crate. -~ -#3317 -bow hunting~ -a hunting bow~ -A hunting bow lies here, unwanted~ -~ -5 0 8193 -0 1 5 11 -6 400 40 -E -bow hunting~ -This is the type of weapon you would use to bag -some deer or rabbits, but not the type you'd take -into battle... -~ -A -19 1 -#3318 -vest leather~ -a leather vest~ -A nice leather vest lies here.~ -~ -9 g 9 -6 0 0 0 -6 5000 500 -E -vest leather~ -The seams are delicately sewn with a enruned thread... -~ -#3319 -glass beer~ -a glass~ -A glass of beer sits forgotten here.~ -~ -17 0 16385 -1 1 1 0 -2 5 1 -E -glass~ -This is a nice glass filled with homebrew. There doesn't seem to -be too much stuff floating in it. -~ -#3320 -glass mead ale~ -a glass~ -A big glass of mead sits here, cool and frosty.~ -~ -17 0 16385 -1 1 3 0 -2 8 3 -E -glass mead~ -Looks good. Looks warm. Doesn't matter; it still looks good. -~ -#3321 -shot whisky~ -a shot~ -A shot of whisky is sitting here.~ -~ -17 0 16385 -1 1 5 0 -1 10 5 -E -shot~ -Whew! Looks like potent stuff! -~ -$ - diff --git a/lc-mud/circle/world/obj/35.obj b/lc-mud/circle/world/obj/35.obj deleted file mode 100644 index 7f3cd6820f05c275802178a63a773ec6ce9f9650..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/35.obj +++ /dev/null @@ -1,97 +0,0 @@ -#3500 -sword small~ -a small sword~ -A small sword lies here.~ -~ -5 0 8193 -0 1 6 11 -3 60 10 -#3501 -sword long~ -a fine long sword~ -A long sword has been left here.~ -~ -5 an 8193 -0 1 9 3 -8 600 10 -A -19 2 -#3502 -club wooden~ -a wooden club~ -A simple looking wooden club is here.~ -~ -5 0 8193 -0 1 3 7 -3 12 10 -#3503 -jacket studded leather~ -a studded leather jacket~ -A studded leather jacket is lying on the ground.~ -~ -9 0 9 -5 0 0 0 -20 500 10 -#3504 -spear small~ -a small spear~ -A small spear lies here.~ -~ -5 m 8193 -0 5 1 11 -15 500 120 -#3505 -corpse mutilated~ -a mutilated corpse~ -A mutilated corpse has been left on the ground here.~ -~ -15 0 0 -20 0 -1 0 -25 0 0 -E -corpse mutilated~ -Looks to be an aftermath of whatever caused this carnage. -~ -#3506 -corpse mutilated~ -a mutilated corpse~ -A mutilated corpse has been left on the ground here.~ -~ -15 0 0 -20 0 -1 0 -25 0 0 -E -corpse mutilated~ -Looks to be an aftermath of whatever caused this carnage. -~ -#3507 -dagger ornate~ -an ornate dagger~ -A beautiful looking dagger is stuck in the ground.~ -~ -5 dfghkmnpq 8193 -0 3 3 11 -4 1000 500 -E -dagger ornate~ -The hilt of this dagger looks to be two intertwined snakes. At the end of -it, there is a small red ruby. -~ -A -18 5 -A -19 -3 -#3508 -gyroscope toy~ -the gyroscope~ -A small toy is spinning about on the ground here.~ -~ -9 b 16387 -5 0 0 0 -1 25 600 -E -gyroscope toy~ -As the gyroscope spins around and around you find yourself almost -hypnotized by its movement. -~ -$ diff --git a/lc-mud/circle/world/obj/36.obj b/lc-mud/circle/world/obj/36.obj deleted file mode 100644 index 64943ed88f88815da07c38681f9c0a7d93e2b0a8..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/36.obj +++ /dev/null @@ -1,177 +0,0 @@ -#3600 -armour black pawn~ -some Black Pawn Armour~ -A pile of black armour is here.~ -~ -9 j 9 -1 0 0 0 -13 300 1 -#3601 -armour white pawn~ -some White Pawn Armour~ -A pile of white armour is here.~ -~ -9 k 9 -1 0 0 0 -13 300 1 -#3602 -sword black pawn~ -a Black Pawn's Sword~ -The sword of a Black Pawn lies here.~ -~ -5 j 8193 -0 3 4 3 -10 100 1 -#3603 -sword white pawn~ -a White Pawn's Sword~ -The sword of a White Pawn lies here.~ -~ -5 k 8193 -0 3 4 3 -10 100 1 -#3604 -armour black rook~ -some Black Rook Armour~ -Some armour made from the remains of a black rook lies heaped on the floor.~ -~ -9 ahj 9 -2 0 0 0 -60 17000 5 -A -17 2 -A -5 1 -#3605 -armour white rook~ -some White Rook Armour~ -Some armour made from the remains of a white rook lies heaped on the floor.~ -~ -9 agk 9 -2 0 0 0 -60 17000 5 -A -17 2 -A -5 1 -#3606 -lance black knight~ -the Lance of the Black Knight~ -The Lance of the Black Knight lies here, waiting to rust.~ -~ -5 bgj 8193 -0 3 6 6 -18 10000 3 -A -19 2 -A -23 5 -#3607 -lance white knight~ -the Lance of the White Knight~ -The Lance of the White Knight lies here, waiting to rust.~ -~ -5 bgk 8193 -0 3 6 6 -18 10000 3 -A -19 2 -A -23 5 -#3608 -staff black bishop~ -the Staff of the Black Bishop~ -The Black Bishop's Staff is lying here.~ -~ -4 agj 16385 -20 5 5 36 -3 20000 6 -#3609 -staff white bishop~ -the Staff of the White Bishop~ -The White Bishop's Staff is lying here.~ -~ -4 agk 16385 -20 5 5 36 -3 20000 6 -#3610 -crown black queen~ -the Crown of the Black Queen~ -The Crown of the Black Queen lies here, looking neglected.~ -~ -9 bgj 17 -2 0 0 0 -4 3000 5 -A -3 1 -A -4 1 -#3611 -crown white queen~ -the Crown of the White Queen~ -The Crown of the White Queen lies here, looking neglected.~ -~ -9 bgk 17 -2 0 0 0 -4 3000 5 -A -3 1 -A -4 1 -#3612 -sceptre black king~ -the Black King's Sceptre~ -The Sceptre of the Black King lies here, collecting dust.~ -~ -8 bfgj 16385 -0 0 0 0 -200 85000 1 -A -1 1 -A -18 1 -#3613 -sceptre white king~ -the White King's Sceptre~ -The Sceptre of the White King lies here, collecting dust.~ -~ -8 bfgk 16385 -0 0 0 0 -300 85000 10 -A -1 1 -A -18 1 -#3614 -key black treasury~ -The Key to the Black Treasury~ -There is a sinister black key lying here.~ -~ -18 cdfq 16385 -3614 0 0 0 -1 1000 300 -#3615 -key white treasury~ -the Key to the White Treasury~ -There is a bright white key lying here.~ -~ -18 cdfq 16385 -3615 0 0 0 -1 1000 300 -#3616 -coins gold black royal treasure~ -the Black Royal Treasure~ -There are a LOT of coins here.~ -~ -20 0 1 -10000 0 0 0 -10 10000 0 -#3617 -coins gold white royal treasure~ -the White Royal Treasure~ -There are a LOT of coins here.~ -~ -20 0 1 -10000 0 0 0 -10 10000 0 -$ diff --git a/lc-mud/circle/world/obj/40.obj b/lc-mud/circle/world/obj/40.obj deleted file mode 100644 index 7002af80180213200a8900379565e9d51c21eae6..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/40.obj +++ /dev/null @@ -1,154 +0,0 @@ -#4000 -ring yellow green~ -a yellow and green ring~ -A ring is here, with yellow and green ornamentation. It looks very old.~ -~ -9 dhq 3 -0 0 0 0 -1 50 20 -E -ring yellow green~ -It feels heavy. -~ -A -1 -2 -#4001 -corpse goblin~ -a goblin's corpse~ -A halfway decayed corpse of a goblin is here, giving off a foul odor.~ -~ -15 0 1 -1 0 -1 0 -20 0 500 -#4002 -coins~ -some coins~ -A small pile of coins is on the ground.~ -~ -20 0 1 -500 0 0 0 -0 0 0 -#4050 -potion purple~ -a purple potion~ -A purple potion is here.~ -~ -10 0 16385 -17 14 36 33 -1 35500 2000 -E -potion purple~ -It looks rather strange! -~ -#4051 -helmet metal~ -a metal helmet~ -A metal helmet in here.~ -~ -9 g 17 --5 0 0 0 -4 3000 100 -E -helmet metal~ -It looks somehow magical!. -~ -A -24 -2 -A -23 -2 -#4052 -mushroom~ -a mushroom~ -A small mushroom is here.~ -~ -19 0 16385 -2 0 0 1 -1 9 3 -E -mushroom~ -Let's put it this way - I wouldn't eat it!! -~ -#4053 -dirk~ -a thieves' dirk~ -A beautifully crafted dirk is lying here.~ -~ -5 np 8193 -0 2 4 11 -2 850 500 -E -dirk~ -It is a medium sized, beautifully crafted dirk made from some greyish alloy. -Its blade is double-edged and very thin... this looks like a good thieves' -weapon. -~ -A -18 1 -A -19 1 -#4100 -blade black demon~ -a black demon blade~ -A black demon blade is here.~ -~ -5 mjl 8193 -0 3 4 11 -8 10000 800 -E -blade black demon~ -You'll become as evil as the weapon, if you use it as you sense the forces -of evil controlling the weapon... -~ -#4101 -gloves swordmans~ -a pair of swordsmans' gloves~ -A pair of finely crafted gloves are lying on the ground here.~ -~ -9 j 129 -0 0 0 0 -1 3500 800 -E -gloves swordsmans~ -They look like the right kind of equipment to use when fighting. -~ -A -18 2 -A -19 1 -#4102 -scroll ysafg~ -a scroll which reads 'ysafg'~ -A scroll which reads 'ysafg', it looks very fragile and quite old.~ -~ -2 0 1 -1 44 -1 -1 -1 1500 10 -E -scroll ysafg~ -It looks informative. -~ -#4103 -slime mould green~ -a green slime mould~ -A green slime mould is here. Stinks like you wouldn't believe!~ -~ -19 0 1 -24 0 0 0 -1 20 8 -E -smile mould~ -It wasn't meant to be food -- at least, certainly not for humans. -~ -#4104 -slime mould green~ -a green slime mould~ -A green slime mould is here. Stinks like you wouldn't believe!~ -~ -19 0 1 -24 0 0 1 -1 20 8 -E -smile mould~ -It wasn't meant to be food -- at least, certainly not for humans. -~ -$ diff --git a/lc-mud/circle/world/obj/50.obj b/lc-mud/circle/world/obj/50.obj deleted file mode 100644 index dc96a224aca4c6dcc25cc58df1a8ee4439f290a6..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/50.obj +++ /dev/null @@ -1,281 +0,0 @@ -#5000 -pick mining~ -a small mining pick~ -A small mining pick made of what appears to be silver lies on the ground.~ -~ -5 j 8193 -0 1 9 11 -3 600 500 -#5001 -suit mail banded~ -a glowing suit of banded mail~ -A glowing suit of banded mail lies on the ground.~ -~ -9 ag 9 -7 0 0 0 -0 75000 20000 -A -2 2 -A -17 -4 -#5002 -halberd~ -a halberd~ -A mighty halberd lies against the wall.~ -~ -5 gi 8193 -0 3 5 3 -16 12000 10000 -A -18 2 -A -19 2 -#5003 -amulet mushroom~ -a mushroom amulet~ -A mushroom-shaped amulet lies on the ground.~ -~ -9 gp 5 -0 0 0 0 -2 1500 4000 -A -5 2 -#5005 -bone leg~ -a large leg bone~ -A large leg bone rests on the ground.~ -~ -5 0 8193 -0 1 4 7 -5 300 60 -#5006 -cactus cup water~ -a small cactus cup~ -A small cactus cup lies on the ground.~ -~ -17 0 1 -5 5 0 0 -6 30 5 -#5007 -basket wicker small~ -a small wicker basket~ -A small wicker basket sits on the ground.~ -~ -15 0 1 -100 5 -1 0 -50 5000 50 -#5008 -basket wicker small~ -a small wicker basket~ -A small wicker basket sits on the ground.~ -~ -15 0 1 -100 5 -1 0 -50 5000 50 -#5009 -basket wicker small~ -a small wicker basket~ -A small wicker basket sits on the ground.~ -~ -15 0 1 -100 5 -1 0 -50 5000 50 -#5010 -basket wicker small~ -a small wicker basket~ -A small wicker basket sits on the ground.~ -~ -15 0 0 -100 5 -1 0 -50 5000 50 -#5011 -rope coil~ -a coil of rope~ -A long coil of rope lies on the ground.~ -~ -12 0 1 -0 0 0 0 -12 450 45 -#5012 -stakes bundle bunch~ -a bunch of stakes~ -A small bundle of stakes lies here.~ -~ -5 0 8193 -0 1 2 11 -6 250 30 -#5013 -map tattered old~ -an old, tattered map~ -An old, tattered, and much faded map lies here.~ -~ -12 0 1 -0 0 0 0 -1 300 20 -#5014 -turban padded~ -a thick padded turban~ -A thick padded turban lies here.~ -~ -9 gh 17 -0 0 0 0 -15 4300 100 -A -17 1 -#5015 -coins treasure~ -a great pile of treasure~ -A great, gleaming pile of treasure lies at your feet.~ -~ -20 0 1 -46270 0 0 0 -0 0 0 -#5016 -sabre curved long~ -a long, curved sabre~ -A long, curved sabre stands upright in the ground.~ -~ -5 l 8193 -0 1 8 3 -7 1050 200 -A -18 2 -#5017 -scimitar curved~ -a curved scimitar~ -A curved scimitar lies at your feet.~ -~ -5 l 8193 -0 1 7 3 -6 600 150 -A -18 1 -#5018 -cutlass pointed long~ -a long, pointed cutlass~ -A long, pointed cutlass lies here.~ -~ -5 l 8193 -0 1 7 3 -5 550 10 -#5019 -potion pink~ -a pink potion~ -A pink potion stands here.~ -~ -10 0 1 -25 33 17 -1 -6 600 100 -#5020 -wand platinum~ -a platinum wand~ -A platinum wand lies here.~ -~ -3 b 16385 -30 10 10 32 -8 1900 1000 -#5021 -bow golden~ -a golden bow~ -A powerful golden bow lies here.~ -~ -5 abfgio 8193 -0 4 6 12 -20 150000 20000 -#5022 -scroll encrypted~ -an encrypted scroll~ -An encrypted scroll lies at your feet.~ -~ -2 0 1 -22 14 35 43 -7 1500 500 -#5023 -chest iron bound~ -an iron bound chest~ -An iron bound chest with a shiny lock sits here.~ -~ -15 0 0 -200 13 5024 0 -200 1000 0 -#5024 -key golden~ -a golden key~ -A shiny golden key lies here.~ -~ -18 c 16385 -10 0 0 0 -1 150 0 -#5025 -bracelet copper~ -a copper bracelet~ -A tarnished copper bracelet lies at your feet.~ -~ -9 gh 4097 --5 0 0 0 -10 23000 2500 -A -13 10 -A -19 -4 -#5026 -ruby gem~ -a large ruby~ -A large ruby lies on the ground, collecting dust.~ -~ -8 gh 16385 -20 0 0 0 -9 4000 200 -#5027 -diamond gem~ -a glittering diamond~ -A glittering diamond lies at your feet.~ -~ -8 g 16385 -21 0 0 0 -10 9500 200 -#5028 -sapphire gem~ -a brilliant sapphire~ -A brilliant sapphire lies here, twinkling happily.~ -~ -8 g 16385 -22 0 0 0 -7 3500 200 -#5029 -lapis lazuli blue gem~ -a deep blue lapis lazuli~ -A deep blue lapis lazuli gem lies here.~ -~ -8 g 16385 -24 0 0 0 -11 8500 200 -#5030 -jewel tiger~ -the Tiger Jewel~ -The Tiger Jewel lies here blazing.~ -~ -8 256 16385 -0 0 0 0 -23 43000 1500 -A -2 1 -#5031 -jewel red-eyed~ -the red-eyed jewel~ -The red-eyed jewel glares at you greedily.~ -~ -8 h 16385 -0 0 0 0 -30 35000 600 -A -3 -2 -#5032 -emerald gem fiery green~ -a fiery green emerald~ -A fiery green emerald sits here.~ -~ -8 g 16385 -23 0 0 0 -7 5500 200 -$ diff --git a/lc-mud/circle/world/obj/51.obj b/lc-mud/circle/world/obj/51.obj deleted file mode 100644 index 2cff1cb3952c2c789d8ad64806089d8e3747338e..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/51.obj +++ /dev/null @@ -1,185 +0,0 @@ -#5100 -longsword commoner~ -a commoner's longsword~ -A commoner's longsword made of adamantite has been left here.~ -~ -5 m 8193 -0 1 8 3 -12 1000 500 -A -18 1 -A -19 1 -#5101 -longsword noble~ -a noble's longsword~ -A drow noble's longsword, made of adamantite, lies here.~ -~ -5 m 8193 -0 1 8 3 -12 1500 800 -A -18 2 -A -19 2 -#5102 -whip snake twoheaded~ -a two-headed snake whip~ -A whip with two snakes heads lies here.~ -~ -5 ab 8193 -0 2 6 3 -12 1750 1500 -A -18 2 -A -19 2 -#5103 -whip snake threeheaded~ -a three-headed snake whip~ -A whip with three snake heads has been left here.~ -~ -5 ab 8193 -0 2 7 3 -12 5000 2300 -A -18 2 -A -19 2 -#5104 -whip snake fourheaded~ -a four-headed snake whip~ -A whip with four snake heads has been carelessly left here.~ -~ -5 ab 8193 -0 2 8 3 -12 10250 4000 -A -18 2 -A -19 2 -#5105 -longsword black~ -a black longsword~ -A black longsword has been carelessly left here.~ -~ -5 agm 8193 -0 2 8 3 -12 10250 4000 -A -18 2 -A -19 2 -#5106 -whip snake fiveheaded~ -a five-headed snake whip~ -A whip with 5 snake heads has been carelessly dropped here.~ -~ -5 agj 8193 -0 3 6 3 -12 12000 4500 -A -1 -2 -A -3 -2 -#5107 -whip snake sixheaded~ -a six-headed snake whip~ -A whip with six snake heads has been dropped here very carelessly.~ -~ -5 agj 8193 -0 4 5 3 -12 15000 8000 -A -1 -3 -A -3 -3 -#5108 -bracers iron~ -a pair of bracers~ -A pair of iron bracers has been dropped here.~ -~ -9 ag 257 -8 0 0 0 -3 2000 1000 -A -18 -1 -#5109 -gauntlets~ -a pair of gauntlets~ -A pair of gauntlets is lying on the ground.~ -~ -11 a 129 -0 0 0 0 -2 10000 3000 -A -1 2 -#5110 -wand blue silver~ -a silvery blue wand~ -A silvery blue wand has been dropped in the dirt.~ -~ -3 g 16385 -10 3 3 30 -1 4000 3000 -#5111 -helmet small~ -a small helmet~ -A small helmet lies up against a rock.~ -~ -9 g 17 -1 0 0 0 -5 6000 3000 -A -3 3 -#5112 -ring ruby~ -a small ruby ring~ -A small ruby ring lies in the dirt.~ -~ -11 g 3 -0 0 0 0 -1 20000 8000 -A -13 25 -#5113 -dagger sacrificial spider~ -a spider shaped dagger~ -A dagger with spider leg shaped blades lies on the ground.~ -~ -5 gjmnp 8193 -0 3 4 11 -8 12000 15000 -A -18 3 -A -19 3 -#5114 -hat green~ -a small bright green hat~ -A small bright green hat lies in the dirt.~ -~ -9 h 17 -10 0 0 0 -1 2000 600 -A -9 -15 -A -17 -2 -#5115 -key adamantite~ -an adamantite key~ -A key made of a strange metal is lying here.~ -~ -18 c 16385 -5115 0 0 0 -1 0 0 -#5116 -gold treasure coins~ -a pile of golden coins~ -A large pile of golden coins is lying here.~ -~ -20 0 1 -17645 0 0 0 -10 17645 0 -$ diff --git a/lc-mud/circle/world/obj/52.obj b/lc-mud/circle/world/obj/52.obj deleted file mode 100644 index 12a51a6792c18d6fee79b9fbcee5d3445b30b576..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/52.obj +++ /dev/null @@ -1,423 +0,0 @@ -#5200 -vest ringmail~ -a ringmail vest~ -A vest made of iron rings lies heaped on the floor.~ -~ -9 ag 9 -6 0 0 0 -60 12000 400 -A -17 -1 -#5201 -helm iron~ -an iron helm~ -An iron helm has been left on the ground.~ -~ -9 0 17 -7 0 0 0 -10 5000 800 -A -18 -2 -#5202 -gauntlets iron~ -a pair of iron gauntlets~ -A pair of iron gauntlets rests heavily on the ground.~ -~ -9 0 129 -7 0 0 0 -10 2200 900 -A -18 -3 -A -19 1 -#5203 -sleeves iron~ -a pair of iron sleeves~ -A set of iron sleeves lies on the ground.~ -~ -9 0 257 -7 0 0 0 -10 2450 500 -A -18 -4 -A -19 2 -#5204 -boots iron~ -a pair of iron boots~ -A pair of iron boots has been left here.~ -~ -9 0 65 -4 0 0 0 -6 800 200 -A -18 -1 -A -2 -2 -#5205 -greaves iron~ -a set of iron greaves~ -A set of iron greaves lie here unattended.~ -~ -9 0 33 -7 0 0 0 -10 5400 210 -A -18 -3 -A -2 -3 -#5206 -girth iron~ -an iron girth~ -A small iron girth lies at your feet.~ -~ -9 0 2049 -4 0 0 0 -6 4200 600 -#5207 -plate breast iron~ -a battered iron breast plate~ -A battered iron breast plate lies here.~ -~ -9 0 9 -5 0 0 0 -125 13000 150 -A -18 -6 -#5208 -shield iron~ -a sturdy iron shield~ -A small, but sturdy, iron shield has been left here.~ -~ -9 gh 513 -5 0 0 0 -5 500 1000 -A -23 -2 -A -24 -2 -#5210 -potion black~ -a black potion~ -A jet black potion sits upright waiting to be taken.~ -~ -10 fg 1 -16 4 36 39 -5 6000 1000 -#5211 -potion orange~ -an orange potion~ -A small orange potion lies here.~ -~ -10 fg 1 -20 44 -1 -1 -10 7500 200 -#5213 -staff serpentine~ -a green serpentine staff~ -A green serpentine staff has been left here.~ -~ -4 fg 16385 -15 2 2 23 -12 6600 300 -#5214 -ball quartz~ -a smooth quartz ball~ -A smooth quartz ball lies here gleaming.~ -~ -1 g 16385 -0 0 72 0 -30 3050 950 -#5215 -scroll tattered~ -a tattered scroll~ -A worn and tattered scroll has been left here.~ -~ -2 g 1 -24 24 44 4 -15 11000 4000 -#5216 -scroll bound~ -a bound scroll~ -A bound scroll of detection lies at your feet.~ -~ -2 g 1 -15 18 19 20 -15 4200 100 -#5217 -flute silver~ -a silver flute~ -A brilliant silver flute glimmers from beneath a rock.~ -~ -4 fg 16385 -18 2 2 7 -3 10500 8000 -#5218 -talisman demon~ -a demon-faced talisman~ -A demon-faced talisman glares at you angrily.~ -~ -9 agh 5 -5 0 0 0 -11 2500 150 -A -1 -10 -A -2 -8 -#5219 -venison chunk~ -a chunk of venison~ -A large chunk of venison sits here, ready to be eaten.~ -~ -19 0 1 -24 0 0 0 -20 100 20 -#5220 -fountain blood cracked~ -a large cracked fountain~ -~ -~ -23 0 0 -10 10 13 1 -0 0 0 -E -fountain blood cracked~ -A pool of blood lies in the bottom of the fountain. -~ -#5221 -sword two-handed~ -a two-handed sword~ -A nice two-handed sword hangs on a hook in the wall.~ -~ -5 0 8193 -0 3 6 3 -22 55000 8000 -A -18 -3 -A -19 4 -#5222 -robe black silk~ -a black silk robe~ -A black silk robe lies heaped in one corner.~ -~ -9 0 1025 -1 0 0 0 -6 1300 500 -#5223 -cloak green~ -a dark green cloak~ -A beautiful dark green cloak has been dropped here by someone.~ -~ -9 ag 5 -0 0 0 0 -12 14500 4000 -A -13 8 -A -17 -5 -#5224 -seal ebony~ -an engraved ebony seal~ -A small, engraved ebony seal is here.~ -~ -18 c 16385 -5224 0 0 0 -2 0 0 -#5225 -desk curved~ -the desk~ -~ -~ -15 0 0 -100 13 5224 0 -0 0 0 -#5226 -seal ivory~ -an engraved ivory seal~ -A small, engraved ivory seal lies here.~ -~ -18 c 16385 -5226 0 0 0 -2 0 0 -#5227 -cabinet glass~ -the glass cabinet~ -~ -~ -15 0 0 -500 13 5226 0 -0 0 0 -#5228 -arm rotted~ -a half-rotted arm~ -A half-rotted arm floats lazily past your feet.~ -~ -19 0 1 -50 0 0 1 -20 0 10 -#5230 -stone pale blue~ -a pale blue stone~ -A pale blue stone sits here.~ -~ -8 dg 16385 -0 0 0 0 -10 5500 600 -A -1 1 -#5231 -stone scarlet blue~ -a scarlet and blue stone~ -A pretty scarlet and blue stone has been dropped here.~ -~ -8 dg 16385 -0 0 0 0 -10 5500 600 -A -3 1 -#5232 -stone blue incandescent~ -an incandescent blue stone~ -A small incandescent blue stone lies here.~ -~ -8 dg 16385 -0 0 0 0 -10 5500 600 -A -4 1 -#5233 -stone red deep~ -a deep red stone~ -Someone has left a deep red stone here.~ -~ -8 dg 16385 -0 0 0 0 -10 5500 600 -A -2 1 -#5234 -stone pink~ -a pink stone~ -A tiny pink stone lies at your feet.~ -~ -8 dg 16385 -0 0 0 0 -10 5500 600 -A -5 1 -#5235 -stone pearly white~ -a pearly white stone~ -A lovely, pearly white stone has been carelessly left here.~ -~ -8 dg 16385 -0 0 0 0 -10 8700 600 -A -13 1 -#5236 -stone lavender pale~ -a pale lavender stone~ -A beautiful pale lavender stone lies here.~ -~ -8 dgh 16385 -0 0 0 0 -10 4300 600 -A -24 -2 -#5237 -stone lavender green~ -a lavender and green stone~ -A stunning lavender and green stone rests on the ground.~ -~ -8 dgh 16385 -0 0 0 0 -10 4700 600 -A -24 -4 -#5238 -stone rose dusty~ -a dusty rose stone~ -A stone is here, sort of a dusty rose color and very pretty.~ -~ -8 dg 16385 -0 0 0 0 -10 9800 600 -A -17 -1 -#5239 -stone grey dull~ -a dull grey stone~ -You can barely make out a dull grey stone on the ground.~ -~ -8 dg 16385 -0 0 0 0 -10 20 200 -#5240 -stone purple vibrant~ -a vibrant purple stone~ -A stunningly vibrant purple stone attracts your attention.~ -~ -8 dgh 16385 -0 0 0 0 -10 10200 1000 -A -13 -50 -#5241 -stone pink green~ -a pink and green stone~ -A bright pink and green stone has been left here.~ -~ -8 dgh 16385 -0 0 0 0 -10 6600 1000 -A -18 -5 -#5242 -stone green pale~ -a pale green stone~ -A pale green stone lies here collecting dust.~ -~ -8 dgh 16385 -0 0 0 0 -10 7100 1000 -A -19 -5 -#5243 -stone clear~ -a clear stone~ -An odd clear stone lies at your feet.~ -~ -8 dgh 16385 -0 0 0 0 -10 8900 1000 -A -17 -3 -#5244 -stone iridescent~ -an iridescent stone~ -A large iridescent stone has been left here.~ -~ -8 dgh 16385 -0 0 0 0 -10 3700 1000 -A -13 -100 -#5250 -mandolin~ -a mandolin~ -A mandolin lies against the wall.~ -~ -4 g 16385 -13 3 3 15 -20 3000 1500 -#5251 -harp golden~ -a golden harp~ -A battered golden harp has been tipped over.~ -~ -4 g 16385 -18 1 1 6 -100 2500 800 -$ diff --git a/lc-mud/circle/world/obj/53.obj b/lc-mud/circle/world/obj/53.obj deleted file mode 100644 index 303baa048934f003169100f5740a5bdf488dadb1..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/53.obj +++ /dev/null @@ -1,425 +0,0 @@ -#5300 -mace egyptian~ -an egyptian mace~ -A hierogylph-engraved mace has been left here.~ -~ -5 0 8193 -0 2 6 7 -10 800 50 -E -mace egyptian~ -The mace is formed from solid brass, and engraved in strange hieroglyphs. -~ -#5301 -robe sand~ -some sand-colored robes~ -Sand-colored robes lie here.~ -~ -9 0 1025 -4 0 0 0 -5 500 40 -E -robes sand~ -The robes are colored a sandy off-white, and are in fact caked and covered -with sand as well. You don't seem to be able to remove all of the sand, no -matter how much you try. -~ -#5302 -dirk obsidian~ -an obsidian dirk~ -A flat dirk made of chipped obsidian lies here.~ -~ -5 g 8193 -0 3 3 11 -8 1000 100 -A -2 1 -A -18 1 -E -dirk obsidian~ -The blade of the dirk is black, glassy obsidian, chipped razor sharp. -~ -#5303 -turban cloth~ -a dirty cloth turban~ -A dirty cloth turban has been forgotten here.~ -~ -9 g 17 -5 0 0 0 -10 1500 250 -A -2 1 -A -13 5 -E -turban cloth~ -The turban used to be white cloth, now it is covered with oil and dirt from -the head and hair of its previous owner, who must not have bathed much. -~ -#5304 -wrappings cloth~ -some cloth wrappings~ -Long cloth wrappings lie on the ground in a pile.~ -~ -9 0 9 -5 0 0 0 -15 1250 175 -E -wrappings cloth~ -The cloth wrappings are old, wrinkled, and stink of embalming fluid. -~ -#5305 -bottle fluid~ -a bottle of embalming fluid~ -A dusty bottle lies here on the ground.~ -~ -10 0 1 -5 33 -1 -1 -5 250 50 -E -bottle fluid~ -The bottle is dusty and the fluid has a strange sickly-sweet smell to it. -~ -#5306 -jar formaldehyde~ -a jar of formaldehyde~ -A small jar lies here on the ground.~ -~ -10 0 1 -10 16 -1 -1 -6 300 60 -E -jar formaldehyde~ -The jar is sticky and smells really bad. -~ -#5307 -ball fire~ -a small hot ball of fire~ -A little ball of fire hovers in the air before your eyes.~ -~ -1 agp 16385 -0 0 -1 0 -10 3500 500 -A -13 10 -A -14 50 -E -ball fire~ -The ball of fire is hot to the touch and very very bright. -~ -#5308 -scimitar stone~ -a stone scimitar~ -A curved scimitar made of stone rests on the ground.~ -~ -5 bgmno 8193 -0 4 3 3 -18 10000 750 -A -18 2 -A -19 3 -E -scimitar stone~ -The scimitar is formed from solid stone, chipped and carved to perfection, -with a sharp, cold blade that is marred only by a few nicks here and there. -~ -#5309 -key stone~ -a stone key~ -A stone key has been dropped here.~ -~ -18 c 16385 -5309 0 0 0 -15 0 0 -E -key stone~ -The key is made from stone, but is otherwise unremarkable. -~ -#5310 -sarcophagus stone~ -a mighty stone sarcophagus~ -A mighty stone sarcophagus lies in the center of the tomb.~ -~ -15 0 0 -500 15 5309 0 -5000 5000 5000 -E -sarcophagus stone~ -The sarcophagus is engraved on the sides with the images of pharoahs, -great wars fought long ago, mighty pyramids being constructed... - -A raised image atop the sarcophagus is formed in the visage of one of -the mighty pharoahs, painted in gold and studded with precious gems. - -You see a small keyhole in the side of the sarcophagus. -~ -#5311 -dust~ -some ancient dust~ -A small pile of dust is being scattered by the breeze.~ -~ -13 0 1 -0 0 0 0 -1 1 1 -E -dust~ -The dust is old. As you sift it through your hands you find tiny chips -of aged bone inside -- it must be the ancient remains of something. -~ -#5312 -scarab emerald~ -a small emerald scarab~ -A small emerald scarab lies here on the ground.~ -~ -18 c 16385 -5312 0 0 0 -5 0 0 -E -scarab emerald~ -The scarab is intricately detailed, down to the tiny hairs on its -insectile legs and the faceting of the emeralds in its eyes. -~ -#5313 -lamp~ -the lamp~ -A small, tarnished, battered lamp has been dropped here.~ -~ -4 abgk 16385 -25 5 5 51 -10 25000 600 -A -17 -5 -A -18 1 -E -lamp~ -The lamp is quite old and tarnished. You rub at it to get some of the -grime off, but it doesn't seem like anybody is home. -~ -#5314 -ankh~ -an ankh~ -A small brass ankh has been left here.~ -~ -9 ik 16385 -7 0 0 0 -9 10000 300 -A -3 1 -A -4 2 -E -ankh~ -The ankh is a small brass symbol of an ancient religion. It glows -with a soft bright light that is soothing to you. -~ -#5315 -book riddles~ -a book of riddles~ -A medium-sized parchment book with well-worn pages lies here.~ -~ -2 0 1 -21 201 20 22 -15 7500 250 -E -book riddles~ -The book has well-worn pages, containing many befuddling riddles -to surprise, confuse, and amuse you. You find yourself bewildered -by its contents and put it down to sort your head out. -~ -#5316 -paw lion~ -a lion's paw~ -The mighty paw of a lion-like creature has been dropped here.~ -~ -5 g 8193 -0 1 14 5 -20 18000 600 -A -5 1 -A -18 4 -E -paw lion~ -The massive paw has straps on it formed of bronze, so that it will -fit snugly over your hand. As you put it on, it melds with your hand, -becoming an extension of your arm. -~ -#5317 -parchment answer~ -the answer~ -A small piece of parchment covered in hieroglyphics lies here.~ -~ -18 c 16385 -5317 0 0 0 -1 1 1 -E -answer hieroglyphics parchment~ -You cannot decipher the strange hieroglyphics that cover the -sheet of parchment. -~ -#5318 -treasure~ -the treasure of the sphinx~ -The massive treasure of the sphinx lies here in a big pile.~ -~ -20 0 1 -23850 0 0 0 -23 23850 0 -E -treasure~ -The treasure is incredibly large, filled with gold coins and valuables, more -wealth than you could ever possibly imagine accumulated in one place. -~ -#5319 -sand pile~ -a pile of sand~ -You see a small pile of sand.~ -~ -20 0 1 -12986 0 0 0 -12 12986 0 -E -sand pile~ -You think you see some coins and valuables glinting amongst the grains of -sand. -~ -#5320 -curse mummy~ -the curse of the mummy~ -Some fortunate soul has escaped the mummy's curse, for now.~ -~ -13 cdfgh 16385 -0 0 0 0 -1 500 50 -A -13 -50 -A -14 -100 -E -curse mummy~ -Rumor has it that whomever disturbs the grave of the mummy shall be -cursed for all eternity, and that the descendents of that person shall -likewise be cursed for ten generations to follow. -~ -#5321 -elixir small glass~ -a small elixir~ -A small glass elixir lies under your feet.~ -~ -10 g 1 -30 39 1 36 -2 10000 500 -E -elixir small glass~ -The elixir is deceptively small. Something tells you that its -contents are truly quite potent. Perhaps too potent for ordinary -mortals to attempt to consume. -~ -#5322 -mask golden~ -a golden mask~ -A beautiful, intricately detailed mask has been forgotten here.~ -~ -9 g 17 -10 0 0 0 -10 15000 750 -A -12 25 -A -13 10 -E -mask golden~ -This beautiful mask was shaped from solid gold and magically enchanted -to perfectly fit the face of any who choose to wear it, its golden features -and turquoise highlights even moving to match the expressions of the face -of the wearer. -~ -#5323 -diamond~ -the diamond~ -~ -~ -13 0 1 -0 0 0 0 -5 0 0 -E -diamond~ -Aha! - -You see a multifaceted gemstone, which strangely reflects no -light, making it very hard to see when it lies on the ground. -~ -#5324 -wand sun brass pipe~ -a blazing sun wand~ -A small length of brass pipe shines here with its own light.~ -~ -3 agp 16385 -25 5 5 27 -10 25000 1000 -A -21 -5 -A -24 -5 -E -wand sun brass pipe~ -This small brass shaft is a holy weapon used by the ancient people of -this land to defend against the deadliest of foes. It shines with the -brilliant blazing light of the sun. -~ -#5325 -ring sandy~ -a sandy-coloured ring~ -A small sandy-coloured ring has been carelessly dropped here.~ -~ -9 bg 3 -8 0 0 0 -5 20000 750 -A -3 1 -A -12 35 -E -ring sandy~ -The ring is small, smooth, sandy-coloured and unremarkable, save that -it gives off a continuous low humming noise that tickles your fingertips. -~ -#5326 -sphinx golden~ -a small golden sphinx~ -A small golden sphinx glints in the light.~ -~ -8 g 16385 -0 0 0 0 -5 50000 750 -A -4 2 -E -sphinx golden~ -The golden sphinx is incredibly detailed and very small, fitting easily -into the palm of your hand. You can even make out the expression -of wisdom and peace on its face. -~ -#5327 -leggings sphinxian~ -a pair of sphinxian leggings~ -Massive leggings formed from the body of a sphinx stand here.~ -~ -9 gk 33 -10 0 0 0 -20 20000 500 -A -1 3 -A -14 80 -E -leggings sphinxian~ -These magically fashioned leggings impart the strength and stamina -of the mightiest of the ancient sphinxes. You feel ancient power -emanating from them; they seem to be almost alive. -~ -$ diff --git a/lc-mud/circle/world/obj/54.obj b/lc-mud/circle/world/obj/54.obj deleted file mode 100644 index 226df9501822bdcc7cc39f1e7a504b79a3200b15..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/54.obj +++ /dev/null @@ -1,812 +0,0 @@ -#5400 -palace key~ -the palace key of New Thalos~ -A large key bearing the crest of New Thalos lies here.~ -~ -18 c ao -5400 0 0 0 -5 0 0 -#5401 -city key~ -the Key to the City of New Thalos~ -The heavy city key lies here in the dust~ -~ -18 c ao -5401 0 0 0 -5 0 0 -#5402 -fountain water~ -the large central fountain~ -The large central fountain domintating the central square rests here.~ -~ -23 ce 0 -9999 9999 0 0 -9999 0 0 -#5403 -morningstar morning star~ -a morningstar~ -A small spiked metal ball connected to a rod by links of chain lies here.~ -~ -5 0 8193 -0 2 5 6 -5 1200 500 -#5404 -awl-pike~ -an awl-pike~ -An awl pike lies here.~ -~ -5 0 8193 -0 1 12 5 -3 2100 100 -#5405 -bardiche~ -a bardiche~ -A bardiche lies here.~ -~ -5 0 8193 -0 2 6 3 -4 1900 110 -#5406 -corbin bec~ -a bec de corbin~ -A bec de corbin lies here.~ -~ -5 0 8193 -0 1 8 3 -3 5400 50 -#5407 -guisarme bill~ -a bill-guisarme~ -A bill-guisarme lies here.~ -~ -5 0 8193 -0 1 10 3 -3 1300 50 -#5408 -fauchard~ -a fauchard~ -A fauchard lies here.~ -~ -5 0 8193 -0 1 8 1 -3 1250 20 -#5409 -glaive~ -a glaive~ -A glaive lies here.~ -~ -5 0 8193 -0 1 10 5 -3 1870 20 -#5410 -guisarme~ -a guisarme~ -A guisarme lies here.~ -~ -5 0 8193 -0 2 4 4 -4 1953 20 -#5411 -sickle~ -a sickle~ -A sickle lies here.~ -~ -5 0 8193 -0 2 4 3 -1 500 10 -#5412 -sword bastard two-handed~ -a two-handed bastard sword~ -A two handed bastard sword lies here.~ -~ -5 0 8193 -0 2 8 3 -18 12580 10000 -#5413 -scimitar~ -a scimitar~ -A scimitar lies here.~ -~ -5 0 8193 -0 1 9 3 -10 1200 150 -A -19 1 -#5414 -rapier~ -a rapier~ -A rapier lies here.~ -~ -5 0 8193 -0 1 8 3 -10 3100 100 -A -18 1 -#5415 -suit mail banded~ -a suit of banded mail~ -A suit of banded mail lies here.~ -~ -9 agmno 9 -8 0 0 0 -25 3400 800 -#5416 -suit brigandine~ -a suit of brigandine~ -A suit of brigandine lies here.~ -~ -9 agmo 9 -7 0 0 0 -20 2000 420 -#5417 -suit plate field~ -a suit of field plate~ -A suit of field plate lies here.~ -~ -9 agmno 9 -9 0 0 0 -28 4000 1000 -#5418 -suit ringmail ring mail~ -a suit of ringmail~ -A suit of ringmail lies here.~ -~ -9 n 9 -5 0 0 0 -6 1385 100 -#5419 -suit splintmail splint mail~ -a suit of splintmail~ -A suit of splintmail aromr lies here.~ -~ -9 m 9 -4 0 0 0 -5 2500 100 -#5420 -shield wooden~ -a wooden shield~ -A wooden shield lies here~ -~ -9 0 513 -1 0 0 0 -1 10 1 -#5421 -shield splinted~ -a splinted shield~ -A splinted shield lies here.~ -~ -9 0 513 -7 0 0 0 -8 175 17 -#5422 -buckler shield~ -a buckler~ -A buckler lies here.~ -~ -9 0 513 -1 0 0 0 -6 30 7 -#5423 -jacket leather~ -a leather jacket~ -A leather jacket lies here.~ -~ -9 0 9 -3 0 0 0 -6 600 200 -#5424 -sleeves leather~ -a pair of leather sleeves~ -A pair of leather sleeves lies here.~ -~ -9 0 257 -2 0 0 0 -2 350 200 -#5425 -cap leather~ -a leather cap~ -A leather cap lies here~ -~ -9 0 17 -1 0 0 0 -2 65 200 -#5426 -pants leather~ -a pair of leather pants~ -A pair of leather pants lies here.~ -~ -9 0 33 -2 0 0 0 -2 850 200 -#5427 -gloves leather~ -a pair of leather gloves~ -A pair of leather gloves lies here.~ -~ -9 0 129 -2 0 0 0 -2 150 200 -#5428 -boots padded leather~ -a pair of padded leather boots~ -A pair of padded leather boots lies here.~ -~ -9 0 65 -2 0 0 0 -2 410 200 -#5429 -jacket studded leather~ -a studded leather jacket~ -A studded leather jacket lies here.~ -~ -9 0 9 -3 0 0 0 -10 650 200 -#5430 -sleeves studded leather~ -a pair of studded leather sleeves~ -A pair of studded leather sleeves lie here.~ -~ -9 0 257 -3 0 0 0 -3 500 200 -#5431 -pants studded leather~ -a pair of studded leather pants~ -A pair of studded leather pants lie here.~ -~ -9 0 33 -3 0 0 0 -3 500 200 -#5432 -gloves studded leather~ -a pair of studded leather gloves~ -A pair of studded leather gloves lie here.~ -~ -9 0 129 -3 0 0 0 -3 500 200 -#5433 -shield leather~ -a leather shield~ -A leather shield lies here.~ -~ -9 0 513 -5 0 0 0 -3 50 200 -#5434 -sack~ -a sack~ -A sack lies here~ -~ -15 0 16385 -50 0 0 0 -1 20 200 -#5435 -lamp oil oillamp~ -an oil lamp~ -An oil lamp lies here~ -~ -1 0 1 -0 0 48 0 -1 100 200 -#5436 -backpack back pack~ -a backpack~ -A backpack lies here~ -~ -15 0 1025 -75 1 0 0 -8 100 100 -#5437 -basket~ -a basket~ -A basket lies here.~ -~ -15 0 1 -50 0 0 0 -4 250 50 -#5438 -pouch belt~ -a belt pouch~ -A belt pouch lies here~ -~ -15 0 2049 -25 0 0 0 -3 100 20 -#5439 -candle~ -a candle~ -A candle lies here~ -~ -1 0 16385 -0 0 50 0 -1 35 10 -#5440 -cheese~ -a hunk of cheese~ -A hunk of cheese lies here.~ -~ -19 0 1 -5 0 0 0 -1 5 10 -#5441 -bread~ -some bread~ -Some bread lies here.~ -~ -19 0 1 -3 0 0 0 -1 3 10 -#5442 -rations dry~ -some dry rations~ -Some dry rations lie here.~ -~ -19 0 1 -20 0 0 0 -2 20 30 -#5443 -rations iron~ -some iron rations~ -A tin of iron rations lies here.~ -~ -19 0 1 -25 0 0 0 -3 25 50 -#5445 -nuts~ -some nuts~ -Some nuts lie scatterd on the ground.~ -~ -19 0 1 -1 0 0 0 -1 1 10 -#5446 -belt~ -a belt~ -A nicely made belt lies here.~ -~ -9 0 2049 -0 0 0 0 -2 2 10 -#5447 -boots hiking~ -a pair of hiking boots~ -A nicely made pair of boots lies here.~ -~ -9 0 65 -0 0 0 0 -3 390 10 -#5448 -cloak fur~ -a fur cloak~ -A nicely made fur cloak lies here.~ -~ -9 0 1025 -0 0 0 0 -2 4550 50 -#5449 -girdle~ -a girdle~ -A nicely made girdle lies here.~ -~ -9 0 2049 -0 0 0 0 -1 375 10 -#5450 -hose~ -a pair of hose~ -A nicely made pair of hose lies here.~ -~ -9 0 33 -0 0 0 0 -1 120 10 -#5451 -robe common~ -a common robe~ -A nicely made robe of common cloth lies here.~ -~ -9 0 5 -0 0 0 0 -2 90 20 -#5452 -robe embroidered~ -an embroidered robe~ -A nicely made robe of embroidered cloth lies here.~ -~ -9 0 5 -0 0 0 0 -2 2500 5 -#5453 -sandals~ -a pair of sandals~ -A nicely made pair of sandals lies here.~ -~ -9 0 65 -0 0 0 0 -1 15 10 -#5454 -sash~ -a sash~ -A nicely made sash lies here.~ -~ -9 0 2049 -0 0 0 0 -1 20 10 -#5455 -jacket silk~ -a silk jacket~ -A nicely made silk jacket lies here.~ -~ -9 0 1025 -0 0 0 0 -1 3800 100 -#5456 -egg~ -an egg~ -An egg lies here.~ -~ -19 0 1 -2 0 0 0 -1 3 10 -#5457 -carrot~ -a carrot~ -A carrot lies here.~ -~ -19 0 1 -3 0 0 0 -1 4 10 -#5458 -tomato~ -a tomato~ -A tomato lies here.~ -~ -19 0 1 -2 0 0 0 -1 8 10 -#5459 -fig~ -a fig~ -A fig lies here.~ -~ -19 0 1 -1 0 0 0 -1 2 10 -#5460 -dates~ -some dates~ -A bunch of dates lies here.~ -~ -19 0 1 -2 0 0 0 -1 4 10 -#5461 -lamb leg~ -a leg of lamb~ -A leg of lamb lies here.~ -~ -19 0 1 -10 0 0 0 -2 10 20 -#5462 -beef side~ -a side of beef~ -A side of beef lies here.~ -~ -19 0 1 -15 0 0 0 -5 20 50 -#5463 -chicken whole~ -a whole chicken~ -A whole skinned chicken lies here.~ -~ -19 0 1 -12 0 0 0 -3 12 30 -#5464 -herring salted~ -a salted herring~ -A salted herring lies here.~ -~ -19 0 1 -8 0 0 0 -1 8 10 -#5465 -muscle~ -a muscle~ -A muscle lies here.~ -~ -19 0 1 -4 0 0 0 -1 4 10 -#5467 -glass liquor blue oasis whisky~ -a glass~ -A glass of blue alcohol rests here.~ -~ -17 0 1 -5 5 5 0 -1 1800 10 -#5468 -glass wine~ -a glass~ -A glass rests here.~ -~ -17 0 1 -1 1 2 0 -1 3800 10 -#5469 -bottle grog ale~ -a bottle of grog~ -A bottle lies here.~ -~ -17 0 1 -2 2 3 0 -1 8000 10 -#5470 -vial glowing blue~ -a glowing blue vial~ -A glowing blue vial lies here.~ -~ -10 ag 16385 -12 1 3 -1 -1 800 15 -E -vial glowing blue~ -The blueish liquid inside this potion bottle is glowing with -a strange light. There is a small label that reads 'Protection' -~ -#5471 -potion green~ -a deep-green potion~ -A deep-green potion lies here.~ -~ -10 ag 16385 -10 15 35 -1 -1 5000 15 -E -potion green~ -The potion inside the bottle is a greenish colour and has a -small label which reads 'Curative' -~ -#5472 -potion crystal clear~ -a crystal clear potion~ -A crystal clear potion lies here.~ -~ -10 g 16385 -10 50 51 35 -1 3000 15 -E -potion crystal clear~ -This glass bottle appears to contain a clear liquid. There is a -label on the bottle which reads 'Preparation' -~ -#5473 -potion white~ -an off-white potion~ -An off-white potion lies here.~ -~ -10 0 16385 -15 14 28 36 -1 3000 15 -E -potion white~ -This potion bottle contains a whitish liquid that looks rather thick. -A small label reads 'Redemption' -~ -#5474 -potion dark blue~ -a dark blue potion~ -A dark blue potion lies here.~ -~ -10 0 16385 -10 35 14 -1 -1 4000 15 -E -potion dark blue~ -This dark blue potion has a small label on it reading 'Restoration' -~ -#5475 -bottle scorpion flaming beer~ -a flaming scorpion~ -A bottle of strong beer lies here.~ -~ -17 0 1 -5 5 1 0 -1 500 10 -#5476 -barrel beer~ -a barrel~ -A barrel of beer lies here.~ -~ -17 0 1 -10 10 1 0 -15 900 50 -#5477 -shot whisky~ -a shot~ -A shot of strong liquor lies here.~ -~ -17 0 1 -1 1 5 0 -1 350 10 -#5478 -scroll recall~ -a scroll of recall~ -A scroll of recall lies here.~ -~ -2 g 16385 -12 42 -1 -1 -4 2000 25 -#5479 -wand grey silver~ -a grey-silver wand~ -A grey-silver wand lies here.~ -~ -3 gnop 16385 -15 1 1 6 -1 10000 15 -E -wand grey silver~ -You see a small engraved storm cloud at the base of this wand. -~ -#5480 -wand yellow~ -a wand of glinting yellow~ -A wand of glinting yellow lies here.~ -~ -3 g 16385 -1 1 1 19 -1 666 15 -E -wand yellow~ -You see a shape slowly fading into existance at the base of this wand. -~ -#5481 -wand oak~ -an oak wand~ -A wand of oak lies here.~ -~ -3 g 16385 -5 1 1 32 -1 500 15 -#5482 -wand pink~ -a pink wand~ -A pink wand lies here~ -~ -3 g 16385 -3 1 1 38 -1 5000 15 -#5483 -shears sewing~ -a pair of sewing shears~ -A pair of sewing shears lies here.~ -~ -5 0 8193 -0 1 4 1 -2 100 50 -#5484 -cleaver meat~ -a meat cleaver~ -A meat cleaver lies here~ -~ -5 cd 8193 -0 1 5 0 -5 100 10 -#5485 -pen fountain~ -a fountain pen~ -A fountain pen lies here.~ -~ -5 b 8193 -0 1 3 11 -1 100 5 -#5486 -hammer sledge~ -a sledge hammer~ -A sledge hammer lies here.~ -~ -5 0 8193 -0 2 3 6 -24 200 40 -#5487 -shoe horse~ -a horse shoe~ -A horse shoe lies here.~ -~ -9 bg 16389 -1 0 0 0 -2 1000 200 -A -18 1 -#5488 -saddle~ -a saddle~ -A saddle lies here.~ -~ -12 0 1 -0 0 0 0 -4 100 50 -#5489 -crop riding~ -a riding crop~ -A riding crop lies here.~ -~ -5 0 8193 -0 1 4 2 -1 50 10 -#5490 -chessboard~ -a chessboard~ -A heavy marble chessboard lies here.~ -~ -5 0 16385 -0 1 30 6 -10 100 20 -#5491 -seed sesame~ -a sesame seed~ -A sesame seed lies here.~ -~ -19 0 16385 -6 0 0 0 -1 10 0 -#5492 -spear gae bolg~ -Gae Bolg~ -A beautiful spear is lying on the ground here.~ -~ -5 agmno 8193 -0 5 3 11 -12 18000 12500 -E -spear gae bolg~ -The beautiful, glowing spear is close to eight feet long and has -a bright, polished silver blade that tapers at the end into what -must be the finest point you have ever seen. -~ -#5493 -key~ -the jail key~ -The key to the jail lies here.~ -~ -18 c 16385 -5493 0 0 0 -1 100 200 -#5494 -key~ -the dungeon key~ -The dungeon key lies here.~ -~ -18 c 16385 -5494 0 0 0 -1 100 200 -#5495 -claw wolverine~ -the wolverine claw~ -A claw from some animal lies here.~ -~ -5 bl 8193 -0 3 6 8 -2 400 50 -A -13 -20 -#5496 -wrath allah mace~ -the wrath of Allah~ -A large ornate mace floats above the ground here.~ -~ -5 agmop 8193 -0 4 4 6 -16 25000 12500 -E -wrath allah mace~ -This enormous weapon looks like it could pound the stuffing out of -anything or anyone around. -~ -$ diff --git a/lc-mud/circle/world/obj/60.obj b/lc-mud/circle/world/obj/60.obj deleted file mode 100644 index e9a2e60829df6a49aac6c24702405528712b822b..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/60.obj +++ /dev/null @@ -1,285 +0,0 @@ -#6000 -axe lumber~ -a lumber axe~ -A heavy lumber axe lies here.~ -~ -5 d 8193 -0 2 3 3 -12 50 15 -E -axe lumber~ -It is a heavy axe of the kind lumberjacks use to chop down trees. -~ -A -18 1 -#6001 -shirt chequered~ -a chequered shirt~ -A chequered shirt lies here.~ -~ -9 d 9 -1 0 0 0 -2 20 8 -E -shirt chequered~ -It is an extra large, chequered shirt made from heavy cloth. -~ -#6002 -boots leather~ -a pair of worn leather boots~ -A pair of worn leather boots lies here.~ -~ -9 d 65 -2 0 0 0 -4 60 10 -E -boots~ -They are fashioned from rough leather that has been oiled frequently to make -it stay waterproof. They look worn but quite functional. -~ -#6003 -fireplace~ -a fireplace~ -A fireplace made from stone is set against the east wall.~ -~ -15 0 0 -200 0 0 0 -0 0 0 -E -fireplace~ -It is fashioned from stones of various sizes that have been stacked on top of -each other and fastened with mortar. Its chimney is constructed likewise and -leads the smoke out through the low cabin ceiling. -~ -#6004 -lantern brass hooded~ -a hooded brass lantern~ -A hooded brass lantern has been left here.~ -~ -1 0 16385 -0 0 100 0 -4 60 10 -E -lantern brass hooded~ -It is a large and robust but somewhat battered oil lantern made from brass, -and it is equipped with a handle to make it handy and a hood to protect its -flame. Some letters have been scratched on its bottom. -~ -E -letters~ -The letters say: - -Use 'hold lantern' to activate. - -~ -#6005 -chest wooden~ -a wooden chest~ -A wooden chest stands in the corner.~ -~ -15 0 1 -100 15 6006 0 -20 100 10 -E -chest wooden~ -It is a robust chest made from short, heavy planks that have been fastened -together with tenons. It is equipped with a simple brass lock. -~ -#6006 -key brass~ -a small brass key~ -A small brass key lies here.~ -~ -18 c 16385 -6006 0 0 0 -1 0 0 -E -key brass~ -It is a small, simple brass key with no inscriptions or marks of any kind. -~ -#6007 -coins gold~ -a heap of gold coins~ -Some gold coins lie piled up in a heap on the floor.~ -~ -20 0 1 -127 0 0 0 -1 127 0 -E -coins gold~ -The coins seem to be gold. They are obviously valuable. -~ -#6010 -blackberries berries~ -some blackberries~ -Some blackberries grow on a bush nearby.~ -~ -19 c 1 -3 0 0 0 -1 0 0 -E -blackberries berries~ -They look very tasty indeed. -~ -#6011 -mushroom~ -a mushroom~ -A small mushroom grows nearby.~ -~ -19 0 1 -6 0 0 0 -1 10 10 -E -mushroom~ -It looks to be a tasty little thing. -~ -#6012 -sign~ -a large sign~ -A large sign mounted on a pole is standing by the roadside.~ -~ -12 0 0 -0 0 0 0 -100 0 0 -E -pole~ -Not the most interesting pole in the world. -Better leave it here, though, as it holds the sign in place. -~ -E -sign~ -It says :- - - Haon-Dor - -------- - - This is the Forest of Haon-Dor. Enter at your own risk. - Please report any strange occurrences to Furry, - as Quifael and Derkhil are currently indisposed. - -~ -#6013 -barrel water~ -a barrel~ -A water barrel has been left here.~ -~ -17 0 1 -40 40 15 0 -45 60 20 -#6014 -water brook~ -a small brook~ -A small brook trickles through the forest beside the path.~ -~ -23 0 0 -50000 50000 15 0 -0 0 0 -E -water brook~ -The water looks clean and refreshing. -~ -#6015 -water lake~ -the lake~ -~ -~ -23 0 0 -50000 50000 0 0 -0 0 0 -#6016 -cudgel oak oaken limb~ -an oaken cudgel~ -A limb has fallen here.~ -~ -5 g 8193 -0 1 7 7 -16 1 20 -A -19 2 -A -1 -2 -E -cudgel oak oaken limb~ -The cudgel looks quite sturdy, and would make a nice weapon. -~ -#6017 -corpse boar~ -the corpse of a boar~ -~ -~ -15 0 0 -100 0 0 0 -500 1 1 -#6018 -slab meat~ -a large slab of meat~ -A large piece of freshly cut boar meat is on the ground here.~ -~ -19 0 1 -24 0 0 0 -15 40 1 -E -slab meat~ -It looks quite filling. -~ -#6019 -tusks pair~ -a pair of boar tusks~ -A pair of large boar tusks have been dropped here.~ -~ -8 0 16385 -0 0 0 0 -10 60 1 -E -tusks pair~ -They look like they might be worth something to a craftsman. -~ -#6020 -log hollow floating~ -a hollow log~ -~ -~ -22 0 1 -0 0 0 0 -48 2 1 -E -log~ -It looks like it would probably float. -~ -#6021 -nest bird~ -the bird's nest~ -~ -~ -15 0 0 -30 0 0 0 -0 0 0 -#6022 -egg blue robin~ -a blue robin's egg~ -A small bluish egg has been left here.~ -~ -19 0 1 -6 0 0 0 -1 10 0 -E -egg blue robin~ -It is small, but food nonetheless. -~ -#6023 -meat rabbit~ -a piece of rabbit meat~ -A large piece of rabbit meat.~ -~ -19 0 1 -12 0 0 0 -5 29 20 -#6024 -meat deer venison~ -a piece of venison~ -A large piece of venison.~ -~ -19 0 1 -24 0 0 0 -10 80 20 -$ diff --git a/lc-mud/circle/world/obj/61.obj b/lc-mud/circle/world/obj/61.obj deleted file mode 100644 index a17e8c17f5c4fcbc3db178d9ca4450a6fe2d7a62..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/61.obj +++ /dev/null @@ -1,283 +0,0 @@ -#6101 -sign~ -a sign~ -An old, battered sign lies on the ground.~ -~ -12 0 1 -0 0 0 0 -10 2 2 -E -sign~ -Only some of the letters are legible :- - _ - _________| |_________ - / | | \ - / CAR.AX | | M.STY \ - \ M..SI.N | | SW..P / - \_________| |_________/ - | | - -~ -#6102 -tree opening~ -a colossal tree~ -A colossal tree blocks the way westward.~ -~ -15 0 0 -1000 0 0 0 -0 0 0 -E -tree~ -This enormous tree must be a thousand years old. Its rough bark looks grey -and pale and is decorated with scratches and clawmarks. On its west side is -a small opening just above ground level. -~ -E -opening~ -The opening is far too narrow for you to squeeze through but it looks as if -the tree is hollow. -~ -#6103 -branch grey long~ -a long, grey branch~ -A long, grey branch rests heavily on the ground.~ -~ -1 0 16385 -0 0 25 0 -20 1 3 -E -branch grey long~ -It is quite heavy and looks as if it has been dropped from great height. It -is long dead and very dry. Could probably be lighted quite easily. -~ -#6104 -branch grey long~ -a long, grey branch~ -A long, grey branch rests heavily on the ground.~ -~ -5 0 8193 -0 2 6 7 -18 60 20 -E -branch grey long~ -It is very heavy and looks as if it has been dropped from great height. It -is long and straight and the wood is very hard, still being full of sap. -Although it does not fit very well in your hand, it could be used as a clumsy -but very heavy weapon. -~ -A -18 -2 -#6105 -branch grey long~ -a long, grey branch~ -A long, grey branch rests heavily on the ground.~ -~ -13 0 1 -0 0 0 0 -40 0 0 -E -branch grey long~ -It is very heavy and looks as if it has been dropped from great height. It -is somewhat twisted and the hard wood is still full of sap. -~ -#6106 -toadstool~ -a toadstool~ -A large toadstool grows nearby.~ -~ -19 0 1 -12 0 0 0 -5 20 20 -E -toadstool~ -It is a large, brown boletus that must weigh nearly five pounds. The top -surface is covered in a thin layer of transparent slime that emits a weak, -musty smell. Not the most delicious thing you have seen. -~ -#6107 -toadstool~ -a toadstool~ -A large toadstool grows nearby.~ -~ -19 0 1 -12 0 0 1 -5 20 20 -E -toadstool~ -It is a large, brown boletus that must weigh nearly five pounds. It -has small white spots and the top surface is covered in a thin layer -of transparent slime that emits a weak, musty smell. Not the most -delicious thing you have seen. -~ -#6108 -coins gold~ -a big pile of gold coins~ -A big pile of gold coins is lying here.~ -~ -20 0 1 -15326 0 0 0 -15 15326 0 -#6109 -potion blue~ -a blue potion~ -A blue potion has been left here.~ -~ -10 g 1 -15 28 -1 -1 -2 68000 5000 -E -potion blue~ -It has a nice deep blue color and a smell like peppermint. -~ -#6110 -potion yellow musky~ -a musky yellow potion~ -A yellow potion has been left here.~ -~ -10 g 1 -15 39 -1 -1 -2 1000 200 -E -potion yellow musky~ -It has a deep yellow color and and a strong spicy smell. -~ -#6111 -shield round large~ -a large round shield~ -A large round shield has been left here.~ -~ -9 0 513 -5 0 0 0 -15 300 800 -E -shield round large~ -It is made from hard wood that has been reinforced with heavy iron bands. -~ -#6112 -crown iron~ -an iron crown~ -An iron crown rests on the ground.~ -~ -9 g 17 -6 0 0 0 -20 7000 500 -E -crown iron~ -It is a heavy human-sized crown made from solid iron. -~ -#6113 -sceptre iron~ -an iron sceptre~ -An iron sceptre lies on the ground.~ -~ -1 g 16385 -0 0 -1 0 -10 5000 700 -E -sceptre iron~ -It is a heavy sceptre made from solid iron. -~ -#6114 -ring iron~ -an iron ring~ -An iron ring has been left here.~ -~ -11 g 3 -0 0 0 0 -10 5000 500 -E -ring iron~ -It is a quite heavy human-sized ring made from solid iron. It lacks -decorations of any kind. -~ -A -17 -4 -A -9 1 -#6115 -star morning-star~ -the morning star~ -the morning star is here collecting dust while it lies on the ground.~ -~ -5 g 8193 -0 2 9 7 -10 15000 2000 -A -18 2 -#6116 -shirt scale~ -a black dragon scale shirt~ -A black dragon scale shirt has been left here.~ -~ -9 g 9 -6 0 0 0 -10 10000 100 -E -shirt scale~ -It is a sleeveless shirt made from big, black dragon scales joined -with silver threads. Its inside has been made from the soft skin -on the dragon's belly, making it very comfortable to wear. The word -'Isha' has been engraved on one of the scales. -~ -#6117 -skirt scale~ -a black dragon scale skirt~ -A black dragon scale skirt has been left here.~ -~ -9 g 33 -6 0 0 0 -8 5000 100 -E -skirt scale~ -It is a short skirt made from big, black dragon scales joined with -silver threads. Its inside has been made from the soft skin on the -dragon's belly, making it very comfortable to wear. The word 'Isha' -has been engraved on one of the scales. -~ -#6118 -cloak black~ -a black, hooded cloak~ -A large, hooded cloak, as dark as the night, has been left here.~ -~ -11 g 1025 -0 0 0 0 -20 8000 4000 -E -cloak black~ -It is a heavy, black cloak with a large hood. The word 'Isha' is written -inside it with a silver thread. -~ -A -17 -6 -A -24 -4 -#6119 -belt silver~ -a broad silver belt~ -A broad silver belt has been left here.~ -~ -9 ag 2049 -6 0 0 0 -4 5000 3500 -E -belt silver~ -It is a broad belt made from tiny silver rings woven together. -~ -#6120 -sword long slender~ -a long, slender sword~ -A long, slender sword lies on the ground.~ -~ -5 agjl 8193 -0 3 6 3 -4 30000 6000 -E -sword long slender~ -It is a long, slender sword that seems to be made from silver. The word -'Isha' has been engraved on the hilt. -~ -A -18 4 -A -19 2 -$ diff --git a/lc-mud/circle/world/obj/62.obj b/lc-mud/circle/world/obj/62.obj deleted file mode 100644 index 27e4ad738c7d039da9319c1ba7f324f2f55da038..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/62.obj +++ /dev/null @@ -1,87 +0,0 @@ -#6200 -key~ -a key~ -A key sits here.~ -~ -18 cdq 16385 -6200 0 0 0 -1 20 0 -E -key~ -It is a plain looking key. -~ -#6201 -manacles~ -a set of manacles~ -A set of iron manacles lie here.~ -~ -9 h 129 -0 0 0 0 -20 100 20 -E -manacles~ -They're big steel cuffs, meant to be locked around the hands. -~ -A -18 -20 -#6202 -shackles~ -a set of shackles~ -A set of shackles sit here, discarded.~ -~ -9 h 65 -0 0 0 0 -20 100 20 -E -shackles~ -Big iron cuffs, meant to be locked around the ankles. -~ -A -14 -80 -#6203 -Runestone rune stone~ -the Runestone~ -A small stone with an inscription sits here.~ -~ -1 a 16385 -0 0 -1 0 -1 10000 2000 -E -runestone rune stone~ -It is a small, carved stone with a strange symbol -carved upon it. Strange... -~ -A -12 8 -#6204 -club~ -a club~ -A crude wooden club sits here.~ -~ -5 0 8193 -0 2 2 7 -12 10 2 -E -club~ -It is a big, wooden club. -~ -#6205 -Starkblade knife dagger blade~ -Starkblade~ -A knife hums with eternal energy here.~ -~ -5 bp 8193 -0 3 7 3 -1 100000 20000 -E -starkblade knife dagger blade~ -It is an odd knife, with an inset of sapphire in the -pommel. It hums constantly, and your hand stings a -bit when you touch it. -~ -A -12 10 -A -13 -20 -$ - diff --git a/lc-mud/circle/world/obj/63.obj b/lc-mud/circle/world/obj/63.obj deleted file mode 100644 index fed60e1f49e03c1d0dea1275f76fe05e1425bed7..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/63.obj +++ /dev/null @@ -1,86 +0,0 @@ -#6300 -key black~ -a black key~ -A somewhat plain black key has been left here.~ -~ -18 c 16385 -6300 0 0 0 -1 0 0 -#6301 -knife thief~ -a very sharp knife~ -A very sharp knife lies here.~ -~ -5 glmnp 8193 -0 8 1 11 -9 1000 2500 -E -knife thief~ -A keen knife, very sharp -- you could cut the air in two! -~ -A -2 2 -A -18 3 -#6302 -hat wizard~ -a wizard's hat~ -A blue wizard's hat lies here.~ -~ -9 fgnop 17 -6 0 0 0 -5 20000 10000 -E -hat wizard~ -A hat made of blue cloth. It looks very comfortable. -~ -A -3 2 -A -12 17 -#6303 -headress pontiff ornament cone head~ -a pontiff's headress~ -A white cone-shaped head ornament with religious symbols lies here.~ -~ -9 fgmop 17 -6 0 0 0 -5 20000 10000 -E -headress pontiff ornament cone head~ -A starchy headress worn by powerful secular types. -~ -A -4 3 -A -12 13 -#6304 -visor black knight~ -a black knight's visor~ -A black visor sits here.~ -~ -9 fgmno 17 -8 0 0 0 -5 20000 10000 -E -visor black knight~ -A visor that protects the head, good for warriors. -~ -A -1 1 -A -5 2 -#6305 -potion thick white~ -a thick white potion~ -A thick white potion has been left here.~ -~ -10 g 1 -25 15 35 19 -9 21000 1000 -E -potion thick white~ -It is disgusting thick white gunk which looks like liquid web and smells like -medicine. -~ -$ diff --git a/lc-mud/circle/world/obj/64.obj b/lc-mud/circle/world/obj/64.obj deleted file mode 100644 index 3b7e9c5aff937026cdbb66f6dce9217903c6a99f..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/64.obj +++ /dev/null @@ -1,202 +0,0 @@ -#6400 -dagger glowing~ -a glowing dagger~ -A glowing dagger glows here.~ -~ -5 ag 8193 -0 1 4 11 -1 1000 300 -A -18 3 -#6401 -platemail glowing plate mail~ -the glowing platemail~ -Some glowing platemail lies in a heap here.~ -~ -9 ag 9 -15 0 0 0 -150 30000 10000 -#6402 -agate gem~ -an agate~ -A small gem lies here.~ -~ -8 0 1 -0 0 0 0 -1 5000 500 -#6403 -jade jewel~ -a piece of jade~ -A small jewel gleams here.~ -~ -8 0 1 -0 0 0 0 -1 10000 1000 -#6404 -sculpture~ -a piece of sculpture~ -A nice piece of sculpture is here.~ -~ -8 0 1 -0 0 0 0 -75 20000 2000 -E -sculpture~ -It is of a beautiful woman, straining -beneath a heavy weight. She looks -tired, with chiseled tears staining -her cheeks. It makes you sad. -~ -#6405 -vial dragons blood~ -a vial of dragon's blood~ -A small vial filled with a red fluid lies in the dust here.~ -~ -10 0 1 -7 39 39 39 -5 48000 20500 -#6406 -amulet~ -an amulet~ -An odd looking amulet has been discarded here.~ -~ -9 ag 5 -0 0 0 0 -3 20000 3000 -A -2 3 -#6407 -pole tent~ -a tent pole~ -A tent pole has been tossed away here.~ -~ -3 ag 16385 -25 5 5 38 -10 25000 5000 -#6408 -bag powder wealth~ -a bag of powder of wealth~ -A small bag filled with powder of wealth lies here.~ -~ -20 ag 1 -100000 0 0 0 -1 100000 0 -#6409 -desk~ -a desk~ -There is an ebony desk here.~ -~ -15 0 0 -100 13 0 0 -800 0 0 -#6410 -book chaos~ -the Book of Chaos~ -A book with a title written in moving letters rests here.~ -~ -3 abgh 16385 -20 1 1 26 -25 100000 25000 -#6411 -book elder~ -the Book of the Elder~ -A grey-bound book lies here.~ -~ -3 abg 16385 -30 1 1 28 -25 300000 50000 -#6412 -lens occluded~ -the Occluded Lens~ -A smoky lens about a foot around has been scuffled in the dirt here.~ -~ -1 aghjk 16385 -0 0 0 0 -20 200000 50000 -A -12 20 -A -4 1 -#6413 -mevais herb leaf~ -a leaf of mevais~ -A small black leaf of a mevais plant lies here, well preserved.~ -~ -10 0 1 -30 27 33 4 -1 0 0 -E -mevais herb leaf~ -Quaffing this down might provide interesting effects. -~ -#6414 -bottle peska~ -a bottle of peska~ -There is a bottle of a milky fluid here.~ -~ -10 0 1 -30 28 3 1 -12 15000 3000 -E -bottle peska~ -It is a milky concoction, with strange motes floating in it. -~ -#6415 -staff rand~ -Rand's staff~ -There is a metal-shod staff here.~ -~ -9 agnop 16385 -8 0 0 0 -7 100000 25000 -A -12 5 -A -17 5 -#6416 -chest wooden~ -a wooden chest~ -There is a wooden chest here.~ -~ -15 0 0 -500 13 0 0 -0 0 0 -#6417 -chest wooden~ -a wooden chest~ -There is a wooden chest here.~ -~ -15 0 0 -500 13 0 0 -0 0 0 -#6418 -chest wooden~ -a wooden chest~ -There is a wooden chest here.~ -~ -15 0 0 -500 13 0 0 -0 0 0 -#6419 -basin water~ -a water basin~ -A basin filled with crisp, clean water is here.~ -~ -17 a 0 -100 100 0 0 -100 0 0 -#6420 -food~ -some food~ -There's some food lying here.~ -~ -19 0 1 -8 0 0 0 -3 20 10 -E -food~ -It is just random and assorted food. -Don't ask questions. It is only a game. -~ -$ - diff --git a/lc-mud/circle/world/obj/65.obj b/lc-mud/circle/world/obj/65.obj deleted file mode 100644 index 04e332022b2333813dd28fbf5883e509e3f3c54c..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/65.obj +++ /dev/null @@ -1,153 +0,0 @@ -#6500 -key treasury~ -a treasury key~ -There is a key for the treasury lying here.~ -~ -18 c 16385 -6500 0 0 0 -1 0 0 -#6501 -gold treasure coins~ -the Queen's treasure~ -A large pile of treasure has been left here, it must be the Queen's.~ -~ -20 0 1 -65000 0 0 0 -20 65000 0 -#6502 -key mine~ -a mine key~ -There is a key to the mines lying here.~ -~ -18 c 16385 -6502 0 0 0 -1 0 0 -#6503 -key bright gold~ -a bright golden key~ -There is a bright golden key lying here.~ -~ -18 c 16385 -6503 0 0 0 -1 0 0 -#6504 -hammer dwarven~ -a dwarven hammer~ -There is a dwarven hammer lying here.~ -~ -5 0 8193 -0 2 6 7 -13 5500 1000 -#6505 -plate dwarven mail~ -the dwarven plate mail~ -There is dwarven plate mail lying here.~ -~ -9 0 9 -6 0 0 0 -80 4500 300 -#6506 -stick black long~ -a long, black stick~ -There is a long, black stick lying here.~ -~ -4 q 16385 -4 2 2 28 -1 100 6000 -#6507 -stick black long~ -a long, black stick~ -There is a long, black stick here.~ -~ -1 q 16385 -0 0 0 0 -1 100 6000 -#6508 -club dwarven~ -a dwarven club~ -There is a dwarven club lying here.~ -~ -5 0 8193 -0 2 3 3 -12 3000 300 -#6509 -axe two-handed dwarven~ -a two-handed dwarven axe~ -A two-handed dwarven axe is here.~ -~ -5 g 8193 -0 2 7 3 -14 5000 3000 -A -18 2 -A -1 2 -#6510 -helmet dwarven~ -a dwarven helmet~ -A dwarven helmet is here.~ -~ -9 0 17 -4 0 0 0 -4 2500 500 -#6511 -ring gold dwarven~ -a golden dwarven ring~ -A golden dwarven ring is lying here.~ -~ -11 g 3 -0 0 0 0 -1 10000 10000 -A -18 1 -A -19 1 -#6512 -gloves dwarven~ -a pair of dwarven gloves~ -A pair of thick dwarven gloves lay here.~ -~ -9 0 129 -1 0 0 0 -2 4000 200 -A -5 1 -A -2 1 -#6513 -coal chunk~ -a chunk of coal~ -There is a chunk of coal here.~ -~ -13 0 16385 -0 0 0 0 -100 0 0 -#6514 -pick mining~ -a mining pick~ -There is a mining pick here.~ -~ -5 i 8193 -0 2 3 11 -9 300 10 -E -pick mining~ -It looks almost blessed! -~ -#6515 -key deep green~ -a deep green key~ -There is a deep green key lying here.~ -~ -18 c 16385 -6515 0 0 0 -10 0 0 -#6516 -key old~ -an old key~ -Someone seems to have dropped an old key.~ -~ -18 c 16385 -6516 0 0 0 -1 0 0 -$ diff --git a/lc-mud/circle/world/obj/71.obj b/lc-mud/circle/world/obj/71.obj deleted file mode 100644 index ed1c9d52118b56c7bbc0938b76e710c9a6332445..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/71.obj +++ /dev/null @@ -1,13 +0,0 @@ -#7190 -ring silver~ -a glinting silver ring~ -A lovely silver ring has been left here.~ -~ -11 g 3 -0 0 10 0 -9 16000 5000 -A -17 -10 -A -18 2 -$ diff --git a/lc-mud/circle/world/obj/72.obj b/lc-mud/circle/world/obj/72.obj deleted file mode 100644 index e780417ff7a82e9061ae52e29fc9552231017413..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/72.obj +++ /dev/null @@ -1,180 +0,0 @@ -#7200 -rod devil~ -the devil rod~ -The mysterious devil rod lies on the floor.~ -~ -5 gj 8193 -0 2 5 3 -6 16000 800 -E -devil rod~ -This is indeed a mysterious rod. It is dark black at the base but has four -very sharp purple tentacles at the end. -~ -A -18 3 -A -1 -1 -#7201 -mace large~ -the large mace~ -A large mace lies here.~ -~ -5 g 8193 -0 1 6 7 -10 1000 400 -E -large mace~ -The mace is pretty large with a weight of 10 lbs. The head is actually four -purple tentacles tied together. -~ -A -19 2 -#7202 -mace small~ -the small mace~ -a small mace has been left here.~ -~ -5 g 8193 -0 1 6 7 -6 600 200 -E -small mace~ -This weapon does look like it does a lot of damage, but then you never know. -It consists of a black handle and a purple head. -~ -A -19 1 -#7203 -cloak purple~ -a purple cloak~ -A purple cloak lies on the floor.~ -~ -11 g 5 -0 0 0 0 -20 5000 6000 -E -cloak purple~ -This is a very fine made cloak from an unknown material, in a nice purple -color. -~ -A -24 2 -A -17 -10 -#7204 -potion blue neon~ -a neon blue potion~ -A neon blue potion stands on the floor.~ -~ -10 g 1 -14 6 15 16 -4 100 1000 -E -potion blue~ -In the flask is a transparent electric blue liquid. -~ -#7205 -key black~ -a black key~ -A black key has been left on the floor.~ -~ -18 c 16385 -0 0 0 0 -2 0 0 -E -black key~ -This little key is made from a black metal of unknown origin. -~ -#7206 -skull white~ -a strange white skull~ -A strange white skull lies on the floor looking at you.~ -~ -9 abh 17 -1 0 0 0 -30 0 250 -E -white skull~ -The skull has two small horns in the forehead. You notice some writing on -the inside. -~ -E -writing text~ -You read the number '666'. -~ -A -2 -4 -#7207 -gauntlets muddy~ -a pair of muddy gauntlets~ -A pair of muddy gauntlets have been thrown away here.~ -~ -9 g 129 -6 0 0 0 -10 6000 1500 -E -muddy gauntlets~ -These gauntlets are muddy indeed, however they look very effective. -~ -A -1 1 -#7208 -stick small~ -a small stick~ -A small stick lies here.~ -~ -1 0 16385 -0 0 -1 0 -4 200 200 -E -small stick~ -The small stick does not look interesting at all. But just as you are going -to throw it away you notice some small letters. -~ -E -letters letter~ -They read: - -Hold me - -~ -#7209 -boots muddy~ -a pair of muddy boots~ -A pair of muddy boots has been dropped here.~ -~ -9 g 65 -4 0 0 0 -10 75 500 -E -boots muddy~ -The boots are muddy and they look well worn, but also very comfortable. -~ -A -14 15 -#7210 -treasure coins~ -a huge treasure~ -There is a huge treasure here, looking very valuable.~ -~ -20 0 1 -6522 0 0 0 -5 6522 0 -E -treasure coins~ -This looks like a whole lot of coins. -~ -#7211 -sword short~ -a short sword~ -A short sword is lying here.~ -~ -5 0 8193 -0 2 3 3 -4 100 300 -E -short sword~ -This is a very nice little weapon. -~ -$ diff --git a/lc-mud/circle/world/obj/79.obj b/lc-mud/circle/world/obj/79.obj deleted file mode 100644 index 90aa05aa46d7a6aabf36b52501fa009179ae0c12..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/79.obj +++ /dev/null @@ -1,285 +0,0 @@ -#7900 -key steel~ -a large key~ -A large steel key has been left here.~ -~ -18 c 16385 -7900 0 0 0 -2 0 0 -E -steel key~ -This huge key is made from solid steel. -~ -#7901 -key copper~ -a copper key~ -A copper key has been left on the floor.~ -~ -18 c 16385 -7901 0 0 0 -2 0 0 -E -copper key~ -This little key is made from copper. -~ -#7902 -key brass~ -a small brass key~ -A small brass key lies here.~ -~ -18 c 16385 -7902 0 0 0 -1 10 4 -E -key brass~ -It is a small, simple brass key with no inscriptions or marks of any kind. -~ -#7903 -treasure coins~ -a huge treasure~ -There is a huge treasure here, looking moderately valuable.~ -~ -20 0 1 -7734 0 0 0 -5 7734 0 -E -treasure~ -This looks like a whole lot of coins, though not as many as you expected. -~ -#7904 -chest wooden~ -a wooden chest~ -A wooden chest stands in the corner.~ -~ -15 0 0 -100 15 7902 0 -0 0 0 -E -chest wooden~ -It is a robust chest made from short, heavy planks that have been fastened -together with tenons. It is equipped with a simple brass lock. -~ -#7905 -chest~ -a chest~ -A heavy iron chest sits in one corner of the room.~ -~ -15 f 0 -15 15 7902 0 -0 0 0 -#7906 -dagger plain black~ -a plain dagger~ -A long black, but very plain, dagger rests here.~ -~ -5 dfhn 8193 -0 5 3 11 -3 6500 15000 -A -18 -3 -A -19 -1 -#7907 -bracelet spiked~ -a large spiked bracelet~ -A large spiked bracelet has been left here.~ -~ -11 g 4097 -0 0 0 0 -1 1200 2000 -A -17 -4 -#7908 -waybread bread~ -a waybread~ -Some waybread has been put here.~ -~ -19 0 1 -24 0 0 0 -1 50 50 -E -waybread bread~ -The waybread is the traditional feed of elves when travelling, they -call it lembas. It is said to refresh the weary traveler greatly. -~ -#7909 -ring gold goldring~ -a golden ring~ -A shiny goldring has been abandoned here.~ -~ -11 dfmpq 3 -0 0 0 0 -20 3500 2000 -A -3 2 -#7910 -sword bastard~ -a huge bastard sword~ -There is a huge bastard sword here.~ -~ -5 gklmn 8193 -0 2 8 3 -18 1700 800 -E -bastard sword~ -Quite a heavy weapon, with a pure white hilt. -~ -A -19 3 -#7911 -helmet large~ -a large helmet~ -There is a large helmet on the floor.~ -~ -9 g 17 -7 0 0 0 -5 4500 1500 -E -large helmet~ -This looks like some heavy protection, for the head of course. -~ -#7912 -helmet chaos~ -a chaos helmet~ -On the floor is a grand evil-looking chaos helmet.~ -~ -9 fgj 17 -8 0 0 0 -8 2300 1000 -E -chaos helmet~ -This helmet has mounted some mean looking spikes on the front, -moreover it looks like good protection. -~ -A -19 2 -A -24 -2 -#7913 -sword two-handed~ -a two-handed sword~ -On the floor rests a enormous two-handed sword.~ -~ -5 gjkm 8193 -0 3 6 3 -22 3500 3500 -E -two-handed sword~ -You notice that there has been inscribed some runes and a sort of -pattern, which resembles flames running along the edge. -~ -E -runes~ -On the blade you can read 'Flame And Strength United Are My Soul Power'. -~ -A -17 10 -A -19 3 -#7914 -plate breast silvery silver~ -a silvery breast plate~ -There is a silvery breast plate on the floor.~ -~ -9 gkl 9 -10 7000 0 0 -70 20000 5000 -E -plate breast silvery silver~ -On the breast plate you notice a relief of large rose. The metal seems -to be some kind of silver or platinum. -~ -#7915 -plates leg silvery~ -some silvery leg plates~ -On the floor you see some leg plates.~ -~ -9 gkl 33 -7 7000 0 0 -40 12500 5000 -E -leg plates silvery silver~ -They seem to be made from silver or platinum. You see the outline of a -rose. -~ -#7916 -gloves silvery silver~ -a pair of silvery gloves~ -You can see a pair of gloves on the floor.~ -~ -9 gkl 129 -5 7000 0 0 -14 2500 2000 -E -gloves silvery silver~ -The gloves are made of silver threads. -~ -A -18 1 -#7917 -helmet silvery silver~ -a silvery helmet~ -The silvery helmet lies here.~ -~ -9 gkl 17 -8 7000 0 0 -35 9000 5000 -E -helmet silvery silver~ -The helmet is made from platinum or silver and has a white fur brush -attached on the top. -~ -#7918 -shield rose~ -the shield of the rose~ -The shield of the rose rests on the floor.~ -~ -9 gkl 513 -12 7000 0 0 -60 15000 7500 -E -shield rose~ -On the shield you see a clear and perfect painting of a dark red rose -on a white background. You also notice an inscription. -~ -E -inscription~ -The inscription reads: - -Pax Est Sanctuum - -~ -#7919 -boots heavy plated~ -a pair of heavy plated boots~ -A pair of heavy plated boots stand on the floor.~ -~ -9 gkl 65 -5 7000 0 0 -40 3500 3500 -E -boots heavy plated~ -The boots are made from a silvery metal. -~ -#7920 -plates arm silvery silver~ -some silvery arm plates~ -On the floor you see some arm plates.~ -~ -9 gkl 257 -7 7000 0 0 -40 12500 5000 -E -plates arm silvery silver~ -They seem to be made from silver or platinum. You see the outline of a -rose. -~ -#7921 -barrel water~ -a barrel~ -A water barrel has been left here.~ -~ -17 0 1 -40 40 15 0 -45 60 20 -$ diff --git a/lc-mud/circle/world/obj/9.obj b/lc-mud/circle/world/obj/9.obj deleted file mode 100644 index 5cbc04b6ece3f3f6752d2900dc778c43b6061453..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/9.obj +++ /dev/null @@ -1,118 +0,0 @@ -#900 -key golden heavy~ -a golden key~ -A heavy golden key lies here.~ -~ -18 c 16385 -900 0 0 0 -1 0 0 -#901 -shield minotaur~ -a dark minotaur shield~ -A dark minotaur shield has been left here.~ -~ -9 dgh 513 -12 0 0 0 -12 5000 1350 -E -shield minotaur~ -A strong, sturdy shield. It brings to mind legends of a shield that -provided protection from poisonous gases. -~ -A -23 -4 -#902 -potion speckled~ -a speckled potion~ -A speckled potion speckles here.~ -~ -10 g 1 -15 15 15 15 -2 1300 500 -#903 -gauntlets troll~ -a pair of troll gauntlets~ -A pair of gauntlets made from troll skin lie on the ground.~ -~ -9 g 129 -5 0 0 0 -8 2000 1350 -#904 -ring platinum~ -a platinum ring~ -A shining ring of platinum lies here. It has a tiny inscription.~ -~ -1 agh 16387 -0 0 -1 0 -1 2000 5500 -E -ring platinum inscription~ -The inscription on the ring reads: - -Cursed be the gods that supply coins to mortals! -And cursed be the mortal that accepts valuable gifts from the gods! -Especially cursed are those who do not leave the toilet seat up! - -~ -A -17 10 -A -18 2 -#905 -flail~ -a flail~ -A flail has been carelessly left here.~ -~ -5 fgh 8193 -0 3 4 7 -8 5000 3500 -A -19 2 -#906 -coins gold treasure~ -a great pile of treasure~ -A great, gleaming pile of treasure lies at your feet.~ -~ -20 0 1 -43500 0 0 0 -20 43500 0 -#907 -spear heavy~ -a heavy spear~ -A heavy spear has been tossed on the ground here.~ -~ -5 0 8193 -0 1 7 11 -8 450 200 -A -19 1 -#908 -trident~ -a trident~ -There is a warrior's trident here.~ -~ -5 0 8193 -0 2 4 11 -8 350 200 -E -trident~ -This is a common trident, often used by gladiators or mermen. It has -three sharp prongs jutting from the business end and a smooth wooden -handle with two comfortable grip points. -~ -#909 -boots boat~ -a pair of boots~ -A pair of boots sit here in a puddle of water.~ -~ -22 deq 65 -0 0 0 0 -1 5000 1850 -E -boots boat~ -The boots are made of a strange lightweight hide and float in a puddle -of water. -~ -A -14 -20 -$ diff --git a/lc-mud/circle/world/obj/index b/lc-mud/circle/world/obj/index deleted file mode 100644 index 561b7870c41ce4676b4229c0a7d5bb68f7824920..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/index +++ /dev/null @@ -1,28 +0,0 @@ -0.obj -9.obj -15.obj -25.obj -30.obj -31.obj -33.obj -35.obj -36.obj -40.obj -50.obj -51.obj -52.obj -53.obj -54.obj -60.obj -61.obj -62.obj -63.obj -64.obj -65.obj -71.obj -72.obj -79.obj -120.obj -150.obj -186.obj -$ diff --git a/lc-mud/circle/world/obj/index.mini b/lc-mud/circle/world/obj/index.mini deleted file mode 100644 index 77ce07a5149d4af51f9d532b09035b04732b957b..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/obj/index.mini +++ /dev/null @@ -1,3 +0,0 @@ -0.obj -30.obj -$ diff --git a/lc-mud/circle/world/shp/120.shp b/lc-mud/circle/world/shp/120.shp deleted file mode 100644 index 7cfeb1d28608c413fa4be246784afe6c3d98aa99..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/shp/120.shp +++ /dev/null @@ -1,171 +0,0 @@ -CircleMUD v3.0 Shop File~ -#12011~ -3020 -3021 -3022 -3023 -3024 -3025 -12008 --1 -2.25 -0.6 -WEAPON -ARMOR --1 -%s We are out of that item right now.~ -%s You don't have that. Stop wasting my time!~ -%s This is a weapon and armour shop! Go someplace else!~ -%s A fine weapon indeed, but more than I can afford.~ -%s NO CREDIT!~ -%s Here you go. That will be %d coins. Don't get hurt!~ -%s You'll get %d for that.~ -0 -0 -12011 -0 -12006 --1 -0 -28 -0 -0 -#12012~ -12006 -12007 --1 -1.2 -0.6 --1 -%s I don't have anything like that. Sorry.~ -%s I don't think you have that.~ -%s I don't stock that stuff. Try another shop.~ -%s I can't afford to buy anything, I'm only a poor peddler.~ -%s No cash, no goods!~ -%s Here you go. That'll be... %d coins.~ -%s Thank-you very much. Here are your %d coins as payment.~ -1 -0 -12012 -0 -12032 --1 -7 -13 -14 -19 -#12016~ --1 -1.6 -0.3 --1 -%s We don't sell that.~ -%s I don't think you have that.~ -%s I don't stock that stuff. Try another shop.~ -%s I can't afford to buy anything, I'm only a poor peddler.~ -%s No cash, no goods!~ -%s Here you go. That'll be... %d coins.~ -%s Thank-you very much. Here are your %d coins as payment.~ -1 -0 -12016 -0 -12003 -12004 -12008 -12015 -12022 -12023 --1 -9 -17 -18 -22 -#12034~ -3050 -3051 -3052 -3053 -3054 -12030 --1 -1.85 -0.5 -SCROLL -WAND --1 -%s We don't carry that item.~ -%s You don't have that.~ -%s I can't buy that. See another shop.~ -%s We are low on cash. Come back later.~ -%s Sorry, but you can't afford that.~ -%s Here you go. That will cost you %d.~ -%s I will give you %d coins for that.~ -2 -2 -12034 -96 -12042 --1 -8 -18 -0 -0 -#12036~ -3000 -3001 -3009 -3010 -3011 -12006 -12007 --1 -1.1 -0.8 --1 -%s We don't have that item in stock right now.~ -%s I don't think you have that item.~ -%s Hmmmm... if I was in a good mood, I'd consider it. But I'm not.~ -%s The Emperor's tax collector just came. I don't have the cash. Sorry.~ -%s NO CREDIT! We don't even take the Renaissance Express card!~ -%s That will be %d coins. Enjoy!~ -%s You'll get %d coins for that.~ -2 -2 -12036 -0 -12062 --1 -0 -28 -0 -0 -#12037~ -3030 -3031 -3032 -3033 -3036 -12003 --1 -1.75 -0.6 --1 -%s We don't have that item on stock.~ -%s I don't think you have that.~ -%s I don't stock that stuff. Try another shop.~ -%s I can't afford it right now. Come back tomorrow.~ -%s No cash, no goods!~ -%s Here you go. That'll be... %d coins.~ -%s Thank-you very much. Here are your %d coins as payment.~ -2 -2 -12037 -0 -12063 --1 -6 -20 -0 -0 -$~ diff --git a/lc-mud/circle/world/shp/150.shp b/lc-mud/circle/world/shp/150.shp deleted file mode 100644 index eeba85a025828021dcacda9141e9805e7088fd54..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/shp/150.shp +++ /dev/null @@ -1,55 +0,0 @@ -CircleMUD v3.0 Shop File~ -#15019~ -15012 -3050 -3052 --1 -1.2 -0.3 -SCROLL -WAND -STAFF -POTION --1 -%s But I have no such thing for sale.~ -%s But you do not have this item.~ -%s I have no interest in that.~ -%s I am sorry, but I can not afford such a valuable item.~ -%s But you can not afford that item.~ -%s It will cost you %d coins.~ -%s Here, you shall have %d coins for it.~ -2 -2 -15019 -40 -15052 --1 -2 -8 -20 -28 -#15022~ -15019 -15020 --1 -1.1 -1.0 --1 -%s Je suis tres desole, mais je n'ai pas ca.~ -%s Mais, je n'achete pas!~ -%s Mais, je n'achete pas!~ -%s Mais, je n'achete pas!~ -%s Si vous n'avez d'argent, vous ne pouvez p'acheter!~ -%s Ca coute %d piece d'or, s'il vous plait.~ -%s Oops - %d, a minor bug - please report!~ -0 -2 -15022 -0 -15005 --1 -6 -23 -0 -0 -$~ diff --git a/lc-mud/circle/world/shp/25.shp b/lc-mud/circle/world/shp/25.shp deleted file mode 100644 index 9fa8ef75ea8398aa312a9ba1dfbbb066c321984b..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/shp/25.shp +++ /dev/null @@ -1,62 +0,0 @@ -CircleMUD v3.0 Shop File~ -#2505~ -2504 -2545 -2546 -3010 -3100 -3101 --1 -2.1 -0.5 -FOOD -LIQ CONTAINER --1 -%s Haven't got that in storage, try LIST!~ -%s You can't sell what you don't HAVE!~ -%s Sorry, I'm not a fence.~ -%s I'd love to buy it, I just can't spare the coinage~ -%s Bah, come back when you can pay!~ -%s That'll be %d coins -- thank you.~ -%s I'll give ya %d coins for that!~ -0 -2 -2505 -112 -2518 --1 -0 -28 -0 -0 -#2506~ -3050 -3051 -3053 --1 -2.5 -0.3 -SCROLL -WAND -STAFF -POTION --1 -%s Say again?~ -%s You don't have that, try INVENTORY!~ -%s What do I look like, a fence?~ -%s Sorry, I just can't afford such a costly item.~ -%s You can't afford it!~ -%s You're getting a bargain for that at only %d!~ -%s I guess I could give ya %d for that.~ -0 -2 -2506 -112 -2519 --1 -0 -28 -0 -0 -$~ - diff --git a/lc-mud/circle/world/shp/30.shp b/lc-mud/circle/world/shp/30.shp deleted file mode 100644 index 7be2b588d2200082018286f2295f9501a23a0361..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/shp/30.shp +++ /dev/null @@ -1,375 +0,0 @@ -CircleMUD v3.0 Shop File~ -#3000~ -3050 -3051 -3052 -3053 -3054 --1 -1.15 -0.15 -SCROLL -WAND -STAFF -POTION --1 -%s Sorry, I haven't got exactly that item.~ -%s You don't seem to have that.~ -%s I don't buy such items.~ -%s That is too expensive for me!~ -%s You can't afford it!~ -%s That'll be %d coins, please.~ -%s You'll get %d coins for it!~ -0 -2 -3000 -2 -3033 --1 -0 -28 -0 -0 -#3001~ -3009 -3010 -3011 --1 -1.4 -1.0 --1 -%s Haven't got that on storage - try list!~ -%s I don't buy!~ -%s I don't buy!~ -%s I don't buy!~ -%s If you have no money, you'll have to go!~ -%s That'll be %d coins.~ -%s Oops - %d a minor bug - please report!~ -0 -2 -3001 -0 -3009 --1 -0 -28 -0 -0 -#3002~ -3030 -3031 -3032 -3033 -3036 --1 -1.5 -0.4 -LIGHT -TREASURE -CONTAINER --1 -%s Haven't got that on storage - try list!~ -%s You don't seem to have that.~ -%s I don't buy THAT... Try another shop.~ -%s I can't afford such a treasure.~ -%s You can't afford it!~ -%s That'll be %d coins, please.~ -%s You'll get %d coins for it!~ -0 -2 -3002 -0 -3010 --1 -0 -28 -0 -0 -#3003~ -3020 -3021 -3022 -3023 -3024 -3025 --1 -1.3 -0.4 -WEAPON --1 -%s I haven't got that kind of a weapon!~ -%s You don't carry that weapon!~ -%s I only buy weapons.~ -%s I can't afford such a great weapon!~ -%s sorry, but NO CREDIT!~ -%s That costs just %d coins.~ -%s Here, you can have %d coins for that.~ -0 -2 -3003 -0 -3011 --1 -0 -28 -0 -0 -#3004~ -3040 -3041 -3042 -3043 -3044 -3045 -3046 -3070 -3071 -3075 -3076 -3080 -3081 -3085 -3086 --1 -1.0 -0.5 -ARMOR --1 -%s Haven't got that on storage - try list!~ -%s You don't seem to have that.~ -%s I only buy armors.. Go away!~ -%s That is too expensive for me - Try a wizard!~ -%s You can't afford it!~ -%s That'll be %d coins, please.~ -%s You'll get %d coins for it!~ -0 -2 -3004 -0 -3020 --1 -0 -28 -0 -0 -#3006~ -3060 -3061 --1 -1.2 -0.9 -BOAT --1 -%s Sorry pal, I have not got that kind of ship.~ -%s Ok, but let me see it first.~ -%s I only trade ships.~ -%s I can't afford such a nice ship.~ -%s This ship is too expensive for you.~ -%s Here is your ship, I'll take %d gold coins.~ -%s What a fine deal, you get %d gold coins.~ -0 -2 -3006 -0 -3049 --1 -6 -22 -0 -0 -#3007~ --1 -1.0 -1.0 --1 -%s Sorry, you aren't on my list of people I can sell to.~ -%s Sorry, I don't buy from outsiders.~ -%s Sorry, I don't buy from outsiders.~ -%s Sorry, I don't buy from outsiders.~ -%s Sorry, but here, no money means no goods!~ -%s That will be %d coins, please. Thank you.~ -%s Oops - %d a minor bug - please report.~ -2 -2 -3007 -1 -3050 --1 -0 -28 -0 -0 -#3009~ -3102 -3103 -3104 --1 -1.0 -1.0 --1 -%s Sorry, I don't have that -- try list!~ -%s Sorry, I don't buy waters from outsiders.~ -%s Sorry, I don't buy waters from outsiders.~ -%s Sorry, I don't buy waters from outsiders.~ -%s Sorry, but here, no money means no water!~ -%s That will be %d coins, please. Thank you.~ -%s Oops - %d a minor bug - please report.~ -0 -2 -3009 -0 -3058 --1 -0 -28 -0 -0 -#3040~ -3000 -3001 -3002 -3003 -3004 --1 -1.1 -1.0 --1 -%s It's very noisy in here, what did you say you wanted to buy?~ -%s I don't buy!~ -%s I don't buy!~ -%s I don't buy!~ -%s Are you drunk or what?? - NO CREDIT!~ -%s That'll be - say %d coins.~ -%s Oops - %d a minor bug - please report!~ -0 -2 -3040 -0 -3007 --1 -0 -28 -0 -0 -#3042~ -3002 -3003 --1 -1.0 -1.0 --1 -%s Haven't got that on storage - try list!~ -%s I don't buy!~ -%s I don't buy!~ -%s I don't buy!~ -%s If you have no money, you'll have to go!~ -%s That'll be %d coins.~ -%s Oops - %d a minor bug - please report!~ -0 -2 -3042 -112 -3018 --1 -0 -28 -0 -0 -#3043~ -3002 -3004 --1 -1.1 -1.0 --1 -%s Haven't got that on storage - try list!~ -%s I don't buy!~ -%s I don't buy!~ -%s I don't buy!~ -%s If you have no money, you'll have to go!~ -%s That'll be %d coins.~ -%s Oops - %d a minor bug - please report!~ -0 -2 -3043 -104 -3003 --1 -0 -28 -0 -0 -#3044~ -3003 -3004 --1 -1.7 -1.0 --1 -%s Haven't got that on storage - try list!~ -%s I don't buy!~ -%s I don't buy!~ -%s I don't buy!~ -%s If you have no money, you'll have to go!~ -%s That'll be %d coins.~ -%s Oops - %d a minor bug - please report!~ -0 -2 -3044 -88 -3028 --1 -0 -28 -0 -0 -#3045~ -3002 -3003 -3004 --1 -1.5 -1.0 --1 -%s Haven't got that on storage - try list!~ -%s I don't buy!~ -%s I don't buy!~ -%s I don't buy!~ -%s If you have no money, you'll have to go!~ -%s That'll be %d coins.~ -%s Oops - %d a minor bug - please report!~ -0 -2 -3045 -56 -3022 --1 -0 -28 -0 -0 -#3046~ -3004 -3003 --1 -1.0 -1.0 --1 -%s It's very noisy in here, what did you say you wanted to buy?~ -%s I don't buy!~ -%s I don't buy!~ -%s I don't buy!~ -%s Oh, bugger off, NO CREDIT!~ -%s That'll be - say %d coins.~ -%s Oops - %d a minor bug - please report!~ -0 -2 -3046 -0 -3048 --1 -0 -28 -0 -0 -$~ diff --git a/lc-mud/circle/world/shp/31.shp b/lc-mud/circle/world/shp/31.shp deleted file mode 100644 index f53b86256f029e20ef2a32d86415781bb6c022e5..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/shp/31.shp +++ /dev/null @@ -1,27 +0,0 @@ -CircleMUD v3.0 Shop File~ -#3100~ -3100 -3101 -3102 --1 -1.1 -0.9 --1 -%s I haven't got such a drink.~ -%s I see no such thing.~ -%s I do not buy, would you like a drink?~ -%s BUG, Please report.~ -%s You can't afford such a fine drink, try the Grubby Inn.~ -%s Fine, that'll be %d gold pieces.~ -%s Bug, please report (%d).~ -0 -0 -3100 -0 -3106 --1 -6 -22 -23 -24 -$~ diff --git a/lc-mud/circle/world/shp/33.shp b/lc-mud/circle/world/shp/33.shp deleted file mode 100644 index 62ea3002317b6add310903bde4d4be37b828259a..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/shp/33.shp +++ /dev/null @@ -1,80 +0,0 @@ -CircleMUD v3.0 Shop File~ -#3301~ -3300 -3301 -3308 -3309 -3310 --1 -1.1 -0.9 --1 -%s We didn't grow any of those this year.~ -%s You don't have that!~ -%s I won't buy that!~ -%s I can't buy that!~ -%s You can't buy that!~ -%s Ok, %d coins please!~ -%s Ok, %d coins please!~ -2 -2 -3304 -0 -3350 --1 -8 -22 -0 -0 -#3302~ -3032 -3037 -3038 -3039 --1 -1.1 -0.9 --1 -%s Could you repeat that please?~ -%s I don't buy!~ -%s I don't buy!~ -%s I don't buy!~ -%s But you haven't the money!~ -%s Ok, %d gold please.~ -%s Ok, %d gold please.~ -2 -0 -3301 -0 -3345 --1 -8 -22 -0 -0 -#3303~ -3319 -3320 -3321 --1 -1.2 -1.0 --1 -%s I don't know how to make one of those!~ -%s We don't *buy* drinks... we sell 'em!~ -%s We don't *buy* drinks... we sell 'em!~ -%s We don't *buy* drinks... we sell 'em!~ -%s I don't give 'em away free, you know!~ -%s That's %d gold.~ -%s We don't *buy* drinks... we sell 'em!~ -2 -0 -3314 -0 -3357 --1 -20 -2 -11 -18 -$~ diff --git a/lc-mud/circle/world/shp/54.shp b/lc-mud/circle/world/shp/54.shp deleted file mode 100644 index a52e8469c1c381d72c822ebba91ca3e3dff2421f..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/shp/54.shp +++ /dev/null @@ -1,510 +0,0 @@ -CircleMUD v3.0 Shop File~ -#5405~ -5467 -5468 -5469 --1 -1.1 -1.0 -LIQ CONTAINER --1 -%s I don't know how to make one of those!~ -%s I don't *buy* drinks... we sell 'em!~ -%s I don't *buy* drinks... we sell 'em!~ -%s I don't *buy* drinks... we sell 'em!~ -%s I don't give 'em away free, you know!~ -%s That's %d gold.~ -%s I don't *buy* drinks... we sell 'em!~ -1 -2 -5405 -0 -5402 --1 -0 -28 -0 -0 -#5410~ -5440 -5441 -5442 -5443 -5445 -5491 --1 -1.1 -1.0 --1 -%s Haven't got that on storage - try list!~ -%s I don't buy!~ -%s I don't buy!~ -%s I don't buy!~ -%s If you have no money, you'll have to go!~ -%s That'll be %d coins.~ -%s Oops - %d a minor bug - please report!~ -0 -2 -5410 -0 -5535 --1 -0 -28 -0 -0 -#5411~ -5434 -5435 -5436 -5437 -5438 -5439 --1 -1.5 -0.4 -LIGHT -CONTAINER -FOOD -TRASH -TREASURE --1 -%s Haven't got that on storage - try list!~ -%s You don't seem to have that.~ -%s I don't buy THAT... Try another shop.~ -%s I can't afford such a treasure.~ -%s You can't afford it!~ -%s That'll be %d coins, please.~ -%s You'll get %d coins for it!~ -0 -2 -5411 -0 -5528 --1 -0 -28 -0 -0 -#5413~ -5446 -5447 -5448 -5449 -5450 -5451 -5452 -5453 -5454 -5455 --1 -1.05 -0.15 --1 -%s Sorry, I haven't got exactly that item.~ -%s You don't seem to have that.~ -%s I don't buy such items.~ -%s That is too expensive for me!~ -%s You can't afford it!~ -%s That'll be %d coins, please.~ -%s You'll get %d coins for it!~ -0 -2 -5413 -0 -5514 --1 -0 -28 -0 -0 -#5414~ -5456 -5457 -5458 -5459 -5460 --1 -1.3 -1.0 --1 -%s I've never heard of that... what kind of vegetable is it?~ -%s I don't buy.~ -%s I don't buy.~ -%s I don't buy.~ -%s If you come back with more money, I may consider selling it.~ -%s That's %d coins... can I wrap it up for you?~ -%s I don't buy.~ -0 -2 -5414 -0 -5515 --1 -0 -28 -0 -0 -#5415~ -5461 -5462 -5463 --1 -1.1 -1.0 -FOOD --1 -%s I didn't kill any of those this season, sorry.~ -%s I don't buy that.~ -%s I don't buy that.~ -%s I don't buy that when I don't have the money.~ -%s That costs money. Something you don't have... sorry.~ -%s That costs %d coins.~ -%s Here are %d coins, thank you for your business.~ -0 -2 -5415 -0 -5522 --1 -0 -28 -0 -0 -#5416~ -5415 -5416 -5417 -5418 -5419 -5420 -5421 --1 -1.3 -0.5 -ARMOR --1 -%s Haven't got that on storage - try list!~ -%s You don't seem to have that.~ -%s I only buy armours.. Go away!~ -%s That is too expensive for me - Try a wizard!~ -%s You can't afford it!~ -%s That'll be %d coins, please.~ -%s You'll get %d coins for it!~ -2 -2 -5416 -40 -5529 --1 -0 -28 -0 -0 -#5417~ -5403 -5404 -5405 -5406 -5407 -5408 -5409 -5410 -5411 -5412 -5413 -5414 --1 -1.3 -0.4 -WEAPON --1 -%s I haven't got that kind of a weapon~ -%s You don't carry that weapon~ -%s I only buy weapons.~ -%s I can't afford such a great weapon~ -%s Sorry, but NO CREDIT~ -%s That just costs %d coins.~ -%s Here is %d coins for that.~ -0 -2 -5417 -0 -5536 --1 -0 -28 -0 -0 -#5418~ --1 -2.0 -0.5 -FOOD --1 -%s Sorry buddy, I don't sell that.~ -%s Why don't you sell something you own?~ -%s I don't buy such items!~ -%s That is much to valuable for you to let go!~ -%s No money. Off with ya then!~ -%s That will be %d gold.~ -%s Here is %d gold for that.~ -0 -2 -5418 -0 -5432 --1 -6 -12 -13 -20 -#5433~ --1 -1.1 -1.0 -SCROLL -WAND -STAFF -TREASURE --1 -%s Don't have one, but I think I might be able to find one...~ -%s You have one? Really? Let me see!~ -%s I'm not interested. Anything else?~ -%s Too rich for my blood!~ -%s Perhaps you should go visit the bank first...~ -%s That's just %d coins, cash in advance.~ -%s I'll take that for %d coins, thank you!~ -2 -2 -5433 -8 -5403 -5404 -5405 -5406 -5407 -5408 -5409 -5410 -5414 -5415 -5416 -5417 -5418 -5419 -5420 -5421 -5422 -5424 -5425 -5426 -5427 -5428 -5429 -5430 -5434 -5435 -5436 -5437 -5438 -5439 -5440 -5441 -5442 -5444 -5445 -5446 -5447 -5448 -5449 -5450 -5451 -5452 -5453 -5454 -5455 -5456 -5460 -5461 -5462 -5463 -5464 --1 -0 -28 -0 -0 -#5465~ -3060 -3061 --1 -1.2 -0.9 -BOAT --1 -%s Sorry pal, I have not got that kind of ship.~ -%s Ok, but let me see it first.~ -%s I only trade ships.~ -%s I can't afford such a nice ship.~ -%s This ship is too expensive for you.~ -%s Here is your ship, I'll take %d gold coins.~ -%s What a fine deal, you get %d gold coins.~ -0 -2 -5465 -0 -5542 --1 -6 -22 -0 -0 -#5466~ -5487 -5488 -5489 --1 -1.2 -0.5 -ARMOR -WEAPON --1 -%s Havn't got that in storage, try LIST!~ -%s You can't sell what you dont HAVE!~ -%s Sorry, I'm not a fence.~ -%s I'd love to buy it, I just can't spare the coinage~ -%s Bah, come back when you can pay!~ -%s That'll be %d coins -- thank you.~ -%s I'll give ya %d coins for that!~ -0 -2 -5466 -0 -5544 --1 -0 -28 -0 -0 -#5479~ -5470 -5471 -5472 -5473 -5474 --1 -1.2 -1.0 -POTION --1 -%s We don't have any of those, Sugar.~ -%s Are you sure you have one, handsome?~ -%s I don't buy those, darling.~ -%s I'm a little strapped -- how about a gift?~ -%s Perhaps later, when you've more cash, honey.~ -%s That's %d coins, love.~ -%s Here's %d coins, friend.~ -0 -2 -5479 -0 -5523 --1 -7 -17 -0 -0 -#5480~ -5478 -5479 -5480 -5481 -5482 --1 -1.8 -0.5 -WORN -OTHER -WAND -STAFF --1 -%s Sorry buddy, I don't sell that.~ -%s Why don't you sell something you own?~ -%s I don't buy that kind of crap!~ -%s That is much to valuable for you to let go!~ -%s No money. I killed my mother for less.~ -%s That will be %d gold.~ -%s Here is %d gold for that.~ -0 -2 -5480 -0 -5524 --1 -0 -12 -13 -20 -#5483~ -5475 -5476 -5477 --1 -1.3 -1.0 --1 -%s It's very noisy in here, what did you say you wanted to buy?~ -%s I don't buy!~ -%s I don't buy!~ -%s I don't buy!~ -%s Are you drunk or what ?? - NO CREDIT!~ -%s That'll be - say %d coins.~ -%s Oops - %d a minor bug - please report!~ -0 -2 -5483 -0 -5538 --1 -0 -28 -0 -0 -#5484~ -5422 -5423 -5524 -5525 -5526 -5527 -5528 -5529 -5530 -5531 -5532 -5533 --1 -1.1 -0.5 -ARMOR --1 -%s Havn't got that in storage, try LIST!~ -%s You can't sell what you dont HAVE!~ -%s Sorry, I'm not a fence.~ -%s I'd love to buy it, I just can't spare the coinage~ -%s Bah, come back when you can pay!~ -%s That'll be %d coins -- thank you.~ -%s I'll give ya %d coins for that!~ -0 -2 -5484 -0 -5537 --1 -0 -28 -0 -0 -$~ - diff --git a/lc-mud/circle/world/shp/65.shp b/lc-mud/circle/world/shp/65.shp deleted file mode 100644 index 92b14e8a931cde9541a306c4ee03cd20598a99a8..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/shp/65.shp +++ /dev/null @@ -1,63 +0,0 @@ -CircleMUD v3.0 Shop File~ -#6503~ -3022 -6504 -6505 -6510 -6512 --1 -1.9 -0.3 -ARMOR -WEAPON --1 -%s We don't have any in storage, sorry!~ -%s Check your possessions, you don't have that.~ -%s I don't care for those types of goods.~ -%s I can't afford something that great!~ -%s You can't afford it, and don't ask a God for the money!~ -%s That'll cost you %d coins, please.~ -%s You'll get %d coins for that.~ -1 -2 -6503 -0 -6516 --1 -1 -22 -23 -28 -#6504~ -3000 -3003 -3010 -3011 -3031 -6013 --1 -1.9 -0.2 -LIGHT -CONTAINER -LIQ CONTAINER -FOOD --1 -%s Haven't got that on storage!~ -%s You don't seem to have that!~ -%s I don't buy those types, try another shop.~ -%s I cannot afford such a great treasure!~ -%s You can't afford that!~ -%s That'll be %d coins, please.~ -%s You'll get %d coins for that!~ -0 -2 -6504 -0 -6535 --1 -6 -18 -20 -28 -$~ diff --git a/lc-mud/circle/world/shp/index b/lc-mud/circle/world/shp/index deleted file mode 100644 index 6337feb7ec43b0753109da765c1e3d5baa3dd2fb..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/shp/index +++ /dev/null @@ -1,10 +0,0 @@ -25.shp -30.shp -31.shp -33.shp -54.shp -65.shp -120.shp -150.shp -$ - diff --git a/lc-mud/circle/world/shp/index.mini b/lc-mud/circle/world/shp/index.mini deleted file mode 100644 index db5fd77fa6e1a5acc15b1d7a993320d30c8feb1d..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/shp/index.mini +++ /dev/null @@ -1,2 +0,0 @@ -30.shp -$ diff --git a/lc-mud/circle/world/shp/shop-convert.pl b/lc-mud/circle/world/shp/shop-convert.pl deleted file mode 100755 index 65885f7e9cb8f22139a81d18300a01f2279daa72..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/shp/shop-convert.pl +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/perl -w - -# This quick and dirty perl script was written to convert v3 shop files from -# using hard-coded numbers to using keywords. The keywords are stored in -# the @item_types array found immediately after these comments. Ensure that -# the order and contents of this array match the item types in your source -# code (defines found in structs.h, keywords in constant.c). -# -# Please note that this is not a supported script and is merely provided in -# an attempt to ease your life if you choose to use keywords rather than -# hard-coded values in the same fashion. -# -# ** IMPORTANT ** Back up your shop files before using this script, and verify -# the changes before booting up your mud. This may make your mud unbootable -# if you do not verify the changes. -# -# ** IMPORTANT ** This only works on v3 shops (ie, ones that conform to the -# v3 format, and begin with the line 'CircleMUD v3.0 Shop File~'. This will -# destroy v2 shop files. -# -# Usage: shop-convert.pl [old shop file] > [new shop file] -# Example: shop-convert.pl 1.shp > 1.shp.new -# - -my @item_types = ( - "UNDEFINED", - "LIGHT", - "SCROLL", - "WAND", - "STAFF", - "WEAPON", - "FIRE WEAPON", - "MISSILE", - "TREASURE", - "ARMOR", - "POTION", - "WORN", - "OTHER", - "TRASH", - "TRAP", - "CONTAINER", - "NOTE", - "LIQ CONTAINER", - "KEY", - "FOOD", - "MONEY", - "PEN", - "BOAT", - "FOUNTAIN", -); - -my $state = 0; -my $vthree = 0; -while (<>) { - chomp; - $vthree = 1 if (/^CircleMUD v3.0 Shop File~/); - die "Use only on v3 format shop files.\n" unless ($vthree); - if (/^#/) { - $state = 1; - } elsif ($state == 1) { - $state++ if ($_ eq '-1'); - } elsif ($state == 2 || $state == 3) { - $state++; - } elsif ($state == 4) { - if ($_ eq '-1') { - $state++; - } else { - $_ = $item_types[$_]; # add 'lc' before '$item' to lower case. - } - } - print "$_\n"; -} - diff --git a/lc-mud/circle/world/wld/0.wld b/lc-mud/circle/world/wld/0.wld deleted file mode 100644 index 1c19575acaf4121e58eee3a3c09516a4e0b35265..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/0.wld +++ /dev/null @@ -1,37 +0,0 @@ -#0 -The Void~ - You don't think that you are not floating in nothing. You can see -a strange portal located above you. -~ -0 d 1 -D4 -The Temple of Midgaard floats above you. -~ -~ -0 -1 3001 -S -#1 -Limbo~ - You are floating in a formless void, detached from all sensation of physical -matter, surrounded by swirling glowing light, which fades into the relative -darkness around you without any trace of edges or shadow. - There is a "No Tipping" notice pinned to the darkness. -~ -0 d 1 -S -#3 -A Totally Empty Room~ - The walls are completely bare... nothing at all in the room. -How... utterly bizarre and completely weird. There is a strange -portal just above you, and it almost looks as if there is some -sort of room above you. -~ -1 dj 0 -D4 -You notice that the portal above you looks almost like glass, -albeit very dirty glass. -~ -~ -0 -1 3048 -S -$ diff --git a/lc-mud/circle/world/wld/12.wld b/lc-mud/circle/world/wld/12.wld deleted file mode 100644 index 9cdb21e4c3a9b376e2bd698465c5b0aa7d7e0d1c..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/12.wld +++ /dev/null @@ -1,119 +0,0 @@ -#1200 -The Meeting Room Of The Gods~ - The meeting room is plain and very simple. A circular table sits -in the middle of the room, lit by some unseen light source. There -are many chairs around the table, all empty. The Immortal Board Room -is to the north. -~ -12 d 0 -D0 -The Immortal Board Room can be seen to the north. -~ -~ -0 -1 1204 -S -#1201 -The Inn Of The Gods~ - The Inn of the Gods is a small room, holding only a shelf with many -small precious stones on it. When a God comes to rent his belongings, -his essence is stored in the stones. The Immortal Board Room is to -the south. -~ -12 dj 0 -D2 -The Immortal Board Room can be seen to the south. -~ -~ -0 -1 1204 -S -#1202 -The Ice Box Of The Gods~ - The Ice Box is for little boys and girls that cannot play nice. Be good -and maybe someone will come and get you. -~ -12 defh 0 -S -#1203 -The Gods' Mortal Board Room~ - Here the Gods have magically created an exact copy of the mortal board -room. Any God can easily post and read messages from the mortal board room -without being seen by any mortals. The Immortal Board Room is to the west. -~ -12 d 0 -D3 -The Immortal Board Room can be seen to the west. -~ -~ -0 -1 1204 -S -#1204 -The Immortal Board Room~ - The main hang out of the Gods, the Immortal Board Room is the place to -be. Gods exchange messages here most every day. The mortal board room is -to the east and the meeting room for the gods is to the south. To the north -is the Gods' Inn and to the west is a post office for Gods. There is a large -staircase leading down to the main temple in the city of Midgaard. In the -northeast corner you spot a small staircase leading upwards. -~ -12 d 0 -D0 -The Gods' Inn can be seen just to the north. -~ -~ -0 -1 1201 -D1 -The Mortal Board Room can be seen just to the east. -~ -~ -0 -1 1203 -D2 -The Gods' Meeting Room is located to the south. -~ -~ -0 -1 1200 -D3 -The Gods' Post Office is just to the west. -~ -~ -0 -1 1205 -D4 -There is a small stair in the corner leading up to the social room of -the Gods. -~ -~ -0 -1 1206 -D5 -You see the hustle and bustle of the Temple of Midgaard at the bottom of -the stairs. -~ -~ -0 -1 3001 -S -#1205 -The Post Office Of The Gods~ - The Post Office Of The Gods is the same as most Post Offices except that -it is not as slow. Even the Postal service knows not to anger the Gods. -Piles of junk mail line the walls. I guess even Gods get on mailing lists. -The Immortal Board Room is to the east. -~ -12 d 0 -D1 -The Immortal Board Room is just to the east. -~ -~ -0 -1 1204 -S -#1206 -The Social Gathering Room~ - This elegantly decorated room has one simple purpose. To socialize with -everyone else around in one central location. -~ -12 d 0 -D5 -The Immortal Board Room is just down through the floor. Funny how you -didn't notice that exit before isn't it? -~ -~ -0 -1 1204 -S -$ diff --git a/lc-mud/circle/world/wld/120.wld b/lc-mud/circle/world/wld/120.wld deleted file mode 100644 index 1858535f38ceb7e5f098e13f8a105f7bfc8e9070..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/120.wld +++ /dev/null @@ -1,1770 +0,0 @@ -#12001 -The Judging Booth~ - You stand in the midst of a small room with windows on the east and south -walls. These windows provide a complete view of the competition fields. -There are several scorecards, pencils and other items that are used by the -judges sitting on a table. The only exit is a trapdoor leading down. -~ -120 d 0 -D5 -There is a rickety ladder leading down. -~ -trapdoor~ -1 12033 12002 -E -scorecards~ -The cards all have been filled in with the judges evaluations of today's -combatants. It seems that Sparticus is having a good day. -~ -E -pencils pencil~ -An ordinary #2 lead pencil. Judging by the teeth marks on the shaft, the -user should see a dentist very soon! -~ -S -#12002 -Caesar's Private Box~ - This is the best view in the house! You can see gladiators fighting or -the chariot races with an unobstructed view. The seats are upholstered in -red velvet and are in top-notch condition. There is a rickety ladder leading -up and a marble staircase leading down. -~ -120 cd 0 -D4 -You see a rickety ladder with a trapdoor leading up. -~ -trapdoor~ -1 12033 12001 -D5 -There is a marble staircase leading down. -~ -~ -0 -1 12003 -S -#12003 -The West Side Of The Commoner's Seating Area~ - This is the western side commoner's seating area. There are row upon -row of rough wooden benches bolted to the floor. There is stadium garbage -everywhere and the smell makes you want to puke. Stairs lead up to Caesar's -private box, a small ramp leads down to the playing field and a hallway -leads south. -~ -120 0 1 -D2 -You see a small hallway that leads to a larger area. -~ -~ -0 -1 12004 -D4 -Watch your step! -~ -~ -0 -1 12002 -D5 -Watch your step! -~ -~ -0 -1 12010 -E -seats benches~ -The benches are made of rough cut lumber that has dried and split over time. -You would probably get splinters if sat on them. The words 'BURT WAS HERE' -have been carved into one of the benches with exquisite care. -~ -S -#12004 -The Southern Commoner's Seats~ - This is the southeastern part of the common seating areas. The benches -here are made of stone and are probably centuries old. A few scratches on -one of the benches catch your eye. An acrid smell is coming from the east -and a tunnel leads off to the north. -~ -120 0 1 -D0 -The tunnel looks like it leads to another seating area. -~ -~ -0 -1 12003 -D1 -There is an acrid smell coming from that direction. -~ -~ -0 -1 12011 -E -marks scratches~ -They look like they form the words "Onivel Cinemod Semaj" But you could be -mistaken. -~ -S -#12005 -The Abandoned Gate~ - This used to be a gateway to and from western Rome. There is an iron gate -blocking your way and judging by the amount of rust and foliage growing on the -bars, it hasn't been open for years. Looking through the gate at the barren -landscape that lies beyond, you can see why. A dirt road leads off to the -east, and a store is directly south. -~ -120 0 1 -D1 -Through the clouds of dust, you can make out a passable road. -~ -~ -0 -1 12012 -D2 -You can barely make out a storefront through the foliage. -~ -~ -0 -1 12006 -D3 -The gate has been permanently rusted shut and is further secured by a large -chain and padlock. Don't even bother THINKING about trying to open it. -~ -gate~ -2 -1 -1 -E -gate~ -The gate has been permanently rusted shut and is further secured by a large -chain and padlock. Don't even bother THINKING about trying to open it. -~ -S -#12006 -Swords 'R Us~ - Welcome to the weaponshop of Titus Andronicus!! Rare halberds, whips, -swords and other instruments of death are proudly displayed on the walls -and in gleaming glass cases. More common weapons are stacked like wood on -the floor. To the north you can barely make out a gate. There is a very -secure looking door to the south. -~ -120 dh 0 -D0 -You can see a city gate to the north. -~ -~ -0 -1 12005 -D2 -There is a very secure looking door blocking your progress. -~ -door~ -2 12034 12007 -E -swords weapons armor halberds whips~ -Titus has enough hardware in here to outfit a large army. Maybe that's why -he has a lucrative contract to sell weapons to the Emperor's armies for -outrageous prices. -~ -S -#12007 -The Back Room~ - If you thought that there were a lot of weapons in the front of the store, -you haven't seen anything yet!! There is barely enough room to walk amongst -the crates of armor and swords. No wonder Rome will stand for a thousand -years. The only exit is through a door to the north. -~ -120 ad 0 -D0 -Through the piles of weapons, you can see a door leading north to the rest of -the store. -~ -door~ -2 12034 12006 -E -weapons swords crates armor weapon sword crate~ -There are literally thousands of each. Take your pick. -~ -S -#12008 -Peanut Heaven~ - You are now so high up that you begin to feel lightheaded and your nose -feels like it is going to start bleeding. There aren't even benches to sit -on here; just bare dirty stone. The view of the surrounding country is -spectacular. Unfortunately you can barely see the playing field. There is -a set of steps here, leading down. -~ -120 0 1 -D5 -Watch your step! -~ -~ -0 -1 12015 -E -landscape country~ -You can see the entire city of Rome from here. The buildings housing the -Roman government are to the east. To the south east, off in the distance, -is the massive aqueduct and further in that direction lies the Mountain of -the Gods. -~ -S -#12009 -The Practice And Warm-up Area~ - There are many gladiators, chariot drivers and their coaches here, warming -up in preparation for the games. The dust rising from the parched earth makes -you want to sneeze. A short tunnel leads east and the thunder of pounding -hooves and the clash of weapons can be heard coming from the south. -~ -120 0 2 -D1 -There is a large oval dirt-track in that direction. -~ -~ -0 -1 12016 -D2 -You can hear the clash of weapons and the thunder of hooves in that -direction. -~ -~ -0 -1 12010 -E -gladiator~ -He is a big muscular man with lots of armor. He sizes you up and decides -that you aren't worth his time or trouble. -~ -E -driver~ -The driver is too busy changing a wheel on his chariot to notice you. -~ -E -chariot~ -You see a two wheeled open cart which is obviously meant to be pulled by -horses. The flaming paint-job and the large '01' stenciled on the side -identify the chariot as belonging to Drucilis 'Lightning-whip' Octavious, -a favorite driver of the masses. -~ -E -coach trainer~ -The coach tell you "Stop bothering my athletes and get lost!" -~ -S -#12010 -The Jousting Arena~ - This is a wide open grassy plane... LOOK OUT!!!! You are almost -skewered by a gladiator's lance as he makes his charge. A practicing -area is due north. -~ -120 c 2 -D0 -Through a small tunnel you can see athletes stretching and warming up for -the games. -~ -~ -0 -1 12009 -D4 -You see a set of steps leading up into the spectator stands. -~ -~ -0 -1 12003 -E -gladiator~ -He is in the final stages of a charge against his opponent... THUD! CLANG! -CRASH!!!!... judging from the blood and the amount of distance that now -separates the gladiators head from the rest of his body, you can safely -assume that this was the final combat of his life. -~ -S -#12011 -The First-Aid Station~ - This is the place to come to if one is overcome by the heat and gore. -(Or if a lion gets loose) You see a jar of live leeches and other barbaric -medical apparati lying about here. From the west comes the roar of the -crowd, and a hall leads east. The healer will be with you shortly. -~ -120 cd 0 -D1 -You see hundreds, perhaps thousands of people. -~ -~ -0 -1 12018 -D3 -Rows of stone bleachers lie to the west. -~ -~ -0 -1 12004 -E -leech leeches~ -DISGUSTING! Each is about the size of matchbox and very slimy. You are VERY -glad that you have access to a cleric! -~ -S -#12012 -A Dirt Road~ - You are on a parched and dusty rural road which runs east and west. There -is a structure lying to the south. -~ -120 0 2 -D1 -Through the dust, you see a paved road. -~ -~ -0 -1 12019 -D2 -It is difficult to see through the haze and dust. -~ -~ -0 -1 12013 -D3 -It is difficult to see through the haze and dust. -~ -~ -0 -1 12005 -S -#12013 -The Commoner's House~ - You are standing in the main living quarters of a common Roman citizen. -The furnishings are sparse and it is warm here. A putrid odor is coming -from the east and passages lead north and south. -~ -120 d 0 -D0 -A dusty road lies to the north. -~ -~ -0 -1 12012 -D1 -What is that smell??!!! It is enough to make a yak gag!!! -~ -~ -0 -1 12020 -D2 -You hazard a guess that a bedroom lies in that direction. -~ -~ -0 -1 12014 -E -furnishings furniture~ -The furniture that you see is very simple and plain. It is made of rough hewn -wood and fastened together with nails. It looks very uncomfortable. -~ -S -#12014 -The Bedchamber~ - This is the bedroom. There is a hard and lumpy bed in the far corner. -It looks like the commoner's wife has been shirking her duties lately, as -there is a big pile of soiled laundry here. The only way out is from where -you came. -~ -120 cd 0 -D0 -You see the living quarters to the north. -~ -~ -0 -1 12013 -E -laundry wash clothing~ -It smells of sweat and is covered with mud. -~ -S -#12015 -The Noblemans' Box~ - These are the 'better' seats used primarily by the upper class of Rome. -There is a large seating area to the east and a staircase leading up here. -The view of the chariot track is pretty good. -~ -120 0 0 -D1 -Rows upon rows of bleachers lie to the east. -~ -~ -0 -1 12022 -D4 -The stairs look safe enough. -~ -~ -0 -1 12008 -S -#12016 -The Race Track~ - This is a hard dirt track about a quarter of a mile long. There are hoof -prints everywhere, and you see a large cloud of dust approaching. You had -better move before you get run over. A small tunnel leads west, you can see -the crowd to the east. You can hear loud snarls and roars coming from below. -~ -120 0 2 -D3 -You see athletes warming up and stretching. -~ -~ -0 -1 12009 -D4 -~ -~ -0 -1 12023 -D5 -Do you like lots of live lions that haven't been fed for a few days? -~ -~ -0 -1 12017 -S -#12017 -The Lion Pit~ - As you land at the bottom of this dirt-walled pit, the realization that a -pit full of lions is NOT a good thing to be hanging around in. Several of -the gladiators gather around the edge of the pit to watch your demise. You -look around you, and all you see is tawny fur and gaping jaws... it is too -late to run, too late to hide. - Twelve lions rip you and your belongings into a gory mass of bloodied -leather, bronze, and bone. - - What's that old saying? - Cats killed the curious? Something like that, I'm sure... - -~ -120 bd 0 -D4 -~ -~ -0 -1 12010 -D5 -~ -~ -0 -1 12016 -S -#12018 -The South Entrance To The Coliseum~ - You are standing at the south entrance to the Coliseum. There are -citizens of Rome everywhere, apparently in a mad rush to get in. A -statue of Caligula the Mad Emperor overlooks the area. There are long -lines standing to the east, and an acrid smell is coming from the west. -A busy road lies to the south. -~ -120 c 1 -D1 -The lines are very long and people look impatient. -~ -~ -0 -1 12025 -D2 -A road lies in that direction. -~ -~ -0 -1 12019 -D3 -An acrid, almost medicinal smell is coming from that direction. -~ -~ -0 -1 12011 -E -statue caligula~ -A larger than life stone statue of Caligula, the Mad Emperor, looks at you. -It looks like it is holding a phallus. He has got a grin on his face that -seems to say 'My horse would like you, I bet...' -~ -S -#12019 -The Main Highway~ - This is a well built and heavily traveled road running from east to west -and there is a large structure built entirely of stone to the north. -~ -120 0 1 -D0 -You can hear the roar of a large crowd of people coming from that direction. -~ -~ -0 -1 12018 -D1 -The highway continues to the east. -~ -~ -0 -1 12026 -D3 -The highway continues to the west. -~ -~ -0 -1 12012 -S -#12020 -The Outhouse~ - PEEEEEEEEEEEEEEEE-YEEEEEWWWWWWWW!!!!! Boy does it stink in here!!! You -taste bile in your mouth and your eyes begin to water. As you wipe away your -tears, you see that this is a small room, in the far corner of which a hole -is dug. The odor intensifies as you move closer and there is a roll of toilet -paper sitting on the ground. The only exit is to the west and your nose and -stomach are strongly suggesting that you use it. -~ -120 d 0 -D3 -The living quarters lie in that direction. Why don't you stop pussyfooting -around and go that way??!! Please? -~ -~ -0 -1 12013 -E -hole toilet~ -You walk over to the hole and see that there is a large turd floating in a -pool black water about 2 feet below the surface of the ground. As you lean -closer to get a better look, your nose catches a concentrated dose of the -fragrant aroma wafting upwards. Your stomach decides that it has had enough -of this shoddy treatment and you puke until it is empty. -~ -E -roll paper~ -Hey!! This is first-class stuff!! - White Cloud brand with lotion. The roll -is about half-used. -~ -S -#12021 -The Slave Quarters~ - This is where the slaves sleep. There are hard boards set out for use -as beds and not much else. The only exit is to the east. -~ -120 d 0 -D1 -To the east, a well manicured path winds through the nobleman's estate. -~ -~ -0 -1 12027 -S -#12022 -The Common Seating~ - This is where many of the common Roman citizens are seated during the -games. These are the cheapest seats in the house, as glare from the sun -is usually a problem during the afternoon. Like the other common seating -areas, this place could stand extensive renovation and a thorough cleaning. -This area extends to the south and a much more elegant seating area can be -seen to the west. -~ -120 0 1 -D3 -The seating gets much fancier and elegant in that direction. -~ -~ -0 -1 12015 -D2 -The common seating area continues. -~ -~ -0 -1 12023 -S -#12023 -The Common Seating~ - This is where many of the common Roman citizens are seated during the -games. Like the other commoners' areas in the coliseum, it could use -extensive renovation and cleaning. This area extends to the north and -lots of noise can be heard coming from the south. -~ -120 0 1 -D0 -The common seating area continues. -~ -~ -0 -1 12022 -D2 -You see hundreds, perhaps thousands of people. -~ -~ -0 -1 12024 -S -#12024 -The East Entrance To The Coliseum~ - You are standing at the east entrance to the Coliseum. There are people -everywhere, apparently in a mad rush to get in. A statue of Tiberius, an -Emperor of a time long since passed, stands here looking out over the crowd. -There is a passage to the north, the ticket booth is to the south and a gate -opening to the city lies to the east. -~ -120 c 1 -D0 -You see rows upon rows of dilapidated wooden bleachers. -~ -~ -0 -1 12023 -D2 -There are VERY long lines standing outside the ticket booth. -~ -~ -0 -1 12025 -D1 -Nero Drive lies in that direction. -~ -~ -0 -1 12031 -E -statue tiberius~ -The statue of Tiberius, made of iron, stands here. -~ -S -#12025 -The Ticket Booth~ - Long lines are standing here, waiting to buy tickets. There are three -vendors working furiously. Ticket stubs litter the ground and you can see -that the people are getting very impatient. There is a large, open cashbox -here. Main entrances to the Coliseum are to the north and west. -~ -120 d 0 -D0 -You see hundreds, if not thousands of people. -~ -~ -0 -1 12024 -D3 -You see hundreds, if not thousands of people. -~ -~ -0 -1 12018 -E -cashbox~ -It is a shame that the exchange rate for Roman money is so low. What amounts -to a fortune in Rome isn't even worth one gold coin. The contents of the box -add up to about... well forget it. It isn't worth your time or trouble to -carry it around. -~ -S -#12026 -A Paved Road~ - You are on a paved road that runs east to west. You can see an elaborate -looking estate to the south and to the north-west, off in the distance, you -can see a very large stone structure. -~ -120 0 1 -D1 -The road leads off to the east. -~ -~ -0 -1 12033 -D2 -It looks like a Nobleman's estate. We are talking RICH nobleman's estate. -~ -estate house~ -0 -1 12027 -D3 -The road leads west towards the highway. -~ -~ -0 -1 12019 -E -structure~ -That would probably be the Coliseum. There are a few good matches scheduled -for today. -~ -S -#12027 -A Noble Estate~ - You are on the grounds of a nobleman's estate which is hundreds of times -the size and splendor of anything that a common citizen of Rome would ever -hope to own. Everything is lush and green. The grass is perfectly manicured -and the trees are all bearing fruit. Ornamental plants are in perfectly -situated to enhance and adorn the three statues of dedicated to gods Jupiter, -Venus and Neptune. A tranquil path leads east and west, there is a paved road -to the north and an extravagant house lies to the south. -~ -120 0 2 -D0 -You see a paved road in the distance. -~ -~ -0 -1 12026 -D1 -The path leads east through the estate. -~ -~ -0 -1 12034 -D2 -You see an incredible house off in the distance. -~ -~ -0 -1 12028 -D3 -Off through the trees, you see a small, plain hut. -~ -~ -0 -1 12021 -E -Venus~ -Venus, the Roman goddess of beauty and knowledge is displayed in a all of her -splendor. -~ -E -Jupiter~ -A statue made of pure gold depicts Jupiter sitting on his throne. The throne -looks like it is made of silver. -~ -E -Neptune~ -The statue of Neptune is made of pure jade and is holding a crystal trident. -It is sitting in the center of a small pond which has hundreds of beautiful -fish swimming in it. -~ -E -trees tree shrubs shrub plants plant~ -All of the plants, trees and shrubs are perfectly trimmed, without so much -as a dead leaf anywhere to be seen. You welcome the shade that they give -from the harsh sun above. -~ -S -#12028 -An Opulent House~ - You stand in a house, the size and splendor of which almost defies the -imagination. The floor is done with hand crafted marble tile with silver -and jeweled inlays. The light coming through the exquisitely crafted stained -glass windows bathes the room in splendor and the furniture looks as though -it was made by master craftsmen from all over the empire. A path through the -estate is north of here. -~ -120 cd 0 -D0 -You see a well manicured path that winds through the estate. -~ -~ -0 -1 12027 -E -floor tile~ -Very expensive! A lot of master craftsmen labored long and hard to produce -such a work of art. -~ -E -windows~ -They are intricate and the scenes that they depict cast honor on several of -the gods. -~ -E -furniture~ -You hope to eventually be able to own a piece of furniture just like these -someday. These are only dreams, of course. -~ -S -#12029 -The Great North Gate~ - This is the northern gateway to the city of Rome. The huge gate appears -to be closed and locked against intrusion. A large road muddy road runs -through the gate and into the countryside. Nero Drive runs south from here. -~ -120 0 1 -D0 -The gate is made of solid iron and is well maintained. -~ -gate~ -2 -1 -1 -D2 -Nero Drive continues in that direction. -~ -~ -0 -1 12030 -E -gate~ -The gate is made of solid iron and is well maintained. -~ -E -road~ -The road is wide and very muddy. -~ -S -#12030 -Nero Drive~ - You are walking on a paved road that runs south through the city of Rome. -A great gate is directly north of here. The Roman citizens are very friendly -and tip their hats or say hello as you pass. -~ -120 0 1 -D0 -To the north, you can see a gate leading out of the city. -~ -~ -0 -1 12029 -D2 -Nero Drive continues in that direction. -~ -~ -0 -1 12031 -D3 -You see the bakery of Rome. -~ -~ -0 -1 12062 -S -#12031 -Nero Drive~ - You are walking on a great paved road that runs north and south through -the city. People are hurrying from one place to another, but always stop -to say hello. Most of the people are either coming from or going to the -town square. Nero Drive continues to the north, and you can see a large -open area to the south. -~ -120 0 1 -D0 -Nero drive continues in that direction. -~ -~ -0 -1 12030 -D2 -It looks like the town square. -~ -~ -0 -1 12032 -D3 -You see the an opulent estate. -~ -~ -0 -1 12024 -S -#12032 -The Town Square~ - You are standing in the middle of a large open area which is the common -area of Rome. During the day, this place is alive with the hustle and -bustle of all of the citizens of Rome and everyone in the city is sure to -stop by at some time or another. There are several street vendors peddling -their wares and the overall atmosphere is carnival-like in nature. To the -southeast, off in the distance, you can see the aqueduct and the buildings -of the Roman government lie to the northwest. Nero Drive leads north and -south from here and Clay Avenue runs east. -~ -120 0 1 -D0 -Nero Drive heads in the direction of the northern gate. -~ -~ -0 -1 12031 -D2 -A street made of hard packed clay runs in that direction towards the -aqueduct and buildings of the Roman government. -~ -~ -0 -1 12033 -D1 -Nero Drive heads in the direction of the south gate. -~ -~ -0 -1 12039 -E -vendor vendors~ -There are several sidewalk vendors here, selling fresh fruits and vegetables, -home baked goods, fine jewelry and other items. Most of the items for sale -are of very high quality. -~ -E -aqueduct~ -To the southeast, off in the distance, stands a large stone structure that -is used to channel water into the city. -~ -S -#12033 -Nero Drive~ - You are walking on a paved road that runs north and south through the -city of Rome. There are many people here, as polite as always. Most of -them are either coming from or going to the town square which lies to the -north. Nero Drive continues to the south. There is an observation area -overlooking the aqueduct to the east and a paved road leads west. -~ -120 0 1 -D0 -The town square lies in that direction. -~ -~ -0 -1 12032 -D1 -The aqueduct and mountain of the gods are in that direction. -~ -~ -0 -1 12040 -D2 -Nero Drive continues toward the South Gate. -~ -~ -0 -1 12034 -D3 -A paved road runs west through the city. -~ -~ -0 -1 12026 -S -#12034 -Nero Drive~ - This is a busy paved road that runs north through the city. The people -of Rome are very friendly and say hello as you pass. A gate leading out of -the city lies to the south and a small path goes west towards a nobleman's -estate. To the east, off in the distance, lies the great mountain. It is -rumored that the Gods watch over and protect the empire from there. -~ -120 0 1 -D0 -Nero Drive leads in that direction. -~ -~ -0 -1 12033 -D2 -You see many people entering and leaving the city through a large gate in the -walls protecting the city. -~ -~ -0 -1 12035 -D3 -It looks like a nobleman's estate. We are talking RICH nobleman's estate. -~ -~ -0 -1 12027 -S -#12035 -The South Gate~ - This is the southern gateway to the city of Rome. The bronze gate is -closed and locked. Looking through the bars, you see a heavily traveled -road leading out of the city. Nero Drive starts here and runs north and -a wizard's shop lies to the east. -~ -120 0 1 -D0 -Nero Drive leads towards the center of town. -~ -~ -0 -1 12034 -D1 -A small store, from which an occasional detonation can be heard, lies off -in that direction. It appears to be surrounded by a rolling pink mist. -~ -~ -0 -1 12042 -D2 -The gate appears to be closed and locked against intruders. -~ -gate~ -2 -1 -1 -E -gate~ -The gate appears to be closed and locked against intruders. -~ -S -#12036 -The Emperor's Private Office~ - You are standing in the Emperor's private office. The room is richly -furnished with the finest of the loot brought back from conquests of far -away lands. There is a massive, intricately carved desk here, upon which -are important documents, decrees and other paperwork involved in running -the empire. On the far wall, there is a marble bookcase that is well -stocked with the works of Homer, Plato, Socrates and other wise men. -Further, it seems that the current Emperor likes flowers as there are -many potted and cut specimens throughout the room. There is a french -door leading to the waiting room and a wooden door to the south. -~ -120 d 0 -D1 -Through the door, you see a waiting room. -~ -doors french~ -2 12035 12043 -D2 -The south door leads directly to the senate chambers. -~ -door wooden~ -2 12035 12037 -E -desk~ -The desk is made of solid walnut and gold inlay. It is exquisitely carved -with superior craftsmanship, the likes of which has rarely been seen. It -was probably brought to Rome from Gaul. -~ -E -documents decrees paperwork document decree papers paper~ -The documents are all written on reed scrolls made in Egypt and have been -sealed with wax. -~ -E -bookcase books~ -The books are very old and contain the wisdom of wise men from throughout the -entire Roman empire. They appear to be collecting dust. -~ -E -flowers plants flower plant~ -The plants contribute to a very relaxing atmosphere. -~ -S -#12037 -The Senate Chambers~ - This is the working room where elected senators from all over the empire -gather to advise the Emperor. An official seal of the Emperor is hanging on -the far wall. There is a wooden door to the north and a bronze door to the -east and doublehung door to the south. -~ -120 d 0 -D0 -The door is made of thick walnut. -~ -door wooden~ -2 12035 12036 -D1 -The door leads to the foyer. -~ -door bronze~ -1 12036 12044 -D2 -~ -door doublehung~ -1 12037 12038 -S -#12038 -The House Of Commons~ - This is the lower house of the advising body to the Emperor. Common men -from all parts of Rome work here to further assist the senators in advising -the Emperor on critical matters of state. The seal of the Emperor is painted -on the far wall. The only exit is to the north. -~ -120 d 0 -D0 -You see that the doublehung door leads to the senate chambers. -~ -door doublehung~ -1 12104 12037 -S -#12039 -Clay Avenue~ - You are on a wide well traveled road running east and west through the -heart of Rome. There are large crowds of people to the west and the road -continues to the east. The aqueduct is directly south of here. -~ -120 0 1 -D1 -Clay Avenue continues in that direction. -~ -~ -0 -1 12046 -D2 -You see an entrance to the aqueduct. -~ -~ -0 -1 12041 -D3 -There are large crowds of people in that direction. -~ -~ -0 -1 12032 -E -crowds people~ -It looks like some kind of bizarre or festival is occurring to the west. -There are hundreds of people of all classes shopping, talking or eating. -~ -S -#12040 -The Observation Lookout~ - You are on a platform overlooking a massive aqueduct. There is a -telescope mounted to the railing that surrounds the area and you can -hear the gurgle of water as it is channeled into the city. Off in -the distance, you can see the Mountain of the Gods. -There is a sign mounted to the railing and a ramp leads west. -~ -120 0 1 -D3 -You can see a busy street in that direction. -~ -~ -0 -1 12033 -E -telescope~ -If it were operational, it would offer a spectacular view of the Mountain of -the Gods. Unfortunately, it appears to have been vandalized. -~ -E -aqueduct~ -The aqueduct is a massive stone structure that channels water into Rome from -the Mountain of the Gods. During the rainy season, it is filled to the top. -However, due to recent drought, the water level appears to be very low. -~ -E -sign~ - - ******************************************** - * * - * The Roman Aquarian and Mountain * - * Observation Platform * - * * - * Designed and built by the Froboz * - * Magic Platform Company * - * * - ******************************************** - -~ -S -#12041 -The Aqueduct~ - You are in a massive stone structure that has been designed to channel -water into the city of Rome. Due to the recent drought, the water level -is low, allowing passage without a boat. The walls and floor are covered -with algae and slime producing treacherous footing conditions. There are -exits to the north, south and east. -~ -120 cd 6 -D0 -You can see a wide street to the north. -~ -~ -0 -1 12039 -D1 -You see more aqueduct. -~ -~ -0 -1 12048 -D2 -You see more aqueduct. -~ -~ -0 -1 12041 -D3 -You see more aqueduct. -~ -~ -0 -1 12054 -E -slime algae~ -Due to the availability of moisture and nutrients, a green, viscous slime has -grown and covered everything with a slippery coating. It seems to go out of -its way to drip on you. -~ -S -#12042 -The Mage's Shop~ - You are standing in the mage's shop. Magical ointments, charms and -potions are sitting on shelves and behind a glass counter. There is a -dense neon blue fog hugging the floor here, making it impossible to see -below your knees. You suddenly hear mutterings coming from the back -room, possibly from... -KKKKKAAAAAABBBBOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOMMMMMMMMMMMMMMMM!!!!!! -You are deafened by the noise from a tremendous explosion and the -concussion from the blast staggers you! The shopkeeper seems to pay -no heed to this. The door to the back room opens and an older man, -wearing a pointed hat, whose face is smudged with soot sticks his head -out. 'Is everyone alright? Sorry about that. I was testing a new -spell. I'll try to give advance notice next time.', he says. The door -then closes. -~ -120 d 0 -D1 -The door is reinforced with steel and looks VERY sturdy. Considering the -'test' that you just witnessed, you are glad that it stands between you and -whatever is going on in the back room. -~ -door~ -2 12038 12049 -D3 -You see the south gate through the door. -~ -~ -0 -1 12035 -E -fog mist~ -This is some really strange stuff! You have never seen anything this color -before. Your legs are totally obscured from the knee down. -~ -S -#12043 -The Waiting Room~ - You are standing in a very large room with a high ceiling and there -are a few people waiting here to see the Emperor on urgent matters. The -master scheduler tells you to have a seat and sends a page to inform the -his highness of your arrival. There are large doors to the east and west -and an exit leads south to the foyer. -~ -120 d 0 -D1 -There is a sign on the door that says: MUNICIPAL COURT OF ROME. It appears -to be open. -~ -~ -0 -1 12050 -D2 -The foyer is directly to the south. -~ -~ -0 -1 12044 -D3 -There is a large door to the west. -~ -door~ -2 12035 12036 -S -#12044 -The Entrance Foyer~ - You have just entered the main government building of the Roman Empire -and are standing in a massive room with an elaborately decorated domed roof. -There are many people here; messengers and senators being the most numerous. -There is a large, ornate door to the west, a hallway leads north and marble -stairs that lead out of the building are to the south. -~ -120 d 0 -D0 -You see a hallway leading north to what looks like a waiting room. -~ -~ -0 -1 12043 -D3 -There is a large door to the west that blocks your path. -~ -door~ -1 12036 12037 -D5 -You see a stairway leading out of the building. -~ -~ -0 -1 12045 -S -#12045 -Outside The Capitol Building~ - You stand on white marble steps that lead up and into the Capitol -Building. There are several statues, none of any real significance, -at the entrance to the building. The main entrance to the building -is at the top of the steps. -~ -120 0 1 -D4 -The steps lead into the Capitol Building. -~ -~ -0 -1 12044 -D5 -The steps terminate onto Clay Avenue. -~ -~ -0 -1 12046 -E -stairs stairway steps~ -The stairs are immaculately polished and made of white marble. -~ -E -statue statues~ -There is really nothing noteworthy about them. -~ -S -#12046 -Clay Avenue~ - You are standing on a wide, heavily traveled road that runs east and -west through the heart of the city. There are marble steps leading up. -To the south, off in the distance, you can see a large stone structure -and a mountain that is partially obscured by the haze. There is a -general store to the north. -~ -120 0 1 -D0 -The general store lies in that direction. -~ -~ -0 -1 12063 -D1 -There is what appears to be a large gate in that direction. -~ -~ -0 -1 12051 -D3 -Clay Avenue continues. -~ -~ -0 -1 12039 -D4 -There are some white marble steps leading up. -~ -~ -0 -1 12045 -E -stone structure aqueduct~ -You see a massive stone structure, built several centuries ago, that is used -to channel water into the city. -~ -E -mountain~ -Off to the southwest, you can see a huge mountain that is partially obscured -by the haze. It is rumored that the gods reside there and protect the city. -~ -S -#12047 -The Summit Of The Mountain Of The Gods~ - You are at the summit of a very high mountain and are standing above -the clouds. The sun is shining brilliantly here and the clouds below -look like balls of cotton. The path that you have been walking on is -damp and the scent of lilac is in the air. -~ -120 0 5 -D5 -You see a damp path leading back down the mountain. -~ -~ -0 -1 12052 -S -#12048 -The Aqueduct~ - You are in a massive stone structure that has been designed to channel -water into the city of Rome. Due to the recent drought, the water level -is low, allowing passage without a boat. The walls and floor are covered -with algae and slime, producing treacherous footing conditions. There are -exits in all four cardinal directions. -~ -120 d 6 -D0 -The aqueduct continues. -~ -~ -0 -1 12057 -D1 -The aqueduct continues. -~ -~ -0 -1 12041 -D2 -The aqueduct continues. -~ -~ -0 -1 12041 -D3 -The aqueduct continues. -~ -~ -0 -1 12048 -E -slime algae~ -Due to the availability of moisture and nutrients, a green viscous slime has -grown and covered everything with a slippery coating. It seems to go out of -its way to drip on you. -~ -S -#12049 -Froboz's Workshop~ -You are standing in the workshop of Froboz the Great, the most powerful and -famous mage that Rome has ever known. Workbenches line the walls and are -covered with various test tubes, beakers, petri dishes and crucibles and -there is an odor in here that can best be described as a combination of old -sweat socks and burning tires. The only exit is back through the door -through which you came. In the middle of the room, you see a pile of ashes -that looks like it once was a body and Froboz is is busy making adjustments -on a new type of magic wand... possibly the one responsible for the explosion -a few minutes ago. He removes a jeweler's loupe from his eye as he turns -around. 'How in the name of Merlin did you get in here??!!' he asks. 'Oh, -nevermind! Since you are here, you can serve as witnesses to the final test -of the new mages' spell: "ectowatt".' With this he makes a magical gesture -and a paladin appears. Crossing his fingers, Froboz waves the wand his -direction and what happens next is incredible! The Paladin is enveloped in -what appears to be a small, well contained, thermonuclear explosion. When -the smoke clears you can see that the paladin and all of equipment has been -reduced to a large pile of flaming cinders. Froboz throws his head back and -cackles with insane glee. 'Now, my young friends, what can I do for you?', -he asks. -~ -120 d 0 -D3 -There is a door, reinforced with steel, in that direction. -~ -door~ -2 12038 12042 -E -workbench workbenches tubes beakers crucibles dishes~ -These are all tools of great power. You cannot even begin to understand what -any of this stuff does. -~ -E -cinders ashes pile~ -The ashes are a very fine grayish white powder that seems to be the only -worldly remains of Froboz's "test specimens". -~ -S -#12050 -The Courtroom~ - You stand inside of a large courtroom in which common civil disputes and -criminal matters are decided. There is a judge's bench and a witness stand -on the far side of the room and a jury's box along side. The Emperor's seal -is prominently displayed on the wall behind the judge's stand, reminding all -who enter that he is an extension of his highness. There is a door, possibly -leading to the judge's chambers, to the east and the waiting room is to the -west. -~ -120 d 0 -D1 -The door might lead into the judge's private chambers. -~ -door~ -1 12039 12055 -D2 -The holding cells lie in that direction. -~ -~ -0 -1 12060 -D3 -The waiting room lies in that direction. -~ -~ -0 -1 12043 -E -bench stand box jury~ -You see large wooden structures that are designed to separate the judge, jury -and witnesses from the rest of the courtroom. They are made of polished -oak and are strictly functional. -~ -E -seal~ -The seal of the Emperor is mounted above the judge's stand. -~ -S -#12051 -The East Gate Of Rome~ - You are standing inside of the eastern gate of Rome. There are two tall -spires built into the city wall, from which the guards can see the whole -eastern side of the city. The gate is currently open and to the east, -there is a heavily used road, made of packed clay, that leads out of Rome. -Another road leads westward into the city. -~ -120 0 1 -D1 -The clay road heads eastwards. -~ -gate~ -1 -1 12064 -D3 -The clay street leads into the city. -~ -~ -0 -1 12046 -E -spires towers~ -There are two tall spires on either side of the gate and are constantly -manned by the city guards. They are made of stone and stand about 40 -feet tall. -~ -E -gate~ -The gate is fabricated from iron and has been designed to keep intruders -out of the city. -~ -S -#12052 -A Mountain Path~ - You stand on a small trail that leads up and down. It has recently been -raining and there are small puddles everywhere. You are just below the -clouds and the view of the surrounding countryside is breathtaking. -~ -120 0 5 -D4 -The trail leads up and enters the clouds. -~ -~ -0 -1 12047 -D5 -The trail leads down. -~ -~ -0 -1 12056 -E -trail~ -The mountain trail is a little muddy, due to the recent rains. -~ -S -#12054 -The Aqueduct~ - You are in a massive stone structure that has been designed to channel -water into the city of Rome. Due to the recent drought, the water level -is low, allowing passage without a boat. The walls and floor are covered -with algae and slime, producing treacherous footing conditions. There are -exits in all four cardinal directions. -~ -120 d 6 -D0 -The aqueduct continues. -~ -~ -0 -1 12041 -D1 -The aqueduct continues. -~ -~ -0 -1 12054 -D2 -The aqueduct continues. -~ -~ -0 -1 12057 -D3 -The aqueduct continues. -~ -~ -0 -1 12048 -E -slime algae~ -Due to the availability of moisture and nutrients, a green, viscous slime has -grown and covered the everything with a slippery coating. It seems to go out -of its way to drip on you. -~ -S -#12055 -The Judge's Chambers~ - You are in a small room that is filled with legal tombs. There is a -small desk here, literally buried under legal documents. There is also -a small window overlooking the northern part of the city. -~ -120 d 0 -D3 -The courtroom lies in that direction. -~ -door~ -1 12039 12050 -E -tombs books~ -The books are very large and filled with Roman legal precedent. -~ -E -papers documents~ -There are hundreds of pages of petitions, lawsuits and court orders sitting -on the desk. One particularly interesting case involves a nobleman, a slave -and a roll of toilet paper. -~ -S -#12056 -A Mountain Path~ - You are standing on a small trail that leads through a grove of trees. -Every thing is lush and green here and it appears to have been raining -recently. 'This would be an ideal place for a picnic.' , you think to -yourself. -~ -120 0 5 -D4 -You see a small trail leading further up the mountain. -~ -~ -0 -1 12052 -D5 -You see a small trail, leading down. -~ -~ -0 -1 12059 -E -tree trees vegetation~ -All of the vegetation is lush, green and in full bloom. You wish that you -could take the time to stop and enjoy it properly. -~ -E -trail path~ -The path is a little muddy, possibly due to a recent thundershower. -~ -S -#12057 -The Aqueduct~ - You are in a massive stone structure that has been designed to channel -water into the city of Rome. Due to a recent drought, the water level is -low, allowing passage without a boat. The walls and floor are covered -with algae and slime, producing treacherous footing conditions. A valley -lies to the south and the other cardinal directions lead further into the -aqueduct. -~ -120 d 6 -D0 -The aqueduct continues. -~ -~ -0 -1 12054 -D1 -The aqueduct continues. -~ -~ -0 -1 12054 -D2 -You see a gorgeous valley. -~ -~ -0 -1 12058 -D3 -The aqueduct continues.... -~ -~ -0 -1 12041 -E -slime algae~ -Due to the availability of moisture and nutrients, a green, viscous slime has -grown and covered everything with a slippery coating. It seems to go out of -its way to drip on you. -~ -S -#12058 -The Valley Of The Gods~ - You stand in a tranquil valley at the base of a large mountain. A quiet -stream, with fruit trees growing along its banks, winds its way peacefully -through the valley and enters a large stone structure that lies to the west. -There are birds singing and every now and then a ripple breaks the surface -of the stream. You can see a path leading through the trees to the up. -~ -120 0 4 -D0 -A small path winds its way through the trees. -~ -~ -0 -1 12057 -D4 -You see a path leading up the mountain. -~ -~ -0 -1 12059 -E -stream brook~ -A stream of the clearest, cleanest water that you have ever seen winds its -way through the valley. -~ -E -fish~ -A variety of species swims peacefully in the cool, clear water. -~ -E -trees fruit~ -The fruit trees, nourished by the fertile ground at the edge of the stream -and sustained by the brilliant sunshine, line the banks of the stream and -are laden with fruit. -~ -S -#12059 -A Mountain Path~ - You are standing on a path that leads up through a stand of large trees. -Everything is green and it seems like eternal spring - this is Mother Nature -at her finest. It is possible to descend into a tranquil valley from here. -~ -120 0 5 -D4 -The path leads further up the mountain. -~ -~ -0 -1 12056 -D5 -The path widens out into a tranquil valley. -~ -~ -0 -1 12058 -E -trees~ -The trees are old and tower hundreds of feet above the ground. If you stand -still and listen carefully, you can hear the birds singing. -~ -S -#12060 -The Holding Cells~ - You are standing in the holding cell area, just off of the cortroom. Those -who are recently convicted of serious crimes are brought here, pending torture -and execution. The courtroom lies to the north and another exit goes east. -~ -120 d 0 -D0 -The courtroom lies to the north. -~ -~ -0 -1 12050 -D1 -~ -~ -0 -1 12061 -E -cells cell~ -You can see small and very cramped cells which are filthy. You shiver and -vow to never do anything that would cause you to become a resident. -~ -S -#12061 -The Torture Chamber~ - You are standing in a very small room in which there are many tools -designed specifically for inflicting pain and suffering. Some of them -are familiar, such as the rack and the iron maidens. Others, you have -never seen before and they make you wonder about the kind of sadistic -mind that dreamt them up. The only exit is to the west. -~ -120 d 0 -D3 -The holding cells lie in that direction. -~ -~ -0 -1 12060 -S -#12062 -The Roman Bakery~ - You are standing in the bakery of Rome and your mouth waters at the -delicious aromas wafting from the kitchen. The only exit is to the east. -~ -120 d 0 -D1 -~ -~ -0 -1 12030 -S -#12063 -The General Store~ - You are standing in the only general store of Rome. The walls and shelves -are covered with all of the various items required by Roman citizens and -stalwart adventurers. Clay Avenue lies to the south. -~ -120 d 0 -D2 -Clay Avenue lies in that direction. -~ -~ -0 -1 12046 -S -#12064 -Before Rome~ - You travel upon an East-West road wide enough for 30 men to march -abreast. It is packed hard through heavy use. To the west stands the -Gates of Rome inviting you to enter and partake of all the glory and -splendor that is Rome. -~ -120 d 1 -D1 -~ -~ -0 -1 12065 -D3 -~ -gate~ -1 -1 12051 -S -#12065 -Clay Road~ - You travel upon an East-West road wide enough for 30 men to march -abreast. It is packed hard through heavy use. To the west, your eyes -catch the splendors of a mighty city. -~ -120 d 1 -D1 -~ -~ -0 -1 12066 -D3 -~ -~ -0 -1 12064 -S -#12066 -Clay Road~ - You travel upon an East-West road wide enough for 30 men to march -abreast. -~ -120 d 1 -D1 -~ -~ -0 -1 12067 -D3 -~ -~ -0 -1 12065 -S -#12067 -The End Of The Clay Road~ - The mighty clay road turns into lesser, but still well traveled roads -here. You feel a surge run through your body as you look East into the -lands that Rome turned into its mighty empire. -~ -120 d 1 -D1 -A dirt trail leads towards the desert to the east. -~ -~ -0 -1 12068 -D3 -The mighty clay road leads off in this direction. -~ -~ -0 -1 12066 -S -#12068 -A Small Dirt Trail~ - This small dirt path seems to be a joint between a large clay road -located a short distance to the west and the expanse of sand which opens -up before you to the east. The clay road appears to lead through the -foothills towards the snowcapped mountain chain to the west. Perhaps -there is a city or settlement in that direction. - You cannot see any breaks in the horizon of the sand which fills your -vision as you look to the east, it seems to stretch forever. -~ -120 c 1 -D1 -The expanse of the Great Eastern Desert opens up before you. -~ -~ -0 -1 5028 -D3 -A large clay road begins a short distance to the west. -~ -~ -0 -1 12067 -S -$ diff --git a/lc-mud/circle/world/wld/15.wld b/lc-mud/circle/world/wld/15.wld deleted file mode 100644 index 2f39abefb0aaf9efccbe009d39d1fcb277fbabfe..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/15.wld +++ /dev/null @@ -1,742 +0,0 @@ -#1500 -A Road Leading From The Bank~ - You find yourself on a small road leading away from the edge -of the River of Lost Souls. The dark waters of the River can -be seen and heard just south of here. Looking to the east and -west, you see only the walls of the rocky cliffs. Off to the -north a strange path seems to lead straight into the depths of -the mountain. -~ -15 c 4 -D0 -A strange path leads northwards. -~ -~ -0 -1 1501 -D2 -The River of Lost Souls flows just to the south of here. -~ -~ -0 -1 5619 -S -#1501 -A Long Road~ - You stand here in spiritual emptiness, beginning a long and dangerous -path. Your honest submission has already been made, but the truth of your -heart has yet to be told. Leave here now, and do not come back until -you have grown. -~ -15 d 0 -D0 -~ -~ -0 -1 1502 -D2 -~ -~ -0 -1 1500 -S -#1502 -A Long Road~ - You stop for a moment, screaming in frustration. Surely it was that one -sin that was avoidable, of all that you regret. The hitting and the hurting -flash briefly before you. Moments later the pain passes, and the straight -path reveals itself before you. -~ -15 d 0 -D2 -~ -~ -0 -1 1501 -D0 -~ -~ -0 -1 1503 -S -#1503 -A Long Road~ - The road clears, the fog and pain of the first few steps left behind -you. Despite the sudden clarity, your mind is still haunted, images of -an old woman kneeling in prayer, eyes closing, smiling and crying. -~ -15 d 0 -D0 -~ -~ -0 -1 1504 -D2 -~ -~ -0 -1 1502 -S -#1504 -A Long Road~ - Looking ahead, you can see that the path you have been following will -soon come to an end, but something in the cold and the breeze tells you -that that will be only the beginning of the journey. -~ -15 d 0 -D0 -~ -~ -0 -1 1505 -D2 -~ -~ -0 -1 1503 -S -#1505 -A Test for the Faithful~ - It is here finally that decisions must be made. The first one that -confronts you is simple enough, to walk in the darkness, or to walk in -the light. Only the depths of your soul can decide, but remember this -much: the same truth lies at the end of both paths. -~ -15 d 0 -D4 -~ -~ -0 -1 1507 -D5 -~ -~ -0 -1 1506 -S -#1506 -Halls of the Forgotten~ - Even the darkest have a place on the road to the truth. It is in this -place, so empty and forgotten, that God has chosen the worst, and brought -them close to Him for one last time. -~ -15 d 0 -D1 -~ -~ -0 -1 1513 -D3 -~ -~ -0 -1 1508 -D4 -~ -~ -0 -1 1505 -S -#1507 -Shahadah~ - It was written once, on an ancient parchment in a curious and flowing -script, that there is in fact no god but Allah, and that Muhammad was -the last of His Prophets. With this recognition, all else became empty -and meaningless. -~ -15 d 0 -D1 -~ -~ -0 -1 1523 -D3 -~ -~ -0 -1 1518 -D5 -~ -~ -0 -1 1505 -S -#1508 -Earthly Evil~ - Whatever it carries, that rage converts into a weapon. Wrath supplies -all with arms. When an angry man thirsts for blood anything will serve -him for a spear. Fury turns a stick into a cudgel. -~ -15 ad 0 -D0 -~ -~ -0 -1 1509 -D1 -~ -~ -0 -1 1506 -S -#1509 -Misguidance~ - Some have been brought here not for what they did, but what they -failed to do. It is these, the poor souls that were presented the -fair evidence and rejected it with an honest mind, that deserve our -pity the most of all. -~ -15 ad 0 -D2 -~ -~ -0 -1 1508 -D0 -~ -~ -0 -1 1510 -S -#1510 -Temptation~ - Old tales tell of a conversation between the devil and the Prophet -Jesus: the devil offered him a kingdom, vast riches, the temptation of -a glorious near-death saved by his angels. Even this Messenger of God -was forced to stop and think. Imagine how hard it could be for the rest. -~ -15 ad 0 -D0 -~ -~ -0 -1 1511 -D2 -~ -~ -0 -1 1509 -S -#1511 -Hypocrisy~ - He called the populace to strict religious purity, rigidly enforcing -the times of prayer and the most correct forms of the words of the Muezzin. -All of this he strengthened by his most impeccable example, shunning all -riches and riding in tattered rags through his capital on the back of a -donkey. Despite all this, remember. Behind closed doors, all men are -hypocrites. -~ -15 ad 0 -D0 -~ -~ -0 -1 1512 -D2 -~ -~ -0 -1 1510 -S -#1512 -Hate~ - There is little in life much easier, and truthfully, little that is a -quicker ticket to damnation. You give brief thanks that you have come to -the end of these trials, but your words are drowned out by something -much louder, a mechanical preaching that drowns your ears in anger. You -hear a steady, repetitive litany of the same phrase, over and over again: -"I go the way history dictates with the blind assurance of a sleep-walker." -~ -15 ad 0 -D2 -~ -~ -0 -1 1511 -D0 -~ -~ -0 -1 1528 -S -#1513 -Spiritual Danger~ - Some evils are tangible, solid, so evident that they spit you right in -the face. Others are more clever, more subtle, and it is these that present -the greatest danger. Looking down the hall before you, a great fear fills -your heart, and a great, heavy longing. -~ -15 ad 0 -D0 -~ -~ -0 -1 1514 -D3 -~ -~ -0 -1 1506 -S -#1514 -The Fall~ - In the beginning, he was the best, the most beautiful of all the angels, -and God's most loved creation. Look at your own beauty, human, and do what -he could not. Look at your beauty, and learn to kneel! -~ -15 ad 0 -D2 -~ -~ -0 -1 1513 -D0 -~ -~ -0 -1 1515 -S -#1515 -Temptation~ - Temptation is the IF, the wondering, the second-guessing, the "I will -be a better man... if..." And that if is usually taken, sitting alone, -listening to that voice, calling you, offering such an easy way, but such -a crooked one. -~ -15 ad 0 -D0 -~ -~ -0 -1 1516 -D2 -~ -~ -0 -1 1514 -S -#1516 -The Last Day~ - The din of a great battle shakes these halls, the moans of the earth -erupting at the shakings of the End Time. Be ready for that day, be very -ready, for if you are not, he will claim you for one of his own. -~ -15 ad 0 -D2 -~ -~ -0 -1 1515 -D0 -~ -~ -0 -1 1517 -S -#1517 -Flame~ - Undescribable horror and pain, a blackness drowned out only by the -burning anguish, the inextinguishable fire coming not from some burning -wood or molten lava but from the brightness and pain of the horrible, -tortured souls that surround, everywhere you turn. -~ -15 ad 0 -D0 -~ -~ -0 -1 1530 -D2 -~ -~ -0 -1 1516 -S -#1518 -Earthly Light~ - To slip into evil is easy, but walking this path is the hardest of -all. Even the four you will find here today have strayed from the line -at least once in their lives, and there are still some living who curse -the very sound of their names. Despite all this, confront them now, and -let their actions serve as your example. -~ -15 d 0 -D0 -~ -~ -0 -1 1519 -D1 -~ -~ -0 -1 1507 -S -#1519 -The Light of the Rashidun~ - Many believed that the Prophet would never die, but when the stark -evidence of his body confronted them, it soon became necessary to provide -for the future. The four that came after are called the Rashidun, the -rightly-guided Caliphs that would spread the word and the light, and with -it forge one of history's greatest empires. -~ -15 d 0 -D0 -~ -~ -0 -1 1520 -D2 -~ -~ -0 -1 1518 -S -#1520 -The Light of the Rashidun~ - The first Caliphs were chosen by consultation with a noble council -of elders, each of whom, hoping to lead the world of Islam alone, voted -to elect the one amongst them they thought was the weakest. Each time, -they were wrong. Each one was more noble, more upright than the one -before. -~ -15 d 0 -D0 -~ -~ -0 -1 1521 -D2 -~ -~ -0 -1 1519 -S -#1521 -The Light of the Rashidun~ - Every majestic and happy tale must end, usually all too soon, and thus -it was with the golden age of the Caliphate. The Rashidun were pure men, -good men, true to the path, but their followers soon began to bicker, and -civil war was on the horizon. -~ -15 d 0 -D2 -~ -~ -0 -1 1520 -D0 -~ -~ -0 -1 1522 -S -#1522 -The Light of the Rashidun~ - The end of the Rashidun was the beginning of Schism. The memories -of the Prophet and the living example of the Caliphs proved to be -insufficient example to the faithful. Ali died, and some say that -with him the Caliphate died too, a martyr, his blood still flowing in -the nameless river. -~ -15 d 0 -D0 -~ -~ -0 -1 1531 -D2 -~ -~ -0 -1 1521 -S -#1523 -Spritual Reward~ - Behold, Allah is the Provider, the most Generous. He would not suffer -his believers to walk the path of light without guidance. He provided the -Prophets, may peace be upon them, and in the examples of their own growth, -we shall find the truth of our own. -~ -15 d 0 -D0 -~ -~ -0 -1 1524 -D3 -~ -~ -0 -1 1507 -S -#1524 -Creation~ - In the creation of the heavens and the earth, and in the alternation of -night and day, there are signs for men of sense; those that remember Allah -say: "Lord, You have not created this in vain!" -~ -15 d 0 -D0 -~ -~ -0 -1 1525 -D2 -~ -~ -0 -1 1523 -S -#1525 -Revelation~ - The Angel Gabriel came to him and said: "Read!" He replied: "But I -cannot!" The order was repeated three times, until the Angel himself -said: "Read, in the name of your Lord who created man from clots of blood. -Praise be to God, Lord of the Universe." -~ -15 d 0 -D2 -~ -~ -0 -1 1524 -D0 -~ -~ -0 -1 1526 -S -#1526 -Conversion~ - Unbelievers, I do not worship what you worship, nor do you worship -what I worship. I shall never worship what you worship, nor will you -ever worship what I worship. You have your own religion, and I have -mine. -~ -15 d 0 -D0 -~ -~ -0 -1 1527 -D2 -~ -~ -0 -1 1525 -S -#1527 -Deliverance~ - The balance had been made, the soul placed in readiness, and the final -measurement taken. For those that have come this far, surely this is the -day of immortality! -~ -15 d 0 -D0 -~ -~ -0 -1 1533 -D2 -~ -~ -0 -1 1526 -S -#1528 -Repentance~ - God forgives those who commit evil in ignorance, for He is all-knowing -and wise. But He will not forgive those who do evil, and when death comes -to them, say: "Now we repent!" For those We have prepared a woeful scourge. -~ -15 ad 0 -D4 -~ -~ -0 -1 1534 -D1 -~ -~ -0 -1 1529 -D2 -~ -~ -0 -1 1512 -S -#1529 -Pilgrimage~ - It is incumbent upon all Muslims to make the pilgrimage to Mecca once -in their lifetime, if they are able, and for those unfortunate enough to -follow the lives of the lower evils, such a pilgrimage with an open and -contrite heart shall absolve them of all. -~ -15 ad 0 -D4 -~ -~ -0 -1 1535 -D1 -~ -~ -0 -1 1530 -D3 -~ -~ -0 -1 1528 -S -#1530 -Intercession~ - It is written that no one may intercede with God on behalf of another. -No prayers from another may save the soul of a doomed man; his only hope -is prayers of his own. -~ -15 ad 0 -D4 -~ -~ -0 -1 1536 -D2 -~ -~ -0 -1 1517 -D3 -~ -~ -0 -1 1529 -S -#1531 -The Upper Reaches~ - You have traveled the righteous path, and you have faced the examples -of the true models of the Prophet. Only the final journey awaits you; -live like this and you shall live forever. -~ -15 d 0 -D2 -~ -~ -0 -1 1522 -D1 -~ -~ -0 -1 1532 -D5 -~ -~ -0 -1 1534 -S -#1532 -The Upper Reaches~ - When the records of men's deeds are laid open, and heaven is stripped -bare; when Hell burns fiercely and Paradise is brought near: then each -soul shall know what it has done. -~ -15 d 0 -D1 -~ -~ -0 -1 1533 -D3 -~ -~ -0 -1 1531 -D5 -~ -~ -0 -1 1535 -S -#1533 -The Upper Reaches~ - You have traveled the righteous path, and your own journey has -imitated the evolution of the most perfect soul. Only one final -path awaits you; die as the one in the room before, and your death -will mean nothing. -~ -15 d 0 -D2 -~ -~ -0 -1 1527 -D3 -~ -~ -0 -1 1532 -D5 -~ -~ -0 -1 1536 -S -#1534 -The Final Facing~ - The last of the darkness lies behind you; only the straight path -remains. Go forth with a clean heart. Only the penitent shall find -what they seek. -~ -15 cd 0 -D1 -~ -~ -0 -1 1535 -D4 -~ -~ -0 -1 1531 -D5 -~ -~ -0 -1 1528 -S -#1535 -The Final Facing~ - The last of the darkness lies behind you; only the straight path -remains. Go forth with a clean heart. Only the penitent shall find -what they seek. -~ -15 cd 0 -D0 -~ -~ -0 -1 1537 -D3 -~ -~ -0 -1 1534 -D1 -~ -~ -0 -1 1536 -D4 -~ -~ -0 -1 1532 -D5 -~ -~ -0 -1 1529 -S -#1536 -The Final Facing~ - The last of the darkness lies behind you; only the straight path -remains. Go forth with a clean heart. Only the penitent shall find -what they seek. -~ -15 cd 0 -D3 -~ -~ -0 -1 1535 -D4 -~ -~ -0 -1 1533 -D5 -~ -~ -0 -1 1530 -S -#1537 -A Straight Path~ - The Compassionate, the Merciful, Sovereign of the Day of Judgment! -You alone we worship, and to You alone we turn for help. Guide us to -the Straight Path, the path of those whom You have favored, not of -those who have gone astray. -~ -15 d 0 -D2 -~ -~ -0 -1 1535 -D0 -~ -~ -0 -1 1538 -S -#1538 -Progression~ - Were We worn out by the First Creation? Yet they are in doubt about -a new creation. WE created man. We know the promptings of his soul, -and are closer to him than his jugular vein. -~ -15 d 0 -D0 -~ -~ -0 -1 1539 -D2 -~ -~ -0 -1 1537 -S -#1539 -Judgment~ - Undoubtedly the shortest path is the straightest one. Only one more -step awaits before a final decision is made and a home given to you for -all eternity. -~ -15 d 0 -D0 -~ -~ -0 -1 1540 -D2 -~ -~ -0 -1 1538 -S -#1540 -The Utmost Throne~ - You have come at last to the resting place of the most holy. Startling -crystal clarity of vision has been granted to you; seven guardians rim -the periphery of the throne and all is bathed in a warm and clean light. -It is here that the final choice is to be made, and no defiance of yours -can change the outcome. -~ -15 d 0 -D2 -~ -~ -0 -1 1539 -S -$ diff --git a/lc-mud/circle/world/wld/150.wld b/lc-mud/circle/world/wld/150.wld deleted file mode 100644 index f4fc32dbfd68ac81cf0eb5425a65e28ca3d29922..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/150.wld +++ /dev/null @@ -1,1766 +0,0 @@ -#15000 -The King's Road~ - You stand at the beginning of the actual King's Road. The road is wide -enough for several horses to ride along side by side with room to spare. -The stones which make up the road have been put into place with such skill -that the road seems to be perfectly smooth and perfectly straight. - You spot a small trail leading to the south through the undergrowth which -surrounds the road at this point. -A traveller passes by and waves cheerfully at you. -~ -150 c 1 -D1 -The King's Road continues in a straight line to the east towards a grand -castle. -~ -~ -0 -1 15001 -D2 -A small overgrown trail leads through the undergrowth to the south. -~ -~ -0 -1 15061 -D3 -The King's Road thins out a bit into a lane just to the west. -~ -~ -0 -1 3502 -E -traveller~ -The traveller smiles cheerfully and calls 'hello' when you greet him, -but continues on his way. -The traveller is in excellent condition. -~ -S -#15001 -The King's Road~ - You stand in the center of the great King's Road. The road is very well -built, and goes in a straight line due east-west. -~ -150 0 1 -D1 -The King's Road continues in a straight line to the east. -~ -~ -0 -1 15002 -D3 -You see that the King's Road continues westwards towards a large city. -~ -~ -0 -1 15000 -S -#15002 -The King's Road~ - You stand on the King's Road, which leads east and west. The -skill of the builders is apparent, since it is impossible to notice -any turn or irregularity in the road. -~ -150 0 1 -D1 -You see a castle in the far east. -~ -~ -0 -1 15003 -D3 -The King's Road continues in a straight line to the west. -~ -~ -0 -1 15001 -S -#15003 -On The King's Road Outside A Castle~ - You are standing on the King's Road. Before you is a large -Castle, evidently built not so much for strength as for beauty. -It is not totally without defences, though, for it is surrounded -by a deep moat, and its windows are just narrow slits for archers -to shoot through. To the north there is a drawbridge across the -moat. -~ -150 0 1 -D0 -You see the drawbridge. -~ -~ -0 -1 15004 -D3 -The King's Road continues in a straight line to the west. -~ -~ -0 -1 15002 -S -#15004 -On The Drawbridge~ - You have arrived at the drawbridge leading into the Castle. Before -you is a huge, double-doored gate. It seems very strong. You see some -whirls in the moat. -~ -150 c 1 -D0 -The gate has huge, but intricately carved hinges. As the Castle itself, -it seems designed not only for strength, but also for beauty. -~ -gate door~ -1 -1 15007 -D2 -You see the King's Road. -~ -~ -0 -1 15003 -E -whirls whirl moat~ -You can't see much, but it seems that something beneath the surface -is creating them. -~ -S -#15005 -The Kitchen~ - You are in the Kitchen. Lots of helpers hurry to do the Chief Cook's -bidding, and there is a wonderful smell that makes you feel very hungry. -All around the room, there are shelves with different kinds of cooking -gear stacked on them. There is an exit to the north, and one to the east; -both leading to small passages. -~ -150 d 0 -D0 -You see a small, dimly lit passage. -~ -~ -0 -1 15010 -D1 -You see a small, dimly lit passage. -~ -~ -0 -1 15006 -S -#15006 -A Small Passage~ - You are standing in a small passage, that is clearly intended mostly -for the servants of the Castle. It is only dimly lit and quite narrow. -The passage leads west, and to the east there is a small door. -~ -150 d 0 -D1 -The door is small and uninteresting. -~ -door small~ -1 -1 15007 -D3 -You hear clanging of pots, and smell cooking meat. -~ -~ -0 -1 15005 -S -#15007 -The Entrance Hall~ - You are standing in the impressive Entrance Hall of the Castle. -To the north is an exit into the Great Hall. There is also an exit -east, and a small door to the west. -~ -150 d 0 -D0 -You see the King's Great Hall. -~ -~ -0 -1 15012 -D1 -There seems to be a small guard room to the east. -~ -~ -0 -1 15008 -D2 -To the south, there is a gate, that leads to the Drawbridge. -~ -gate~ -1 -1 15004 -D3 -The door is small and uninteresting. -~ -door small~ -1 -1 15006 -S -#15008 -The Guard Room~ - You are in a small room, evidently meant for guards currently -not on duty. There is only one exit, back to the entrance hall. -~ -150 d 0 -D3 -You see the Castle Entrance. -~ -~ -0 -1 15007 -S -#15009 -Under The Tower~ - You are below one the three mighty towers of the Castle. There are -no guards here, and you sense that this part of the Castle is largely -unused. There are stairs going up to the tower, and there is also an -exit to the north. -~ -150 cd 0 -D0 -You see a small, dimly lit passage. -~ -~ -0 -1 15014 -D4 -The stairs are old, but in good repair. They lead up into the tower. -~ -~ -0 -1 15034 -E -stairs~ -The stairs are old, but in good repair. They lead up into the tower. -~ -S -#15010 -The Small Passage~ - You are standing in a small passage, that is clearly intended -mainly for the servants of the Castle. The passage leads north -and south. -~ -150 d 0 -D0 -You see a small, dimly lit passage. -~ -~ -0 -1 15015 -D2 -You hear the clanging of pots, and smell cooking meat. -~ -~ -0 -1 15005 -S -#15011 -The Great Hall~ - You are standing in the south-west end of the Great Hall. It -is truly vast; the roof is so high above your head, that it seems no -closer than the clouds outside. The roof is beautifully painted, by -someone who must have been a true master. The hall is very large, -and could easily seat several hundred people at a banquet. -~ -150 d 0 -D0 -You see the King's Great Hall. -~ -~ -0 -1 15016 -D1 -You see the King's Great Hall. -~ -~ -0 -1 15012 -E -roof paintings paint~ -The paintings on the roof depict the great heroes and gods. One of -the gods is fairly heavy-bellied and incredibly hairy, with a massive -beard. Also among them are the great enemies and wrongdoers, such as -the evil Goddess Yochlol and the powerful evil Wizard Tharoecon. -~ -S -#15012 -The Great Hall~ - You are standing in the southern end of the Great Hall. It -is truly vast; the roof is so high above your head, that it seems no -closer than the clouds outside. The roof is beautifully painted, by -someone who must have been a true master. The hall is very large, -and could easily seat several hundred people at a banquet. To your -north, you see King Welmar's great throne, and to the south is the -Castle Entrance. -~ -150 d 0 -D0 -You see the part of the Great Hall where the throne is. -~ -~ -0 -1 15017 -D1 -You see the King's Great Hall. -~ -~ -0 -1 15013 -D2 -You see the Castle Entrance. -~ -~ -0 -1 15007 -D3 -You see the King's Great Hall. -~ -~ -0 -1 15011 -E -roof paintings paint~ -The paintings on the roof depict the great heroes and gods. One of -the gods is fairly heavy-bellied and incredibly hairy, with a massive -beard. Also among them are the great enemies and wrongdoers, such as -the evil Goddess Yochlol and the powerful evil Wizard Tharoecon. -~ -S -#15013 -The Great Hall~ - You are standing in the south-east end of the Great Hall. It -is truly vast; the roof is so high above your head, that it seems no -closer than the clouds outside. The roof is beautifully painted, by -someone who must have been a true master. The hall is very large, -and could easily seat several hundred people at a banquet. -~ -150 d 0 -D0 -You see the King's Great Hall. -~ -~ -0 -1 15018 -D3 -You see the King's Great Hall. -~ -~ -0 -1 15012 -E -roof paintings paint~ -The paintings on the roof depict the great heroes and gods. One of -the gods is fairly heavy-bellied and incredibly hairy, with a massive -beard. Also among them are the great enemies and wrongdoers, such as -the evil Goddess Yochlol and the powerful, evil Wizard Tharoecon. -~ -S -#15014 -A Passage~ - You are standing in a passage, that leads north and south. To the south -it leads towards one of towers. -~ -150 d 0 -D0 -You see the small passage continue. -~ -~ -0 -1 15019 -D2 -~ -~ -0 -1 15009 -S -#15015 -The Passage~ - You are in a passage, that leads north and south. To the east there -is an exit to the Great Hall. -~ -150 d 0 -D0 -You see the passage continue. -~ -~ -0 -1 15020 -D1 -You see the King's Great Hall. -~ -~ -0 -1 15016 -D2 -You see the passage continue. -~ -~ -0 -1 15010 -S -#15016 -The Great Hall~ - You are standing in the north-west end of the Great Hall. It -is truly vast; the roof is so high above your head, that it seems no -closer than the clouds outside. The roof is beautifully painted, by -someone who must have been a true master. The hall is very large, -and could easily seat several hundred people at a banquet. To your -east, you see King Welmar's great throne, and to the west there is -an exit to a passage. -~ -150 d 0 -D1 -You see the part of the Great Hall where the throne is. -~ -~ -0 -1 15017 -D2 -You see the King's Great Hall. -~ -~ -0 -1 15011 -D3 -You see a passage. -~ -~ -0 -1 15015 -E -roof paintings paint~ -The paintings on the roof depict the great heroes and gods. One of -the gods is fairly heavy-bellied and incredibly hairy, with a massive -beard. Also among them are the great enemies and wrongdoers, such as -the evil Goddess Yochlol and the powerful evil Wizard Tharoecon. -~ -S -#15017 -By The Throne In The Great Hall~ - You are standing by the King's huge ivory throne. The throne is, to -an even greater degree than the Hall itself, a masterpiece. It is -intricately and beautifully carved, and it seems to be made out of a -single block of ivory, though you shiver at the thought of meeting -the animal that died to yield a piece of that size. The Hall continues -to the east, west and south. -~ -150 d 0 -D1 -You see the King's Great Hall. -~ -~ -0 -1 15018 -D2 -You see the King's Great Hall. -~ -~ -0 -1 15012 -D3 -You see the King's Great Hall. -~ -~ -0 -1 15016 -E -roof paintings paint~ -The paintings on the roof depict the great heroes and gods. One of -the gods is fairly heavy-bellied and incredibly hairy, with a massive -beard. Also among them are the great enemies and wrongdoers, such as -the evil Goddess Yochlol and the powerful evil Wizard Tharoecon. -~ -E -throne ivory~ -It is large and very beautiful. The carvings are mainly of animals and -magic beasts. -~ -S -#15018 -The Great Hall~ - You are standing in the north-east end of the Great Hall. It -is truly vast; the roof is so high above your head, that it seems no -closer than the clouds outside. The roof is beautifully painted, by -someone who must have been a true master. The hall is very large, -and could easily seat several hundred people at a banquet. To your -west, you see King Welmar's great throne, and to the east there is -an exit to a small passage. -~ -150 d 0 -D1 -You see a passage. -~ -~ -0 -1 15019 -D2 -You see the King's Great Hall. -~ -~ -0 -1 15013 -D3 -You see the part of the Great Hall where the throne is. -~ -~ -0 -1 15017 -E -roof paintings paint~ -The paintings on the roof depict the great heroes and gods. One of -the gods is fairly heavy-bellied and incredibly hairy, with a massive -beard. Also among them are the great enemies and wrongdoers, such as -the evil Goddess Yochlol and the powerful evil Wizard Tharoecon. -~ -S -#15019 -The Small Passage~ - You are standing in a small passage, that leads north and south. -To the west, there is an exit into the Great Hall. -~ -150 d 0 -D0 -The passage continues to the north. -~ -~ -0 -1 15024 -D2 -The passage continues to the south. -~ -~ -0 -1 15014 -D3 -To the west you see the Great Hall. -~ -~ -0 -1 15018 -S -#15020 -The Passage~ - You are standing in a north-south leading passage. There is a door -to the east. -~ -150 d 0 -D0 -The passage leads to a staircase. -~ -~ -0 -1 15025 -D1 -The door is quite small and unobtrusive. -~ -door~ -1 -1 15021 -D2 -The passage continues to the south. -~ -~ -0 -1 15015 -S -#15021 -The Servants' Corridor~ - You are standing in a corridor, that stretches further to the east. -There are doors to the north and west. The corridor itself is mainly -used by servants, and lacks some of the beauty of the rest of the -castle. -~ -150 d 0 -D0 -There is a door there! -~ -door~ -1 -1 15026 -D1 -The corridor seems to come to its end a bit further east. -~ -~ -0 -1 15022 -D3 -The door to the west is made out of wood. -~ -door wood~ -1 -1 15020 -S -#15022 -The End Of The Servants' Corridor~ - The corridor leads only west from here, but there is a door to -the north. -~ -150 d 0 -D0 -The door leads to a room intended for the butler. -~ -door~ -1 15009 15027 -D3 -You see the corridor continue. -~ -~ -0 -1 15021 -S -#15023 -The Training Room~ - This is the Training Room of the men of the Castle guard. It is -very large, with weapons standing in racks by all the walls. Most -of the weapons seem to be intended for training only, with blunt -edges and the like, but there are some that might be useful for -real fighting. There is a door to the north. -~ -150 d 0 -D0 -The door is large and heavy. -~ -door large heavy~ -1 -1 15028 -D1 -You see a small passage. -~ -~ -0 -1 15024 -S -#15024 -The Small Passage~ - You are standing in a small passage leading north and south. There -is also an exit to the west, from which grunts, cheers and heavy blows -can be heard. -~ -150 d 0 -D0 -The passage leads north to some stairs. -~ -~ -0 -1 15029 -D2 -You see the passage continuing. -~ -~ -0 -1 15019 -D3 -You see the Training Room. -~ -~ -0 -1 15023 -S -#15025 -The Stair Room~ - You are standing below a great staircase, that leads up to the -second floor of the Castle. The stairs are made of marble, and there -are pillars carved in the likenesses of trees with little animals -running up and down the trunks. -~ -150 d 0 -D2 -You see the passage. -~ -~ -0 -1 15020 -D4 -The stairs lead up to the second floor. -~ -~ -0 -1 15049 -E -stairs stair~ -Made out of marble, and as all the rest of the Castle made primarily -for beauty and with great skill. -~ -E -pillar pillars tree trees~ -Very nice. Squirrels and little birds all over. -~ -S -#15026 -The Servants' Quarters~ - You are standing in a large room, that seems to house many of the -servants. The room is full of comfortable-looking beds. There is also -a large chest, probably containing some of the servants' belongings. -~ -150 d 0 -D2 -The door is made out of wood. -~ -door wood~ -1 -1 15021 -E -bed~ -The beds all look comfortable, despite the fact that this is just -the servants' place. -~ -S -#15027 -The Butler's Quarters~ - You see at once that this must be the butler's room, for it lies -in the servants' wing, and still it is large and comfortable; almost -luxurious, in fact. There is a large bed and a drawer in the room. -The only exit is via the door to the south. -~ -150 d 0 -D2 -You see the corridor. -~ -door~ -1 15009 15022 -E -bed~ -Looks very comfortable indeed. -~ -S -#15028 -The Guards' Barracks~ - You are standing in a very large room with bunks all over. It is -obvious, that this is where the guards off duty spend most of their -time, drinking and gambling or, probably, mostly sleeping. -~ -150 d 0 -D2 -The door is large and heavy. -~ -door large heavy~ -1 -1 15023 -E -bunk bunks~ -They look a bit hard, but you could sleep in them. -~ -S -#15029 -The Stairs~ - You are standing by a staircase leading down. As you look down, -you notice that for the first time since you entered the castle, -things are not aesthetically made. Instead it looks more functional -and prison-like. -~ -150 d 0 -D2 -You see the small passage. -~ -~ -0 -1 15024 -D5 -The stairs down lead into darkness. -~ -~ -0 -1 15055 -E -stairs stair staircase~ -They seem to be made of granite, and stretch down into a more dimly -lit area than where you come from. -~ -S -#15030 -At A Bend In The Corridor~ - You are standing at a place where the corridor bends from east to north. -~ -150 d 0 -D0 -You see the corridor continue. -~ -~ -0 -1 15035 -D1 -You see the corridor continue. -~ -~ -0 -1 15031 -S -#15031 -The Corridor~ - You are standing in a long corridor, decorated with tapestries -depicting old times and old heroes. It leads east and west. -~ -150 d 0 -D1 -You see the corridor continue. -~ -~ -0 -1 15032 -D3 -You see the corridor continue. -~ -~ -0 -1 15030 -S -#15032 -The Corridor~ - You are standing in a long corridor, decorated with tapestries -depicting old times and old heroes. It leads east and west. -~ -150 d 0 -D1 -You see the corridor continue. -~ -~ -0 -1 15033 -D3 -You see the corridor continue. -~ -~ -0 -1 15031 -S -#15033 -The Corridor~ - You are standing in a long corridor, decorated with tapestries -depicting old times and old heroes. The corridor continues west, -and to the north you see the luxurious guest wing. -~ -150 d 0 -D0 -You see the guest wing. -~ -~ -0 -1 15038 -D3 -You see the corridor continue. -~ -~ -0 -1 15032 -S -#15034 -In The South-East Tower~ - This part of the tower is fairly uninteresting, but it leads further -upwards... -~ -150 d 0 -D4 -The room at the top of the tower seems darkish for some reason. -~ -~ -0 -1 15052 -D5 -You see the stairs at the bottom of the tower. -~ -~ -0 -1 15009 -S -#15035 -The Corridor~ - You are standing in a long corridor, decorated with tapestries -depicting old times and old heroes. It leads north and south. There -is also an exit to the east here. -~ -150 d 0 -D0 -You see the corridor continue. -~ -~ -0 -1 15040 -D1 -You see a small room. -~ -~ -0 -1 15036 -D2 -You see the corridor continue. -~ -~ -0 -1 15030 -S -#15036 -By The Treasure Room~ - You are standing by a great iron door. The door is very large, and -seems very solid indeed. There is a sign posted by it. -~ -150 d 0 -D1 -You see a large steel door. -~ -door steel large~ -2 15007 15037 -D3 -You see the corridor. -~ -~ -0 -1 15035 -E -sign~ - - TREASURE ROOM - - Authorized personnel only - all others keep out. - ANY trespassing will be SEVERELY punished!! - -~ -S -#15037 -The Great Treasury~ - As you enter this room, you are astonished by the riches that -are stowed away here; not so much in gold, but paintings, tapestries, -skillful carvings and sculptures all over the vast room. You realise, -however, that most of these things are too well known to be sold -anywhere, without branding yourself as a thief, and condemning yourself -to instant death at the hands of the Royal Guard. -~ -150 d 0 -D3 -You see a large steel door. -~ -door large steel~ -2 15007 15036 -E -painting paintings carving carvings sculptures tapestries~ -It seems they are stored here temporarily to enable changing -of the decoration in the Castle on a regular basis. -~ -S -#15038 -The Guest Wing~ - You have arrived at the part of the Castle where prominent -guests are housed. To the east there is a large, ornamented -door, and a somewhat smaller one leads north. -~ -150 d 0 -D0 -The door seems to lead to a guest room. -~ -door small~ -1 -1 15043 -D1 -You see the guest suite behind the ornamented door. -~ -door ornament ornamented~ -1 -1 15039 -D2 -You see the corridor. -~ -~ -0 -1 15033 -S -#15039 -The Guest Suite~ - This must be where only the most highly regarded guests stay, since -it is luxurious beyond your wildest imagination. This is only the living -room of the suite, but it is huge and tastefully decorated. All the -furniture is not only beautiful, but also made for comfort. To the -north, there is an exit to the bedroom, and there is a door to the west. -~ -150 d 0 -D0 -You see the bedroom. -~ -~ -0 -1 15044 -D3 -Behind the door you see the entrance to the Guest Wing. -~ -door~ -1 -1 15038 -S -#15040 -The Corridor~ - You are standing in a long corridor, decorated with tapestries -depicting old times and old heroes. It leads north and south. -~ -150 d 0 -D0 -You see the corridor continue. -~ -~ -0 -1 15045 -D2 -You see the corridor continue. -~ -~ -0 -1 15035 -S -#15041 -The Ball Room~ - You are standing in the great Ball Room. It is a truly large room, -with a stage for an orchestra in the south-east end. -~ -150 d 0 -D0 -You see the Ball Room. -~ -~ -0 -1 15046 -D1 -To the east you see the stage. -~ -~ -0 -1 15042 -S -#15042 -By The Stage~ - Before you you see the stage. It is large enough for some 40 -musicians to play on at the same time. The Ball Room continues -to the west and north. -~ -150 d 0 -D0 -You see the Ball Room. -~ -~ -0 -1 15047 -D3 -You see the Ball Room. -~ -~ -0 -1 15041 -S -#15043 -A Guest Room~ - You are standing in a large room. Although it is comfortable enough, -you can tell it is not meant for any of the most illustrious guests, -since it lacks that extreme luxury found elsewhere in the Castle. -~ -150 d 0 -D2 -Behind the door, you see the entrance to the Guest Wing. -~ -door~ -1 -1 15038 -S -#15044 -The Bedroom~ - This room is dominated by the huge four-poster bed, that stands -against the northern wall. The room is large and cosy, and the bed -virtually begs you to lie down in it and sleep. -~ -150 d 0 -D2 -You see the living room of the suite. -~ -~ -0 -1 15039 -E -bed~ -Large, comfortable, bolstered... Invites you to sleep in it. -~ -S -#15045 -The Corridor~ - You are standing in a long corridor, decorated with tapestries -depicting old times and old heroes. It leads north and south. There -is an exit to the east, that leads to a large room. -~ -150 d 0 -D0 -You see the corridor continue. -~ -~ -0 -1 15049 -D1 -You see the Ball Room. -~ -~ -0 -1 15046 -D2 -You see the corridor continue. -~ -~ -0 -1 15040 -S -#15046 -The Ball Room~ - You are standing in the great Ball Room. It is a truly large room, -with a stage for an orchestra in the south-east end. -~ -150 d 0 -D1 -You see the Ball Room. -~ -~ -0 -1 15047 -D2 -You see the Ball Room. -~ -~ -0 -1 15041 -D3 -You see the corridor. -~ -~ -0 -1 15045 -S -#15047 -The Ball Room~ - You are standing in the great Ball Room. It is a truly large room, -with a stage for an orchestra in the south-east end. -~ -150 d 0 -D1 -To the east, you can enter a tower. -~ -~ -0 -1 15048 -D2 -To the south you see the stage. -~ -~ -0 -1 15042 -D3 -You see the Ball Room. -~ -~ -0 -1 15046 -S -#15048 -In The Tower~ - You are standing in the north-eastern of the three great watch- -towers of the Castle. To the west, you can enter the Ball Room and -there are stairs leading up into the Tower. -~ -150 d 0 -D3 -You see the Ball Room. -~ -~ -0 -1 15047 -D4 -The stairs lead a long way up to the top of the Tower. -~ -~ -0 -1 15054 -E -stairs~ -The stairs are made out of granite, and seem solid enough. -~ -S -#15049 -The Grand Staircase~ - You are standing on a great staircase, that leads up and down. To -the east, there is a large oak door, and a corridor leads south. -~ -150 d 0 -D1 -The door is large and made out of oak. -~ -door oak large~ -1 15014 15050 -D2 -You see the corridor. -~ -~ -0 -1 15045 -D4 -The stairs continue up to the top of the tower. -~ -~ -0 -1 15053 -D5 -The stairs lead down to the first floor of the Castle. -~ -~ -0 -1 15025 -E -stairs~ -The stairs are made of marble, and there are pillars carved in the -likenesses of trees with little animals running up and down the -trunks. -~ -S -#15050 -The Cosy Room~ - You have entered a large, cosy living room. There is a fireplace -with a fire burning, and a few comfortable chairs around a little -table. There is a door to the west, and also an exit to the east. -~ -150 d 0 -D1 -You see a large bedroom. -~ -~ -0 -1 15051 -D3 -The door is large, and made out of oak. -~ -door large oak~ -1 15014 15049 -E -fire fireplace~ -The fire is built out of logs, and seems to be able to burn for -quite a while longer. -~ -E -table~ -The table is made of mahogany, and elegant in a cosy way(!) -~ -E -chairs~ -The chairs are arranged around the fireplace. -~ -S -#15051 -King Welmar's Bedroom~ - This is a large room, with a wonderful view. To one side of the -room, stands a large four-poster bed. All around the room there are -massive bookshelves, filled with all kinds of books. The titles include -works such as: 'A Treatise on the History of Midgaard and surrounding -areas', 'Magic - A Beginner's Introduction' and many others. There is -an exit to the west. -~ -150 d 0 -D3 -There is a large and cosy room to the west. -~ -~ -0 -1 15050 -E -books book shelf shelves bookshelf bookshelves~ -Most of the books seem worn, as if thoroughly studied. The King -evidently is interested in keeping himself educated. -~ -E -bed~ -Seems nice enough to sleep in, though you would never dare to, since -it is a Royal Bed! -~ -E -history midgaard~ -A dry tome, filled with boring knowledge. -~ -E -magic~ -Beginner? This book goes beyond most of what YOU know about magic -anyway. But then, there are levels of magical knowledge, it seems. -~ -S -#15052 -Up In The Tower~ - After a long climb, you finally reach the top of the tower. This -room is small, and the only light source is a flickering candle, on -a cluttered table, in the middle of the room. The only obvious exit -is back down the stairs. -~ -150 d 0 -D5 -The stairs go down the tower. -~ -~ -0 -1 15034 -E -table~ -On the table are various objects, all very strange-looking. -~ -E -candle~ -Small, uninteresting... A candle that is as normal as can be. -~ -S -#15053 -The Top Of The Tower~ - You have arrived at the top of the tower. This tower is pretty -uninteresting, and seems made purely for reasons of defence and -guarding. The windows are slits for bowmen, very narrow on the -outward side and broad inwards to allow a wide shooting angle. -The only evident exit is down the stairs again. -~ -150 d 0 -D5 -The stairs go down to the second floor. -~ -~ -0 -1 15049 -E -window slit~ -As you look out the windows, you are granted a view of the countryside. -~ -S -#15054 -The Top Of The Tower~ - This is the highest of all the towers, and is obviously used for -lookout purposes. The view is splendid in all four directions. All -around you, the rich countryside spreads out to the horizon. To the -north and east you see a vast mountain range, and far to the west -a beautiful lake. A bit closer, the town of Midgaard lies at the -end of the King's Road. The only exit you can see is down again. -~ -150 d 0 -D0 -To the north, the tall White Mountains have their highest peaks. -The mountaintops disappear in the white clouds, far above the -plains. The sight of those high, far mountains fills you with a -desire to scale them, to see the world from that vantage. -~ -~ -0 -1 -1 -D1 -In the east you see an arm of the dominating mountain range on this -continent, the White Mountains. Though not as high as those in the -north, the sight of those mountains fills you with awe. -~ -~ -0 -1 -1 -D2 -To the south, rolling hills stretch away, as far as you can see. -~ -~ -0 -1 -1 -D3 -As you look west, you see a river flowing through all of Midgaard -and continuing beyond it towards a great lake. Still further -away, you can glimpse something silvery that has to be the Sea. -~ -~ -0 -1 -1 -D5 -You see the stairs going back down to the second floor. -~ -~ -0 -1 15048 -S -#15055 -The Bottom Of The Stairs~ - The stairs lead down to a damp part of the castle, you can hear -water dripping somewhere around you. The area is lit by a single -torch flickering in the room which this staircase is built off of. - The stairs lead upwards and they open up onto a fairly small -room to the east. -~ -150 d 0 -D1 -A small room opens up to the east. -~ -~ -0 -1 15056 -D4 -The stairs lead upwards out of this dank, dark place. -~ -~ -0 -1 15029 -S -#15056 -The Guard Room~ - You are at a loss to explain why someone would want to spend all -day down here. The only explanation that seems even remotely logical -to you is that there must be an important prisoner kept in one of the -cells through the south door. - The decorations of the room are sparse, merely a table, a chair, -and a deck of cards. A stairwell has been built into the western wall -and it leads upwards. -~ -150 d 0 -D2 -Through the peep hole at the top of the small wooden door you can see -that there is a small corridor leading past several cells. -~ -door wooden~ -1 15017 15057 -D3 -A small stairwell built into the western wall of the room leads upwards. -~ -~ -0 -1 15055 -E -table cards deck~ -There is a deck of cards on the table in a small pile. There is one card -lying on the floor however. -~ -E -card floor~ -The card on the floor seems to be the Ace of Spades... a bad card to find -indeed. What could be the bad luck brought about by this discovery? -~ -S -#15057 -The Prison~ - This small passage is about thirty feet long and is well lit by the -torches on each wall. The torches have been locked inside small metal -cages to ensure that they are not removed. The strangest thing about -the torches however, is the manner in which they burn, they have what -appears to be a constant flame in that it does not flicker whatsoever, -and does not give off any smoke. Perhaps they have been magicked to -burn forever... - There are three cells along this passage way, one on each side of -the corridor right near the north end and one isolated at the south -end of the corridor with a small metal plaque located over the door -in the keystone of the archway. -~ -150 d 0 -D0 -A small wooden door blocks the way out of the prison. -~ -door wooden~ -1 15017 15056 -D1 -A cell door is set into the eastern wall. -~ -door cell~ -2 15017 15060 -D2 -The cell door to the south has been double padlocked and there is a -plaque placed in the keystone above the door. -~ -door cell~ -2 15017 15059 -D3 -A cell door is set into the western wall. -~ -door cell~ -2 15017 15058 -E -plaque keystone~ -The plaque in the keystone is engraved with four simple words: - - Ergan, Murderer of Townsbridge - -~ -S -#15058 -A Cell~ - This cell is in a shambles. There is a small hole in the -western wall where something has broken through the stones -into the cell. There is a cell door in the eastern wall. -~ -150 d 0 -D1 -The cell door to the east leads back to the prison hallway. -~ -door cell~ -2 15017 15057 -E -hole~ -The hole is much too small for you to clamber through. -~ -S -#15059 -Ergan's Cell~ - This large cell is almost like a living quarters with a cot -in one corner serving as a bed, a small table built out of the -wall in another corner. There is even a rug in the center of -the floor to keep some warmth. It seems that the prisoner kept -here is treated quite well, almost too well for a murderer of -an entire town... -~ -150 d 0 -D0 -The cell door to the north leads back to the prison hallway. -~ -door cell~ -2 15017 15057 -S -#15060 -A Cell~ - This small cell is damp and dark and looks like noone and nothing -has lived in it for quite some time. A small cell door is located in -the west wall. -~ -150 d 0 -D3 -The cell door to the west leads back to the prison hallway. -~ -door cell~ -2 15017 15057 -S -#15061 -An Overgrown Trail~ - Moving off of the King's Road, you find yourself on a small -fading trail which appears to have been so little used that it -has almost completely grown over with vegitation from the woods -here. Sounds of the forest can be heard all round and you feel -a peaceful feeling come over you as you realize that mankind -has not passed this way for some time. - The faded trail appears to lead north and south. -~ -150 0 4 -D0 -The travel upon the King's Road can be heard off to the north. -~ -~ -0 -1 15000 -D2 -The trail continues southwards. -~ -~ -0 -1 15062 -S -#15062 -An Overgrown Trail~ - Continuing through the heavy undergrowth, you find yourself -in the middle of the forest. The sounds of the forest can be -heard all round and you feel a peaceful feeling come over you -as you realize that mankind has not passed this way for some -time. - The fading trail you are on appears to have been so little -used that it has almost completely grown over with vegitation -from the woods here. - The faded trail appears to lead north and east. -~ -150 0 4 -D0 -The trail continues northwards. -~ -~ -0 -1 15061 -D1 -The trail appears to continue to the east. -~ -~ -0 -1 15063 -S -#15063 -An Overgrown Trail~ - Continuing through the heavy undergrowth, you find yourself -in the middle of the forest. The sounds of the forest can be -heard all round and you feel a peaceful feeling come over you -as you realize that mankind has not passed this way for some -time. - The fading trail you are on appears to have been so little -used that it has almost completely grown over with vegitation -from the woods here. - The faded trail appears to lead west and south. To the south -a strange eerie silence seems to hang in the air, almost blocking -out all the sounds that you can hear from the north and east. -~ -150 0 4 -D2 -The undergrowth begins to open up to the south and you can see what -appears to be a small village to the south. It is very quiet, almost -too quiet. -~ -~ -0 -1 15064 -D3 -The overgrown trail continues to the northwest. -~ -~ -0 -1 15062 -S -#15064 -A Dirt Road~ - As you leave the forest to the north, you find yourself at -what appears to be the beginning of a dirt road and a small -village. Upon first laying eyes on this place you realize -that there is something funny about this settlement... there -is no sound other that the whistling wind here. You would have -expected to hear people going about their regular business, but -the village is silent. You cannot see any movement around the -village either. It is almost as still and silent as the woods -to the north. -There is a small sign lying by the side of the road here. -~ -150 0 2 -D0 -An trail leads into the heavy undergrowth to the north. -~ -~ -0 -1 15063 -D2 -The dirt road continues through the village to the south. -~ -~ -0 -1 15065 -D3 -A house stands a short distance off the west side of the road, its -door hanging ajar. -~ -~ -0 -1 15068 -E -sign~ - -/----------------------------------\ -| Welcome to the hamlet of | -| Townsbridge | -| | -| | -| Population: 276 | -| | -\----------------------------------/ - -The number 276 has been scratched out and replaced with the -number 0. - -~ -S -#15065 -A Small Intersection~ - Continuing along the dirt road, you find yourself at a place where -a small path splits away from the main road and leads off to the west. -The woods around the village seem to be pressing inwards towards you -as if the village hides a secret which they do not want to be spread -about. - There is another house standing on the east side of the road. -~ -150 0 2 -D0 -The dirt road continues to the north. -~ -~ -0 -1 15064 -D1 -You can hear a wailing sound coming from the house to the east. -~ -~ -0 -1 15069 -D2 -The dirt road continues towards the south where a horrible smell -permeates the air. -~ -~ -0 -1 15066 -D3 -A small, dark trail leads off into the woods to the west. -~ -~ -0 -1 15072 -S -#15066 -A Dirt Road~ - This section of the dirt road is quiet, but there is an awful stench -in the air. It brings to mind rotting corpses and raw sewage. The woods -contiue to press closely about you, and almost totally surround the small -building to the west with a thatched roof. There is a blackened shell of -a building to the east with a small sign hanging out front from a black -and charred chain. - The dirt road continues north and south. -~ -150 0 2 -D0 -The small dirt road continues towards the north. -~ -~ -0 -1 15065 -D1 -The building to the east is merely a shell of what it once probably -was. The walls are blackened as if they had been exposed to fire at -some point in the past... -~ -~ -0 -1 15071 -D2 -The stench from the south is almost overpowering now... it seems that -the source wouldn't be too far from here. -~ -~ -0 -1 15067 -D3 -A small quiet cottage stands on the west side of the road, apparently -untouched by the desecration and destruction that appears to have hit -this small village. -~ -~ -0 -1 15070 -E -sign~ -The sign is covered with soot and the wood is quite charred, but you can -still make out the following letters: - - T TO SB DGE NER L RE - -~ -S -#15067 -A Large Pit~ - The dirt road ends at the edge of a large pit here and you now -realize where the awful smell was coming from. This pit appears -to be a mass grave for the citizens of the village. There are -bones and corpses lying all over the place. A lot of the corpses -look too recent to be from the Townsbridge murders of almost a -decade ago, but the village seems to have been empty for almost -that long. - The dirt road leads away from the carnage to the north. -~ -150 0 2 -D0 -Just near the north edge of the pit a small and narrow trail leads -away. -~ -~ -0 -1 15066 -S -#15068 -A House~ - This house is a wreck, furniture has been strewn all about -the room, and it looks like a tornado landed right in the middle -of the room. The destruction that has taken place in this room -is almost beyond belief. The oddest part of it all though, is -how it all seems so recent, since there are no cobwebs, and there -is no dust on anything. - The dirt road can be seen to the east through the doorway. -~ -150 d 0 -D1 -You can see the dirt road through the doorway to the east. -~ -~ -0 -1 15064 -S -#15069 -A House~ - This darkened room is barely lit by the outdoor light, but what -you can see of it gives you the creeps. There are cobwebs dangling -from everything, a thick layer of dust begins to rise up at your -passage, and a strange howl comes from somewhere around you. The -furniture in this house is old and of a type that hasn't been seen -around these lands for some time. If it was in better shape, you -might be able to sell it as antique. - The meager light of the road shines through the doorway to the -west. -~ -150 ad 0 -D3 -You can see the dirt road through the doorway to the west. -~ -~ -0 -1 15065 -S -#15070 -A Small Cottage~ - This cottage looks to have been left in exactly the same shape as -it was in quite some time ago. It looks as if the residents left one -day and haven't returned home yet. Oddly enough, the furniture is -dust free and the food on the table still looks fresh. This house is -really strange, perhaps it wuld be in your best interests to leave as -soon as humanly possible. - The road is back through the open doorway to the east. -~ -150 d 0 -D1 -You can see the dirt road through the doorway to the east. -~ -~ -0 -1 15066 -S -#15071 -The Burned Shop~ - As you enter this small building, you notice that that blackened -walls are due to a fire that seemed to burn here unattended for quite -some time. There is almost nothing left of the roof that would have -once covered this building, and the north and east walls have been -burnt to almost half the height of the other two walls. There are -some burnt goods around on the ground and the remains of a counter -near what is left of the north wall seems to indicate that this was -once a shop. - The road lies to the west through the blackened wall. -~ -150 0 2 -D3 -You can see the dirt road to the west. -~ -~ -0 -1 15066 -S -#15072 -A Dark Path~ - As you move away form the open air into the darkness of the path -and the sinister looking woods around you, you get a feeling of awe -and something almost akin to horror. The wood around is completely -silent, not even the rustling of leaves or the cracking of branches -breaks the silence. The final thing you notice is that the darkness -all around you seems to be almost contrived, and doesn't seem natural -for this kind of vegitation. - The path continues west and you can see light to the east. -~ -150 ad 1 -D1 -The path continues towards a small intersection with a dirt road. -~ -~ -0 -1 15065 -D3 -The path continues through the darkness. -~ -~ -0 -1 15073 -S -#15073 -A Dark Path~ - This narrow path leads through the overhanging trees in the unnatural -darkness. It seems almost as if the trees are crowding in on you here, -as if they didn't want to feel your presence. The wood is almost totally -silent and you wonder silently to yourself why this could be. - The path appears to continue east and west. -~ -150 ad 1 -D1 -The path continues through the darkness. -~ -~ -0 -1 15072 -D3 -The glow from the west appears to be quite strong, but it does not -give enough light to see by here, nor can you see the source of the -glow. -~ -~ -0 -1 15074 -S -#15074 -The Circle Of Stones~ - You are at the edge of a circle of seven large monolith-like stones. -Each stone towers over your head and appears to be at least double your -height. The stones are made of a dark black material, almost black in -colour. - In the center of the ring of stones, you can see a black circular -mirror-like disk on the ground. The surface is highly reflective and -almost appears to be rippling. The trees surrounding the circle tower -far above your heads blocking out the sky. - A strange glow seems to be emanating from each stone, almost green -in colour. This glow provides enough light for you to see with even -though the sky above has been blotted out. -~ -150 d 1 -D1 -A narrow path leads away into the darkness. -~ -~ -0 -1 15073 -D4 -You cannot see the sky above since the trees around the stone ring -block it out entirely. -~ -~ -0 -1 -1 -E -stones glow stone ring circle~ -Each stone is at least fifteen feet tall, maybe more, and the dark -material glows with a greenish aura providing more than enough light -for you to see by. -~ -S -$ diff --git a/lc-mud/circle/world/wld/186.wld b/lc-mud/circle/world/wld/186.wld deleted file mode 100644 index 33d706c15907957969d971121d331251bf99ab57..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/186.wld +++ /dev/null @@ -1,871 +0,0 @@ -#18600 -The Entrance To The Newbie Zone~ - Ahhh... the entrance to the newbie zone! Just the place you have -been looking for. Well, when you've readied yourself you can enter -to the north. -~ -186 c 1 -D0 -You see the start of the newbie zone. -~ -~ -0 -1 18601 -D3 -Back to the road that way... chickening out already? -~ -~ -0 -1 3061 -S -#18601 -The Beginning Of The Passage~ - You find yourself entering a long corridor. You can hear the sound -of creatures roaming about, but you can't tell where the sound emanates -from exactly. - Exits lead to the east along the hallway, and south back to the -entrance. -~ -186 d 0 -D1 -More of the hallway there... how exciting! -~ -~ -0 -1 18602 -D2 -The entrance to the newbie zone... how dull -~ -~ -0 -1 18600 -S -#18602 -The Dirty Hallway~ - You continue wandering down the hallway. Nothing much different here, -but you are positive you here noises behind the door to the south, and -coming from the east. The walls are a bit slimy and moldy here... yeech, -couldn't they hire someone to clean this place? What will the newbies -think? Oh well, you can continue along the hallway to the east or west. -~ -186 d 0 -D1 -More of the hallway there... how exciting! -~ -~ -0 -1 18603 -D2 -A small room lies to the south... you hear something moving about inside. -~ -door~ -1 -1 18606 -D3 -More of the hallway there... how exciting! -~ -~ -0 -1 18601 -S -#18603 -A Nexus~ - Well... you've reached an intersection of two passages, to the north -and east, the passage brightens, while the darker hallway continues to -the south. -~ -186 d 0 -D0 -A brighter hallway leads off that way. -~ -door~ -1 -1 18644 -D1 -A brighter hallway leads off that way. -~ -door~ -1 -1 18646 -D2 -More of the hallway there... how exciting! -~ -~ -0 -1 18607 -D3 -More of the hallway there... how exciting! -~ -~ -0 -1 18602 -S -#18604 -A Narrow Passage~ - The thin passage is plain and undecorated, but still clean. It -ends abruptly to the south at a small oak door, behind which you here -movement... -~ -186 ad 0 -D0 -A large domed room. -~ -~ -0 -1 18647 -D2 -A small cluttered room. -~ -door~ -1 -1 18612 -S -#18605 -The Dark Pit~ - Ick... a dark damp dirty pit. Even worse, what is that dark damp -dirty thing looking at you from the corner? Ewww... maybe you should -go back up where it is a bit safer, unless you think you can tackle -that thing in the corner. -~ -186 ad 0 -D4 -You see a ladder leading up -~ -grate~ -1 18608 18606 -S -#18606 -A Small Room~ - Hmmm... this is an interesting little room. Ack, and there is -an interesting little creature staring at you too. He looks a bit -surprised at your intrusion. You can leave via the doors north or -east, or you can stay and annoy him a bit more. There also appears -to be some type of well down here also, but it has a rather secure -grate covering it. -~ -186 d 0 -D0 -More of the hallway there... how exciting! -~ -door~ -1 -1 18602 -D1 -More of the hallway there... how exciting! -~ -door~ -1 -1 18607 -D5 -A ladder leads down into darkness. -~ -grate~ -1 18608 18605 -S -#18607 -More Of The Hallway~ - Oh joy! More of this annoying passage. Perhaps there is something -more exciting through that door to the west? Or you can keep searching -the hallways to the north or south. -~ -186 d 0 -D0 -More of the hallway there... how exciting! -~ -~ -0 -1 18603 -D2 -More of the hallway there... how exciting! -~ -~ -0 -1 18611 -D3 -~ -door~ -1 -1 18606 -S -#18608 -An Open Field By The Great Field~ - Finally, you are in an open field... it is so nice to breathe fresh air -again! You can return to that dank, smelly place to the east, or take the -exit to the north which appears to lead into a large field. -~ -186 c 0 -D0 -There appears to be a field road to the north. -~ -~ -0 -1 3061 -D1 -The end of that darn hallway lies back to the east. -~ -~ -0 -1 18609 -S -#18609 -The End Of The Passage~ - Ahhh... at last, the end of the hallway... you can exit into open -air to the west,or return to the east and make sure you didn't miss -anything. -~ -186 d 0 -D1 -More of the hallway there... how exciting! -~ -~ -0 -1 18610 -D3 -An open field near The Great Field of Midgaard can be seen. -~ -~ -0 -1 18608 -S -#18610 -A Brighter Hallway~ - The hallway continues on in a east-west direction... and it seems to -be brightening up to the west. -~ -186 d 0 -D1 -A corner in the passage lies to the east. -~ -~ -0 -1 18611 -D3 -More of the hallway there... how exciting! -~ -~ -0 -1 18609 -S -#18611 -Another Corner~ - Another corner of the passage, and just as untidy as the rest of -this place (maybe more so?). There is a door to the east though... -wonder where that leads? Oh, and the hallway continues west and -north. -~ -186 d 0 -D0 -More of the hallway there... how exciting! -~ -~ -0 -1 18607 -D1 -You peer into a cluttered little room to the east. -~ -door~ -1 -1 18612 -D3 -More of the hallway there... how exciting! -~ -~ -0 -1 18610 -S -#18612 -The Alchemist's Room~ - Lots of bottles and flasks lie about this room, but it all looks like -worthless clutter. It appears whatever alchemist has been working here -is really very adept at his art. There are a lot of formulae and spells -written on the walls too... couldn't he buy some paper? There is a door -to the north, and also a dark stairway in the corner leading down, with a -large sign next to it that you probably should read... -~ -186 d 0 -D0 -A nice shiny hallway! -~ -door~ -1 -1 18604 -D3 -A corner in the passage lies to the west. -~ -door~ -1 -1 18611 -D5 -A shadowed stairway leading down. -~ -~ -0 -1 18632 -E -sign stairs stairway~ -The sign next to the stairs says: - -If you are below level 7 and alone, or below level 4 then bugger off! -Or else don't blame me if you die... - -~ -S -#18620 -A Turn In The Passage~ - This corner is much like all the others... except you see a strange -glow coming from the south. Could be an exit... you hope. -~ -186 ad 0 -D1 -The passage continues east quite a ways. -~ -~ -0 -1 18621 -D2 -You see an odd red glow from that direction. -~ -~ -0 -1 18629 -S -#18621 -A T-Intersection In The Passage~ - This is an intersection of a long east-west passage with a corridor -leading south. The air seems a bit clearer here though, as if you were -approaching an exit. -~ -186 ad 0 -D1 -~ -~ -0 -1 18622 -D2 -~ -~ -0 -1 18633 -D3 -~ -~ -0 -1 18620 -S -#18622 -Another Corner~ - The passage turns from north to west here. The walls are still -covered with the same disgusting green fungus you have seen all -along, and you hear sounds of creatures moving all around you... -~ -186 ad 0 -D2 -~ -~ -0 -1 18628 -D3 -~ -~ -0 -1 18621 -S -#18623 -A Corner In The Hallway~ - You can hear creatures moving all around you... and it is not -a comforting sound at all. The furnishing is nothing to speak of -either, plain grey brick walls with green fungus (or something) -growing on them. -~ -186 ad 0 -D1 -~ -~ -0 -1 18624 -D2 -~ -~ -0 -1 18627 -S -#18624 -Another Turn~ - Hmmm... the passage turns south here. You beginning to realize you -can easily lose your bearings if you aren't careful, and you don't think -you would like spending too much time here... -~ -186 ad 0 -D2 -~ -~ -0 -1 18630 -D3 -~ -~ -0 -1 18623 -S -#18625 -A Large Room~ - The passage opens into a large oval room. There really isn't much of -interest here though. -~ -186 ad 0 -D1 -~ -~ -0 -1 18626 -D2 -~ -~ -0 -1 18631 -S -#18626 -A Long East-West Passage~ - This is a long, narrow passage leading east and west. The walls are -damp and covered with mildew and fungus. There is a very unhealthy air -about this place and you're beginning to want out of here... soon. -~ -186 ad 0 -D1 -~ -~ -0 -1 18627 -D3 -~ -~ -0 -1 18625 -S -#18627 -A Crossing Of Corridors~ - Here a narrow east-west passage crosses with a wider passage to the -north and south. The air is dank, and has an odor of decay and debris. -Not a nice place at all really... -~ -186 ad 0 -D0 -~ -~ -0 -1 18623 -D1 -~ -~ -0 -1 18628 -D2 -~ -~ -0 -1 18632 -D3 -~ -~ -0 -1 18626 -S -#18628 -A Corner Room~ - This room is hardly more than a crossing of passages. You do sense a -slight breeze wafting down the passage to the north though, but it smells -altogether bad... -~ -186 ad 0 -D0 -~ -~ -0 -1 18622 -D3 -~ -~ -0 -1 18627 -S -#18629 -The Red Room~ - It takes you a moment to realize that the red glow here is coming -from a round portal on the floor. It looks almost as if someone had -painted a picture of a dirt running through a field on the floor of -this room. Oddly enough, it is so realistic you can feel the wind in -the field coming out of the picture. -~ -186 ad 0 -D0 -~ -~ -0 -1 18620 -D1 -~ -~ -0 -1 18630 -D5 -~ -~ -0 -1 3061 -E -portal floor~ -It looks as if you could go down into it... but you can't be sure of where -you will end up, or if you can get back. -~ -S -#18630 -A Branching Passage~ - The north-south passage branches to the east here. There is a queer red -glow coming from that way as well, along with a faint breeze. -~ -186 ad 0 -D0 -~ -~ -0 -1 18624 -D2 -~ -~ -0 -1 18634 -D3 -A very odd red glow emanates from that direction. -~ -~ -0 -1 18629 -S -#18631 -A Passage~ - Ick... this place is just disgusting. You try and stay clear of the -walls, but the passage is so narrow you keep bumping them anyway. You -are almost convinced that the fungus coating the walls is grabbing at -you too. -~ -186 ad 0 -D0 -~ -~ -0 -1 18625 -D1 -~ -~ -0 -1 18632 -D2 -~ -~ -0 -1 18638 -S -#18632 -The Entrance~ - It is dark, dank, disgusting and cold up here. Plus you here the -sounds of creatures all around you... and somehow they don't sound -friendly. It is probably wise to exercise some degree of caution -here... no telling what you may run into here. -~ -186 ad 0 -D0 -~ -~ -0 -1 18627 -D2 -~ -~ -0 -1 18635 -D3 -~ -~ -0 -1 18631 -D4 -~ -~ -0 -1 18612 -S -#18633 -Another Corner~ - Well... what is there to say. More fungus, more weird sounds, and a -slight breeze from the north. Bet you want to sign a lease, don't ya... -~ -186 ad 0 -D0 -~ -~ -0 -1 18621 -D1 -~ -~ -0 -1 18634 -S -#18634 -An Intersection Of Passages~ - Cold, smelly, and coated with green fungus... just like last week's -left-overs. Furthermore you want nothing to do with either, you just -want out right now. -~ -186 ad 0 -D0 -~ -~ -0 -1 18630 -D2 -~ -~ -0 -1 18637 -D3 -~ -~ -0 -1 18633 -S -#18635 -A Turn In The Passage~ - This place is just plain nauseating... it certainly smells as if -something (or someone) died in here. You hope you aren't next, but -from the sounds you hear all around you, it seems as if something has -other ideas about that. -~ -186 ad 0 -D0 -~ -~ -0 -1 18632 -D1 -~ -~ -0 -1 18636 -S -#18636 -A Branch To The South~ - The east-west passage branches of to the south here. All around you -is the odour of death. Actually, the mold and fungus on the walls is -doing great, but otherwise... well... you don't want to think about what -else lives here. -~ -186 ad 0 -D1 -~ -~ -0 -1 18637 -D2 -~ -~ -0 -1 18639 -D3 -~ -~ -0 -1 18635 -S -#18637 -Yet Another Corner~ - The passage turns here and heads north. You sense something up ahead -that way, but you aren't sure what. You aren't sure if you want to know -what either at this point. -~ -186 ad 0 -D0 -~ -~ -0 -1 18634 -D3 -~ -~ -0 -1 18636 -S -#18638 -A Large Room~ - You almost stumble as you enter this room... the sudden feeling of no -walls on either side of you makes you a bit nervous. Suddenly you are -vulnerable on all sides. You can't even tell how big a room this is, -because it extends to the east farther than you light will reach... -~ -186 ad 0 -D0 -~ -~ -0 -1 18631 -D1 -The room extends into shadows... -~ -~ -0 -1 18639 -S -#18639 -A Large Room~ - As you enter, you light glints of the wall to the east. There appears -to be words scrawled on the wall, and a crude picture. To the west the -room extends beyond the reach of your light, and the dark shadows make you -paranoid... anything could be hiding there. You are painfully aware of -how exposed you are without walls around you. -~ -186 ad 0 -D0 -~ -~ -0 -1 18636 -D3 -The room extends as far as (and farther than) you can see... -~ -~ -0 -1 18638 -E -writing words~ -The writing appears to says 'beware the Minotaur...' -~ -E -wall~ -There is a crude picture of a man with the head of a bull with some writing -next to it. -~ -S -#18640 -The Statue's Room~ - Here, the passage enters a small room. Exits lead to the east and south, -and you notice a wonderful, large (and tastefully done) statue to the north. -~ -186 ad 0 -D1 -A long hallway, ending in a set of steps. -~ -~ -0 -1 18641 -D2 -The hall extends to the south where it seems to lighten somewhat. -~ -~ -0 -1 18644 -E -statue~ -Upon closer inspection you see that the statue has a small plaque affixed -to it. The face looks remarkably familiar also. -~ -E -plaque nameplate name~ -It says: - -Maynard, Death Jester of the Harlequins - -~ -S -#18641 -The Hallway~ - As you continue wandering down the hallway, you notice banners, -pictures, and other fine decorations adorning the walls all along -this passage. It seems very different from the dismal passage where -you entered. -~ -186 ad 0 -D1 -The hallway ends at a grand marble staircase. -~ -~ -0 -1 18642 -D3 -The passage leads into a small room. -~ -~ -0 -1 18640 -S -#18642 -The North Stairs~ - Here, the hall opens into a wide room, with a high domed roof. Now that -that you have come clear of the enclosed passage, you can see that the stair -leads upward to an open air balcony overlooking the area. To the south the -room continues, and another stair is visible matching the one in front of -you. -~ -186 ad 0 -D2 -You see another staircase and two passages leading west and south. -~ -~ -0 -1 18647 -D3 -An entrance to a bright passage. -~ -~ -0 -1 18641 -D4 -An open air balcony. -~ -~ -0 -1 18643 -E -staircase stair stairs~ -They are constructed of smooth, beautiful marble -~ -S -#18643 -The Balcony~ - Here you can look out and observe the world around. Constructed in a -semi-circle around the dome of the room, the balcony allows you to look -out in almost any direction. Wandering to the north end, you can see that -the Great Fields north of Midgaard continue off towards the Dragonhelm -Mountains to the north. -~ -186 ad 0 -D2 -The south end of the balcony. -~ -~ -0 -1 18645 -D5 -Down the stairs to a large, domed room. -~ -~ -0 -1 18642 -E -staircase stair stairs~ -They are constructed of smooth, beautiful marble -~ -S -#18644 -A Bright Hallway~ - Wow! What a change from the dismal passage to the south. Whoever -keeps this room up must really like newbies. The walls and floor are -clean, and tastefully decorated. You also notice an interesting design -on the floor. -~ -186 ad 0 -D0 -A small room with a statue in it. -~ -~ -0 -1 18640 -D2 -A intersection of passages. -~ -door~ -1 -1 18603 -E -floor design~ -It appears to be the Crest of the Harlequin Guild. -~ -S -#18645 -The Balcony~ - Here you can look out and observe the world around. Constructed in a -semi-circle around the dome of the room, the balcony allows you to look out -in almost any direction. Wandering to the south end, you can see the great -city of Midgaard off to the south-west. -~ -186 ad 0 -D0 -The north end of the balcony. -~ -~ -0 -1 18643 -D5 -Back down the south staircase. -~ -~ -0 -1 18647 -E -staircase stair stairs~ -They are constructed of smooth, beautiful marble. -~ -S -#18646 -A Bright Hallway~ - Wow! What a change from the dismal passage to the west. Whoever keeps -this room up must really like newbies. The walls and floor are clean, and -tastefully decorated. You also notice an interesting design on the floor. -~ -186 ad 0 -D1 -The passage opens into a domed room with a grand marble staircase. -~ -~ -0 -1 18647 -D3 -A dark intersection of passages. -~ -door~ -1 -1 18603 -E -floor design~ -It appears to be the crest of the Harlequin Guild. -~ -S -#18647 -The South Stairs~ - Here, the hall opens into a wide room, with a high domed roof. Now that -that you have come clear of the enclosed passage, you can see that the stair -leads upward to an open air balcony overlooking the area. to the north the -room continues, and another stair is visible matching the one in front of -you. -~ -186 ad 0 -D0 -Another stairway is to the north, as well as a passage to the west. -~ -~ -0 -1 18642 -D2 -A narrow passage to the south, ending in a wood door. -~ -~ -0 -1 18604 -D3 -Back down the bright hallway. -~ -~ -0 -1 18646 -D4 -An open air balcony. -~ -~ -0 -1 18645 -E -staircase stair stairs~ -They are constructed of smooth, beautiful marble. -~ -S -$ diff --git a/lc-mud/circle/world/wld/25.wld b/lc-mud/circle/world/wld/25.wld deleted file mode 100644 index a9ceaad3d4f3e2a211f99449e53d4b002bd973a4..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/25.wld +++ /dev/null @@ -1,3326 +0,0 @@ -#2500 -The Entrance To The Shadow Grove~ - Before you, the grove of shadows lies. Giant grey trees are all that -can be seen through the thick shadows. A great sense of both power and -menace permeates the surrounding area. You have a strange urge to turn -back and go back the way you've come. - A small path leads north into the shadows and back south to the plains. -~ -25 cg 3 -D0 -The shadows obscure your vision. -~ -~ -0 -1 2508 -D2 -The copse of trees and plains are back to the south. -~ -~ -0 -1 4075 -S -#2501 -The Shadow Grove~ - You are inside the shadow grove. Giant trees seem to glare at you -from all sides. The shadowy mist obscures most of your vision. Strange -sounds of moaning and growling come from all directions. - All exits lead into shadows, you are very confused. -~ -25 acfg 3 -D0 -The shadows obscure your vision. -~ -~ -0 -1 2507 -D1 -The shadows obscure your vision. -~ -~ -0 -1 2502 -D2 -The shadows obscure your vision. -~ -~ -0 -1 2504 -D3 -The shadows obscure your vision. -~ -~ -0 -1 2503 -S -#2502 -The Shadow Grove~ - You are inside the shadow grove. Giant trees seem to glare at you -from all sides. The shadowy mist obscures most of your vision. Strange -sounds moaning and growling come from all directions. - All exits lead into shadows, you are very confused. -~ -25 acfg 3 -D0 -You see a small clearing in the shadows. -~ -~ -0 -1 2511 -D1 -The shadows obscure your vision. -~ -~ -0 -1 2503 -D2 -The shadows obscure your vision. -~ -~ -0 -1 2505 -D3 -The shadows obscure your vision. -~ -~ -0 -1 2501 -S -#2503 -The Shadow Grove~ - You are inside the shadow grove. Giant trees seem the glare at you -from all sides. The shadowy mist obscures most of your vision. Strange -sounds of moaning and growling come from all directions. - All exits lead into shadows, you are very confused. -~ -25 acfg 3 -D0 -The shadows obscure your vision. -~ -~ -0 -1 2509 -D1 -The shadows obscure your vision. -~ -~ -0 -1 2501 -D2 -The shadows obscure your vision. -~ -~ -0 -1 2506 -D3 -The shadows obscure your vision. -~ -~ -0 -1 2502 -S -#2504 -The Shadow Grove~ - You are inside the shadow grove. Giant trees seem to glare at you -from all sides. The shadowy mist obscures most of your vision. Strange -sounds of moaning and growling come from all directions. - All exits lead into shadows, you are very confused. -~ -25 acfg 3 -D0 -The shadows obscure your vision. -~ -~ -0 -1 2501 -D1 -The shadows obscure your vision. -~ -~ -0 -1 2505 -D2 -The shadows obscure your vision. -~ -~ -0 -1 2507 -D3 -The shadows obscure your vision. -~ -~ -0 -1 2503 -S -#2505 -The Shadow Grove~ - You are inside the shadow grove. Giant trees seem to glare at you -from all sides. The shadowy mist obscures most of your vision. Strange -sounds of moaning and growling come from all directions. - All exits lead into shadows, you are very confused. -~ -25 acfg 3 -D0 -The shadows obscure your vision. -~ -~ -0 -1 2502 -D1 -The shadows obscure your vision. -~ -~ -0 -1 2506 -D2 -The shadows obscure your vision. -~ -~ -0 -1 2508 -D3 -The shadows obscure your vision. -~ -~ -0 -1 2504 -S -#2506 -The Shadow Grove~ - You are inside the shadow grove. Giant trees seem to glare at you -from all sides. The shadowy mist obscures most of your vision. Strange -sounds of moaning and growling come from all directions. - All exits lead into shadows, you are very confused. -~ -25 acfg 3 -D0 -The shadows obscure your vision. -~ -~ -0 -1 2503 -D1 -The shadows obscure your vision. -~ -~ -0 -1 2510 -D2 -The shadows obscure your vision. -~ -~ -0 -1 2509 -D3 -You see a small clearing in the shadows. -~ -~ -0 -1 2511 -S -#2507 -The Shadow Grove~ - You are inside the shadow grove. Giant trees seem to glare at you -from all sides. The shadowy mist obscures most of your vision. Strange -sounds of moaning and growling come from all directions. - All exits lead into shadows, you are very confused. -~ -25 acfg 3 -D0 -The shadows obscure your vision. -~ -~ -0 -1 2504 -D1 -The shadows obscure your vision. -~ -~ -0 -1 2508 -D2 -The shadows obscure your vision. -~ -~ -0 -1 2501 -D3 -The shadows obscure your vision. -~ -~ -0 -1 2509 -S -#2508 -The Shadow Grove~ - You are inside the shadow grove. Giant trees seem to glare at you -from all sides. The shadowy mist obscures most of your vision. Strange -sounds of moaning and growling come from all directions. - All exits lead into shadows, you are very confused. -~ -25 acfg 3 -D0 -The shadows obscure your vision. -~ -~ -0 -1 2505 -D1 -The shadows obscure your vision. -~ -~ -0 -1 2509 -D2 -The shadows obscure your vision. -~ -~ -0 -1 2500 -D3 -The shadows obscure your vision. -~ -~ -0 -1 2507 -S -#2509 -The Shadow Grove~ - You are inside the shadow grove. Giant trees seem to glare at you -from all sides. The shadowy mist obscures most of your vision. Strange -sounds of moaning and growling come from all directions. - All directions lead into shadows, you are very confused. -~ -25 acfg 3 -D0 -The shadows obscure your vision. -~ -~ -0 -1 2506 -D1 -The shadows obscure your vision. -~ -~ -0 -1 2507 -D2 -The shadows obscure your vision. -~ -~ -0 -1 2503 -D3 -The shadows obscure your vision. -~ -~ -0 -1 2508 -S -#2510 -The Shadow Grove~ - You are inside the shadow grove. Giant trees seem to glare at you -from all sides. The shadowy mist obscures most of your vision. Strange -sounds of moaning and growling come from all directions. - All directions lead into shadows, you are very confused. -~ -25 acfg 3 -D0 -The shadows obscure your vision. -~ -~ -0 -1 2507 -D1 -The shadows part to reveal a small clearing. -~ -~ -0 -1 2511 -D2 -The shadows obscure your vision. -~ -~ -0 -1 2509 -D3 -The shadows obscure your vision. -~ -~ -0 -1 2502 -S -#2511 -A Small Clearing~ - You are in a small clearing in the shadow grove. There is charred grass -underfoot, and the signs of fire here and there. It is almost as if the -plant life shuns this spot. The shadowy mist hovers all around, obscuring -your view into the grove. - A small path leads north to some shadowy structure. All other exits are -shrouded in shadowy mist. -~ -25 ag 3 -D0 -You can barely make out some sort of building to the north. -~ -~ -0 -1 2512 -D1 -The shadows obscure your vision. -~ -~ -0 -1 2506 -D2 -The shadows obscure your vision. -~ -~ -0 -1 2502 -D3 -The shadows obscure your vision. -~ -~ -0 -1 2510 -S -#2512 -The Entrance To The High Tower~ - You have reached the entrance to the High Tower of Sorcery. The -tower looms above you at an incredible height. It seems to disappear -into the storm clouds above. - A diamond gate is to the north, whilst the trail back south has -disappeared behind you. -~ -25 g 0 -D0 -The diamond gate looks incredibly strong. -~ -gate diamond~ -2 2500 2513 -S -#2513 -Inside The High Tower Of Sorcery~ - You are inside the High Tower of Sorcery. The sight is truly amazing. -From here, it is obvious that somehow, the tower is much larger on the -inside than it is on the outside. Young mages walk about, completely -oblivious to your presence. - Exits lead north to the common room, west to the dinning room, east -to a plain hallway and back south through the gate. -~ -25 dg 0 -D0 -The common room looks quite busy and noisy. -~ -~ -0 -1 2514 -D1 -~ -~ -0 -1 2515 -D2 -~ -gate diamond~ -2 2500 2512 -D3 -~ -~ -0 -1 2516 -S -#2514 -Common Room~ - You are in the common room. There are many apprentice warlocks here -talking and resting, playing games, comparing notes. Obviously they -are taking a break from their rigorous studies. There are benches, -tables and a small water fountain here, otherwise the room is quite -unremarkable. - Exits lead off in all directions. -~ -25 dg 0 -D0 -~ -~ -0 -1 2517 -D1 -The mages' bar can be seen to the east. -~ -~ -0 -1 2518 -D2 -~ -~ -0 -1 2513 -D3 -~ -~ -0 -1 2519 -S -#2515 -The Hallway~ - You are in a long hallway, it seems rather unremarkable. The -hallway continues east and back west. -~ -25 dg 0 -D1 -~ -~ -0 -1 2530 -D3 -~ -~ -0 -1 2513 -S -#2516 -The Dining Room~ - You are in the dining area of the student mages. From the number of -tables and chairs here, you can see that this room could easily seat -several hundred people. It is oddly deserted here, obviously not meal -time. - Exits lead west to the kitchen, and back east. -~ -25 dg 0 -D1 -~ -~ -0 -1 2513 -D3 -~ -door wooden~ -1 -1 2520 -S -#2517 -A Dark Hallway~ - You are in a dark hallway. It is apparent that this area is seldom -used by the regular occupants of the tower. Dust covers the floors -here. - The faint outline of a trapdoor can be seen in the dust. -~ -25 adg 0 -D2 -~ -~ -0 -1 2514 -D5 -~ -trapdoor~ -1 -1 2521 -S -#2518 -The Mages' Tavern~ - You are in the mages' tavern. The air is smokey and filled with the -smells of foreign food and drink. The other patrons pay you little heed, -as they obviously have more interesting things to contemplate. - The only exit leads back west. -~ -25 dg 0 -D3 -~ -~ -0 -1 2514 -S -#2519 -The Magic Shop~ - You are in the High Tower's store of magic. This place sells all -sorts of herbs, parchment and other reagents used in magical studies. - The only exit leads back east to the common room. -~ -25 dg 0 -D1 -~ -~ -0 -1 2514 -S -#2520 -The Kitchen~ - You are in a small kitchen. All the usual kitchen type utensils and -equipment is here, including some not so usual ones. Among the later, -a huge black oven against one wall, it must be at least 12 feet high. - Opposite the oven is an equally enormous meat locker, large enough -to comfortably store several hapless adventurers no doubt. In the middle -of the room, hanging in mid-air is a spice rack. -~ -25 dg 0 -D1 -~ -door wooden~ -1 -1 2516 -S -#2521 -Below The Trapdoor~ - You are below the trapdoor. It is very dark and dusty here, very -little light filters through from above. A faint sound of dripping -water can be heard in the distance below. - A rope ladder leads down. -~ -25 adg 0 -D4 -~ -trapdoor~ -1 -1 2517 -D5 -~ -~ -0 -1 2522 -S -#2522 -A Damp Intersection~ - You are in a damp intersection of what seems to be the basement of -the tower. The sound of running water can be heard coming from the -south, other than that, an almost tangible stillness fills the air. - Passages lead off in all directions, and a ladder leads up. -~ -25 adg 0 -D0 -~ -~ -0 -1 2523 -D1 -A faint light can be seen in the distance up the east passage. -~ -~ -0 -1 2524 -D2 -~ -~ -0 -1 2525 -D3 -~ -~ -0 -1 2526 -D4 -~ -~ -0 -1 2521 -S -#2523 -A Dark Passage~ - You are at the end of a dark passage which ends in a stout wooden door. -Other then through the door, the only apparent exit is back the way you -came. -~ -25 adg 0 -D0 -~ -door oak~ -2 2522 2527 -D2 -~ -~ -0 -1 2522 -S -#2524 -A Dark Passage~ - You are at the end of a dark passage. A half opened door is to the -east, shedding soft light around the edges. Faint snoring sounds can -be heard behind the door. - Exits lead east through the door, or back west. -~ -25 adg 0 -D1 -~ -door~ -1 -1 2528 -D3 -~ -~ -0 -1 2522 -S -#2525 -The Stagnant Pool~ - You are at the edge of a stagnant pool of water. The smell here is quite -nauseating. This is apparently where the denizens of the tower dispose of -their garbage. Faint gurgling can be heard from beneath the surface of the -pool. - Exits lead back north, or perhaps for the very adventurous, down into the -pool. -~ -25 adg 0 -D0 -~ -~ -0 -1 2522 -D5 -No light penetrates the gloom of the stagnant pool. -~ -~ -0 -1 2529 -S -#2526 -A Dark Passage~ - You are in a dark passage, which comes to an abrupt stop at what appears -to be a cave-in to the west. It is certainly unpassable, and perhaps quite -dangerous just being this close. - The only exit leads back east. -~ -25 adg 0 -D1 -~ -~ -0 -1 2522 -S -#2527 -A Dark Cell~ - You are in a dark cell. Straw and dirt cover the floors here, it is -very dark. Someone, or something seems to be chained to the far wall. - The only exit is back south. -~ -25 adg 0 -D2 -~ -door oak~ -2 2522 2523 -S -#2528 -The Jailor's office~ - You are in the Jailor's office. It is rather messy here. Judging -by the sleeping form of the Jailor on duty, you can surmise that very -few, if any prisoners survive long enough to spend much time in these -dank dungeons. - The only exit leads back west. -~ -25 dg 0 -D3 -~ -door~ -1 -1 2524 -S -#2529 -Below The Stagnant Pool~ - As you dive beneath the putrid waters, you feel a strong tug and a -whirlpool drags you under. You are sucked into blackness. You feel -your lungs burst from lack of oxygen. Just as you feel your life fading, -you notice a change in direction... and are sucked under by a rip tide. -~ -25 abdg 0 -S -#2530 -The Hallway~ - You are in a long hallway leading east and west. The walls emit a faint -magical glow which provides enough light to see by. -~ -25 dg 0 -D0 -~ -door wooden~ -1 -1 2532 -D1 -~ -~ -0 -1 2531 -D2 -~ -door wooden~ -1 -1 2533 -D3 -~ -~ -0 -1 2515 -S -#2531 -A Bend In The Hallway~ - You are at a bend in the hallway. The walls emit a faint magical glow -which provides enough light to see by. -~ -25 dg 0 -D0 -~ -door wooden~ -1 -1 2534 -D1 -~ -door wooden~ -1 -1 2536 -D2 -~ -door wooden~ -1 -1 2535 -D3 -~ -~ -0 -1 2530 -S -#2532 -A Store Room~ - You are in a small store room. Assorted junk is piled on shelves or -leaning against walls. - The only apparent exit it back south. -~ -25 adg 0 -D2 -~ -door wooden~ -1 -1 2530 -S -#2533 -A Broom Closet~ - You are in a dark broom closet. Many straw brooms and other cleaning -instruments have been left here, apparently unused (perhaps the maid -quit?). - The only exit leads back north to the hallway. -~ -25 adg 0 -D0 -~ -door wooden~ -1 -1 2530 -S -#2534 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. -~ -25 dg 0 -D0 -~ -~ -0 -1 2538 -D1 -~ -door wooden~ -1 -1 2537 -D2 -~ -door wooden~ -1 -1 2531 -E -walls wall~ -The walls shed a warm light -~ -S -#2535 -The Guardians' chamber~ - You are in the chamber of the tower guardians. It is rather sparsely -furnished, but then again the odd occupants don't look to need furniture. -Here and there a disembodied pair of hands or eyes flits about. -~ -25 dg 0 -D0 -~ -door wooden~ -1 -1 2531 -S -#2536 -A Guest Bedroom~ - You are in a small guest bedroom. A small cot is in one corner, and a -dusty mirror on one wall, other than that the room looks quite bare, and -unused. - The only apparent exit leads back west to the hallway. -~ -25 dg 0 -D3 -~ -door wooden~ -1 -1 2531 -E -mirror~ -Why, someone seems to be looking back at you from the other side! -~ -S -#2537 -A Guest Bedroom~ - You are in a comfortable looking bedroom. A small globe of magical -energy floats overhead, providing light. A small cot is in one corner -looking ever so comfortable, so comfortable in fact... someone is sleeping -in it. - The only apparent exit leads back west to the hallway. -~ -25 dg 0 -D3 -~ -door wooden~ -1 -1 2534 -S -#2538 -A hallway~ - You are in a long hallway leading from the south. The walls emit a -faint magical glow which provides enough light to see by. - Stairs lead up to the next level and the hallway leads back south. -~ -25 dg 0 -D1 -~ -door wooden~ -1 -1 2539 -D2 -~ -~ -0 -1 2534 -D4 -~ -~ -0 -1 2540 -S -#2539 -The Burnt Room~ - You are in what looks to have once been a guest bed room. The walls -are blackened and burnt by what you could only imagine to be magical fire. -There is no sign of the previous occupant, undoubtedly he left in a hurry. - The only exit leads back west to the hallway. -~ -25 adg 0 -D3 -~ -door charred~ -1 -1 2538 -S -#2540 -A Hallway~ - You are in a long hallway leading west from here. The walls emit a -faint magical glow which provides enough light to see by. Some faint -moonlight can be seen in the cul de sac to the east. - The hallway continues west and stairs lead down to the level below. -~ -25 dg 0 -D0 -~ -door oak~ -1 -1 2542 -D1 -Faint moonlight can be seen to the east. -~ -~ -0 -1 2541 -D3 -~ -~ -0 -1 2543 -D5 -~ -~ -0 -1 2538 -S -#2541 -A Cul De Sac~ - You are in a small cul de sac. A window to the east is letting in -moonlight and a pleasant breeze. Through it, the surrounding country -side can be seen. - The only apparent exit leads back west to the hallway. -~ -25 dg 0 -D1 -Stretching out as far as the eye can see is a canopy of dark tree -tops which can only be the Haon-Dor-Dark Forest. A faint light in -the distance to the northeast marks what is probably the city of -Midgaard. -~ -~ -0 -1 -1 -D3 -~ -~ -0 -1 2540 -E -window~ -Stretching out as far as the eye can see is a canopy of dark tree -tops which can only be the Haon-Dor-Dark Forest. A faint light in -the distance to the northeast marks what is probably the city of -Midgaard. -~ -S -#2542 -The Apprentices' Barracks~ - You are in the barracks of the apprentice magic users. Here and there, -a young apprentice sits engrossed in magical study, or practicing a feeble -cantrip. Cots line the walls, and the room continues west. -~ -25 dg 0 -D2 -~ -door oak~ -1 -1 2540 -D3 -~ -~ -0 -1 2544 -S -#2543 -A Hallway~ - You are in a long hallway leading east and west. The walls emit a -faint magical glow which provides enough light to see by. - There is a door to the north, and the hallway continues west or back -east. -~ -25 dg 0 -D0 -~ -door oak~ -1 -1 2544 -D1 -~ -~ -0 -1 2540 -D3 -~ -~ -0 -1 2545 -S -#2544 -The Apprentices' Barracks~ - You are in the barracks of the apprentice magic users. Here and there, -a young apprentice sits engrossed in magical study, or practicing a feeble -cantrip. Cots line the walls, and the room continues east. -~ -25 dg 0 -D1 -~ -~ -0 -1 2542 -D2 -~ -door oak~ -1 -1 2543 -S -#2545 -A Hallway~ - You are in a long hallway leading east and west. The walls emit a -faint magical glow which provides enough light to see by. Flashes of -light can be seen under the doorway to the north. -~ -25 dg 0 -D0 -A flash of blue light momentarily lights up the door's outline. -~ -door oak~ -1 -1 2546 -D1 -~ -~ -0 -1 2543 -D3 -~ -~ -0 -1 2547 -S -#2546 -The Apprentices' Workshop~ - You are in a small workshop. Writing implements and parchment are -strewn about on a few worktables. In the far corner several young mages -have a small kitten cornered and seem to be testing spells upon it. - The only apparent exit leads back south to the hallway. -~ -25 dg 0 -D2 -~ -door oak~ -1 -1 2545 -S -#2547 -A Bend In The Hallway~ - You are at a bend in the hallway. The walls emit a faint magical glow -which provides enough light to see by. - The hallway continues south and back east. -~ -25 dg 0 -D1 -~ -~ -0 -1 2545 -D2 -~ -~ -0 -1 2548 -S -#2548 -The Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. - There is a closed metal door to the west. -~ -25 dg 0 -D0 -~ -~ -0 -1 2547 -D2 -~ -~ -0 -1 2550 -D3 -~ -door metal~ -1 -1 2549 -S -#2549 -A Classroom~ - You are in a large classroom filled with bored looking students of the -art. The instructor stops in his lecture on the fine uses of magic missile -at your entry and lunges to attack you. - The only apparent exit is back east to the hallway. -~ -25 dg 0 -D1 -~ -door metal~ -1 -1 2548 -S -#2550 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. -~ -25 dg 0 -D0 -~ -~ -0 -1 2548 -D2 -~ -~ -0 -1 2551 -D3 -~ -door metal~ -1 -1 2552 -S -#2551 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. -~ -25 dg 0 -D0 -~ -~ -0 -1 2550 -D2 -~ -~ -0 -1 2553 -D3 -~ -door metal~ -1 -1 2554 -S -#2552 -An Empty Classroom~ - You are in an empty classroom. Some strange sigils are written on a -blackboard which is floating in the air here. Other than a few desks, -it is bare of furnishings. - The only apparent exit leads back east to the hallway. -~ -25 dg 0 -D1 -~ -door metal~ -1 -1 2550 -S -#2553 -A Bend In The Hallway~ - You are at a bend in the hallway. The walls emit a faint magical glow -which provides enough light to see by. - The hallway continues east and north. -~ -25 dg 0 -D0 -~ -~ -0 -1 2551 -D1 -~ -~ -0 -1 2555 -S -#2554 -An Empty Classroom~ - You are in an apparently empty classroom. A strange feeling of being -watched comes over you, and you hear the faint rustle of robes. - The only apparent exit is back east to the hallway. -~ -25 dg 0 -D1 -~ -door metal~ -1 -1 2551 -S -#2555 -A Hallway~ - You are in a long hallway leading east and west. The walls emit a -faint magical glow which provides enough light to see by. - A sturdy iron door can be seen to the south. -~ -25 dg 0 -D1 -~ -~ -0 -1 2556 -D2 -~ -door sturdy iron~ -1 -1 2557 -D3 -~ -~ -0 -1 2553 -S -#2556 -A Hallway~ - You are in a long hallway leading east and west. The walls emit a -faint magical glow which provides enough light to see by. - There is a large oaken door to the south. -~ -25 dg 0 -D1 -~ -~ -0 -1 2558 -D2 -~ -door large oaken~ -1 -1 2559 -D3 -~ -~ -0 -1 2555 -S -#2557 -The Amphitheater~ - You are in a small amphitheater. Rows of comfortable looking chairs -circle a large podium. The echos of your footsteps seem very loud here. - The only apparent exit leads north to the hallway. -~ -25 dg 0 -D0 -~ -door sturdy iron~ -1 -1 2555 -S -#2558 -A Hallway~ - You are in a long hallway leading east and west. The walls emit a -faint magical glow providing enough light to see by. - A small door can be seen to the south. -~ -25 dg 0 -D1 -~ -~ -0 -1 2560 -D2 -~ -door small~ -1 -1 2561 -D3 -~ -~ -0 -1 2556 -S -#2559 -The Training Room~ - You are in a large training room. It is filled with battle scared -manikins, and many other devices used in the practice of fighting. -~ -25 dg 0 -D0 -~ -door~ -1 -1 2556 -S -#2560 -A Bend In The Hallway~ - You are at a bend in the hallway. The walls emit a faint magical glow -which provides enough light to see by. - The hallway continues north and west. -~ -25 dg 0 -D0 -~ -~ -0 -1 2562 -D3 -~ -~ -0 -1 2558 -S -#2561 -A Dueling Room~ - You are in a large room used for duals arcane. The walls, ceiling and -floor all bare the scars of many fiery spells, but still look quite strong -and hold fast. - The only exit leads north to the hallway. -~ -25 dg 0 -D0 -~ -door small~ -1 -1 2558 -S -#2562 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. - A doorway can be seen to the east. -~ -25 dg 0 -D0 -~ -~ -0 -1 2563 -D1 -~ -door~ -1 -1 2564 -D2 -~ -~ -0 -1 2560 -S -#2563 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. - A wooden door can been seen to the east. -~ -25 dg 0 -D0 -~ -~ -0 -1 2566 -D1 -~ -door wooden~ -1 -1 2565 -D2 -~ -~ -0 -1 2562 -S -#2564 -The Spellmasters' Lounge~ - You are in a large comfortable looking lounge. Off duty spell teachers -are here relaxing in their idle time. A large coffee machine is against -the far wall. - The only apparent exit leads back west to the hallway. -~ -25 dg 0 -D3 -~ -door wooden~ -1 -1 2562 -S -#2565 -A Bedroom~ - You are in a large, plush bedroom. The owner is obviously someone of -high standing in the magical community here. An ice mirror is on one wall, -and a scrying globe sit on a stand in the middle of the room. An enormous -bed can be seen floating about a meter above the floor. - The only exit leads back west to the hallway. -~ -25 dg 0 -D3 -~ -door wooden~ -1 -1 2563 -S -#2566 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow providing enough light to see by. - A glass door can be seen to the east. -~ -25 dg 0 -D0 -~ -~ -0 -1 2568 -D1 -~ -door glass~ -1 -1 2567 -D2 -~ -~ -0 -1 2563 -S -#2567 -The Study~ - You are in a small, well kept study. Ancient tomes are on shelves -on the walls, A huge table sits in the middle of the room, with maps -weighted down upon it. The only light source here comes from an -interestingly non-magical oil lamp. - The only apparent exit leads back west to the hallway. -~ -25 dg 0 -D3 -~ -door glass~ -1 -1 2566 -S -#2568 -Below The Stairs~ - You are at the end of a long hallway. The walls emit a faint magical -glow which provides enough light to see by. A lesser guardian is here -keeping silent watch on the entrance to the levels above. - Stairs lead up and the hallway continues back south. -~ -25 dg 0 -D2 -~ -~ -0 -1 2566 -D4 -~ -~ -0 -1 2569 -S -#2569 -Atop The Stairway~ - You are atop a stairway. The halls here look quite a bit less used than -those below. Obviously access to these magic filled corridors is limited -to those of the upper echelon of mages. The walls here emit a faint blue -magical aura which provides some light. - The hallway leads west from here and the stairs go down. -~ -25 dg 0 -D3 -~ -~ -0 -1 2570 -D5 -~ -~ -0 -1 2568 -S -#2570 -A Hallway~ - You are in a long hallway stretching east and west. The walls here emit -a faint magical energy providing enough light to see by. - There is a thick looking wooden door to the north. -~ -25 dg 0 -D0 -~ -door wooden~ -1 -1 2571 -D1 -~ -~ -0 -1 2569 -D3 -~ -~ -0 -1 2572 -S -#2571 -A Small Office~ - You are in a small office. It looks like a calligrapher's -study, there are quills, inkpots and parchments all about on -desks and worktables. - A section to the west seems to be curtained off, but the -flicker of a candle can be seen through the curtain. -~ -25 dg 0 -D2 -~ -door wooden~ -1 -1 2570 -D3 -~ -curtain~ -1 -1 2573 -S -#2572 -A Hallway~ - You are in a long hallway leading east and west. The walls emit a -faint magical glow which provides enough light to see by. -~ -25 dg 0 -D1 -~ -~ -0 -1 2570 -D3 -~ -~ -0 -1 2574 -S -#2573 -The Master Scribe's Workshop~ - You are in the workshop of the tower's master scribe. Many half -finished scrolls lay on the writing table in the center of the room. -A giant candle flickering with soft blue flames provides the only -light here. - The only apparent exit is the way you came in. -~ -25 dg 0 -D1 -~ -curtain~ -1 -1 2571 -S -#2574 -A Hallway~ - You are in a long hallway leading east and west. The walls emit a -faint magical glow which provides enough light to see by. - A half-closed door can be seen to the north. -~ -25 dg 0 -D0 -A dark room can be seen through the half-opened door. -~ -door wooden~ -1 -1 2575 -D1 -~ -~ -0 -1 2572 -D3 -~ -~ -0 -1 2576 -S -#2575 -A Store Room~ - You are in a small dark store room. A few common items are stacked -upon the shelves here, but very little looks interesting. -~ -25 adg 0 -D2 -~ -door wooden~ -1 -1 2574 -S -#2576 -A Bend In The Hallway~ - You are at a bend in the long hallway. The walls emit a faint magical -glow which provides enough light to see by. - The hallway continues south and east from here. -~ -25 dg 0 -D1 -~ -~ -0 -1 2574 -D2 -~ -~ -0 -1 2577 -S -#2577 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. - An iron bound door can be seen to the west. -~ -25 dg 0 -D0 -~ -~ -0 -1 2576 -D2 -~ -~ -0 -1 2578 -D3 -~ -door iron~ -2 2515 2579 -S -#2578 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. - The sharp sound of metal on metal can be heard to the west. -~ -25 dg 0 -D0 -~ -~ -0 -1 2577 -D2 -~ -~ -0 -1 2580 -D3 -~ -door iron~ -1 -1 2581 -S -#2579 -A Store Room~ - You are in a large store room. Bins of ores, minerals and -other rare materials are here along with many neatly stacked -piles of precious metals. The ring of metal on metal can be -heard to the south. A large cabinet with sigils of warding -is bolted to one wall. -~ -25 dg 0 -D1 -~ -door iron~ -2 2515 2577 -D2 -~ -door~ -2 2515 2581 -S -#2580 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. -~ -25 dg 0 -D0 -~ -~ -0 -1 2578 -D2 -~ -~ -0 -1 2583 -S -#2581 -A Very Hot Room~ - You are in a very hot room. Against one wall is a large forge, magical -fires crackle within and heavy blue smoke pours into a vent in the ceiling. -A rune-encrusted mithril anvil is in the center of the room, looking well -used. Other tools of metallurgy hang on a rack which floats about three -meters in the air of its own force. -~ -25 dg 0 -D0 -~ -door~ -2 2515 2579 -D1 -~ -door iron~ -1 -1 2578 -D2 -~ -door~ -1 -1 2582 -D4 -~ -vent~ -1 -1 2612 -S -#2582 -The Master Enchanter's Chamber~ - You have entered the Master Enchanter's chamber. Upon all the walls -here are racks of finely crafted weapons. A huge chest with a glowing -lock is set to one side. Several unfinished looking blades rest atop a -small work table. -~ -25 dg 0 -D0 -~ -door~ -1 -1 2581 -S -#2583 -A Bend In The Hallway~ - You are at a bend in a long hallway. The walls emit a faint magical -glow which provides enough light to see by. - The hallway continues north and east. -~ -25 dg 0 -D0 -~ -~ -0 -1 2580 -D1 -~ -~ -0 -1 2584 -S -#2584 -A Hallway~ - You are in a long hallway leading east and west. The walls emit a -faint magical glow which provides enough light to see by. - A steel door can be seen to the south. -~ -25 dg 0 -D1 -~ -~ -0 -1 2585 -D2 -~ -door steel~ -1 -1 2586 -D3 -~ -~ -0 -1 2583 -S -#2585 -A Hallway~ - You are in a long hallway leading east and west. The walls emit a -faint magical glow which provides enough light to see by. -~ -25 dg 0 -D1 -~ -~ -0 -1 2587 -D3 -~ -~ -0 -1 2584 -S -#2586 -A Laboratory~ - You are in a small laboratory. Many strange instruments, vials, bottles -and some scrawled notes are piled about a workbench. This room is very -untidy, looking almost abandoned, or used by a madman. - The only apparent exits are east and north. -~ -25 dg 0 -D0 -~ -door steel~ -1 -1 2584 -D1 -~ -~ -0 -1 2588 -S -#2587 -A Hallway~ - You are in a long hallway leading east and west. The walls emit a -faint magical glow which provides enough light to see by. - You can see a steel door to the south. -~ -25 dg 0 -D1 -~ -~ -0 -1 2589 -D2 -~ -door steel~ -1 -1 2590 -D3 -~ -~ -0 -1 2585 -S -#2588 -The Mad Alchemist's Workroom~ - You are in the workroom of The Mad Alchemist. Bubbling braziers, -long glass tubes and scores of oddly shaped vials and bottles are -everywhere. It is incredibly messy here, crushed glass and other -trash litter the floor. - The only apparent exit is the one you entered by. -~ -25 dg 0 -D3 -~ -~ -0 -1 2586 -S -#2589 -A Bend In The Hallway~ - You are at a bend in a long hallway. The walls emit a faint magical -glow which provides enough light to see by. - The hallway continues north and west. -~ -25 dg 0 -D0 -~ -~ -0 -1 2591 -D3 -~ -~ -0 -1 2587 -S -#2590 -The Pentagram Chamber~ - You are in a large room with a five pointed star etched into the -floor. A crackling energy field can be seen to the south, it looks -quite dangerous. -~ -25 dg 0 -D0 -~ -door steel~ -1 -1 2587 -D2 -The energy field crackles and glows, nothing seems to be beyond. -~ -~ -0 -1 2592 -S -#2591 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. - A bronze door can be seen to the east. -~ -25 dg 0 -D0 -~ -~ -0 -1 2593 -D1 -~ -door bronze~ -1 -1 2594 -D2 -~ -~ -0 -1 2589 -S -#2592 -Inside The Energy Field~ - You feel a stomach twisting sensation as you enter the energy field. -Nice going! You might as well wait here until the wizard who built this -trap comes back to imprison your soul as well as your body. -~ -25 cdefgj 0 -S -#2593 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. - A bronze door can be seen to the east. -~ -25 dg 0 -D0 -~ -~ -0 -1 2596 -D1 -~ -door bronze~ -1 -1 2595 -D2 -~ -~ -0 -1 2591 -S -#2594 -An Empty Room~ - You are in an empty room. It is both quiet and comfortable here, it -looks like a safe place to rest. -~ -25 cdg 0 -D3 -~ -door bronze~ -1 -1 2591 -S -#2595 -The Charm Master's Chamber~ - You are in the chambers of the tower's Master of Charm. Some straw -and dirt litters the floor here, it looks to have been recently used by -wild animals. - Strange sounds can be heard through the bars to the north. -~ -25 dg 0 -D0 -~ -cage bars~ -1 -1 2597 -D3 -~ -door bronze~ -1 -1 2593 -S -#2596 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. -~ -25 dg 0 -D0 -~ -~ -0 -1 2598 -D2 -~ -~ -0 -1 2593 -S -#2597 -The Animal Pens~ - You are in the animal pens. Many caged animals are here looking unhappy. -Obviously they are destined to be enslaved, or used in some cruel magical -experimentation. -~ -25 dg 0 -D2 -~ -cage bars~ -1 -1 2595 -S -#2598 -The End Of The Hallway~ - You are at the end of a long north-south hallway. The walls emit -a faint magical glow which provides enough light to see by. - Stairs here lead up to the next level, and the hallway continues -south. -~ -25 dg 0 -D2 -~ -~ -0 -1 2596 -D4 -~ -~ -0 -1 2599 -S -#2599 -Atop The Stairway~ - You are atop the stairway to the upper levels of the high tower. The -walls emit a faint magical glow which provides enough light to see by. - A hallway leads west from here, and the stairs lead down. -~ -25 dg 0 -D3 -~ -~ -0 -1 2600 -D5 -~ -~ -0 -1 2598 -S -#2600 -A Hallway~ - You are in a long hallway leading east and west. The walls emit a -faint magical glow which provides enough light to see by. - A silver door can be seen to the north. -~ -25 dg 0 -D0 -~ -door silver~ -1 -1 2601 -D1 -~ -~ -0 -1 2599 -D3 -~ -~ -0 -1 2604 -S -#2601 -A Store Room~ - You are in a large store room. Raw materials are neatly bundled and -piled here and here. Many freshly cut staves rods and wands of different -sizes are here. - You can see a silver door to the west. -~ -25 dg 0 -D2 -~ -door silver~ -1 -1 2600 -D3 -~ -door silver~ -1 -1 2602 -S -#2602 -The Master Spellbinder's Chamber~ - You are in the chambers of the Master Spellbinder. Unlike other work -shops of similar nature, this one is without furnishings or tools. The -spell binder obviously needs none for the working of his art. - A silver door can be seen to the west. -~ -25 dg 0 -D1 -~ -door silver~ -1 -1 2601 -D3 -~ -door silver~ -2 2524 2603 -S -#2603 -The Spellbinder's Cache~ - You have discovered the cache of the Master Spellbinder. There are -three very large silver chased cabinets here, other than that, the room -is bare. - A silver door can be seen to the south. -~ -25 dg 0 -D1 -~ -door silver~ -2 2524 2602 -D2 -~ -door silver~ -2 2524 2605 -S -#2604 -A Hallway~ - You are in a long hallway leading east and west. The walls emit a -faint magical glow which provides enough light to see by. -~ -25 dg 0 -D1 -~ -~ -0 -1 2600 -D3 -~ -~ -0 -1 2605 -S -#2605 -A Hallway~ - You are in a long hallway leading east and west. The walls emit a -faint magical glow which provides enough light to see by. - A silver door can be seen to the north. -~ -25 dg 0 -D0 -~ -door silver~ -2 2524 2603 -D1 -~ -~ -0 -1 2604 -D3 -~ -~ -0 -1 2606 -S -#2606 -A Bend In The Hallway~ - You are at a bend in the long hallway. The walls emit a faint magical -glow which provides enough light to see by. - The hallway continues east and south. -~ -25 dg 0 -D1 -~ -~ -0 -1 2605 -D2 -~ -~ -0 -1 2607 -S -#2607 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. -~ -25 dg 0 -D0 -~ -~ -0 -1 2606 -D2 -~ -~ -0 -1 2608 -S -#2608 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. - A rusty old door can be seen to the west. -~ -25 dg 0 -D0 -~ -~ -0 -1 2607 -D2 -~ -~ -0 -1 2613 -D3 -~ -door rusty~ -1 -1 2609 -S -#2609 -The Golem Master's Workshop~ - You are in the golem master's workshop. A few unfinished looking humanoid -forms of different make are here, some moving, some not. The animated forms -lunge to attack you. -~ -25 dg 0 -D0 -~ -~ -0 -1 2610 -D1 -~ -door rusty~ -1 -1 2608 -D2 -~ -~ -0 -1 2611 -D5 -~ -trapdoor~ -1 -1 2612 -S -#2610 -A Store Room~ - You are in a small store room. Large chunks of clay, stone, wood and -many other raw materials are here. -~ -25 dg 0 -D2 -~ -~ -0 -1 2609 -S -#2611 -The Golem Chamber~ - You are in the golem chamber. Golems made of every imaginable material -are here, ranging in size from a hand-span to nearly the ceiling. They all -seem to be sleeping. -~ -25 dg 0 -D0 -~ -~ -0 -1 2609 -S -#2612 -It Is Very Dark Here...~ - It is very dark here... -~ -25 adg 0 -D4 -~ -trapdoor~ -1 -1 2609 -D5 -~ -vent~ -1 -1 2581 -S -#2613 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. -~ -25 dg 0 -D0 -~ -~ -0 -1 2608 -D2 -~ -~ -0 -1 2614 -S -#2614 -A Bend In The Hallway~ - You are at a bend in the long hallway. The walls emit a faint magical -glow which provides enough light to see by. - The hallway continues north and east from here. -~ -25 dg 0 -D0 -~ -~ -0 -1 2613 -D1 -~ -~ -0 -1 2615 -S -#2615 -A Hallway~ - You are in a long hallway leading east and west. The walls emit a -faint magical glow which provides enough light to see by. -~ -25 dg 0 -D1 -~ -~ -0 -1 2616 -D3 -~ -~ -0 -1 2614 -S -#2616 -A Hallway~ - You are in a long hallway leading east and west. The walls emit a -faint magical glow which provides enough light to see by. - An emerald door can be seen to the south. -~ -25 dg 0 -D1 -~ -~ -0 -1 2619 -D2 -~ -door emerald~ -1 -1 2617 -D3 -~ -~ -0 -1 2615 -S -#2617 -The Illusion Master's Chamber~ - You are in the chamber of the Master of Illusions. The walls here -are ever changing in colour and texture, as if they were reforming before -your very eyes. Many splendorous treasures lie all around in heaps and -piles, or at least they seem to be treasures... -~ -25 dg 0 -D0 -~ -door emerald~ -1 -1 2616 -D3 -~ -~ -0 -1 2618 -S -#2618 -A Bedroom~ - You are in the bedroom of the Master of Illusions. Strange looking -items and artifacts float here and there in the air. The ripples of -strong magic can be felt everywhere. - The room seems much larger than it looks... -~ -25 dg 0 -D0 -The room stretches off to the north. -~ -~ -0 -1 2618 -D1 -~ -~ -0 -1 2617 -D2 -The room stretches off to the south. -~ -~ -0 -1 2618 -D3 -The room stretches off to the west. -~ -~ -0 -1 2618 -S -#2619 -A Hallway~ - You are in a long hallway leading east and west. The walls emit a -faint magical glow which provides enough light to see by. - A glass door can be seen to the south. -~ -25 dg 0 -D1 -~ -~ -0 -1 2621 -D2 -~ -door glass~ -1 -1 2620 -D3 -~ -~ -0 -1 2616 -S -#2620 -The Meditation Chamber~ - You are in a meditation chamber. It is very silent here, in fact -you can not even hear your own footsteps. - You feel very peaceful. -~ -25 cdeg 0 -D0 -~ -door glass~ -1 -1 2619 -S -#2621 -A Bend In The Hallway~ - You are at a bend in the long hallway. The walls emit a faint -magical glow which provides enough light to see by. - The hallway continues north and west from here. -~ -25 dg 0 -D0 -~ -~ -0 -1 2622 -D3 -~ -~ -0 -1 2619 -S -#2622 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. - A blackened door can be seen to the east. -~ -25 dg 0 -D0 -~ -~ -0 -1 2626 -D1 -~ -door black~ -1 -1 2623 -D2 -~ -~ -0 -1 2621 -S -#2623 -A Dark Room~ - You are in a large dark room. The air here seems quite stale, and a -sense of extreme dread comes over you. The stench of rotten flesh seems -to be wafting in from the open doorway to the north. -~ -25 adg 0 -D0 -~ -~ -0 -1 2624 -D3 -~ -door black~ -1 -1 2622 -S -#2624 -A Dark Room~ - You are in a large dark room. The stench here makes you gag and retch. -There are body parts and half rotted corpses strewn about with complete -abandon. Several operating tables with still forms that resemble nothing -you have ever seen alive are here. - Tortured screams can be heard from the north. -~ -25 adg 0 -D0 -Gazing northwards, you are filled with deep dread. -~ -~ -0 -1 2625 -D2 -~ -~ -0 -1 2623 -S -#2625 -The Necromancer's Lair~ - You are in the lair of the evil Necromancer. Undead minions of all -types, human and otherwise stand here waiting to do their master's bidding. -Some glowing arcane sigils have been etched into walls and floor, no doubt -to protect the evil master from his own ungodly creations. -~ -25 adg 0 -D2 -~ -~ -0 -1 2624 -S -#2626 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. -~ -25 dg 0 -D0 -~ -~ -0 -1 2627 -D2 -~ -~ -0 -1 2622 -S -#2627 -A Hallway~ - You are in a long hallway leading north and south. The walls emit a -faint magical glow which provides enough light to see by. -~ -25 dg 0 -D0 -~ -~ -0 -1 2628 -D2 -~ -~ -0 -1 2626 -S -#2628 -The End Of The Hallway~ - You are at the end of a long hallway. The walls here glow with a faint -magical energy which provides plenty of light. - Stairs lead up to the next level here and the hallway continues south. -~ -25 dg 0 -D2 -~ -~ -0 -1 2627 -D4 -~ -~ -0 -1 2629 -S -#2629 -A Corridor~ - You are at the east end of a long corridor. Obsidian walls -engraved with ancient runes of power stretch out before you. -Magical energies seem to crackle with power all around and -whisper in tongues long forgotten, almost as if the corridor -itself were alive. -~ -25 dg 0 -D3 -~ -~ -0 -1 2630 -D5 -~ -~ -0 -1 2628 -S -#2630 -A Corridor~ - You are in a long corridor. Obsidian walls engraved with ancient runes -of power stretch out before you. Magical energies seem to crackle with -power all around and whisper in tongues long forgotten, almost as if the -corridor itself were alive. -~ -25 dg 0 -D1 -~ -~ -0 -1 2629 -D3 -~ -~ -0 -1 2631 -S -#2631 -A Bend In The Corridor~ - You are at a bend in the long corridor. Obsidian walls engraved with -ancient runes of power stretch out before you. Magical energies seem to -crackle with power all around and whisper in tongues long forgotten, almost -as if the corridor itself were alive. -~ -25 dg 0 -D1 -~ -~ -0 -1 2630 -D2 -~ -~ -0 -1 2632 -S -#2632 -A Corridor~ - You are in a long corridor leading north and south. Obsidian walls -engraved with ancient runes of power stretch out before you. Magical -energies seem to crackle with power all around and whisper in tongues -long forgotten, almost as if the corridor itself were alive. -~ -25 dg 0 -D0 -~ -~ -0 -1 2631 -D2 -~ -~ -0 -1 2633 -S -#2633 -An Intersection~ - You are at an intersection in the corridor. The obsidian walled halls -lead off in every direction from here, pulsing with the power of their -ancient runes. -~ -25 dg 0 -D0 -~ -~ -0 -1 2632 -D1 -~ -~ -0 -1 2634 -D2 -~ -~ -0 -1 2646 -D3 -~ -~ -0 -1 2636 -S -#2634 -A Corridor~ - You are at the end of a long corridor. Obsidian walls engraved with -ancient runes of power stretch out before you. A darkened door is to the -east. Tendrils of mist cling to the floor here, they seem to be seeping -from under the door. -~ -25 dg 0 -D1 -~ -door black~ -1 -1 2635 -D3 -~ -~ -0 -1 2633 -S -#2635 -The Scrying Chamber~ - You are in the scrying chamber of the high tower of sorcerery. It is -here that arcane rituals are performed to enable those of the art to look -in upon denizens throughout the world and spy out their darkest secrets. -A huge black cauldron is in the center of the room, bubbling and gurgling, -it pours forth a constant stream of smokey fog into the air about you. Here -and there on stands of different sizes are crystal balls and oddly shaped -mirrors. -~ -25 adg 0 -D3 -~ -door black~ -1 -1 2634 -S -#2636 -A Corridor~ - You have reached an end in the long corridor. Obsidian walls engraved -with ancient runes of power stretch out before you. The sound of snoring -can barely be heard through the door to the west. -~ -25 dg 0 -D1 -~ -~ -0 -1 2633 -D3 -~ -door wooden~ -1 -1 2637 -S -#2637 -The Entrance To The Library~ - You are in the entrance to the great library of magic. A giant desk is -here, covered with books parchments and scrolls. Long shelves loaded with -row upon row of books stretch out in every direction as far as the eye can -see. -~ -25 dg 0 -D0 -All you can see are books. -~ -~ -0 -1 2639 -D1 -~ -door wooden~ -1 -1 2636 -D2 -All you can see are books. -~ -~ -0 -1 2640 -D3 -All you can see are books. -~ -~ -0 -1 2638 -S -#2638 -In The Library~ - You are in the great library of magic. A strong musty smell permeates -the entire area. Upon shelves which float just out of reach are hundreds -of books, tomes and scrolls of every possible shape size and colour. The -elusive books seem to wink in and out of existence before your untrained -eyes. It is very quiet here. -~ -25 dg 0 -D0 -All you can see are books. -~ -~ -0 -1 2641 -D1 -All you can see are books. -~ -~ -0 -1 2637 -D2 -All you can see are books. -~ -~ -0 -1 2642 -D3 -All you can see are books. -~ -~ -0 -1 2643 -S -#2639 -In The Library~ - You are in the great library of magic. A strong musty smell permeates -the entire area. Upon shelves which float just out of reach are hundreds -of books, tomes and scrolls of every possible shape size and colour. The -elusive books seem to wink in and out of existence before your untrained -eyes. It is very quiet here. -~ -25 dg 0 -D0 -All you can see are books. -~ -~ -0 -1 2640 -D1 -All you can see are books. -~ -~ -0 -1 2642 -D2 -All you can see are books. -~ -~ -0 -1 2637 -D3 -All you can see are books. -~ -~ -0 -1 2641 -S -#2640 -In The Library~ - You are in the great library of magic. A strong musty smell permeates -the entire area. Upon shelves which float just out of reach are hundreds -of books, tomes and scrolls of every possible shape size and colour. The -elusive books seem to wink in and out of existence before your untrained -eyes. It is very quiet here. -~ -25 dg 0 -D0 -All you can see are books. -~ -~ -0 -1 2637 -D1 -All you can see are books. -~ -~ -0 -1 2641 -D2 -All you can see are books. -~ -~ -0 -1 2639 -D3 -All you can see are books. -~ -~ -0 -1 2642 -S -#2641 -In The Library~ - You are in the great library of magic. A strong musty smell permeates -the entire area. Upon shelves which float just out of reach are hundreds -of books, tomes and scrolls of every possible shape size and colour. The -elusive books seem to wink in and out of existence before your untrained -eyes. It is very quiet here. -~ -25 dg 0 -D0 -All you can see are books. -~ -~ -0 -1 2642 -D1 -All you can see are books. -~ -~ -0 -1 2639 -D2 -All you can see are books. -~ -~ -0 -1 2638 -D3 -All you can see are books. -~ -~ -0 -1 2640 -S -#2642 -In The Library~ - You are in the great library of magic. A strong musty smell permeates -the entire area. Upon shelves which float just out of reach are hundreds -of books, tomes and scrolls of every possible shape size and colour. The -elusive books seem to wink in and out of existence before your untrained -eyes. It is very quiet here. -~ -25 dg 0 -D0 -All you can see are books. -~ -~ -0 -1 2638 -D1 -All you can see are books. -~ -~ -0 -1 2640 -D2 -All you can see are books. -~ -~ -0 -1 2641 -D3 -All you can see are books. -~ -~ -0 -1 2639 -S -#2643 -In The Library~ - You are in the great library of magic. A strong musty smell permeates -the entire area. Upon shelves which float just out of reach are hundreds -of books, tomes and scrolls of every possible shape size and colour. The -elusive books seem to wink in and out of existence before your untrained -eyes. It is very quiet here. -~ -25 dg 0 -D1 -All you can see are books. -~ -~ -0 -1 2638 -D3 -You see a small gap between some shelves. -~ -~ -0 -1 2644 -S -#2644 -Between The Shelves~ - You are in the great library of magic. The shelves seem uncomfortably -close here, you can barely maneuver between them. The musty smell is still -strong, and the elusive books still hover just out of reach. - A faint flicker of light can barely be made out to the north. -~ -25 dg 0 -D0 -~ -~ -0 -1 2645 -D1 -~ -~ -0 -1 2643 -S -#2645 -The Reading Room~ - You are in a small room completely devoid of furnishings. The only thing -here is an enormous tome, lying face open on the floor. The great book looks -both heavy and ancient. Its jewel encrusted bindings are well worn as the -bark of a tree. Spidery writings seem to crawls across the pages, totally -incomprehensible to your mortal eye. Something seems to be wedged between -the pages. -~ -25 dg 0 -D2 -~ -~ -0 -1 2644 -S -#2646 -A Corridor~ - You are in a long corridor leading north and south. Obsidian walls -engraved with ancient runes of power stretch out before you. Magical -energies seem to crackle with power all around and whisper in tongues -long forgotten, almost as if the corridor itself were alive. -~ -25 dg 0 -D0 -~ -~ -0 -1 2633 -D2 -~ -~ -0 -1 2647 -S -#2647 -The End Of The Corridor~ - You are at the end of a long corridor. The obsidian walls come to an -abrupt halt at the edge of a golden archway here. The hum of power is so -strong it nearly numbs your body. - The archway lies before you, glowing and pulsing with energy. -~ -25 dg 0 -D0 -~ -~ -0 -1 2646 -D2 -~ -~ -0 -1 2648 -S -#2648 -The Arched Entrance~ - You feel a slight tingle as you pass through the archway, as if the living -magical energies here had infused your body, found it wanting and left. The -intense glow from the arch above you is almost blinding. Through the light -you can barely make out a stairway leading up. -~ -25 dg 0 -D0 -~ -~ -0 -1 2647 -D4 -~ -~ -0 -1 2649 -S -#2649 -The Landing~ - You are on a small landing in the middle of a long stairway leading up. -Your senses seem dulled here, no sound or smell can be detected at all, and -the only thing you can see in any direction is endless stairway. -~ -25 dg 0 -D4 -~ -~ -0 -1 2650 -D5 -~ -~ -0 -1 2648 -S -#2650 -An Intersection~ - You are at an intersection of several hallways. You feel as if strange -mystical forces are pushing and pulling at each other from all around you. -The sensation of being trapped, in the middle is almost tangible in the air -here. - A grey tiled hallway leads south, black tiled east, white tiled west, -and a multi-coloured hallway swirling with patterns that remain just barely -unrecognizable is to the north. -~ -25 dg 0 -D0 -~ -~ -0 -1 2673 -D1 -~ -~ -0 -1 2658 -D2 -~ -~ -0 -1 2651 -D3 -~ -~ -0 -1 2665 -D5 -~ -~ -0 -1 2649 -S -#2651 -A Grey Tiled Hallway~ - You are in a grey tiled hallway leading north and south. Dim balls -of energy float here and there shedding a warm light, and showing the -way. A feeling of peace and balance comes over you. -~ -25 dg 0 -D0 -~ -~ -0 -1 2650 -D2 -~ -~ -0 -1 2652 -S -#2652 -A Grey Tiled Hallway~ - You are in a grey tiled hallway leading north and south. Dim balls -of energy float here and there shedding a warm light, and showing the -way. A feeling of peace and balance comes over you. - Large, grey metal double doors can be seen to the south. -~ -25 dg 0 -D0 -~ -~ -0 -1 2651 -D2 -~ -door grey~ -1 -1 2653 -S -#2653 -The Antechamber~ - You are in the antechamber of the Master Magician of the Grey Light. -A feeling of strong magic floats in the air about you, almost as if you -could taste the power held within these walls. - Once your eyes adjust to the semi-light, you can make out a larger -room to the south. -~ -25 dg 0 -D0 -~ -door grey~ -1 -1 2652 -D2 -~ -~ -0 -1 2654 -S -#2654 -The Main Chamber~ - A feeling of tranquility comes over you as you enter the main chamber -of Neutrality. Some artifacts are hung on the walls here, or set on stands. -The room in general looks both comfortable and official. Probably where the -Master of Neutrality holds audience. -~ -25 dg 0 -D0 -~ -~ -0 -1 2653 -D1 -~ -~ -0 -1 2656 -D2 -~ -~ -0 -1 2657 -D3 -~ -~ -0 -1 2655 -S -#2655 -The Study~ - You are in a large study. Shelves filled with many books or arcane -knowledge are on every wall. A large oaken desk is in the center, with -many parchments and scrolls on it. The most notable thing in the room is -a small set of scales, which floats about eye level. In perfect balance, -the scales are no doubt a sign of the Master's neutrality. -~ -25 dg 0 -D1 -~ -~ -0 -1 2654 -S -#2656 -A Closet~ - You are in a small closet. It is filled with many cloaks, and some -other apparel. -~ -25 adg 0 -D3 -~ -~ -0 -1 2654 -S -#2657 -A Bedroom~ - You are in the bedroom of the Master Magician of Neutrality. -Curtained windows can be seen on the south wall. A large -comfortable looking bed takes up most of the room. -~ -25 dg 0 -D0 -~ -~ -0 -1 2654 -S -#2658 -A Dark Hallway~ - You are in a long dark hallway leading east and west. Not much can -be seen in the unnatural darkness here, but you get a deep sense of dread -the further you go. -~ -25 adg 0 -D3 -~ -~ -0 -1 2650 -D1 -~ -~ -0 -1 2659 -S -#2659 -A Dark Hallway~ - You are in a long dark hallway leading east and west. Not much can -be seen in the unnatural darkness here, but you get a deep sense of dread -the further you go. -~ -25 adg 0 -D1 -~ -~ -0 -1 2660 -D3 -~ -~ -0 -1 2658 -S -#2660 -The End Of The Hallway~ - You are at the end of a long dark hallway. The darkness here is almost -tangible in its thickness. A deep sense of fear and loathing comes over -you. - A pair of obsidian doors can be seen to the east. -~ -25 adg 0 -D1 -~ -door obsidian~ -1 -1 2661 -D3 -~ -~ -0 -1 2659 -S -#2661 -The Chamber Of Darkness~ - You are in a vast chamber. The walls fade into darkness, leaving you -with a very vague idea of the actual size of the room. Swirling here and -there in the dark, are patches of pure black which seem to suck in your -light and leave it that much darker here. -~ -25 adg 0 -D0 -~ -~ -0 -1 2662 -D1 -~ -~ -0 -1 2664 -D2 -~ -~ -0 -1 2663 -D3 -~ -door obsidian~ -1 -1 2660 -S -#2662 -It Is Very Dark Here...~ - It is very dark here... -~ -25 adg 0 -D2 -~ -~ -0 -1 2661 -S -#2663 -A Torture Chamber~ - You are in an ill lit chamber. Instruments of torture hang from a rack -on the wall, they seem to quiver with anticipation of a victim as if they -had a mind of their own. An operating table is here, though it is bare. - An extreme feeling of evil permeates the entire area. -~ -25 adg 0 -D0 -~ -~ -0 -1 2661 -S -#2664 -The Inner Chamber~ - You are in a small dark chamber. Upon the walls are glowing sigils of -dark power, scrawled and traced in an evil language no longer known to most -of this plane of existence. There is an obsidian altar here which seems to -glow, but does not shed any light, in fact it seems to be taking light in. -~ -25 adg 0 -D3 -~ -~ -0 -1 2661 -S -#2665 -A Bright Hallway~ - You are in a long well lit hallway leading east and west. The walls -here are a milky white colour, and glow with a warm luminescence, as does -the floor. A feeling of goodness permeates the area, and you feel unworthy -to tread upon these sacred floors. -~ -25 dg 0 -D1 -~ -~ -0 -1 2650 -D3 -~ -~ -0 -1 2666 -S -#2666 -A Bright Hallway~ - You are in a long well lit hallway leading east and west. The walls -here are a milky white colour, and glow with a warm luminescence, as does -the floor. A feeling of goodness permeates the area, and you feel unworthy -to tread upon these sacred floors. - A huge set of double doors in finely worked ivory can be seen to the -west. -~ -25 dg 0 -D1 -~ -~ -0 -1 2665 -D3 -~ -door ivory~ -1 -1 2667 -S -#2667 -An Antechamber~ - You are in a small antechamber. It is well lit here, though the source -of light cannot be seen. It is almost as if the room itself exudes a warm -glow of goodness. A larger chamber can be seen to the west, but you do not -feel worthy to pass into it. -~ -25 dg 0 -D1 -~ -door ivory~ -1 -1 2666 -D3 -~ -~ -0 -1 2669 -S -#2669 -The Chamber Of The White Light~ - You are in a vast chamber, its walls floor and ceiling are of an -unknown metallic material, the brightest white, almost blindingly stark. -A flickering flame is in the center of the room, seeming to feed off of -darkness and cleansing the room of any evil. You feel a slight tug at -your being as the flame flickers towards you. -~ -25 dg 0 -D0 -~ -~ -0 -1 2670 -D1 -~ -~ -0 -1 2667 -D2 -~ -~ -0 -1 2671 -D3 -~ -~ -0 -1 2672 -S -#2670 -The Meditation Chamber~ - You are in a small meditation chamber. White silk cushions are -everywhere, looking very comfortable. You get an easy peaceful -feeling of relaxation here, almost making you want to lie down and -fall asleep. -~ -25 dg 0 -D2 -~ -~ -0 -1 2669 -S -#2671 -A Study~ - You are in a spacious study. It is extremely tidy here, to an almost -antiseptic nature. One would wonder how anyone could study without a -mess all around them, the master of this chamber obviously can. -~ -25 dg 0 -D0 -~ -~ -0 -1 2669 -S -#2672 -A Closet~ - You are in a small closet. Cloaks and vests hang from hooks in -the wall, and a few old boots are all that can be seen here. Rather -featureless all in all. -~ -25 adg 0 -D1 -~ -~ -0 -1 2669 -S -#2673 -A Wide Hallway~ - You are in a large hallway, wide enough to accommodate several people -standing abreast. The floor here is a swirl of multicoloured patterns, in -constant motion. - A huge, grey metal door blocks the way north, it looks quite sturdy. -~ -25 dg 0 -D0 -~ -door metal grey~ -2 2593 2674 -D2 -~ -~ -0 -1 2650 -S -#2674 -A Wide Hallway~ - You are in a large hallway, wide enough to accommodate several people -standing abreast. The floor here is a swirl of multicoloured patterns, in -constant motion. - A huge, black obsidian door blocks the way north, it looks quite sturdy. -~ -25 dg 0 -D0 -~ -door obsidian black~ -2 2594 2675 -D2 -~ -door metal grey~ -2 2593 2673 -S -#2675 -A Wide Hallway~ - You are in a large hallway, wide enough to accommodate several people -standing abreast. The floor here is a swirl of multicoloured patterns, in -constant motion. - A huge, white ivory door blocks the way north, it looks quite sturdy. -~ -25 dg 0 -D0 -~ -door ivory white~ -2 2595 2676 -D2 -~ -door obsidian black~ -2 2594 2674 -S -#2676 -The Entranceway~ - You are at the entrance to the audience chamber of the Grand Master of -Magic. Beautiful tapestries displaying the ancient masters of lore are on -the walls, and the floor is covered with a plush multicoloured carpet, which -seems to rustle and move at the touch of your boots. -~ -25 dg 0 -D0 -~ -~ -0 -1 2677 -D2 -~ -door white ivory~ -2 2595 2675 -S -#2677 -The Audience Chamber~ - You are in a large chamber. Small bolts of energy leap from wall to -wall, crackling with power. The floor is a swirl of indeterminable colours -and patterns ever changing. Bright bursts of colour seem to explode into -the air and fade again at random times. All this splendor plays about and -draws attention to a large throne in the center of the room, it seems to be -cut from a single enormous emerald. -~ -25 dg 0 -D0 -~ -~ -0 -1 2680 -D1 -~ -~ -0 -1 2678 -D2 -~ -~ -0 -1 2676 -D3 -~ -~ -0 -1 2679 -E -throne~ -The giant emerald is flawless, and must be incredibly valuable. -~ -S -#2678 -A Dressing Room~ - You are in a plush dressing room. Fine garments of many styles and some -outlandish colours hang from a rack suspended in mid air at eye level. The -only other interesting feature in the room is a large silver mirror on a -finely crafted gold stand. -~ -25 dg 0 -D3 -~ -~ -0 -1 2677 -S -#2679 -The Library~ - You are in a small cosy looking library. A few well made books sit atop -shelves which span every wall. A large oaken writing table is in the center -of the room with odd papers and parchments on it. The illumination here, -to your surprise is a quite un-magical oil lamp. -~ -25 dg 0 -D1 -~ -~ -0 -1 2677 -S -#2680 -The Altar~ - You are in a small chapel designed around a beautifully crafted golden -altar. Many icons to lesser deities line the room, but it is obvious by -one glance at the symbols on the altar, that this room was designed for -the worship of Mystra, the goddess of magic. -~ -25 dg 0 -D1 -~ -door secret~ -1 -1 2681 -D2 -~ -~ -0 -1 2677 -D3 -~ -door secret~ -1 -1 2682 -S -#2681 -The Treasury~ - You are in a small chamber, the stale air here is testament to the fact -that it has gone undisturbed for many years. -~ -25 dg 0 -D3 -~ -door secret~ -1 -1 2680 -S -#2682 -A Passage~ - You are in a small dark passage, which would be unremarkable if not for -the fact that it ends in a blinding blue light to the west. On hooks set -into the wall here there hang several travel worthy cloaks, and a small -leather backpack. It looks as if someone has prepared this room to be used -in the event speedy of a evacuation. -~ -25 adg 0 -D1 -~ -door~ -1 -1 2680 -D3 -~ -~ -0 -1 2683 -S -#2683 -In The Light~ - You seem to be floating in a magical energy field, though you cannot -see the source of the energy, you can feel its power pushing at you from -all sides, completely negating the effects of gravity. - An imperfection in the uniform blue can be seen overhead, it might be -an exit. -~ -25 dg 0 -D4 -~ -~ -0 -1 3001 -S -$ diff --git a/lc-mud/circle/world/wld/30.wld b/lc-mud/circle/world/wld/30.wld deleted file mode 100644 index 57f20c287bfbcf33370addb852a6f0d958de79f0..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/30.wld +++ /dev/null @@ -1,1444 +0,0 @@ -#3000 -The Reading Room~ - You are in a small, simple room which is mostly empty, save a few -wooden desks and benches. To the east you hear the bustle of the Temple -of Midgaard, a sharp contrast to the relative quiet of this peaceful -room. -~ -30 cdeh 0 -D1 -You see the Temple of Midgaard. -~ -~ -0 -1 3001 -S -#3001 -The Temple Of Midgaard~ - You are in the southern end of the temple hall in the Temple of Midgaard. -The temple has been constructed from giant marble blocks, eternal in -appearance, and most of the walls are covered by ancient wall paintings -picturing Gods, Giants and peasants. - Large steps lead down through the grand temple gate, descending the huge -mound upon which the temple is built and ends on the temple square below. -To the west, you see the Reading Room. The donation room is in a small -alcove to your east. -~ -30 cdeh 0 -D0 -At the northern end of the temple hall is a statue and a huge altar. -~ -~ -0 -1 3054 -D1 -In the east, you see a small alcove with a rickety wooden sign which -reads "Midgaard Donation Room." -~ -~ -0 -1 3063 -D2 -You look down the huge stone steps at the temple square below. -~ -~ -0 -1 3005 -D3 -You see the Reading Room. -~ -~ -0 -1 3000 -D5 -You see the temple square. -~ -~ -0 -1 3005 -S -#3002 -The Clerics' Inner Sanctum~ - This is the inner sanctum. A picture of the mighty Thor, is hanging on -the wall, just above the altar which is set against the western wall. A well -in the middle of the floor leads down into darkness. Vile smells waft from -the depths. -~ -30 cd 0 -D1 -You see your favorite place, the bar of divination. -~ -~ -0 -1 3003 -D5 -You can't see what is down there, it is too dark. Looks like it would be -impossible to climb back up. -~ -~ -0 -1 7026 -S -#3003 -The Bar Of Divination~ - The bar is one of the finest in the land, lucky it is members only. Fine -furniture is set all around the room. A small sign is hanging on the wall. -~ -30 cdh 0 -D2 -You see the entrance. -~ -~ -0 -1 3004 -D3 -You see the inner sanctum. -~ -~ -0 -1 3002 -E -sign~ -The sign reads: -Free instructions provided by the waiter: - - Buy - Buy something (drinkable) from the waiter. - List - The waiter will show you all the different drinks and - specialties, and tell the price of each. -~ -S -#3004 -The Entrance To The Clerics' Guild~ - The entrance hall is a small modest room, reflecting the true nature of -the Clerics. The exit leads east to the temple square. A small entrance to -the bar is in the northern wall. -~ -30 d 0 -D0 -You see the bar, richly decorated with really stylish furniture. -~ -~ -0 -1 3003 -D1 -You see the Temple Square. -~ -~ -0 -1 3005 -S -#3005 -The Temple Square~ - You are standing on the temple square. Huge marble steps lead up to the -temple gate. The entrance to the Clerics' Guild is to the west, and the old -Grunting Boar Inn, is to the east. Just south of here you see the market -square, the center of Midgaard. -~ -30 0 1 -D0 -You see the temple. -~ -~ -0 -1 3001 -D1 -You see the good old Grunting Boar Inn. -~ -~ -0 -1 3006 -D2 -You see the Market Square. -~ -~ -0 -1 3014 -D3 -You see the entrance to the Clerics' Guild. -~ -~ -0 -1 3004 -S -#3006 -The Entrance Hall Of The Grunting Boar Inn~ - You are standing in the entrance hall of the Grunting Boar Inn. The hall -has been wisely decorated with simple, functional furniture. The heavy smell -of dust and aging paper drifts in from the Post Office to the north. A small -staircase leads up to the reception and the bar is to the east. -~ -30 d 0 -D0 -You see the Midgaard Post Office. -~ -~ -0 -1 3062 -D1 -Surprise! You see the bar. -~ -~ -0 -1 3007 -D3 -You see the temple square. -~ -~ -0 -1 3005 -D4 -You see the reception. -~ -~ -0 -1 3008 -S -#3007 -The Grunting Boar~ - You are standing in the bar. The bar is set against the northern wall, old -archaic writing, carvings and symbols cover its top. A fireplace is built into -the western wall, and through the southeastern windows you can see the temple -square. This place makes you feel like home. -A small sign with big letters is fastened to the bar. -~ -30 dh 0 -D3 -You see the exit to the entrance hall. -~ -~ -0 -1 3006 -E -sign~ -The sign reads: -Free instructions provided by the Grunting Boar Inn. - - Buy - Buy something (drinkable) from the bartender. - List - The bartender will show you all the different drinks and - specialties, and tell the price of each. -~ -E -writing carving carvings symbols symbol~ -Although it is very hard to understand, you think it looks a lot like beer, -poems about beer, and small beer-mugs. -~ -S -#3008 -The Reception~ - You are standing in the reception. The staircase leads down to the -entrance hall. An exit to the north leads to the Cryogenic Center. -There is a small sign on the counter. -~ -30 d 0 -D0 -You see the Cryogenic Center. -~ -~ -0 -1 3064 -D5 -You see the entrance hall. -~ -~ -0 -1 3006 -E -sign~ -Rooms are expensive but good! You may: - - Offer - get an offer on a room - Time is in real life days. - Rent - Rent a room (saves your stuff, and quits the game), - minimum charge is one day. - - - MY WAY OR THE HIGHWAY - PAY YOUR RENT! - WE WON'T THINK TWICE BEFORE KICKING YOU OUT. -~ -S -#3009 -The Bakery~ - You are standing inside the small bakery. A sweet scent of Danish and -fine bread fills the room. The bread and Danish are arranged in fine order -on the shelves, and seem to be of the finest quality. -A small sign is on the counter. -~ -30 dh 0 -D2 -You see the main street. -~ -~ -0 -1 3013 -E -danish pastry~ -You see that this is truly delicious pastry. Must be made by a Dane from -Denmark (which surely is not the capital of Sweden!). Former ruler of -Scandinavia, England, Northern Germany, Northern France, Russia, Greenland, -Iceland, Estonia etc. etc. - The sight of those large, wholesome chokoladeboller makes your mouth water -and your soul sing. -~ -E -sign~ -Free instructions provided by the store: - - Buy - Will buy you some bread or pastry. - List - The baker will kindly tell you the price and sort of the bread in - his bakery. -~ -S -#3010 -The General Store~ - You are inside the general store. All sorts of items are stacked on shelves -behind the counter, safely out of your reach. -A small note hangs on the wall. -~ -30 dh 0 -D2 -You see the main street. -~ -~ -0 -1 3015 -E -note~ -The note reads: - - List - Show which various items are in the store. - Buy - Buy an item. - Value - The shopkeeper will (free of charge) tell how much he will - pay for your item. - Sell - Sell an item. -~ -S -#3011 -The Weapon Shop~ - You are inside the weapon shop. There is a small note on the counter. -~ -30 dh 0 -D2 -You see the main street. -~ -~ -0 -1 3016 -E -note~ -The note reads: - - List - Show which various items are in the store. - Buy - Buy an item. - Value - The shopkeeper will (free of charge) tell how much he will - pay for your item. - Sell - Sell an item. -~ -S -#3012 -Main Street~ - You are at the end of the main street of Midgaard. South of here is the -entrance to the Guild of Magic Users. The street continues east towards the -market square. The magic shop is to the north and to the west is the city -gate. -~ -30 0 1 -D0 -You see the magic shop. -~ -~ -0 -1 3033 -D1 -You see the main street. -~ -~ -0 -1 3013 -D2 -You see the entrance to the Guild of Magic Users. -~ -~ -0 -1 3017 -D3 -You see the city gate. -~ -~ -0 -1 3040 -S -#3013 -Main Street~ - You are on the main street passing through the City of Midgaard. South of -here is the entrance to the Armory, and the bakery is to the north. East of -here is the market square. -~ -30 0 1 -D0 -You see the bakery. -~ -~ -0 -1 3009 -D1 -You see the market square. -~ -~ -0 -1 3014 -D2 -You see the armory. -~ -~ -0 -1 3020 -D3 -You see the main street. -~ -~ -0 -1 3012 -S -#3014 -Market Square~ - You are standing on the market square, the famous Square of Midgaard. -A large, peculiar looking statue is standing in the middle of the square. -Roads lead in every direction, north to the temple square, south to the -common square, east and westbound is the main street. -~ -30 0 1 -D0 -You see the temple square. -~ -~ -0 -1 3005 -D1 -You see the main street. -~ -~ -0 -1 3015 -D2 -You see the common square. -~ -~ -0 -1 3025 -D3 -You see the main street. -~ -~ -0 -1 3013 -E -statue~ -What you see is the Midgaard Worm, stretching around the Palace of Midgaard. -~ -S -#3015 -Main Street~ - You are on the main street crossing through town. To the north is the -general store, and the main street continues east. To the west you see and -hear the market place, to the south a small door leads into the Pet Shop. -~ -30 0 1 -D0 -You see the general store. -~ -~ -0 -1 3010 -D1 -You see the main street. -~ -~ -0 -1 3016 -D2 -You see the Pet Shop. -~ -~ -0 -1 3031 -D3 -You see the market square. -~ -~ -0 -1 3014 -S -#3016 -Main Street~ - The main street, to the north is the weapon shop and to the south is the -Guild of Swordsmen. To the east you leave town and to the west the street -leads to the market square. -~ -30 0 1 -D0 -You see the weapon shop. -~ -~ -0 -1 3011 -D1 -You see the city gate. -~ -~ -0 -1 3041 -D2 -You see the swordsmen's guild. -~ -~ -0 -1 3021 -D3 -You see the main street leading to the market square. -~ -~ -0 -1 3015 -S -#3017 -The Entrance To The Mages' Guild~ - The entrance hall to this guild is a small, poor lighted room. -~ -30 d 0 -D0 -You see the main street. -~ -~ -0 -1 3012 -D2 -You see your favorite place, the Mages' Bar. -~ -~ -0 -1 3018 -S -#3018 -The Mages' Bar~ - The bar is one of the weirdest in the land. Mystical images float around -the air. Illusions of fine furniture appear all around the room. -~ -30 cdh 0 -D0 -You see the lobby. -~ -~ -0 -1 3017 -D1 -You see the laboratory. -~ -~ -0 -1 3019 -S -#3019 -The Mages' Laboratory~ - This is the Magical Experiments Laboratory. Dark smoke-stained stones -arch over numerous huge oaken tables, most of these cluttered with strange- -looking pipes and flasks. The floor is covered with half-erased pentagrams -and even weirder symbols, and a blackboard in a dark corner has only been -partially cleaned, some painful-looking letters faintly visible. A well in -the middle of the floor leads down into darkness. Vile smells waft from the -depths. -~ -30 cd 0 -D3 -You see the bar. -~ -~ -0 -1 3018 -D5 -You can't see what is down there, it is too dark. Looks like it would be -impossible to climb back up. -~ -~ -0 -1 7017 -S -#3020 -The Armory~ - The armory with all kinds of armors on the walls and in the window. You -see helmets, shields and chain mails. To the north is the main street. -On the wall is a small note. -~ -30 dh 0 -D0 -You see the main street. -~ -~ -0 -1 3013 -E -note~ -You can use these commands for trading: - - value <item> To get the price of an item in your possession. - sell <item> To sell something. - buy <item> To buy something (provided that the shop has it in store). - list Gives you a listing of the shop's inventory. - - WE DON'T GIVE CREDIT; WE DON'T EXPECT TO RECEIVE CREDIT! - NO HAGGLING -~ -S -#3021 -The Entrance Hall To The Guild Of Swordsmen~ - The entrance hall to the Guild of Swordsmen. A place where one has to be -careful not to say something wrong (or right). To the east is the bar and to -the north is the main street. -~ -30 d 0 -D0 -You see the main street. -~ -~ -0 -1 3016 -D1 -You see the swordsmen's bar, many noises comes from there. -~ -~ -0 -1 3022 -S -#3022 -The Bar Of Swordsmen~ - The bar of swordsmen, once upon a time beautifully furnished. But now the -furniture is all around you in small pieces. To the south is the yard, and -to the west is the entrance hall. -~ -30 cdh 0 -D2 -You see the practice yard. -~ -~ -0 -1 3023 -D3 -You see the entrance hall to the warriors' guild. -~ -~ -0 -1 3021 -S -#3023 -The Tournament And Practice Yard~ - This is the practice yard of the fighters. To the north is the bar. -A well leads down into darkness. -~ -30 cd 0 -D0 -You see the bar. -~ -~ -0 -1 3022 -D5 -You can't see what is down there, it is too dark. Looks like it would be -impossible to climb back up. -~ -~ -0 -1 7048 -S -#3024 -The Eastern End Of Poor Alley~ - You are at the poor alley. South of here is the Grubby Inn and to the -east you see common square. The alley continues further west. -~ -30 0 1 -D1 -You see the common square. -~ -~ -0 -1 3025 -D2 -You see the Inn. -~ -~ -0 -1 3048 -D3 -You see the poor alley. -~ -~ -0 -1 3044 -S -#3025 -The Common Square~ - The common square, people pass you, talking to each other. To the west is -the poor alley and to the east is the dark alley. To the north, this square -is connected to the market square. From the south you notice a nasty smell. -~ -30 0 1 -D0 -You see the market square. -~ -~ -0 -1 3014 -D1 -You see the dark alley. -~ -~ -0 -1 3026 -D2 -You see the city dump. -~ -~ -0 -1 3030 -D3 -You see Poor Alley. -~ -~ -0 -1 3024 -S -#3026 -The Dark Alley~ - The dark alley, to the west is the common square and to the south is the -Guild of Thieves. The alley continues east. -~ -30 0 1 -D1 -The alley continues east. -~ -~ -0 -1 3045 -D2 -You see the entrance to the thieves' guild. -~ -~ -0 -1 3027 -D3 -You see the common square. -~ -~ -0 -1 3025 -E -guild~ -It is the thieves' guild, don't enter if you care about your health or money. -~ -S -#3027 -The Entrance Hall To The Guild Of Thieves~ - The entrance hall to the thieves' and assassins' guild. A place where you -can lose both your life and your money, if you are not careful. To the north -is the dark alley and to the east is the thieves' bar. -~ -30 d 0 -D0 -You see the alley. -~ -~ -0 -1 3026 -D1 -You see the thieves bar, where everything disappears. -~ -~ -0 -1 3028 -S -#3028 -The Thieves' Bar~ - The bar of the thieves. Once upon a time this place was beautifully -furnished, but now it seems almost empty. To the south is the yard, and to -the west is the entrance hall. - (Maybe the furniture has been stolen?!) -~ -30 cdh 0 -D2 -You see the secret yard. -~ -~ -0 -1 3029 -D3 -You see the entrance hall to the thieves' guild. -~ -~ -0 -1 3027 -E -furniture~ -As you look at the furniture, the chair you sit on disappears. -~ -S -#3029 -The Secret Yard~ - The secret practice yard of thieves and assassins. To the north is the -bar. A well leads down into darkness. -~ -30 cd 0 -D0 -You see the bar. -~ -~ -0 -1 3028 -D5 -You can't see what is down there, it is too dark. Looks like it would be -impossible to climb back up. -~ -~ -0 -1 7043 -S -#3030 -The Dump~ - The dump, where the people from the city drop their garbage. Through the -garbage you can see a large junction of pipes, looks like the entrance to the -sewer system. North of here you see the common square. -~ -30 c 2 -D0 -You see the common square. -~ -~ -0 -1 3025 -D5 -You see the sewers. -~ -grate~ -2 3005 7030 -S -#3031 -The Pet Shop~ - The Pet Shop is a small crowded store, full of cages and animals of -various sizes. There is a sign on the wall. -~ -30 cdh 0 -D0 -You see the main street. -~ -~ -0 -1 3015 -E -sign~ -The sign reads: - - Use 'List' to see the available pets. - Use 'Buy <pet>' to buy yourself a pet. - - Instructions for having pets: - - You can use 'order <pet> <instructions>' to order your pets around. - If you abuse your pet, it will no longer regard you as its master. - If you have several pets you may use 'order followers <instructions>' - - You can name the pet you buy with: 'buy <pet> <name>' - - Regards, - - The Shopkeeper - -~ -S -#3032 -Pet Shop Store~ - This is the small dark room in which the Pet shop keeps his pets. -It is vital that this room's virtual number is exactly one larger -than the Pet Shop number. -~ -30 dk 0 -S -#3033 -The Magic Shop~ - Behind the counter you see various items, neatly placed in racks, -presumably most of them are magic. -~ -30 dh 0 -D2 -You see the main street. -~ -~ -0 -1 3012 -S -#3040 -Inside The West Gate Of Midgaard~ - You are by two small towers that have been built into the city wall and -connected with a footbridge across the heavy wooden gate. Main Street leads -east and Wall Road leads south from here. -~ -30 0 1 -D1 -You see Main Street. -~ -~ -0 -1 3012 -D2 -You see the road running along the inner side of the city wall. You notice -that it is called Wall Road. -~ -~ -0 -1 3042 -D3 -The city gate is to the west. -~ -gate~ -1 3112 3052 -E -bridge footbridge~ -It is too high up to reach but it looks as if one easily could walk across it -from one tower to the other. -~ -E -gate~ -It is a set of very big double doors made from hard wood. They have been -reinforced with large iron bands to make them even more sturdy. One of the -doors is equipped with a very big lock. -~ -E -tower towers~ -Both of the towers are built from large grey rocks that have been fastened to -each other with some kind of mortar, just like the city wall. -~ -E -wall~ -It is built from large grey rocks that have been fastened to each other with -some kind of mortar. It is far too high to climb. -~ -S -#3041 -Inside The East Gate Of Midgaard~ - You are by two small towers that have been built into the city wall and -connected with a footbridge across the heavy wooden gate. Main Street leads -west from here. To the south you see the Water Shop. -~ -30 0 1 -D1 -You see the city gate. -~ -gate~ -1 3112 3053 -D2 -You see the water shop. -~ -~ -0 -1 3058 -D3 -You see Main Street. -~ -~ -0 -1 3016 -E -bridge footbridge~ -It is too high up to reach but it looks as if one easily could walk across it -from one tower to the other. -~ -E -gate~ -It is a set of very big double doors made from hard wood. They have been -reinforced with large iron bands to make them even more sturdy. One of the -doors is equipped with a very big lock. -~ -E -tower towers~ -Both of the towers are built from large grey rocks that have been fastened to -each other with some kind of mortar, just like the city wall. -~ -E -wall~ -It is built from large grey rocks that have been fastened to each other with -some kind of mortar. It is far too high to climb. -~ -S -#3042 -Wall Road~ - You are walking next to the western city wall. The road continues further -south and the city gate is just north of here. -~ -30 0 1 -D0 -You see the city gate. -~ -~ -0 -1 3040 -D2 -The road continues further south. -~ -~ -0 -1 3043 -E -wall~ -It is built from large grey rocks that have been fastened to each other with -some kind of mortar. It is far too high to climb. -~ -S -#3043 -Wall Road~ - You are walking next to the western city wall. Wall Road continues further -north and south. A small, poor alley leads east. -Some letters have been written on the wall here. -~ -30 0 1 -D0 -The road continues further north. -~ -~ -0 -1 3042 -D1 -Poor Alley leads east. -~ -~ -0 -1 3044 -D2 -The road continues further south. -~ -~ -0 -1 3047 -E -wall writing letters~ -It says 'Who watches the watchmen?' -~ -E -wall~ -It is built from large grey rocks that have been fastened to each other with -some kind of mortar. It is far too high to climb. -~ -S -#3044 -Poor Alley~ - You are on Poor Alley, which continues further east. You see the -city wall to the west. -~ -30 0 1 -D1 -The alley leads east. -~ -~ -0 -1 3024 -D3 -The alley leads west. -~ -~ -0 -1 3043 -S -#3045 -The Dark Alley At The Levee~ - You are standing in the alley which continues east and west. South of -here you see the levee. -~ -30 0 1 -D1 -The alley leads east. -~ -~ -0 -1 3046 -D2 -You see the levee. -~ -~ -0 -1 3049 -D3 -The alley leads west. -~ -~ -0 -1 3026 -S -#3046 -The Eastern End Of The Alley~ - You are standing at the eastern end of the alley, the city wall is just -east, blocking any further movement. A small warehouse is directly south of -here. -~ -30 0 1 -D2 -You see the warehouse. -~ -~ -0 -1 3050 -D3 -You see the alley. -~ -~ -0 -1 3045 -S -#3047 -Wall Road~ - You are standing on the road next to the western city wall, which -continues north. South of here is a bridge across the river. -~ -30 0 1 -D0 -You see the road. -~ -~ -0 -1 3043 -D2 -You see the bridge. -~ -~ -0 -1 3051 -E -wall~ -It is built from large grey rocks that have been fastened to each other with -some kind of mortar. It is far too high to climb. -~ -S -#3048 -Grubby Inn~ - You are inside the old Grubby Inn. This place has not been cleaned for -several decades; vile smells make you dizzy. -~ -30 dh 0 -D0 -You see the alley. -~ -~ -0 -1 3024 -S -#3049 -The Levee~ - You are at the levee. South of here you see the river gently flowing west. -The river bank is very low making it possible to enter the river. -~ -30 h 1 -D0 -You see the alley. -~ -~ -0 -1 3045 -D2 -You see the river flowing west. -~ -~ -0 -1 3203 -S -#3050 -The Deserted Warehouse~ - You are inside the warehouse. The room is decorated with various old -items from ships. -~ -30 d 0 -D0 -You see the alley. -~ -~ -0 -1 3046 -S -#3051 -On The Bridge~ - You are standing on the stone bridge crosses the river. The bridge is -built out from the western city wall and the river flows west through an -opening in the wall ten feet below the bridge. -~ -30 0 1 -D0 -You see the road. -~ -~ -0 -1 3047 -D2 -You see the Concourse. -~ -~ -0 -1 3100 -E -bridge~ -It is built from large grey rocks that have been fastened to each other with -some kind of mortar, just like the wall. -~ -E -opening~ -You cannot really see it from here as it is somewhere beneath your feet. -~ -E -wall~ -It is built from large grey rocks that have been fastened to each other with -some kind of mortar. It is far too high to climb. -~ -S -#3052 -Outside The West Gate Of Midgaard~ - You are by two small towers that have been built into the city wall and -connected with a footbridge across the heavy wooden gate. To the west you -can see the edge of a big forest. -~ -30 0 1 -D1 -The city gate is to the east. -~ -gate~ -1 3112 3040 -D3 -The forest edge is to the west. -~ -~ -0 -1 6092 -E -bridge footbridge~ -It is too high up to reach but it looks as if one easily could walk across it -from one tower to the other. -~ -E -gate~ -It is a set of very big double doors made from hard wood. They have been -reinforced with large iron bands to make them even more sturdy. One of the -doors is equipped with a very big lock. -~ -E -tower towers~ -Both of the towers are built from large grey rocks that have been fastened to -each other with some kind of mortar, just like the city wall. -~ -E -wall~ -It is built from large grey rocks that have been fastened to each other with -some kind of mortar. It is far too high to climb. -~ -S -#3053 -Outside The East Gate Of Midgaard~ - You are by two small towers that have been built into the city wall and -connected with a footbridge across the heavy wooden gate. To the east the -plains stretch out in the distance. -~ -30 0 1 -D1 -You see the plains. -~ -~ -0 -1 3503 -D3 -You see the city gate. -~ -gate~ -1 3112 3041 -E -bridge footbridge~ -It is too high up to reach but it looks as if one easily could walk across it -from one tower to the other. -~ -E -gate~ -It is a set of very big double doors made from hard wood. They have been -reinforced with large iron bands to make them even more sturdy. One of the -doors is equipped with a very big lock. -~ -E -tower towers~ -Both of the towers are built from large grey rocks that have been fastened to -each other with some kind of mortar, just like the city wall. -~ -E -wall~ -It is built from large grey rocks that have been fastened to each other with -some kind of mortar. It is far too high to climb. -~ -S -#3054 -By The Temple Altar~ - You are by the temple altar in the northern end of the Temple of -Midgaard. A huge altar made from white polished marble is standing -in front of you and behind it is a ten foot tall sitting statue of -Odin, the King of the Gods. - To the north, steps lead out the back of the temple towards the -countryside. -~ -30 d 0 -D0 -You see the vast Midgaard countryside. -~ -~ -0 -1 3059 -D2 -You see the southern end of the temple. -~ -~ -0 -1 3001 -E -altar~ -Even though the altar is more than ten feet long it appears to be made from -a single block of white virgin marble. -~ -E -statue odin king god~ -The statue represents the one-eyed Odin sitting on a his throne. He has -long, grey hair and beard and a strict look on his face. On top of the -throne, just above his shoulders, his two ravens Hugin and Munin are sitting -and at his feet are his wolves Gere and Freke. -~ -S -#3055 -Odin's Store~ - This is the small dark room in which Odin keeps the player items that he -takes care of. It is vital that this room's virtual number is exactly one -larger than the room by the temple altar. -~ -30 dj 0 -S -#3058 -Ye Olde Water Shoppe~ - You are standing in the center of a small wooden shop whose walls are -covered with racks upon racks of water jugs. Several large barrels with -spigots are stacked in the corner. -~ -30 dh 0 -D0 -You see the East Gate. -~ -~ -0 -1 3041 -S -#3059 -Behind The Temple Altar~ - You are on a dirt path leading away from the Temple Altar which is south -of here. To the north, the path continues through the lush contryside of -Midgaard towards the Dragonhelm Mountains far off to the north. -~ -30 0 1 -D0 -You see the lush, green countryside of Midgaard. -~ -~ -0 -1 3060 -D2 -You see the Temple Altar. -~ -~ -0 -1 3054 -S -#3060 -The Great Field Of Midgaard~ - You are walking on a wide dirt path through the lush, green, fresh -Midgaard countryside. You can see to the horizon to the north, east, -and west; the busy city of Midgaard lies to the south. All around you -is healthy green grass and an occasional large oak tree. The sun feels -wonderful on your face and a pleasant wind blows through your hair. Birds -chirp quietly to themselves and you can smell the faint scent of flowers -and freshly cut grass. You feel like you could lie down in the grass and -stay here forever, surrounded by powerful beauty in all directions. - The path you are on continues north through the field and south back -to Midgaard. -~ -30 0 1 -D0 -You see more of the path through the Great Field. -~ -~ -0 -1 3061 -D2 -You see the path which goes back to Midgaard. -~ -~ -0 -1 3059 -S -#3061 -The Great Field Of Midgaard~ - You are walking on a wide dirt path through the lush, green, fresh -Midgaard countryside. You can see to the horizon to the north, east, -and west; the busy city of Midgaard lies to the south. All around you -is healthy green grass and an occasional large oak tree. The sun feels -wonderful on your face and a pleasant wind blows through your hair. Birds -chirp quietly to themselves and you can smell the faint scent of flowers -and freshly cut grass. You feel like you could lie down in the grass and -stay here forever, surrounded by powerful beauty in all directions. - There is a strange structure on the eastern side of the path. A small -dirt path splits off of the main path and leads off to the west. -~ -30 c 1 -D0 -The path continues northwards bringing you ever closer to the Dragonhelm -Mountains. -~ -~ -0 -1 3065 -D1 -There is a strange structure to the east on the edge of the trail. -~ -~ -0 -1 18600 -D2 -You see more of the Field. -~ -~ -0 -1 3060 -D3 -There is a strange path leading towards a rusty gate to the west. -~ -~ -0 -1 3066 -S -#3062 -The Post Office~ - You are in the central post office for Midgaard. Piles of assorted mail -lay untouched in the corners, collecting cobwebs. Several large crates have -been pried open by curious customs agents, and are now stacked along the west -wall, hiding plenty of 'WANTED' posters. -There is a sign posted on the wall here. -~ -30 deh 1 -D2 -You see the entrance to the Grunting Boar Inn and Tavern. -~ -~ -0 -1 3006 -E -sign~ -********************************************************** -* * -* Mail Instructions: * -* * -* To send a note to someone: * -* MAIL <playername> * -* * -* To see if you have any mail: * -* CHECK * -* * -* To get the Postmaster to give you your mail: * -* RECEIVE * -* * -* Stamps cost 150 coins per letter * -* Type 'HELP MAIL' for more info * -********************************************************** -~ -E -letters envelopes assorted~ -Envelopes of all sizes are heaped into hugh piles around the room. As you -look closer, you see a letter that you had posted a full week ago, laying -unnoticed and slightly rat-chewed towards the bottom of the pile. -~ -E -cobwebs~ -They seem to cover everything here, even the Postmaster himself. -~ -E -crates opened large~ -As you know, it is illegal to send contraband items through the Midgaard -Mail. The customs agents use this as a great excuse to seize liquor, -rare spices, and just about anything they might find useful or profitable. -~ -E -WANTED posters poster wall~ -Faces of various known Killers and Thieves can barely be seen behind the -crates on the west wall. Some of them look quite familar, sorta like that -guy who you saw in the Reception a minute ago... but then again, they are -rather hard to see past the crates. -~ -S -#3063 -The Midgaard Donation Room~ - You are in a small, undecorated room just off of the main temple. There -are a couple of small wooden benches here where people occasionally sit -while they wait for items to appear. The temple is to the west. -~ -30 cde 1 -D3 -The busy temple is back west. -~ -~ -0 -1 3001 -S -#3064 -The Cryogenic Center~ - You are standing in an impossible white sterile room with cylindrical -body-length canisters lined up against the walls. The Reception is to the -south. -~ -30 d 1 -D2 -The Reception is to the south. -~ -~ -0 -1 3008 -S -#3065 -The Great Field Of Midgaard~ - You are walking on a wide dirt path through the lush, green, fresh -Midgaard countryside. You can see to the horizon to the north, east, -and west; the busy city of Midgaard lies to the south. All around you -is healthy green grass and an occasional large oak tree. The sun feels -wonderful on your face and a pleasant wind blows through your hair. Birds -chirp quietly to themselves and you can smell the faint scent of flowers -and freshly cut grass. You feel like you could lie down in the grass and -stay here forever, surrounded by powerful beauty in all directions. - The way north appears to be blocked by a large plot device and you cannot -see any way around it. -~ -30 0 2 -D0 -Unfortunately the way north is blocked by a large plot device and there -does not seem to be any way around it. -~ -~ -0 -1 -1 -D2 -The path continues through the field to the south past an odd structure -on the eastern side of the path. -~ -~ -0 -1 3061 -E -plot device~ -What more is a plot device than something to block a certain direction -for reasons beyond your comprehension. -~ -S -#3066 -The Dirt Path~ - You are walking along a narrow dirt path through the lush, green, -fresh Midgaard countryside. You can see to the horizon to the north -and east; the busy city of Midgaard lies to the south. All around -you is healthy green grass and an occasional large oak tree. The sun -feels wonderful on your face and a pleasant wind blows through your -hair. Birds chirp quietly to themselves and you can smell the faint -scent of flowers and freshly cut grass. You feel like you could lie -down in the grass and stay here forever, surrounded by powerful beauty -in all directions. - There is a large rusty gate sitting in a stone archway just to the -west. -~ -30 0 2 -D1 -The path meets up with a larger path just to the east. -~ -~ -0 -1 3061 -D3 -There is a large rusty gate just to the west. -~ -~ -0 -1 3600 -S -$ diff --git a/lc-mud/circle/world/wld/31.wld b/lc-mud/circle/world/wld/31.wld deleted file mode 100644 index 32f9495fa64b6707ae5d5522e372fc488558290a..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/31.wld +++ /dev/null @@ -1,1013 +0,0 @@ -#3100 -The Northwest End Of The Concourse~ - You are at the concourse, the city wall is just west. A small promenade -goes east, and the bridge is just north of here. The concourse continues -south along the city wall. -~ -31 0 1 -D0 -You see the Bridge. -~ -~ -0 -1 3051 -D1 -You see the promenade. -~ -~ -0 -1 3101 -D2 -The promenade continues far south. -~ -~ -0 -1 3127 -S -#3101 -The Promenade~ - The river gently flows westwards just north of here. The promenade -continues further east and to the west you see the city wall. Park Road -leads south from here. -~ -31 0 1 -D1 -The promenade continues. -~ -~ -0 -1 3102 -D2 -Park Road leads south. -~ -~ -0 -1 3131 -D3 -You see the Concourse. -~ -~ -0 -1 3100 -S -#3102 -The Promenade~ - The river gently flows westwards just north of here. The promenade -continues both east and west. South of here you see the entrance to -the park, and a small building seems to be just west of the entrance. -~ -31 0 1 -D1 -You see the promenade. -~ -~ -0 -1 3103 -D2 -You see the park entrance. -~ -~ -0 -1 3105 -D3 -You see the promenade. -~ -~ -0 -1 3101 -S -#3103 -The Promenade~ - The river gently flows westwards just north of here. The promenade -continues both east and west. A small path leads south. Looking across -the river you see the levee. -~ -31 0 1 -D1 -You see the Concourse. -~ -~ -0 -1 3104 -D2 -The small path leads south. -~ -~ -0 -1 3132 -D3 -You see the promenade. -~ -~ -0 -1 3102 -S -#3104 -The Northeast End Of The Concourse~ - You are at the Concourse. The city wall is just east and a small -promenade goes west. Looking across the river you see a building that -resembles a warehouse. The Concourse continues south along the city -wall. -~ -31 0 1 -D2 -The Concourse continues south. -~ -~ -0 -1 3130 -D3 -You see the promenade. -~ -~ -0 -1 3103 -E -wall~ -It is built from large grey rocks that have been fastened to each other with -some kind of mortar. It is far too high to climb. -~ -S -#3105 -The Park Entrance~ - You are standing just inside the small park of Midgaard. To the north is -the promenade and a small path leads south into the park. To your east is -the famous Park Cafe. -~ -31 c 1 -D0 -You see the promenade. -~ -~ -0 -1 3102 -D1 -You see Park Cafe. -~ -~ -0 -1 3106 -D2 -You see the park. -~ -~ -0 -1 3108 -S -#3106 -Park Cafe~ - You are inside Park Cafe, a very cozy place with many tables and -seats where you can relax and enjoy the view. To the east you can -see the entrance to the park. -~ -31 dh 0 -D3 -You see the park entrance. -~ -~ -0 -1 3105 -S -#3107 -A Small Path In The Park~ - You are walking along a small path through the park. The path continues -south and east. -~ -31 0 1 -D1 -~ -~ -0 -1 3108 -D2 -~ -~ -0 -1 3113 -S -#3108 -A Small Path In The Park~ - You are standing on a small path inside the park. The park entrance is -just north of here, and Park Cafe is just east of the entrance. The path -leads further east and west. -~ -31 0 1 -D0 -You see the northern park entrance. -~ -~ -0 -1 3105 -D1 -~ -~ -0 -1 3109 -D3 -~ -~ -0 -1 3107 -S -#3109 -A Small Path In The Park~ - You are on a small path running through the park. It continues west and -south and just north of here you see the southern wall of Park Cafe. -~ -31 0 1 -D2 -~ -~ -0 -1 3115 -D3 -~ -~ -0 -1 3108 -S -#3110 -Cityguard HeadQuarters~ - You are inside a tidy office. -~ -31 d 0 -D1 -You see Park Road. -~ -door~ -1 3105 3111 -S -#3111 -Park Road~ - The road continues north and south. A building is just west of here, you -notice a sign on the door. The park entrance is to the east. -~ -31 0 1 -D0 -~ -~ -0 -1 3131 -D1 -You see the park entrance. -~ -~ -0 -1 3112 -D2 -~ -~ -0 -1 3118 -D3 -You see the Cityguard HeadQuarters. -~ -door~ -1 3105 3110 -E -building door sign~ -The sign on the door says: - - Cityguard HeadQuarters - - WARNING: Authorized Personnel Only! - -~ -S -#3112 -The Western Park Entrance~ - You are standing at the western end of the park. A small path leads east -into the park and going west through the entrance you will reach Park Road. -~ -31 c 1 -D1 -~ -~ -0 -1 3113 -D3 -~ -~ -0 -1 3111 -S -#3113 -A Path In The Park~ - You are in the park. The paths lead north and west. Westward is the -park entrance and to the east you see a small pond. -~ -31 0 1 -D0 -~ -~ -0 -1 3107 -D1 -You see the pond. -~ -~ -0 -1 3114 -D3 -You see the western park entrance. -~ -~ -0 -1 3112 -S -#3114 -The Pond~ - You are swimming around in the pond, feeling rather stupid. You can get -back on the path from the eastern and western end of the pond. -~ -31 0 6 -D1 -~ -~ -0 -1 3115 -D3 -~ -~ -0 -1 3113 -S -#3115 -A Path In The Park~ - You are in the park. The paths lead north and east. Eastward is the -park entrance and to the west you see a small pond. -~ -31 0 1 -D0 -~ -~ -0 -1 3109 -D1 -~ -~ -0 -1 3116 -D3 -~ -~ -0 -1 3114 -S -#3116 -The Eastern Park Entrance~ - You are standing at the eastern end of the park. A small path leads west -into the park. Going east through the entrance you will reach Emerald -Avenue. -~ -31 c 1 -D1 -~ -~ -0 -1 3117 -D3 -~ -~ -0 -1 3115 -S -#3117 -Emerald Avenue~ - You are standing on the north end of Emerald Avenue. To the north is the -promenade and to the west is the park entrance. To the east is the not very -big Town Hall of Midgaard. -~ -31 0 1 -D0 -~ -~ -0 -1 3132 -D1 -~ -~ -0 -1 3137 -D2 -~ -~ -0 -1 3119 -D3 -~ -~ -0 -1 3116 -S -#3118 -Park Road~ - You are on Park Road which leads north and south. -~ -31 0 1 -D0 -~ -~ -0 -1 3111 -D2 -~ -~ -0 -1 3135 -S -#3119 -Emerald Avenue~ - You are standing at a bend on Emerald Avenue. The road leads north and -west. -~ -31 0 1 -D0 -~ -~ -0 -1 3117 -D3 -~ -~ -0 -1 3133 -S -#3120 -The Road Crossing~ - You are in the middle of the road cross. Roads lead in all directions. -A huge black iron chain as thick as a tree trunk is fastened into the ground -at the center of the road cross. Its other end leads directly upwards towards -the sky. -A road sign is here. -~ -31 0 1 -D0 -~ -~ -0 -1 3133 -D1 -~ -~ -0 -1 3136 -D2 -~ -~ -0 -1 3134 -D3 -~ -~ -0 -1 3135 -D4 -The chain disappears in the clouds. -~ -~ -0 -1 7914 -E -sign~ -The sign points in all directions: - - North - Emerald Avenue. - East - Park Road. - South - Emerald Avenue. - West - Park Road. - -Someone has added the following with red paint: - - Up - Redferne's Flying Citadel. - -~ -E -chain~ -The chain reaches the clouds high above you. It must take some really -powerful magic to hold such a chain in place. -~ -S -#3121 -Emerald Avenue~ - You are standing at a bend on Emerald Avenue. The road leads south and -east. -~ -31 0 1 -D1 -~ -~ -0 -1 3134 -D2 -~ -~ -0 -1 3125 -S -#3122 -Park Road~ - You are on Park Road which leads south and north. Elm Street is east of -here. -~ -31 0 1 -D0 -~ -~ -0 -1 3136 -D1 -~ -~ -0 -1 3123 -D2 -~ -~ -0 -1 3126 -S -#3123 -Elm Street~ - You are on Elm street. Park Road is to the west and Elm Street continues -in eastward direction. -~ -31 0 1 -D1 -~ -~ -0 -1 3124 -D3 -~ -~ -0 -1 3122 -S -#3124 -The End Of Elm Street~ - You are at the end of Elm Street. -~ -31 0 1 -D3 -~ -~ -0 -1 3123 -S -#3125 -Emerald Avenue~ - You are on Emerald Avenue which continues north. The Concourse is south -of here. -~ -31 0 1 -D0 -~ -~ -0 -1 3121 -D2 -~ -~ -0 -1 3128 -S -#3126 -Park Road~ - You are on Park Road which continues north. The Concourse is south of -here. -~ -31 0 1 -D0 -~ -~ -0 -1 3122 -D2 -~ -~ -0 -1 3129 -S -#3127 -On The Concourse~ - You are at the southwest corner of the city wall. The Concourse leads -both north and east. -~ -31 0 1 -D0 -~ -~ -0 -1 3100 -D1 -~ -~ -0 -1 3128 -D3 -Through the South Gate you can see a small path leading southwards. -~ -~ -0 -1 3504 -S -#3128 -On The Concourse~ - The Concourse continues both east and west. Emerald Avenue is north of -here. -~ -31 0 1 -D0 -~ -~ -0 -1 3125 -D1 -~ -~ -0 -1 3129 -D3 -~ -~ -0 -1 3127 -S -#3129 -On The Concourse~ - The Concourse continues both east and west. Park Road is north of here -and an iron grate leads south to the graveyard. -~ -31 0 1 -D0 -~ -~ -0 -1 3126 -D1 -~ -~ -0 -1 3130 -D2 -Through the solid iron bars you see the graveyard. -~ -grate~ -2 3106 3150 -D3 -~ -~ -0 -1 3128 -S -#3130 -On The Concourse~ - You are at the southeast corner of the city wall. The Concourse leads -both north and west. -~ -31 0 1 -D0 -~ -~ -0 -1 3104 -D3 -~ -~ -0 -1 3129 -S -#3131 -Park Road~ - You are at Park Road which continues north and south. -~ -31 0 1 -D0 -~ -~ -0 -1 3101 -D2 -~ -~ -0 -1 3111 -S -#3132 -Emerald Avenue~ - You are at Emerald Avenue which continues north and south. Penny Lane leads -east from here. -~ -31 0 1 -D0 -~ -~ -0 -1 3103 -D1 -~ -~ -0 -1 3139 -D2 -~ -~ -0 -1 3117 -S -#3133 -Emerald Avenue~ - You are standing at a bend on Emerald Avenue. To the east the road goes on -and to the south is the Road Crossing. -~ -31 0 1 -D1 -~ -~ -0 -1 3119 -D2 -~ -~ -0 -1 3120 -S -#3134 -Emerald Avenue~ - You are standing at a bend on Emerald Avenue. To the west the road goes on -and to the north is the Road Crossing. -~ -31 0 1 -D0 -~ -~ -0 -1 3120 -D3 -~ -~ -0 -1 3121 -S -#3135 -Park Road~ - You are at a bend on Park Road. To the north the road goes on and to the -east is the Road Crossing. -~ -31 0 1 -D0 -~ -~ -0 -1 3118 -D1 -~ -~ -0 -1 3120 -S -#3136 -Park Road~ - You are at a bend on Park Road. To the south the road goes on and to the -west is the Road Crossing. -~ -31 0 1 -D2 -~ -~ -0 -1 3122 -D3 -~ -~ -0 -1 3120 -S -#3137 -The Waiting Room~ - You are standing in the waiting room at the town hall. Wooden chairs stand -along the walls and a long desk with a typewriter is placed in the middle of -the room. -~ -30 d 0 -D1 -It looks like some kind of office. -~ -~ -0 -1 3138 -D3 -The exit west leads to Emerald Avenue. -~ -~ -0 -1 3117 -E -chair chairs~ -Not the very least comfortable. -~ -E -desk~ -An extremely heavy desk. It is so large that it doesn't even need drawers. -Everything can be stored on its top. -~ -E -typewriter~ -It is an ancient Quifatronic T-1000 mk I. These machines are known for their -incredible durability, and for their even more incredible weight. They make -a Cray II look like a laptop. -~ -S -#3138 -The Mayor's Office~ - You are in the not very big office of the Mayor of Midgaard. A large and -polished but completely empty desk is standing in front of an armchair that -looks so comfortable that it most of all resembles a bed with the head end -raised slightly. -~ -30 d 0 -D3 -The waiting room is to the west. -~ -~ -0 -1 3137 -E -desk~ -This desk is obviously very old. Nevertheless it looks as if has never been -used. -~ -E -chair armchair~ -This chair is really a masterpiece. A chair where one can sit as comfortably -as in a bed. All auditoriums should be equipped with these things. A shame -that there wouldn't be room for the students too, though. -~ -S -#3139 -Penny Lane~ - You are on Penny Lane. Emerald Avenue is to the west and Penny Lane -continues in eastward direction. -~ -31 0 1 -D1 -~ -~ -0 -1 3140 -D3 -~ -~ -0 -1 3132 -S -#3140 -Penny Lane~ - You are on Penny Lane. The narrow road continues north and west. -~ -31 0 1 -D0 -~ -~ -0 -1 3141 -D3 -~ -~ -0 -1 3139 -S -#3141 -The End Of Penny Lane~ - You are at the end of Penny Lane. The only exit appears to be south. -~ -31 0 1 -D2 -~ -~ -0 -1 3140 -S -#3150 -A Gravel Road In The Graveyard~ - You are on a well-kept gravel road that leads north-south through the -graveyard. On both sides of the road grow dark evergreen trees. An iron -grate is to the north. -~ -31 0 2 -D0 -Through the solid iron bars you see the Concourse. -~ -grate~ -2 3106 3129 -D2 -The gravel road continues southward. -~ -~ -0 -1 3151 -S -#3151 -A Gravel Road In The Graveyard~ - You are on a well-kept gravel road that leads north-south through the -graveyard. On both sides of the road grow dark evergreen trees. -~ -31 0 2 -D0 -The gravel road continues northwards. -~ -~ -0 -1 3150 -D2 -The gravel road continues southward. -~ -~ -0 -1 3152 -S -#3152 -A Gravel Road In The Graveyard~ - You are on a well-kept gravel road that leads north-south through the -graveyard. On both sides of the road grow dark evergreen trees. -~ -31 0 2 -D0 -The gravel road continues northwards. -~ -~ -0 -1 3151 -D2 -The gravel road continues southward. -~ -~ -0 -1 3153 -S -#3153 -A Gravel Road In The Graveyard~ - You are on a well-kept gravel road that leads north-south through the -graveyard. On both sides of the road grow dark evergreen trees. -~ -34 0 1 -D0 -The gravel road continues northwards. -~ -~ -0 -1 3152 -D2 -The gravel road continues southward to an open space before a small -building. -~ -~ -0 -1 3154 -S -#3154 -In Front Of The Chapel~ - You are on an open space before a small chapel. A gravel road leads north -through the graveyard and the chapel entrance is to the south. -~ -31 0 2 -D0 -The gravel road continues northwards. -~ -~ -0 -1 3153 -D2 -The chapel door is made of dark wood. -~ -door~ -1 -1 3155 -S -#3155 -Inside The Chapel~ - You are in a small, dark chapel. The dark brown glass in the tiny windows -do not let much light through. A few rows of worn wooden benches stand here -and an ancient altar sits in the middle of the floor. -~ -34 ad 0 -D0 -The chapel door is made of dark wood. -~ -door~ -1 -1 3154 -E -glass windows~ -The windows must be meant to be dark. At least they are completely clean. -~ -E -altar~ -The altar looks very old... you examine the floor around the altar and notice -that it seems less dusty than the rest of the room... someone must clean here -regularly... maybe that old guy in Park Cafe, he looked like that sort... -~ -E -benches rows~ -The benches are not of the comfortable kind. -~ -S -#3200 -Under The Bridge~ - The arch under the bridge is covered by seaweed about a foot above the -surface of the river. The water gently flows through an opening in the lower -part of the city wall. -~ -31 0 7 -D1 -~ -~ -0 -1 3201 -D3 -~ -~ -0 -1 900 -E -wall~ -It is built from large grey rocks that have been fastened to each other with -some kind of mortar. Looks pretty solid. -~ -S -#3201 -On The River~ - North of here you see the miserable buildings of Poor Alley. The -river flows west towards the bridge. The riverbanks are too steep to -climb. -~ -31 0 7 -D1 -~ -~ -0 -1 3202 -D3 -~ -~ -0 -1 3200 -S -#3202 -On The River~ - North of here you see the dump. The river flows from east to west. The -riverbanks are too steep to climb. -~ -31 0 7 -D1 -~ -~ -0 -1 3203 -D3 -~ -~ -0 -1 3201 -S -#3203 -On The River~ - The levee is directly north of here. The river flows in an east west -direction. -~ -31 0 7 -D0 -~ -~ -0 -1 3049 -D1 -~ -~ -0 -1 3204 -D3 -~ -~ -0 -1 3202 -S -#3204 -On The River~ - You see the warehouse on the northern riverbank. East of here you see the -city wall. The river flows west towards the levee. -~ -31 0 7 -D1 -~ -~ -0 -1 3205 -D3 -~ -~ -0 -1 3203 -S -#3205 -On The River~ - The river enters from a hole in the eastern city wall. The hole has been -blocked by several vertically positioned iron bars set into the wall. -~ -31 0 7 -D1 -The iron bars make it difficult to pass through the hole in the wall. -Beyond the bars you see that the river leads into a cavern below the -mountain range to the east. -~ -~ -0 -1 5001 -D3 -~ -~ -0 -1 3204 -S -$ diff --git a/lc-mud/circle/world/wld/33.wld b/lc-mud/circle/world/wld/33.wld deleted file mode 100644 index 0252de85315cddfdd093ea196d2da65a1320d495..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/33.wld +++ /dev/null @@ -1,1528 +0,0 @@ -#3300 -A Scraggly Trail~ - This trail slopes up and away from the main road to -the west. At points the trail seems to fade into -obscurity against the grey stone and near-grey mountain -grass prevalent here. The trail leads generally eastward -and up higher into the rocky ground. There is a sign -here, seemingly out-of-place in this rough country. -~ -33 cg 5 -D1 -~ -~ -0 -1 3301 -D3 -~ -~ -0 -1 3500 -E -sign~ - ,_____________________________. - | | - | Gabadiel's | - | Smithery | - | --------------> | - | | - | -- BUAG SIGNS INC.| - `-----------------------------' - | | - | | - | | - | | -~ -S -#3301 -A Scraggly Trail~ - What could barely be called a trail leads west back -down the mountainside, and down into a very small valley -where a small house sits in the middle of a well-groomed -yard. The door to the house is open and inviting, -welcoming you for a visit. -~ -33 0 5 -D3 -~ -~ -0 -1 3300 -D5 -~ -~ -0 -1 3302 -S -#3302 -A Groomed Path~ - You are standing in the western end of a very, very -small valley, just about room enough for the one house -standing to your east. You can see from here that the -door to the cozy cottage is open and inviting, but the -interior seems very dark. A path bordered by shrubberies -leads up to the structure, and ends where you are -standing; right by the easiest path back up into the -mountains. -~ -33 0 5 -D1 -~ -~ -0 -1 3303 -D4 -~ -~ -0 -1 3301 -S -#3303 -Outside A House~ - The path you are on leads from the front door of the -cottage to your east, to the edge of the small valley -to the west. The building seems quiet...almost too -quiet. A small voice in the back of your head, the -same voice that has saved your life on countless -occasions, seems to be telling you that something is -very, very wrong here. -~ -33 0 2 -D1 -It is a normal front door to a house. -~ -door front~ -1 -1 3304 -D3 -~ -~ -0 -1 3302 -S -#3304 -The Smithery~ - Devastation greets your eyes. - The forge has been blasted apart, along with most of -the back door. Hammers, tongs, and anvils lie about in -one gigantic mess, and the smith's bed smoulders yet. -This place has been utterly wrecked and blasted apart, by -more than one man you would think from all the tracks in -the dust... -~ -33 d 0 -D1 -It is a normal hole torn in the wall leading outside into -a garden. -~ -~ -0 -1 3305 -D3 -It is a normal front door. -~ -door front~ -1 -1 3303 -E -bed~ -Ha! Lucky, you were always lucky! Under the pillow is a -half-written letter, unaddressed. The bits of text that -aren't smudged, burnt, and smeared tell tale of the smith/mage -Gabadiel's masterwork: a sword of unequalled power, and two -swords that came before, discarded as 'Not quite what I was -working towards'. Looking around, you notice a distinct lack -of any swords. You think you may have a motive now... -~ -E -tracks dust~ -Three sets of prints lead out where the back door used to stand. -~ -S -#3305 -A Small Garden~ - This garden was probably once kept orderly and weedless. -Unfortunately, it seems someone has been careless with a -fireball. There is nothing here now but blast-marks and -ashes, and the remains of a trail leading to the east edge -of this tiny valley. -~ -33 0 2 -D1 -~ -~ -0 -1 3306 -D3 -~ -~ -0 -1 3304 -E -tracks track~ -They lead east. -~ -S -#3306 -Mountain Ridge~ - You are standing on a ridge in the mountains, just east -of a very small valley. You spot a tiny cottage sitting -in the center of the valley, and the ridge continues -south. Looking at the sheer drops to the north and west, -you consider not taking those directions. -~ -33 0 5 -D2 -~ -~ -0 -1 3307 -D3 -~ -~ -0 -1 3305 -E -tracks track~ -The tracks lead south. -~ -S -#3307 -The Mountain Ridge~ - The mountain range continues north from here, and -widens out into a small plateau just to your south. Going -east and west from here would be a bad idea, considering -the steepness of the drop. From this height, you have a -fairly good panoramic view to the south, including what -appears to be a small mountain village to your south and -west, and a tall, ominous peak westwards from here. -~ -33 0 5 -D0 -~ -~ -0 -1 3306 -D2 -~ -~ -0 -1 3308 -E -tracks track~ -They lead south. -~ -S -#3308 -The Diverging Paths~ - You are standing on a small plateau in the mountains, -just south of a ridge that leads northwards through the -rocky area. To the east, south, and west are gentle -slopes leading down into different areas of the mountains. - A giant, dark peak looks down over you to the west, -looking quite spooky indeed! -~ -33 0 5 -D0 -~ -~ -0 -1 3307 -D1 -~ -~ -0 -1 3341 -D2 -~ -~ -0 -1 3309 -D3 -~ -~ -0 -1 3359 -E -tracks track~ -The three sets of tracks split up here, one west, one east, -one south. -~ -S -#3309 -A Steep Slope~ - This slopes leads down and to the west from here. Up -above, you see a plateau at the southern end of a long -mountain ridge. Surpisingly, there seems to be signs of -traffic in this area, leading into the large depression -here. The going looks somewhat dangerous, and you decide -to exercise a little caution. -~ -33 0 4 -D0 -~ -~ -0 -1 3308 -D3 -~ -~ -0 -1 3310 -D4 -~ -~ -0 -1 3308 -E -signs tracks~ -A few boot prints lead way in the dust here. There is -definitely traffic here, but this area is not what you -would call well-travelled. -~ -S -#3310 -A Small Plateau~ - You are standing upon another mini-plateau, bordered by -a sheer wall of rock to the north. You can climb up the -slope to the east, or continue along the flat area to the -west. Another slope leads downwards to the south, looking -unsafe but climbable. -~ -33 0 4 -D1 -~ -~ -0 -1 3309 -D2 -~ -~ -0 -1 3314 -D3 -~ -~ -0 -1 3311 -S -#3311 -A Small Plateau~ - This plateau ends here, with a steep drop-off to the -south, and a solid wall of rock to the north. Eastwards -the plateau continues, and you think you can climb up the -steep rocky slope just west of here. You are afforded a -good view of the lower regions of this depression, and you -think you spot what might be a cave south and down from -here... -~ -33 0 4 -D1 -~ -~ -0 -1 3310 -D3 -~ -~ -0 -1 3312 -S -#3312 -A Rocky Slope~ - This slope is fairly treacherous, but looks to be -somewhat safer to the north. East the slope leads down -to a small plateau that also looks considerably safer -than your other choices. The shale under your feet -slips badly, and you are almost thrown off balance; -this is no place to be without mountaineering equipment. -~ -33 0 5 -D0 -~ -~ -0 -1 3313 -D1 -~ -~ -0 -1 3311 -S -#3313 -The Overlook~ - You are standing on a point outcropping with a -beautiful view of the mountains to the north. Far -below, you see what appears to be a foot-path climb -up to the central mountain, a peak that looks dark -and disturbing. You get very bad vibes from that -mountain for some reason, and it doesn't seem like -a very good idea to try to find a way to get there. - The only safe way to leave this overlook is to -the south. -~ -33 0 4 -D2 -~ -~ -0 -1 3312 -S -#3314 -A Rocky Slope~ - You slip and slide your way across the steep ground, -trying desperately to keep your balance. You can climb -up to a small plateau to the north from here, or carefully -head down to the floor of the depression to the west. -You're not sure which is safer... -~ -33 0 5 -D0 -~ -~ -0 -1 3310 -D3 -~ -~ -0 -1 3315 -S -#3315 -The Depression Floor~ - A small path leads south here, away from the rocky -slope leading up to the east. A small spring burbles -here, evidently the cause of much of the traffic. -Looking up, you see sheer rock walls surrounding much -of the depression, making an effective fortress of -this place. -~ -33 0 4 -D1 -~ -~ -0 -1 3314 -D2 -~ -~ -0 -1 3316 -S -#3316 -The Depression Floor~ - The small path you are standing on leads north, and -east into what appears to be a large cave hollowed out -of the mountainside. The whole place seems quiet, too -quiet in fact. Your little adventurer's intuition is -busily warning you of traps. -~ -33 0 4 -D0 -~ -~ -0 -1 3315 -D1 -~ -~ -0 -1 3317 -S -#3317 -A Cave Entrance~ - A cave leads into the heart of the mountainside, well- -lit by sconces upon the walls. A large rock sits by -the side here, near a small firepit. Debris litters the -area; rabbit bones, half of a broken whetstone, and random -litter. The ground is devoid of grass, and well trodden -by many pairs of boots. Strange that someone should live -so deep in the mountains... -~ -33 c 0 -D1 -~ -~ -0 -1 3318 -D3 -~ -~ -0 -1 3316 -S -#3318 -A Cave Passageway~ - You are near the entrance of the cave. The outside -light streams in from the west, accompanied by a slight -breeze, making the flames in the sconces flutter a bit -and throw stange shadows upon the walls. This passageway -heads north and south from here, each way seeming dark and -stuffy compared to outdoors. From the tracks in the -floor, you guess that the north is the more used. -~ -33 d 0 -D0 -~ -~ -0 -1 3319 -D2 -~ -~ -0 -1 3331 -D3 -~ -~ -0 -1 3317 -S -#3319 -A Cave Passageway~ - The passage turns here, one end leading south, towards -the cave's entrance, and east -- that much deeper into the -mountain. The light sconces keep the area bright enough -to see, but not nearly bright enough for you to be quite -comfortable in this strange place. From far off you hear -the echoes of what sound to be voices. -~ -33 d 0 -D1 -~ -~ -0 -1 3320 -D2 -~ -~ -0 -1 3318 -S -#3320 -A Cave Passageway~ - This twisty passage leads east and west from here. -Eastwards you hear the unmistakable sounds of low -voices. The echoes seem to be playing funny effects -on you, however, and you are not sure from how far -off these voices might be coming. -~ -33 d 0 -D1 -~ -~ -0 -1 3321 -D3 -~ -~ -0 -1 3319 -S -#3321 -A Cave Passageway~ - The passage you are standing in turns west and south -from here. One of the sconces here is out, making this -area extremely dark and hard to see in. You do see lights -from the south, however, seemingly brighter than the -sconces you've seen along the walls so far. -~ -33 d 0 -D2 -~ -~ -0 -1 3322 -D3 -~ -~ -0 -1 3320 -S -#3322 -A Cave Passageway~ - This is a T-intersection in the cave passageway, the -north leading back towards the cave's entrance (you -think!), the west leading towards a well-lighted area. -Eastwards the passageway continues into the shadowy -recesses of the mountain uninvitingly. The echoes of -voices are confusing you a bit, and you are not sure -whether you should try to remain quiet or not. -~ -33 d 0 -D0 -~ -~ -0 -1 3321 -D1 -~ -~ -0 -1 3324 -D3 -~ -~ -0 -1 3323 -S -#3323 -A Cave~ - Many sconces line the walls here, casting light on -some weapon racks and chests of armor. Everything -is neat, orderly, and actually well-dusted. Someone -cares for these items...frequently it seems. -~ -33 d 0 -D1 -~ -~ -0 -1 3322 -S -#3324 -A Cave Passageway~ - The passageway you are in leads south and west from -here. Many large stones and rocks are on the floor of the -cave, making walking difficult in the dim light from the -sconces on the walls. You hear the continued echo of -voices, seemingly fainter now. Must be the strange -acoustics of this place... -~ -33 d 0 -D2 -~ -~ -0 -1 3325 -D3 -~ -~ -0 -1 3322 -S -#3325 -A Cave Passageway~ - The cave twists around like a coiled snake, leading -east and north from here. You begin to wonder if your -orientations are still correct. That worries you for -some reason. -~ -33 d 0 -D0 -~ -~ -0 -1 3324 -D1 -~ -~ -0 -1 3326 -S -#3326 -A Cave Passageway~ - You can head north and west through the cave passageways -here, both ways dimly lit by the ever-present sconces on -the walls. The echoes you heard earlier seem to be getting -louder, and seem to be coming from the northern passage. -You feeled a bit chilled from the cooled cave air and -shiver a bit in the faint whisper of a breeze. This place -is a little too eerie and dark to be comfortable in. -~ -33 d 0 -D0 -~ -~ -0 -1 3327 -D3 -~ -~ -0 -1 3325 -S -#3327 -A Cave Passageway~ - The echoes are growing louder, and seem to be coming -from the northern end of this corridor. Southwards you -see the tunnel continue right before yet another bend in -the passagway. You spot a small piece of red cloth torn -against a sharp rock jutting out from the passage's side. -It looks like silk, very nice in fact. -~ -33 d 0 -D0 -~ -~ -0 -1 3328 -D2 -~ -~ -0 -1 3326 -S -#3328 -A Cave Passageway~ - The main passageway leads south from here, and a smaller -cave tunnel leads away to the west. Two large boulders -sit against the wall, wiped clean of dirt and grime. A -paper food wrapper has been trodden under several pairs of -feet here; at best guess, you'd say this would probably be -a guard post. -~ -33 d 0 -D2 -~ -~ -0 -1 3327 -D3 -~ -~ -0 -1 3329 -S -#3329 -The End Of The Passageway~ - The cave passageway ends abruptly here to the north in a -large wooden door set into the stone walls. The craftsmanship -is superb! You can also head back to the main passage to the -west, where there seems to be more light than here. An echo -from down the passage makes you wonder for a moment if you are -being followed, but you see nothing there... -~ -33 d 0 -D0 -It is a sturdy wooden door. -~ -door wooden~ -1 -1 3330 -D1 -~ -~ -0 -1 3328 -S -#3330 -A Cavern~ - This natural cavern has been turned into a combination -office/storeroom. A small brook rushes through the south -wall, and flows back into the west wall through a tiny -hole. Boxes and crates are stacked against the walls, and -a beat up oaken desk stands near the door stacked with -papers written upon by an unsteady hand. Some large -lanterns keep the place very well lighted. -~ -33 d 0 -D2 -It is a sturdy wooden door. -~ -door wooden~ -1 -1 3329 -S -#3331 -A Cave Passageway~ - You are standing south of the main entrance to this -cave. The passage you are in continues south, very badly -lit along its length by the sconces lining the walls -every fifteen feet or so. From somewhere deep in the -recesses of the cave, you hear a faint, rhythmic thumping -sound distorted by the passage's strange acoustics. -~ -33 d 0 -D0 -~ -~ -0 -1 3318 -D2 -~ -~ -0 -1 3332 -S -#3332 -A Cave Passageway~ - You are standing at the southern bend of this passage, -able to head east and north from here. The rock around you -echoes the sound of far-off pounding to you, making the -place seem somehow alive, with a heartbeat. This place -is fairly eerie, now that you come to think of it. -~ -33 d 0 -D0 -~ -~ -0 -1 3331 -D1 -~ -~ -0 -1 3333 -S -#3333 -A Cave Passageway~ - The passageway makes a U-turn here, heading north and -westwards to the other side of the 'U'. The air seems -humid and hard to breathe. Some algae grows near the -floor in the slick spots, giving a definite subtle smell -of rot to the air. -~ -33 d 0 -D0 -~ -~ -0 -1 3334 -D3 -~ -~ -0 -1 3332 -S -#3334 -A Cave Passageway~ - The tunnel twists to the south and east from here, -its dark length seemingly dismal and lifeless. A faint -thumping sound reverberates from the walls, making you -perk your ears for the direction of the noise. -~ -33 d 0 -D1 -~ -~ -0 -1 3335 -D2 -~ -~ -0 -1 3333 -S -#3335 -A Cave Passageway~ - This area darker than the rest of the passageway, due -to the fact that the sconces along the walls stop abruptly -here. The way to the south is completely dark, in direct -contrast to the tunnels to the west. You peer hard to the -south, but can make out nothing in the impenetrable -darkness. And still that distant thumping impinges on -your consciousness... -~ -33 d 0 -D2 -~ -~ -0 -1 3336 -D3 -~ -~ -0 -1 3334 -S -#3336 -A Cave Passageway~ - You are standing in a north-south tunnel carved -naturally through the stone of the mountain. To the -north the tunnel is lighted by sconces along the wall, -banishing the deep, deep darkness you now stand in. To -the south you can see nothing. A deep thumping noise -seems to be getting louder and louder as you stand here, -coming from somewhere deep inside. -~ -33 ad 0 -D0 -~ -~ -0 -1 3335 -D2 -~ -~ -0 -1 3337 -S -#3337 -A Cave Passageway~ - The passageway switches directions again in the dark -gloom of the mountain, heading to the north and east from -here. As you round the corner, a trick of the acoustics -make the deep thrumming and pounding you've been hearing -sound as if its coming from two feet away! Very unsettling. -~ -33 ad 0 -D0 -~ -~ -0 -1 3336 -D1 -~ -~ -0 -1 3338 -S -#3338 -A Cave Passageway~ - The tunnel weaves around, twisting to the north and -west here. The darkness around you is near total. Ahead, -you hear the sounds of something metal banging against -stone. Could someone be mining out the tunnel, perhaps? -~ -33 ad 0 -D0 -~ -~ -0 -1 3339 -D3 -~ -~ -0 -1 3337 -S -#3339 -A Cave Passageway~ - A glimmer of light to the east alerts you to the fact -that something is going on in the tunnel nearby. The south -exit of the tunnel leads off into complete darkness. All -around on the ground are piles of earth and stone, making -you have to wend through the tunnel carefully. Hmm. -~ -33 ad 0 -D1 -~ -~ -0 -1 3340 -D2 -~ -~ -0 -1 3338 -S -#3340 -The End Of The Passage~ - The tunnel stops abruptly here at a fissure in the stone. -All around on the ground are rocks and gravel, mined from -the fissure in an attempt to widen it enough for passage. -A few pieces of paper litter and wrappers tells you that -the work here is relatively recent. -~ -33 d 0 -D3 -~ -~ -0 -1 3339 -S -#3341 -A Rocky Slope~ - This treacherous slope leads ever-downward quite a ways, -down to a valley where there seems to be a small village! -What a village is doing this far from civilization, and how -they survive you've no idea. From the smoke wafting from -some of the chimneys, it looks like this place is still -inhabited as well. - Now if you can only get down this slope without breaking -an ankle... -~ -33 0 5 -D1 -~ -~ -0 -1 3342 -D3 -~ -~ -0 -1 3308 -S -#3342 -A Rocky Slope~ - You're slipping and sliding across this slope, trying to -get to your destination without breaking your leg or falling -and shattering your head. Below, you spot some movement in -the village, giving proof the place is not a ghost-town. - The main road of the village starts at the bottom of -the slope just to the east, and the slope continues west -and up far, far up the mountain. -~ -33 c 5 -D1 -~ -~ -0 -1 3343 -D3 -~ -~ -0 -1 3341 -S -#3343 -Main Road~ - This place leaves you very unimpressed. And bored. -You are definitely bored by this place. The people are -listless, going about their daily chores with a slowness -that pains your eyes. A slope to the west climbs up the -mountainside, and two open shops made of wood and stone -are to your north and south. East-wards this road continues. - There is a small sign here. -~ -33 0 1 -D0 -~ -~ -0 -1 3344 -D1 -~ -~ -0 -1 3346 -D2 -~ -~ -0 -1 3345 -D3 -~ -~ -0 -1 3342 -E -sign~ - - ,_____________________________. - | | - | Stanneg by the Mountains | - | | - | Population: 27 | - | | - | -- BUAG SIGNS INC.| - `-----------------------------' - | | - | | - | | - | | - -~ -S -#3344 -The Mountain Tavern~ - Hmm. Looks like there's no one here, not even an bartender. -Evidently you've come during off hours, since no bar could be -THIS dull. The walls are decorated with mounted animal heads -and arrows and longbows and other hunting equipment/trophies. -All of it looks rather plain. -~ -33 d 0 -D2 -~ -~ -0 -1 3343 -S -#3345 -The General Store~ - A bored shopkeeper waves an idle hand towards his stock -of stuff. Browse, type list, buy, sell, whatever... -~ -33 d 0 -D0 -~ -~ -0 -1 3343 -S -#3346 -Main Road~ - Nothing is going on in this section of village either. To the -east is an actual road intersection, and to the west you see one -of the ends of this road. A large grassy area to the south is -fenced off for a horse corral. -~ -33 0 1 -D1 -~ -~ -0 -1 3348 -D2 -~ -~ -0 -1 3347 -D3 -~ -~ -0 -1 3343 -S -#3347 -The Corral~ - Many horses look up at you when you enter this corral. -The horses are kept in by a big wooden fence, which they -seem quite happy to been kept in by. You don't see anyone -around taking care of these horses, but someone is probably -close by. -~ -33 d 0 -D0 -~ -~ -0 -1 3346 -S -#3348 -The Intersection~ - You are standing in an intersection deep in the heart -of Stanneg by the Mountains. In fact, this is the ONLY -intersection anywhere in Stanneg by the Mountain it -appears. - There are some buildings to the north, and south, and -east, and west. None particularly stand out from the -others. -~ -33 0 1 -D0 -~ -~ -0 -1 3349 -D1 -~ -~ -0 -1 3355 -D2 -~ -~ -0 -1 3353 -D3 -~ -~ -0 -1 3346 -S -#3349 -A Small Road~ - This road runs north through Stanneg by the Mountains, -if through would be the operative word for such a motley -collection of buildings. Westwards is a small, open-roofed -building that appears to be a farmer's market. The road -you are on continues north, and comes to an intersection -just south of here. -~ -33 0 1 -D0 -~ -~ -0 -1 3351 -D2 -~ -~ -0 -1 3348 -D3 -~ -~ -0 -1 3350 -S -#3350 -The Farmer's Market~ - One farmer's wife stands here, waiting for someone to -buy the food her family has grown. She looks bored, but -not unhappy... no competition! -~ -33 0 1 -D1 -~ -~ -0 -1 3349 -S -#3351 -A Small Road~ - The small, north-south road running through Stanneg -by the Mountains ends here, curving to become the front -walk of a private home to the east. The road runs south -from this house, towards the center of the village. -~ -33 0 1 -D1 -A normal, wooden front door to a normal looking home. It is -nothing to write home about. -~ -door front~ -1 -1 3352 -D2 -~ -~ -0 -1 3349 -S -#3352 -A Private Home~ - The interior of this home is simple and rustic. A -ladder leads up to the loft, where the sleeping pallets -are tucked away. A wood-burning stove keeps the place -well heated and cozy. A homemade rocking chair stands -crooked in the corner, draped with a old looking afghan. -This home is a nice place, very comfortable. -~ -33 d 0 -D3 -There is a normal appearing door set in the western wall. -~ -door front~ -1 -1 3351 -S -#3353 -A Small Road~ - The road ends here, leading up to a stone house -to the south. Smoke rises from the chimney in a dark -stream, and the windows are frosted over with humidity. -North, you see the main intersection of Stanneg. -~ -33 0 1 -D0 -~ -~ -0 -1 3348 -D2 -A normal looking front door made of wood serves as the entrance. -~ -door front~ -1 -1 3354 -S -#3354 -A Private Home~ - This home strikes you as unbearable warm and uncomfortable. -The fireplace is going at a full-bonfire, a mammoth stack of -firewood beside it against the wall. The decorations seem -somewhat spartan and plain; a landscape, an old hunting -bow... nothing much of interest. -~ -33 d 0 -D0 -You see a normal looking wooden door. -~ -door front~ -1 -1 3353 -S -#3355 -Main Road~ - The main road through Stanneg ends here at a large well -that leads deep, deep into the earth. To the north of the -well is a large building, with a large WELCOME mat outside -its front door. Westwards you see the a road intersection -in the center of the tiny village. Around you is a rocky -terrain in the middle of this mountain range...not very -many places else to go. -~ -33 0 1 -D0 -There is a large set of double doors, made of wood blocking the way. -~ -door doors double~ -1 -1 3356 -D3 -~ -~ -0 -1 3348 -S -#3356 -Stanneg Inn~ - This is a plainly decorated room, the main room of the -Stanneg Inn. A large arch to the west leads to a common -room where food and drink can be ordered, and a set of -rickety wooden stairs lead up to the rooms are. A thread- -bare rug lies in the middle of the floor, evidently well- -loved by a cat or two from the quantity of hair on it. -~ -33 d 0 -D2 -There is a large set of double doors, made of wood set into the wall. -~ -door doors double~ -1 -1 3355 -D3 -~ -~ -0 -1 3357 -D4 -~ -~ -0 -1 3358 -S -#3357 -The Common Room~ - A large fireplace warms this room in great waves of -heat, to combat the chill drafts eminating from the windows -on the west and north sides of this room. A few benches -and tables are clustered in the center of the room, for -the use of the locals. Fairly plain, for a frequented -gathering place. -~ -33 d 0 -D1 -~ -~ -0 -1 3356 -S -#3358 -The Reception~ - A hall leads away to the west lined with small brown -doors. A small table has a ledger on it, seemingly -almost unused. The hall is plain and without any -decoration, except for a nice painting of (what else) -a mountain hanging above the stairs that lead back -down to the inn proper. -~ -33 d 0 -D5 -~ -~ -0 -1 3356 -S -#3359 -A Rocky Slope~ - This slope is fairly shallow and easy to walk on, -despite the loose shale and gravel. To the east is a high -ridge you could stand on, and to the west is a flat area -near two trails leading up and down into the mountains. -High above you, to your west, is that ominous, dark peak, -which seems to radiating a sense of hopelessness... -~ -33 0 5 -D1 -~ -~ -0 -1 3308 -D3 -~ -~ -0 -1 3360 -S -#3360 -A Ledge~ - This ledge overlooks a small path that leads up and -down from here. Below, you see the path head down to a -large flat area where a small cottage lies nestled in the -mountains, smoke rising from it in a curling line. Above, -the path seems to head towards that dark peak piercing the -sky. You notice a few boot-tracks in the earth, seemingly -to lead down towards the cottage. -~ -33 0 4 -D1 -~ -~ -0 -1 3359 -D4 -~ -~ -0 -1 3363 -D5 -~ -~ -0 -1 3361 -S -#3361 -Outside Of A Cottage~ - Now that you approach closer to the cottage, you notice -that the smoke is not coming from the chimney, but rather -the gutted ruins of the building. Something torched this -place, badly. You see no signs of life among the wreckage. -You can enter one of the particularly large holes in the -wall to the west, with caution. -~ -33 0 4 -D3 -~ -~ -0 -1 3362 -D4 -~ -~ -0 -1 3360 -S -#3362 -The Torched Cottage~ - This whole place is smouldering still from whatever -decided to try to burn it to the ground. On the floor -near the center of the ruined structure is the burnt and -dessicated corpse of a man, outstretched and blackened. -There's not much to see here; whatever decided to destroy -this place did it very well. -~ -33 0 1 -D1 -~ -~ -0 -1 3361 -S -#3363 -A Mountain Trail~ - This mountain trail leads straight up into the evil -looking mountains. High above you, one mountain peak -seems to radiate danger and fear, and the trail seems -to be leading straight up to it. You wonder if it is -wise to continue this way... - The trail goes even higher up to the west, and back -down to the west. -~ -33 0 5 -D3 -~ -~ -0 -1 3364 -D5 -~ -~ -0 -1 3360 -S -#3364 -A Mountain Trail~ - The trail leads up even higher into the mountains to the -west here. You shiver as the cold mountain air washes over -you, and your back prickles as you wonder if anything lives -up here, or anything _dangerous_ for that matter. Maybe -heading back down to the east would be a good idea... -~ -33 0 5 -D1 -~ -~ -0 -1 3363 -D3 -~ -~ -0 -1 3365 -S -#3365 -A Mountain Trail~ - The trail leads up the side of the tallest mountain in -the range -- the one that sticks up into the dark sky like -a monument to death and futility. The trail leads back to -safety to the east, and goes even higher to the west. -~ -33 0 5 -D1 -~ -~ -0 -1 3364 -D3 -~ -~ -0 -1 3366 -S -#3366 -Near The Peak~ - This is as close to the peak as you're going to get, -unless you use that tiny, tiny path leading up to your -north. Up the side of the mountain you see a great cave -hollowed out, the inside pitch black. The path leads down -the mountains to your east, which seems to be the best -place to go. -~ -33 gj 5 -D0 -~ -~ -0 -1 3367 -D1 -~ -~ -0 -1 3365 -S -#3367 -A Small, Dangerous Path~ - This path leads up, up, up the side of the mountain, to -the evil-seeming cave. It also heads down to the south--a -lot safer place to be. In fact, you hear footsteps above -your head... -~ -33 gj 5 -D2 -~ -~ -0 -1 3366 -D4 -~ -~ -0 -1 3368 -S -#3368 -A Small, Dangerous Path~ - Unfortunately, you realize too late that this bigger -ledge that leads north to the darkened cave is an ideal -spot for an ambush. This ledge gives you a beautiful -panoramic view of the entire mountain range, however. -Breathtaking! -~ -33 gj 5 -D0 -~ -~ -0 -1 3369 -D5 -~ -~ -0 -1 3367 -S -#3369 -The Cave Entrance~ - You are standing in the entrance of a simply huge cave! -The size is stunning! All around the entrance are burnt -bones and various types of wooden and metal debris. Giant -claw marks are all along the ground, leading back deeper -into the cave. - Two tunnels lead off from here, one up, one down. There -are claw marks leading in either direction. -~ -33 adgj 4 -D2 -~ -~ -0 -1 3368 -D4 -~ -~ -0 -1 3370 -D5 -~ -~ -0 -1 3373 -S -#3370 -A Sloping Tunnel~ - The tunnels slopes up to the north deeper into the -mountain. A rather gusty breeze riffles your clothing -from ahead somewhere. The claw marks in the stone floor -continue up the passage, through the darkness. -~ -33 adgj 0 -D0 -~ -~ -0 -1 3371 -D5 -~ -~ -0 -1 3369 -S -#3371 -A Sloping Tunnel~ - The tunnel continues its slope upwards, and the wind -blows at you even stronger yet. The claw tracks in the -stone stop abruptly here, where there seems to be a lot -of unearthed dirt and stone around, heaped upon the floor. -You feel uneasy about this place. -~ -33 adgj 4 -D0 -~ -~ -0 -1 3372 -D2 -~ -~ -0 -1 3370 -E -dirt stone~ -It has been dug from somewhere, but where? -~ -E -claw claws track tracks mark marks~ -They stop very abruptly here, right where the piles of earth begin, -it seems. -~ -E -floor~ -The floor up ahead looks... strange. You don't think going ahead -would be a good idea. -~ -S -#3372 -The Pit~ - You fall through the illusionary floor. - - You hit the poisoned spikes below. - - You die very slowly of bloodloss, your head impaled at -an awkward angle. - - - - - - - -~ -33 bdgj 0 -D2 -~ -~ -0 -1 3371 -S -#3373 -A Sloping Tunnel~ - This tunnel slopes deep, down into the mountain's heart. -The air feels still and uncomfortably warm, despite the -closeness of the cave's entrance above you. There's a -deep, musky odor in the air, and the giant claw marks -continue downwards. -~ -33 adgj 4 -D4 -~ -~ -0 -1 3369 -D5 -~ -~ -0 -1 3374 -S -#3374 -A Sloping Tunnel~ - A bright light greets your eyes from the north, in -direct contrast to the darkness of the tunnel overhead. -You break out in a sweat due to the overwhelming warmth -of the air. The musky odor has grown quite intense, -drowning out everything else in the air and making it hard -to breathe. Something in your gut begins squirming -uncomfortably as you wonder what's ahead... -~ -33 adgj 4 -D0 -~ -~ -0 -1 3375 -D4 -~ -~ -0 -1 3373 -S -#3375 -The Lair~ - This place is huge!!! It should be considering the -dragon's great bulk. However, instead of seeing the -customary carnage and mound of gold that one is accustomed -to seeing in a dragon lair, this one is decorated subtly -with tapestries and drapes, and other comforts of human -life. There is even a huge-dragon sized bed -- undoubtedly -conjured to life by its elder dragon owner. -~ -33 dgj 4 -D2 -~ -~ -0 -1 3374 -S -$ diff --git a/lc-mud/circle/world/wld/35.wld b/lc-mud/circle/world/wld/35.wld deleted file mode 100644 index 036ee7b708f833f97d902c6e339f82930f4696c5..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/35.wld +++ /dev/null @@ -1,937 +0,0 @@ -#3500 -The Plains~ - You are standing on the plains. This is a vast desolate place where -the wind can howl undisturbed since nothing but you bars its way. However -you are not the first to wander here. Before you somebody has left a small -path. The path looks rather bewildered and is not the kind of path to lead -to anywhere significant or important but it seems to have made up its mind -to enter the hills far away north. A narrow trail scars its way off to the -east as it leads up towards a hillside. -~ -35 0 1 -D0 -~ -~ -0 -1 4000 -D1 -~ -~ -0 -1 3300 -D2 -~ -~ -0 -1 3501 -S -#3501 -The Lane~ - You are strolling along a pleasant, shady lane. The road is lined on both -sides by tall, stately trees which lend the scene with a sense of quiet -serenity. - You can follow the road north or south. -~ -35 0 1 -D0 -~ -~ -0 -1 3500 -D2 -~ -~ -0 -1 3502 -S -#3502 -The Laneway~ - The trees stand close here, and the tall, bushy undergrowth prevents you -from seeing far in any direction save east, where a broad lane continues off -into the distance; and west, where the same lane continues towards what looks -like a fairly large city. The muted sounds of city commotion reach your ears -from a distance; stray dogs barking, children crying, and street salesmen -shouting. - A steep path leads down from here to the northeast towards the Dwarven -Village, and a small trail leads through the trees towards the hills to the -north. -~ -35 0 1 -D0 -~ -~ -0 -1 3501 -D1 -You see a fairly large road leading towards a grand castle in the distance. -~ -~ -0 -1 15000 -D3 -~ -~ -0 -1 3503 -D5 -The well trodden path leads down to the northeast towards a small bustling -village. -~ -~ -0 -1 6500 -S -#3503 -The City Entrance~ - You stand on the outskirts of a large city - Midgaard; the capital of -this land. The road leads east into the peace and quiet - and dangers - -of the forest; and to the west it becomes the main street of the town; -surrounded by a confusion of shops, bars, and market places. -~ -35 c 1 -D1 -~ -~ -0 -1 3502 -D3 -~ -~ -0 -1 3053 -S -#3504 -The South Gate~ - You are standing on a small, dusty path leading away from the south -gate of Midgaard, to the forest of Miden'Nir (Goblinic for 'Green Blood'). -You can still see the city to the east, but if you go south, there is -fresh air and greenery. -~ -35 0 3 -D1 -You can see the walls of the South Gate. -~ -~ -0 -1 3127 -D2 -If you go south, you will enter the Miden'Nir. -~ -~ -0 -1 3505 -S -#3505 -The Trail To Miden'Nir~ - You are in a light forest. A path leads south, but the passage to -the east is easy enough. To the west, smoke can be seen rising above -the treetops. The sprawl of Midgaard lies north of here. -~ -35 c 3 -D0 -To the north, you see the South Gate of Midgaard. -~ -~ -0 -1 3504 -D1 -More light forest. -~ -~ -0 -1 3506 -D2 -This path cuts through the darkness of the Miden'Nir. -~ -~ -0 -1 3507 -D3 -The Woodsman's Inn can be seen a short distance to the west, it appears -to be the source of the smoke. -~ -~ -0 -1 3570 -S -#3506 -The Miden'nir~ - You are in a dark forest. To the east, mountains block passage. From -here, only the lighter forest to the west or south offer a way to travel. -~ -35 0 3 -D1 -The mountains can be seen jutting up to the east. -~ -~ -0 -1 3550 -D2 -The forest is darker to the south. -~ -~ -0 -1 3509 -D3 -The forest gets lighter as you go west. -~ -~ -0 -1 3505 -S -#3507 -The Miden'nir~ - The forest is deep here and the wind blows through the trees and -through your hair. To the north, the forest gets lighter. However, -the southern and western paths place you even deeper in the wood. -~ -35 0 3 -D0 -The forest is lighter in this direction. -~ -~ -0 -1 3505 -D2 -More and darker woods. -~ -~ -0 -1 3510 -D3 -There is a small path leading west. -~ -~ -0 -1 3508 -S -#3508 -On a Small Path~ - A path is here, leading east and south through the dark woods of -Miden'nir. Mountains slash the scenery to the west of here. -~ -35 0 3 -D1 -Wind-swept forest. -~ -~ -0 -1 3507 -D2 -To the south, the trail continues. -~ -~ -0 -1 3511 -S -#3509 -The Miden'nir~ - The trees of Miden'nir are lush and green, hiding the evil that lurks -in these woods. The trees become too thick to the west, but you may go -north, south or travel toward the mountains that lie east of here. -~ -35 0 3 -D0 -The trees lighten up a bit this way. -~ -~ -0 -1 3506 -D1 -Huge grey mountains lie in this direction. -~ -~ -0 -1 3512 -D2 -The forest continues. -~ -~ -0 -1 3514 -S -#3510 -A Crossroads~ - Here footworn paths meet leading north, south and east. The trees -seem to be closing in on you at this point, and you can barely see -the sky through the thick branches above your head. -~ -35 0 3 -D0 -Trees as far as the eye can see. -~ -~ -0 -1 3507 -D1 -There is an especially dark part of the forest this way. -~ -~ -0 -1 3514 -D2 -There is an especially dark section of forest this way. -~ -~ -0 -1 3516 -S -#3511 -The Trail~ - You are on a north-south trail through the woods. To the west, -impassable mountains glare at you, and the thick woods and undergrowth -prevent any movement westward. -~ -35 0 3 -D0 -The trail bends to the north. -~ -~ -0 -1 3508 -D2 -To the south, the path re-enters the forest. -~ -~ -0 -1 3515 -S -#3512 -The Miden'nir~ - The trees of Miden'nir are lush and green, hiding the evil that lurks -in these woods. You can go north toward the mountains, or west to the -forest, but the steep mountains prevent any movement east. -~ -35 0 3 -D0 -The mountains can be seen to the north. -~ -~ -0 -1 3550 -D2 -A light section of forest. -~ -~ -0 -1 3513 -D3 -The forest continues here. -~ -~ -0 -1 3509 -S -#3513 -The Miden'nir~ - The forest is dark, and becomes even darker west. You sense -that there is something evil hidden in these woods. The forest -gets lighter to the north. The wind kicks up as you ponder your -options. -~ -35 0 3 -D0 -There is a small clearing to the north. -~ -~ -0 -1 3512 -D3 -It gets darker and thicker this way. -~ -~ -0 -1 3514 -S -#3514 -The Deep Forest~ - It is quite dark here, forest surrounds you. With each step, the -forest seems to close around you, and get darker and more foreboding. -It might just be time to head back to somewhere safe. -~ -35 0 3 -D0 -More forest. -~ -~ -0 -1 3509 -D1 -Lighter forest and mountains in the distance. -~ -~ -0 -1 3513 -D2 -More trees. -~ -~ -0 -1 3517 -D3 -The forest continues. -~ -~ -0 -1 3510 -S -#3515 -The Light Forest~ - The forest is light here and you can easily pick your way through the -trail. To the east, the forest becomes thick and darker. South, the -trail continues. -~ -35 0 3 -D0 -A trail leading north-south. -~ -~ -0 -1 3511 -D1 -The trees get thicker as you go east. -~ -~ -0 -1 3516 -D2 -More trees and some small hills. -~ -~ -0 -1 3518 -S -#3516 -Some Muddy Ground~ - The ground is quite muddy here and puddles are all around. Your -boots make a disgusting SQUISH as you walk here. You can go in any -of the four cardinal directions from here. Hopefully, it will be -dryer. -~ -35 0 3 -D0 -The Miden'nir continues. -~ -~ -0 -1 3510 -D1 -More trees. -~ -~ -0 -1 3517 -D2 -The trees get VERY thick to the south. You can barely see... -~ -~ -0 -1 3519 -D3 -Some light trees and daylight. -~ -~ -0 -1 3515 -S -#3517 -Near The Mountains~ - The most prominent feature here is the mountains that lie to the -east. You can only go north and west from here as the rocks stop all -other movement. -~ -35 0 3 -D0 -Many trees to the north. -~ -~ -0 -1 3514 -D3 -There is a bit of a slope downward to the west. -~ -~ -0 -1 3516 -S -#3518 -The Fading Trail~ - The trail becomes nearly unpassable here. You can go north -as the forest is relatively light. To the south, you can see a -path. -~ -35 0 3 -D0 -You can see a trail this way. -~ -~ -0 -1 3515 -D1 -The trees are nearly trunk-to-trunk this way. -~ -~ -0 -1 -1 -D2 -Dark forests. -~ -~ -0 -1 3522 -S -#3519 -The Dark Path~ - You are hemmed in by trees on either side of you. The path -continues north and south, and while is much to thick to explore -west, you can head off into the woods to the west. -~ -35 0 3 -D0 -The forest gets lighter this way. -~ -~ -0 -1 3516 -D1 -The forest continues. -~ -~ -0 -1 3520 -D2 -There is a strong stench coming from this direction. -~ -~ -0 -1 3521 -D3 -The trees are nearly trunk-to-trunk this way. -~ -~ -0 -1 -1 -S -#3520 -The Dark Forest~ - You stomp your way through the underbrush. The dark forest of -Miden'nir get pretty thick here, and the branches high above your -head are so thick that they block out all direct sunlight. While -it is much too thick to go further east, you might be able to make -your way though the forest to the south and west. -~ -35 0 3 -D2 -The thick forest continues. -~ -~ -0 -1 3523 -D3 -The thick forest continues. -~ -~ -0 -1 3519 -S -#3521 -The Carnage~ - Here, you see a gruesome sight. Blood is everywhere... on the trees and -soaked into the ground. Two carcasses lie in front of you, seeming to look -up at you. The forest is impassible to the south, but the other directions -look ok. -~ -35 1 3 -D0 -Darkness... -~ -~ -0 -1 3519 -D1 -Your light does not extend that far. -~ -~ -0 -1 3523 -D3 -More dark forest. -~ -~ -0 -1 3522 -E -carcass body corpse carcasses bodies corpses~ -The corpses looked as if they have been pierced by a large, jagged -spear. The damage these people sustained is simply amazing. Worse, -the lips on the bodies are a light shade of blue, hinting at poison -in their systems. -~ -S -#3522 -Deep In The Forest Of Miden'nir~ - There is a sickening stench here. It smells of blood and death. -To the north, you catch glimpses of daylight. To the east, you -simply cannot see. The trees are close and stifling. -~ -35 0 3 -D0 -You see daylight and a trail to follow. -~ -~ -0 -1 3518 -D1 -The stench seems to becoming from this direction. -~ -~ -0 -1 3521 -S -#3523 -The Dark Forest~ - The branches above you block out all direct sunlight, making the forest -in this area rather dark. The forest continues east, where it meets the -mountains. The air is still and stuffy - a stench comes from the west and -an ugly feeling causes the hair to rise on the back of your neck! -~ -35 0 3 -D0 -It appears to get much darker that direction. -~ -~ -0 -1 3520 -D1 -The forest appears to get much darker in this direction. -~ -~ -0 -1 3551 -D3 -The sky becomes lighter in this direction. -~ -~ -0 -1 3521 -S -#3550 -At The Foot Of The Mountains~ - You find yourself at the foot of the mountains, where it is much -to steep to continue north or east. You see the lush, green forest -of Miden'nir to the south and west. -~ -35 0 5 -D2 -The forest of Miden'nir spreads out before you. -~ -~ -0 -1 3512 -D3 -The forest of Miden'nir spreads out before you. -~ -~ -0 -1 3506 -S -#3551 -Deep In The Forest Of Miden'nir~ - The branches above you block out all direct sunlight, making -the forest in this area very dark. The forest continues west, -but mountains block further exploration in all other directions, -except south, where you notice a small tunnel dug into the -mountainside. -~ -35 a 3 -D2 -The tunnel leads into the mountainside. -~ -~ -0 -1 3552 -D3 -The forest continues, but appears to be getting lighter. -~ -~ -0 -1 3523 -S -#3552 -A Tunnel In The Mountains~ - The walls of this tunnel were carved out many years ago by the goblins -of this forest. The floor is well worn, and continues south, into the -mountain, or back north out into the forest. -~ -35 a 1 -D0 -Outside, you see the forest of Miden'nir. -~ -~ -0 -1 3551 -D2 -The tunnel continues to the south. -~ -~ -0 -1 3553 -S -#3553 -A Tunnel In The Mountains~ - The tunnel gets lighter to the north, presumably leading out, while to -the south the passage gets smaller and smaller. A small alcove has been -carved into the east wall. -~ -35 a 1 -D0 -The tunnel gets wider in this direction. -~ -~ -0 -1 3552 -D1 -You see a small alcove. -~ -~ -0 -1 3554 -D2 -The tunnel gets smaller in this direction. -~ -~ -0 -1 3555 -S -#3554 -A Small Alcove~ - A small alcove has been carved out here. There are a bunch of twigs -and leaves thrown into a pile here, probably serving as a bed. -~ -35 a 1 -D3 -You see the main passageway. -~ -~ -0 -1 3553 -E -twigs leaves bead~ -The twigs and leaves have all been piled together as a makeshift bed for -some small humanoid. -~ -S -#3555 -A Tunnel In The Mountains~ - As you explore further into the mountainside, the tunnel gets smaller -and smaller to the south. You almost have to hunch over to make your way -through this area. A small archway to the south leads into a large chamber. -~ -35 a 1 -D0 -The tunnel continues north. -~ -~ -0 -1 3553 -D2 -You see a small cavern. -~ -~ -0 -1 3556 -S -#3556 -The Goblin HeadQuarters~ - The tunnel widens into a large (well, large for goblins) cavern that -serves as the living quarters for the goblins of Miden'nir. The bones of -numbers woodland creatures are strewn about the room, the remanents of a -recent meal. -~ -35 a 1 -D0 -The tunnel heads north. -~ -~ -0 -1 3555 -S -#3570 -The Front Of The Inn~ - You are standing on a well-worn path which opens into a clearing. -An old, wooden building is here with smoke billowing from its -chimney. A painted sign is visible on the porch to the west. You -could go north or south around the building or leave this place and -return to the forest. -~ -35 0 3 -D0 -You can go north around the Inn. -~ -~ -0 -1 3571 -D1 -Back through the trees to the Miden'nir. -~ -~ -0 -1 3505 -D2 -You can go south around the Inn. -~ -~ -0 -1 3572 -D3 -The front door of the Inn beckons. -~ -~ -0 -1 3574 -E -sign~ -The sign reads: - - The Woodsman - -~ -S -#3571 -North Of The Inn~ - You are standing north of the Inn. Things don't look much different -from this angle. The air here is filled with smells of smoke and cooking. -South, the front porch is waiting for you... or you can see if there is -a back door. -~ -4 0 3 -D2 -You see the front of the Inn. -~ -~ -0 -1 3570 -S -#3572 -South Of The Inn~ - You are standing south of the Inn. You could easily go north and enter -through the front door, or west and to the rear of the establishment. You -here some muffled cries from a tiny trail leading south of here. -~ -35 0 3 -D0 -This way leads to the front of the Inn. -~ -~ -0 -1 3570 -D2 -The trail heads south. -~ -~ -0 -1 3575 -D3 -This way leads to the back of the Inn. -~ -~ -0 -1 3573 -S -#3573 -Behind The Inn~ - You now stand behind the Inn. The smell here is not so pleasant as -the keeper and his help throw a good deal of garbage here. A couple of -piles of rubbish are to the west, but you will smell the worse for -meddling there. As a clean alternative, you can go north or east around -the Inn. -~ -35 0 3 -D1 -You can go around the Inn this way. -~ -~ -0 -1 3572 -D3 -Only rats and fool adventurers play in garbage. -~ -~ -0 -1 3578 -S -#3574 -The Woodsman Inn~ - You are in the common room of the Woodsman Inn. A thin haze of smoke -sits in the air here. The Inn is often empty, as the forest has become -overrun by goblins as of late, and it is no longer safe in these parts. -The bar is just north of here. If you'd rather have your own table, one -is empty to the south. -~ -35 cd 1 -D0 -The bar is here, manned by the Innkeeper. -~ -~ -0 -1 3576 -D1 -You can leave now and return to fresher air. -~ -~ -0 -1 3570 -D2 -An empty table is a rare commodity. -~ -~ -0 -1 3579 -D3 -There is a table to the south occupied by a heavy drinker. -~ -~ -0 -1 3577 -S -#3575 -The Ambush Point~ - This is a overgrown foot-trail south of the Inn. It leads west, but you -would be hard pressed to follow it far. A number of bushes are trampled on -and some medium sized branches have been knocked down. Obviously there has -been a battle here rather recently. -~ -35 0 3 -D0 -The Inn lies to the north. -~ -~ -0 -1 3572 -D3 -A trail through the woods. -~ -~ -0 -1 3581 -S -#3576 -The Bar~ - This is where people use to come and enjoy the food, drink and -hospitality of the Innkeeper, but as of late, he only serves the -few adventurers that manage to survive a trip through the forest. -You can leave south and return to the common room. -~ -35 df 1 -D2 -You may retreat south back to the common room. -~ -~ -0 -1 3574 -S -#3577 -The Bard's Table~ - You are in a darker corner in the Inn. A large round table with a few -wooden chairs sits here. There is a large stain on the table, the remnants -of a spilled drink. -~ -35 d 1 -D1 -You see the main floor of the Inn to the east. -~ -~ -0 -1 3574 -S -#3578 -The Garbage Dump~ -You stand knee deep in garbage. YECCH!!! It smells terrible and who knows -what vermin live in these piles of filth... -~ -35 0 3 -D1 -You can return to cleaner lands this way. -~ -~ -0 -1 3573 -S -#3579 -A Quieter Section Of The Inn~ -There seems to be no one in this end of the Woodsman, probably a safe place -to rest and lick your wounds... -~ -35 d 0 -D0 -You see the common room. -~ -~ -0 -1 3574 -S -#3581 -On The Trail Of The Horsemen~ - The path continues east and west of here. You notice fresh tracks in -the soft ground that show the horsemen fled to the west. -~ -35 0 3 -D1 -Back to ambush point. -~ -~ -0 -1 3575 -D3 -The trail continues. -~ -~ -0 -1 3582 -S -#3582 -On The Trail Of The Horsemen~ - The path continues east and south. You notice fresh tracks in the -soft ground that show the horsemen turned, and fled south. -~ -35 0 3 -D1 -The trail continues. -~ -~ -0 -1 3581 -D2 -The tracks lead south. -~ -~ -0 -1 3583 -S -#3583 -On The Trail Of The Horsemen~ - The trail of the horsemen continues east and north along this path -through the forest. The tracks are still fresh, so they must be near. -~ -35 0 3 -D0 -The trail continues. -~ -~ -0 -1 3582 -D3 -The tracks lead east. -~ -~ -0 -1 3584 -S -#3584 -A Dead End Trail~ - The path comes to an abrupt end here, as the trees close around you and -make any further exploration impossible. Fresh tracks cover the ground, and -end right here. The horsemen must be nearby. -~ -35 0 3 -D1 -Back to along the trail. -~ -~ -0 -1 3583 -S -$ - diff --git a/lc-mud/circle/world/wld/36.wld b/lc-mud/circle/world/wld/36.wld deleted file mode 100644 index c0704b665da5ca2a4d2fb8fa8cb4da1c576d9ad9..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/36.wld +++ /dev/null @@ -1,1597 +0,0 @@ -#3600 -The Great Chessboard Of Midgaard~ - You stand in the archway of the Chessboard of Midgaard. The giant -wooden gate is rusted open. - A narrow dirt path leads eastwards into the thick grass and the -chessboard opens up to the west. -~ -36 c 1 -D1 -A dirt path leads away through the great field north of Midgaard. -~ -~ -0 -1 3066 -D3 -The huge chessboard opens up to the west. -~ -~ -0 -1 3632 -S -#3601 -A White Square~ - You are standing on a white marble square. This is usually the home -of the Black Queen's Rook. -~ -36 0 1 -D1 -A black square lies to the east. -~ -~ -0 -1 3602 -D2 -A black square lies to the south. -~ -~ -0 -1 3609 -S -#3602 -A Black Square~ - You are standing on a black marble square. This is usually the home -of the Black Queen's Knight. -~ -36 0 1 -D1 -A white square lies to the east. -~ -~ -0 -1 3603 -D2 -A white square lies to the south. -~ -~ -0 -1 3610 -D3 -A white square lies to the west. -~ -~ -0 -1 3601 -S -#3603 -A White Square~ - You are standing on a white marble square. This is usually the home -of the Black Queen's Bishop. -~ -36 0 1 -D1 -A black square lies to the east. -~ -~ -0 -1 3604 -D2 -A black square lies to the south. -~ -~ -0 -1 3611 -D3 -A black square lies to the west. -~ -~ -0 -1 3602 -S -#3604 -A Black Square~ - You are standing on a black marble square. This is usually the home -of the Black Queen. -~ -36 0 1 -D1 -A white square lies to the east. -~ -~ -0 -1 3605 -D2 -A white square lies to the south. -~ -~ -0 -1 3612 -D3 -A white square lies to the west. -~ -~ -0 -1 3603 -D5 -~ -marble square~ -2 3614 3665 -S -#3605 -A White Square~ - You are standing on a white marble square. This is usually the home -of the Black King. -~ -36 0 1 -D1 -A black square lies to the east. -~ -~ -0 -1 3606 -D2 -A black square lies to the south. -~ -~ -0 -1 3613 -D3 -A black square lies to the west. -~ -~ -0 -1 3604 -S -#3606 -A Black Square~ - You are standing on a black marble square. This is usually the home -of the Black King's Bishop. -~ -36 0 1 -D1 -A white square lies to the east. -~ -~ -0 -1 3607 -D2 -A white square lies to the south. -~ -~ -0 -1 3614 -D3 -A white square lies to the west. -~ -~ -0 -1 3605 -S -#3607 -A White Square~ - You are standing on a white marble square. This is usually the home -of the Black King's Knight. -~ -36 0 1 -D1 -A black square lies to the east. -~ -~ -0 -1 3608 -D2 -A black square lies to the south. -~ -~ -0 -1 3615 -D3 -A black square lies to the west. -~ -~ -0 -1 3606 -S -#3608 -A Black Square~ - You are standing on a black marble square. This is usually the home -of the Black King's Rook. -~ -36 0 1 -D2 -A white square lies to the south. -~ -~ -0 -1 3616 -D3 -A white square lies to the west. -~ -~ -0 -1 3607 -S -#3609 -A Black Square~ - You are standing on a black marble square. This is usually the home -of one of the Black Queen's Pawns. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3601 -D1 -A white square lies to the east. -~ -~ -0 -1 3610 -D2 -A white square lies to the south. -~ -~ -0 -1 3617 -S -#3610 -A White Square~ - You are standing on a white marble square. This is usually the home -of one of the Black Queen's Pawns. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3602 -D1 -A black square lies to the east. -~ -~ -0 -1 3611 -D2 -A black square lies to the south. -~ -~ -0 -1 3618 -D3 -A black square lies to the west. -~ -~ -0 -1 3609 -S -#3611 -A Black Square~ - You are standing on a black marble square. This is usually the home -of one of the Black Queen's Pawns. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3603 -D1 -A white square lies to the east. -~ -~ -0 -1 3612 -D2 -A white square lies to the south. -~ -~ -0 -1 3619 -D3 -A white square lies to the west. -~ -~ -0 -1 3610 -S -#3612 -A White Square~ - You are standing on a white marble square. This is usually the home -of one of the Black Queen's Pawns. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3604 -D1 -A black square lies to the east. -~ -~ -0 -1 3613 -D2 -A black square lies to the south. -~ -~ -0 -1 3620 -D3 -A black square lies to the west. -~ -~ -0 -1 3611 -S -#3613 -A Black Square~ - You are standing on a black marble square. This is usually the home -of one of the Black King's Pawns. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3605 -D1 -A white square lies to the east. -~ -~ -0 -1 3614 -D2 -A white square lies to the south. -~ -~ -0 -1 3621 -D3 -A white square lies to the west. -~ -~ -0 -1 3612 -S -#3614 -A White Square~ - You are standing on a white marble square. This is usually the home -of one of the Black King's Pawns. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3606 -D1 -A black square lies to the east. -~ -~ -0 -1 3615 -D2 -A black square lies to the south. -~ -~ -0 -1 3622 -D3 -A black square lies to the west. -~ -~ -0 -1 3613 -S -#3615 -A Black Square~ - You are standing on a black marble square. This is usually the home -of one of the Black King's Pawns. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3607 -D1 -A white square lies to the east. -~ -~ -0 -1 3616 -D2 -A white square lies to the south. -~ -~ -0 -1 3623 -D3 -A white square lies to the west. -~ -~ -0 -1 3614 -S -#3616 -A White Square~ - You are standing on a white marble square. This is usually the home -of one of the Black King's Pawns. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3608 -D2 -A black square lies to the south. -~ -~ -0 -1 3624 -D3 -A black square lies to the west. -~ -~ -0 -1 3615 -S -#3617 -A White Square~ - You are standing on a white marble square. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3609 -D1 -A black square lies to the east. -~ -~ -0 -1 3618 -D2 -A black square lies to the south. -~ -~ -0 -1 3625 -S -#3618 -A Black Square~ - You are standing on a black marble square. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3610 -D1 -A white square lies to the east. -~ -~ -0 -1 3619 -D2 -A white square lies to the south. -~ -~ -0 -1 3626 -D3 -A white square lies to the west. -~ -~ -0 -1 3617 -S -#3619 -A White Square~ - You are standing on a white marble square. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3611 -D1 -A black square lies to the east. -~ -~ -0 -1 3620 -D2 -A black square lies to the south. -~ -~ -0 -1 3627 -D3 -A black square lies to the west. -~ -~ -0 -1 3618 -S -#3620 -A Black Square~ - You are standing on a black marble square. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3612 -D1 -A white square lies to the east. -~ -~ -0 -1 3621 -D2 -A white square lies to the south. -~ -~ -0 -1 3628 -D3 -A white square lies to the west. -~ -~ -0 -1 3619 -S -#3621 -A White Square~ - You are standing on a white marble square. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3613 -D1 -A black square lies to the east. -~ -~ -0 -1 3622 -D2 -A black square lies to the south. -~ -~ -0 -1 3629 -D3 -A black square lies to the west. -~ -~ -0 -1 3620 -S -#3622 -A Black Square~ - You are standing on a black marble square. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3614 -D1 -A white square lies to the east. -~ -~ -0 -1 3623 -D2 -A white square lies to the south. -~ -~ -0 -1 3630 -D3 -A white square lies to the west. -~ -~ -0 -1 3621 -S -#3623 -A White Square~ - You are standing on a white marble square. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3615 -D1 -A black square lies to the east. -~ -~ -0 -1 3624 -D2 -A black square lies to the south. -~ -~ -0 -1 3631 -D3 -A black square lies to the west. -~ -~ -0 -1 3622 -S -#3624 -A Black Square~ - You are standing on a black marble square. You can see a rusty gate -to the south. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3616 -D2 -A white square lies to the south. -~ -~ -0 -1 3632 -D3 -A white square lies to the west. -~ -~ -0 -1 3623 -S -#3625 -A Black Square~ - You are standing on a black marble square. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3617 -D1 -A white square lies to the east. -~ -~ -0 -1 3626 -D2 -A white square lies to the south. -~ -~ -0 -1 3633 -S -#3626 -A White Square~ - You are standing on a white marble square. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3618 -D1 -A black square lies to the east. -~ -~ -0 -1 3627 -D2 -A black square lies to the south. -~ -~ -0 -1 3634 -D3 -A black square lies to the west. -~ -~ -0 -1 3625 -S -#3627 -A Black Square~ - You are standing on a black marble square. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3619 -D1 -A white square lies to the east. -~ -~ -0 -1 3628 -D2 -A white square lies to the south. -~ -~ -0 -1 3635 -D3 -A white square lies to the west. -~ -~ -0 -1 3626 -S -#3628 -A White Square~ - You are standing on a white marble square. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3620 -D1 -A black square lies to the east. -~ -~ -0 -1 3629 -D2 -A black square lies to the south. -~ -~ -0 -1 3636 -D3 -A black square lies to the west. -~ -~ -0 -1 3627 -S -#3629 -A Black Square~ - You are standing on a black marble square. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3621 -D1 -A white square lies to the east. -~ -~ -0 -1 3630 -D2 -A white square lies to the south. -~ -~ -0 -1 3637 -D3 -A white square lies to the west. -~ -~ -0 -1 3628 -S -#3630 -A White Square~ - You are standing on a white marble square. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3622 -D1 -A black square lies to the east. -~ -~ -0 -1 3631 -D2 -A black square lies to the south. -~ -~ -0 -1 3638 -D3 -A black square lies to the west. -~ -~ -0 -1 3629 -S -#3631 -A Black Square~ - You are standing on a black marble square. There is a rusty gate -a short distance to the east. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3623 -D1 -A white square lies to the east. -~ -~ -0 -1 3632 -D2 -A white square lies to the south. -~ -~ -0 -1 3639 -D3 -A white square lies to the west. -~ -~ -0 -1 3630 -S -#3632 -A White Square~ - You are standing on a white marble square. There is a large rusty -gate to the east. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3624 -D1 -The gate to the chessboard is just to the east. -~ -~ -0 -1 3600 -D2 -A black square lies to the south. -~ -~ -0 -1 3640 -D3 -A black square lies to the west. -~ -~ -0 -1 3631 -S -#3633 -A White Square~ - You are standing on a white marble square. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3625 -D1 -A black square lies to the east. -~ -~ -0 -1 3634 -D2 -A black square lies to the south. -~ -~ -0 -1 3641 -S -#3634 -A Black Square~ - You are standing on a black marble square. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3626 -D1 -A white square lies to the east. -~ -~ -0 -1 3635 -D2 -A white square lies to the south. -~ -~ -0 -1 3642 -D3 -A white square lies to the west. -~ -~ -0 -1 3633 -S -#3635 -A White Square~ - You are standing on a white marble square. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3627 -D1 -A black square lies to the east. -~ -~ -0 -1 3636 -D2 -A black square lies to the south. -~ -~ -0 -1 3643 -D3 -A black square lies to the west. -~ -~ -0 -1 3634 -S -#3636 -A Black Square~ - You are standing on a black marble square. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3628 -D1 -A white square lies to the east. -~ -~ -0 -1 3637 -D2 -A white square lies to the south. -~ -~ -0 -1 3644 -D3 -A white square lies to the west. -~ -~ -0 -1 3635 -S -#3637 -A White Square~ - You are standing on a white marble square. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3629 -D1 -A black square lies to the east. -~ -~ -0 -1 3638 -D2 -A black square lies to the south. -~ -~ -0 -1 3645 -D3 -A black square lies to the west. -~ -~ -0 -1 3636 -S -#3638 -A Black Square~ - You are standing on a black marble square. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3630 -D1 -A white square lies to the east. -~ -~ -0 -1 3639 -D2 -A white square lies to the south. -~ -~ -0 -1 3646 -D3 -A white square lies to the west. -~ -~ -0 -1 3637 -S -#3639 -A White Square~ - You are standing on a white marble square. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3631 -D1 -A black square lies to the east. -~ -~ -0 -1 3640 -D2 -A black square lies to the south. -~ -~ -0 -1 3647 -D3 -A black square lies to the west. -~ -~ -0 -1 3638 -S -#3640 -A Black Square~ - You are standing on a black marble square. There is a rusty gate -to the north. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3632 -D2 -A white square lies to the south. -~ -~ -0 -1 3648 -D3 -A white square lies to the west. -~ -~ -0 -1 3639 -S -#3641 -A Black Square~ - You are standing on a black marble square. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3633 -D1 -A white square lies to the east. -~ -~ -0 -1 3642 -D2 -A white square lies to the south. -~ -~ -0 -1 3649 -S -#3642 -A White Square~ - You are standing on a white marble square. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3634 -D1 -A black square lies to the east. -~ -~ -0 -1 3643 -D2 -A black square lies to the south. -~ -~ -0 -1 3650 -D3 -A black square lies to the west. -~ -~ -0 -1 3641 -S -#3643 -A Black Square~ - You are standing on a black marble square. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3635 -D1 -A white square lies to the east. -~ -~ -0 -1 3644 -D2 -A white square lies to the south. -~ -~ -0 -1 3651 -D3 -A white square lies to the west. -~ -~ -0 -1 3642 -S -#3644 -A White Square~ - You are standing on a white marble square. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3636 -D1 -A black square lies to the east. -~ -~ -0 -1 3645 -D2 -A black square lies to the south. -~ -~ -0 -1 3652 -D3 -A black square lies to the west. -~ -~ -0 -1 3643 -S -#3645 -A Black Square~ - You are standing on a black marble square. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3637 -D1 -A white square lies to the east. -~ -~ -0 -1 3646 -D2 -A white square lies to the south. -~ -~ -0 -1 3653 -D3 -A white square lies to the west. -~ -~ -0 -1 3644 -S -#3646 -A White Square~ - You are standing on a white marble square. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3638 -D1 -A black square lies to the east. -~ -~ -0 -1 3647 -D2 -A black square lies to the south. -~ -~ -0 -1 3654 -D3 -A black square lies to the west. -~ -~ -0 -1 3645 -S -#3647 -A Black Square~ - You are standing on a black marble square. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3639 -D1 -A white square lies to the east. -~ -~ -0 -1 3648 -D2 -A white square lies to the south. -~ -~ -0 -1 3655 -D3 -A white square lies to the west. -~ -~ -0 -1 3646 -S -#3648 -A White Square~ - You are standing on a white marble square. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3640 -D2 -A black square lies to the south. -~ -~ -0 -1 3656 -D3 -A black square lies to the west. -~ -~ -0 -1 3647 -S -#3649 -A White Square~ - You are standing on a white marble square. This is usually the home -of one of the White Queen's Pawns. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3641 -D1 -A black square lies to the east. -~ -~ -0 -1 3650 -D2 -A black square lies to the south. -~ -~ -0 -1 3657 -S -#3650 -A Black Square~ - You are standing on a black marble square. This is usually the home -of one of the White Queen's Pawns. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3642 -D1 -A white square lies to the east. -~ -~ -0 -1 3651 -D2 -A white square lies to the south. -~ -~ -0 -1 3658 -D3 -A white square lies to the west. -~ -~ -0 -1 3649 -S -#3651 -A White Square~ - You are standing on a white marble square. This is usually the home -of one of the White Queen's Pawns. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3643 -D1 -A black square lies to the east. -~ -~ -0 -1 3652 -D2 -A black square lies to the south. -~ -~ -0 -1 3659 -D3 -A black square lies to the west. -~ -~ -0 -1 3650 -S -#3652 -A Black Square~ - You are standing on a black marble square. This is usually the home -of one of the White Queen's Pawns. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3644 -D1 -A white square lies to the east. -~ -~ -0 -1 3653 -D2 -A white square lies to the south. -~ -~ -0 -1 3660 -D3 -A white square lies to the west. -~ -~ -0 -1 3651 -S -#3653 -A White Square~ - You are standing on a white marble square. This is usually the home -of one of the White King's Pawns. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3645 -D1 -A black square lies to the east. -~ -~ -0 -1 3654 -D2 -A black square lies to the south. -~ -~ -0 -1 3661 -D3 -A black square lies to the west. -~ -~ -0 -1 3652 -S -#3654 -A Black Square~ - You are standing on a black marble square. This is usually the home -of one of the White King's Pawns. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3646 -D1 -A white square lies to the east. -~ -~ -0 -1 3655 -D2 -A white square lies to the south. -~ -~ -0 -1 3662 -D3 -A white square lies to the west. -~ -~ -0 -1 3653 -S -#3655 -A White Square~ - You are standing on a white marble square. This is usually the home -of one of the White King's Pawns. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3647 -D1 -A black square lies to the east. -~ -~ -0 -1 3656 -D2 -A black square lies to the south. -~ -~ -0 -1 3663 -D3 -A black square lies to the west. -~ -~ -0 -1 3654 -S -#3656 -A Black Square~ - You are standing on a black marble square. This is usually the home -of one of the White King's Pawns. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3648 -D2 -A white square lies to the south. -~ -~ -0 -1 3664 -D3 -A white square lies to the west. -~ -~ -0 -1 3655 -S -#3657 -A Black Square~ - You are standing on a black marble square. This is usually the home -of the White Queen's Rook. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3649 -D1 -A white square lies to the east. -~ -~ -0 -1 3658 -S -#3658 -A White Square~ - You are standing on a white marble square. This is usually the home -of the White Queen's Knight. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3650 -D1 -A black square lies to the east. -~ -~ -0 -1 3659 -D3 -A black square lies to the west. -~ -~ -0 -1 3657 -S -#3659 -A Black Square~ - You are standing on a black marble square. This is usually the home -of the White Queen's Bishop. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3651 -D1 -A white square lies to the east. -~ -~ -0 -1 3660 -D3 -A white square lies to the west. -~ -~ -0 -1 3658 -S -#3660 -A White Square~ - You are standing on a white marble square. This is usually the home -of the White Queen. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3652 -D1 -A black square lies to the east. -~ -~ -0 -1 3661 -D3 -A black square lies to the west. -~ -~ -0 -1 3659 -D5 -~ -marble square~ -2 3615 3666 -S -#3661 -A Black Square~ - You are standing on a black marble square. This is usually the home -of the White King. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3653 -D1 -A white square lies to the east. -~ -~ -0 -1 3662 -D3 -A white square lies to the west. -~ -~ -0 -1 3660 -S -#3662 -A White Square~ - You are standing on a white marble square. This is usually the home -of the White King's Bishop. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3654 -D1 -A black square lies to the east. -~ -~ -0 -1 3663 -D3 -A black square lies to the west. -~ -~ -0 -1 3661 -S -#3663 -A Black Square~ - You are standing on a black marble square. This is usually the home -of the White King's Knight. -~ -36 0 1 -D0 -A white square lies to the north. -~ -~ -0 -1 3655 -D1 -A white square lies to the east. -~ -~ -0 -1 3664 -D3 -A white square lies to the west. -~ -~ -0 -1 3662 -S -#3664 -A White Square~ - You are standing on a white marble square. This is usually the home -of the White King's Rook. -~ -36 0 1 -D0 -A black square lies to the north. -~ -~ -0 -1 3656 -D3 -A black square lies to the west. -~ -~ -0 -1 3663 -S -#3665 -The Black Treasury~ - You are standing in the treasury of the Black Court. Hopefully no one -has looted the Crown's treasure. -~ -36 adj 0 -D4 -A small staircase rises above you. -~ -marble square~ -2 3614 3604 -S -#3666 -The White Treasury~ - You are standing in the treasury of the White Court. Hopefully no one -has looted the Crown's treasure. -~ -36 adj 0 -D4 -A small staircase rises above you. -~ -marble square~ -2 3615 3660 -S -$ diff --git a/lc-mud/circle/world/wld/40.wld b/lc-mud/circle/world/wld/40.wld deleted file mode 100644 index d1f158075b109ecb6d9a17312dd5db997a45e98e..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/40.wld +++ /dev/null @@ -1,1918 +0,0 @@ -#4000 -The Hills~ - You are on a path leading north, small hills surround you. -You feel the forces of evil approach you from the north. Off -in the distance to the northeast you can see the beginning of -a large mountain range. -~ -40 c 4 -D0 -~ -~ -0 -1 4001 -D2 -~ -~ -0 -1 3500 -S -#4001 -The Hills~ - You are on a small path leading north, dark threatening hills -surround you on almost all sides. A fair distance off to the -north, you can see the enormous shadow of a strangely solitaire -mountain. -~ -40 c 4 -D0 -~ -~ -0 -1 4002 -D2 -~ -~ -0 -1 4000 -S -#4002 -The End Of The Path~ - The path stops here, to the north is a single mountain and around -you are some threatening hills. A small trail leads up the hillside -through the rocks to a dark cave located to the north. Off to the -northeast, you can see the southern end of what appears to be a large -mountain range. -~ -40 c 4 -D0 -~ -~ -0 -1 4010 -D2 -~ -~ -0 -1 4001 -S -#4010 -The Cave~ - You are standing in a small cave, about fifteen feet across at -the widest point and about forty feet long. Off to the south you -sense fresh air and you surmise that the entrance must be located -off in that direction. To the north a small tunnel continues into -the mountain. -~ -40 ad 2 -D0 -~ -~ -0 -1 4011 -D2 -~ -~ -0 -1 4002 -S -#4011 -The Tunnel~ - You force your way into a narrow tunnel, aided by the wet walls -which help you slide through the passageway. The smell of mouldy -moss is growing greater the farther north you head, but you can smell -fresh air off to the south as a light breeze wafts past you. -~ -40 ad 3 -D0 -~ -~ -0 -1 4014 -D2 -~ -~ -0 -1 4010 -S -#4012 -The Tunnel~ - You find yourself at a turn in this narrow tunnel. The tunnel -appears to open up to the north into a cave of some sort while to -the east it leads onwards through the mountain. -~ -40 ad 3 -D0 -~ -~ -0 -1 4016 -D1 -~ -~ -0 -1 4013 -S -#4013 -The Tunnel~ - Standing in the middle of the dusty floor of this tunnel, you can -see that it is not a highly travelled passageway. It looks to lead -in an east-west direction. -~ -40 ad 3 -D1 -~ -~ -0 -1 4014 -D3 -~ -~ -0 -1 4012 -S -#4014 -The Tunnel~ - You find yourself at a small intersection of sorts in this tunnel. -The main tunnel appears to curve from south to west but there is an -entrance into a cave to the north. The entrance itself looks to be -unnatural and much more recent than the tunnel or even the cave. -~ -40 ad 3 -D0 -~ -~ -0 -1 4018 -D2 -~ -~ -0 -1 4011 -D3 -~ -~ -0 -1 4013 -S -#4015 -The Tunnel~ - You clamber on through this narrow tunnel. The walls are damp -with condensation and the weight of the rock above you is beginning -to make you feel almost claustrophobic. The tunnel makes a jagged -turn from west to north here. -~ -40 ad 3 -D0 -~ -~ -0 -1 4019 -D3 -~ -~ -0 -1 4014 -S -#4016 -The Large Cave~ - You find yourself in a fairly large cave. Large enough that the -eastern and western ends are almots completely shrouded in darkness. -A small tunnel breaks through the southern wall, and it too is full -of shadows. -~ -40 ad 2 -D1 -~ -~ -0 -1 4017 -D2 -~ -~ -0 -1 4012 -D3 -~ -~ -0 -1 4023 -S -#4017 -The Large Cave~ - You move along the cave to the west end of it and find that there -appears to be no other exit from here. The walls are fairly smooth -and look to have been naturally carved out of the rock by the passage -of water. -~ -40 ad 2 -D3 -~ -~ -0 -1 4016 -S -#4018 -The Cave~ - You find yourself at the southern end of a cave as it begins -to turn into a tunnel which leads off to the south. The cave -continues northwards deeper into the darkness. -You notice a large pile of bones in the corner. -~ -40 ad 2 -D0 -~ -~ -0 -1 4025 -D2 -~ -~ -0 -1 4014 -E -pile bones~ -You had better watch out - some of the bones are human! -~ -S -#4019 -The Tunnel~ - You stand in the middle of a fairly wide passageway that leads -in a north-south direction. The walls are quite smooth, almost as -if a river had gouged them out of the earth. -~ -40 ad 3 -D0 -~ -~ -0 -1 4026 -D2 -~ -~ -0 -1 4015 -S -#4020 -The Hole~ - You are standing in a small alcove off the main tunnel. There is -a fairly wide hole broken through the floor of the alcove. The only -other exit is to the north. -~ -40 acd 3 -D0 -~ -~ -0 -1 4027 -D5 -~ -~ -0 -1 4064 -S -#4021 -The Hole~ - As you stand at the end of this tunnel, you notice a large hole -sitting in the floor by the northwestern corner of the walls. The -tunnel itself leads off towards the east. The air here feels very -damp and you feel like your clothes are becoming sticky with sweat. -~ -40 acd 3 -D1 -~ -~ -0 -1 4022 -D5 -~ -~ -0 -1 4115 -S -#4022 -The Damp Tunnel~ - You are standing in the middle of a damp tunnel. The moisture -in the air is so thick that you can almost seem it seeping into your -clothes. The tunnel continues to the north and west. A large cave -opens up to the east. -~ -40 ad 3 -D0 -~ -~ -0 -1 4024 -D1 -~ -~ -0 -1 4023 -D3 -~ -~ -0 -1 4021 -S -#4023 -The Large Cave~ - You are in the western part of the large cave, to the east you can -see a tunnel. The air near the tunnel entrance is heavy with moisture, -giving you a feeling as if you were standing in the rain. The walls -of the cave are almost totally shrouded in darkness and shadow as is -the southern end of the cavern. -~ -40 ad 2 -D1 -~ -~ -0 -1 4016 -D3 -~ -~ -0 -1 4022 -S -#4024 -The Damp Tunnel~ - The tunnel you are in now is very humid, and the air seems to almost -hang with moisture. The walls drip with an almost constant water flow, -and the ground is covered with small pools of stagnent water. - The tunnel leads away to the south, and to the west you can feel that -the air is even damper than here. -~ -40 ad 3 -D2 -~ -~ -0 -1 4022 -D3 -~ -~ -0 -1 4059 -S -#4025 -The Cave~ - You find yourself standing in the northern end of a reasonably -large cave. The cave wall to the east has an opening that appears -to lead to a junction of several tunnels. -~ -40 ad 2 -D1 -~ -~ -0 -1 4026 -D2 -~ -~ -0 -1 4018 -S -#4026 -The Many Tunnels~ - You find yourself standing in the midst of an intersection -of numerous tunnels. There is a musty smell emanating from the -tunnel to the north, whilst the one to the west appears to open -up almost immediately into a cave. The tunnels to the south and -east are totally shrouded in darkness. -~ -40 ad 3 -D0 -~ -~ -0 -1 4028 -D1 -~ -~ -0 -1 4027 -D2 -~ -~ -0 -1 4019 -D3 -~ -~ -0 -1 4025 -S -#4027 -The Tunnel~ - You find yourself at an elbow turn in the tunnel as it turns to the -west and north. You spot a small alcove hidden in the shadows just to -the south of you, and you can feel a breeze coming from somewhere to the -north you believe. -~ -40 ad 3 -D0 -~ -~ -0 -1 4029 -D2 -~ -~ -0 -1 4020 -D3 -~ -~ -0 -1 4026 -S -#4028 -The Smelly Tunnel~ - You are in a fairly small north-south leading tunnel. There -is a a small light visible off to the north. As you stop for a -moment, you notice a strange smell from the north. -~ -40 ad 3 -D0 -~ -~ -0 -1 4030 -D2 -~ -~ -0 -1 4026 -S -#4029 -The Cave~ - You are in a cave that is filled with fresh air, you sense the -wind blowing from the north. To the south you see a small tunnel -continue into the mountain. -~ -40 ad 2 -D0 -~ -~ -0 -1 4031 -D2 -~ -~ -0 -1 4027 -S -#4030 -The Light Cave~ - You are in a light cave, through a hole large above you, you -see the sky. A small tunnel to the south is the only way out. -You notice the source of the strange smell, all around you there -are corpses of several monsters. -~ -40 d 2 -D2 -~ -~ -0 -1 4028 -E -corpse corpses~ -Looking at the corpses lying around the cave, they all appear to -have been torn to shreds by some large creature. As a further -not too unexpected point to note, they all smell terrible. -~ -S -#4031 -The Valley~ - You are in a small valley, surrounded by hills and a mountain to -the south. In the mountain there is a cave. To the north you can -enter the hills. There is a small trail leading up a steep hill to -the east. -~ -40 0 2 -D0 -~ -~ -0 -1 4032 -D1 -You spot a small trail leading into the hills to the east. -~ -~ -0 -1 4045 -D2 -~ -~ -0 -1 4029 -S -#4032 -The Foothills~ - You are on a winding path that leads through the foothills on the -north side of Mount Moria. The path continues north. -~ -40 0 4 -D0 -~ -~ -0 -1 4033 -D2 -~ -~ -0 -1 4031 -S -#4033 -The Intersection In The Foothills~ - You stand at a point by a small path that splits off here. The -path continues north and south while a rough trail leads east into -the mountains. -~ -40 0 4 -D0 -~ -~ -0 -1 4034 -D1 -~ -~ -0 -1 4037 -D2 -~ -~ -0 -1 4032 -S -#4034 -The Grassy Area In The Foothills~ - The grass here is unusually high. You notice several areas where -someone or something large has crushed spots of it down. Several -very large rocks litter this area. You can go north towards the end -of the foothills, west to go deeper into the foothills, or south to -a small path intersection. -~ -40 0 2 -D0 -~ -~ -0 -1 4035 -D2 -~ -~ -0 -1 4033 -D3 -~ -~ -0 -1 4042 -S -#4035 -At The Foothills' End~ - You find yourself standing at the northern edge of the foothills -where they meet the plains which lie to the north. You can head back -into the foothills to the south or the plains to the north. -~ -40 0 4 -D0 -~ -~ -0 -1 4036 -D2 -~ -~ -0 -1 4034 -S -#4036 -The Plains~ - You are in the plains. The path leads to the south. As you look -around you notice a small almost invisible trail leading away to the -west towards a copse of trees. -~ -40 0 2 -D2 -~ -~ -0 -1 4035 -D3 -~ -~ -0 -1 4075 -S -#4037 -The Path Through The Foothills~ - You stand on a path that leads through the foothills in an -east-west direction. Some distance off to the west you can see -a small intersection of paths and off to the east you see that -the path seems to come to an end as part of the mountain chain -juts out of the ground, blocking your view of the sky. -~ -40 0 4 -D1 -~ -~ -0 -1 4038 -D3 -~ -~ -0 -1 4033 -S -#4038 -The Base Of The Mountain~ - You find yourself standing at the bottom of a large mountain in -the mountain chain which begins at Mount Moria and stretches north -towards the top of the world. A small path leads off through the -foothills towards the west, where you can see plains quite a ways -away. To the east you spot a small worn trail leading up the side -of the mountain. -~ -40 0 5 -D1 -~ -~ -0 -1 4039 -D3 -~ -~ -0 -1 4037 -S -#4039 -A Trail Up The Mountain~ - You stand partway up the mountainside on a narrow yet well worn -trail. The trail curves its way up the side of the mountain towards -the top and westwards down the mountain into the foothills below. -~ -40 0 5 -D3 -~ -~ -0 -1 4038 -D4 -~ -~ -0 -1 4040 -S -#4040 -The Mountain Top~ - You find yourself at what is essentially the summit of this mountain. -It certainly seemed taller from the ground didn't it? The plateau you -stand on is close to thirty metres across and a small gouge in the north -side of it looks to lead to a small cavern. A small trail leads down -towards a valley that was hidden away on the east side of the mountain. -~ -40 0 5 -D0 -~ -~ -0 -1 4041 -D1 -~ -~ -0 -1 4076 -D5 -~ -~ -0 -1 4039 -S -#4041 -The Lion's Den~ - Following the gouge down to the cave entrance, you clamber through -the small entranceway only to find yourself in what appears to be the -living den of a large carnivorous animal! -~ -40 ad 2 -D2 -~ -~ -0 -1 4040 -S -#4042 -The Level Foothills~ - You continue to move through the foothills and notice that off in -the distance to the west, you can see a rather large cave entrance in -the side of a large hill. The hill seems to jut up from the rest of -the foothills quite unnaturally. A path leads off towards the east -as it seems to begin from nothing here. -~ -40 0 2 -D1 -~ -~ -0 -1 4034 -D3 -~ -~ -0 -1 4043 -S -#4043 -The Cave Entrance~ - You stand in a large tunnel, much larger than it seemed from -the outside. The ceiling is at least twenty feet above, and the -width of the tunnel runs at least fifteen feet. You can feel the -fresh air coming from the east, and off to the west, it looks to -lead into darkness. -~ -40 d 2 -D1 -~ -~ -0 -1 4042 -D3 -~ -~ -0 -1 4044 -S -#4044 -The Hill Giant Cave~ - You find yourself inside a rather large cavern. The ceiling stands -at least twenty five feet above you, if not more. The walls are so far -away, that the shadows of the room obscure them almost completely. Out -of all of the grandeur in this cave however, nothing seems to catch your -eye quite as much as the enormous table standing in the middle of the -sandy floor. It stands tall enough for you to walk under it without the -need to hunch over. A large tunnel leads out of the eastern wall of the -cavern. -~ -40 ad 2 -D1 -~ -~ -0 -1 4043 -S -#4045 -The Steep Trail~ - This trail leads up a steep hill to a point where it levels out as -it begins to pass between the mountains that surround you. It continues -through the hills to the east and heads down to the valley to the west. -~ -40 c 5 -D1 -The rocky trail continues. -~ -~ -0 -1 4046 -D3 -The valley lies at the bottom of the steep trail. -~ -~ -0 -1 4031 -S -#4046 -Between The Mountains~ - The trail between the mountains seems almost endless as you continue -to trek along it. It continues to both the east and west. -~ -40 c 5 -D1 -The trail continues eastwards. -~ -~ -0 -1 4047 -D3 -The trail continues westwards. -~ -~ -0 -1 4045 -S -#4047 -The Foothills~ - After a long trek, you find yourself in the foothills again. You spot -a narrow trail leading away to the northwest not too far distant to the -west. -~ -40 c 5 -D1 -You can head towards the narrow trail this way. -~ -~ -0 -1 4049 -D3 -The trail leading back through the mountains seems to go on forever. -~ -~ -0 -1 4046 -S -#4048 -The Foothills~ - A short trek through the foothills and you find yourself facing a -trail that leads between the mountains to the west. The trail through -them looks to be very long and probably quite tiring. You spot a narrow -trail leading away to the northwest not too far distant to the west. -~ -40 c 5 -D1 -You can head towards the narrow trail this way. -~ -~ -0 -1 4049 -D3 -The trail leading through the mountains seems to go on forever. -~ -~ -0 -1 4046 -S -#4049 -The Foothills~ - You are at a point on the trail where it turns slowly from an -almost straight westwards trail into a trail meandering towards -the northwest. -~ -40 c 4 -D0 -A small trail leads away to the northwest. -~ -~ -0 -1 5628 -D3 -A trail heads towards the mountains to the west. -~ -~ -0 -1 4048 -S -#4050 -The Tunnel~ - You are at a bend in the tunnel here. It turns from an eastwards -heading to a southwards one. The walls are cold and seem to be damp -with moisture. you can see some greenish moss growing up near the -roof of the passageway on the northern wall. -~ -40 ad 3 -D1 -~ -~ -0 -1 4051 -D2 -~ -~ -0 -1 4053 -S -#4051 -The Tunnel~ - Standing in this part of the tunnel, you notice that not only does -the tunnel get suddenly narrower, but the floor does not seem to be -nearly as smooth as it was before. In fact, the floor drops almost -five feet in jagged steps as you look eastward. The western path -seems to be quite smooth however. -~ -40 ad 3 -D1 -~ -~ -0 -1 4052 -D3 -~ -~ -0 -1 4050 -S -#4052 -The Tunnel~ - Continuing along the tunnel, you find that the floor has begun -to smooth itself out once more. Looking about, you notice a small -spring of water bubbling up near the southern wall. -~ -40 ad 3 -D1 -~ -~ -0 -1 4100 -D3 -~ -~ -0 -1 4051 -S -#4053 -The Tunnel~ - You continue along the tunnel to find yourself at a right -angle turn. The passage leads north and east from here. The -way to the north seems to be a longer tunnel which continues -on through the gloom of the underearth. The way to the east -is a fresh change from what would normally be found this far -underground in that the tunnel seems to open up into a fairly -large and well lit cave. -~ -40 ad 3 -D0 -~ -~ -0 -1 4050 -D1 -~ -~ -0 -1 4054 -S -#4054 -The Light Cave~ - The cave you stand in now is lit by an eerie flickering light, -which probably comes from the enormous fire which is burning a -short distance to the south in what looks to be the middle of -the cave. The flickering light creates some really strange and -almost frightening shadows on the walls, almost hiding the two -tunnels that lead away from here, one to the east and one to the -west. -~ -40 d 2 -D1 -~ -~ -0 -1 4055 -D2 -~ -~ -0 -1 4056 -D3 -~ -~ -0 -1 4053 -S -#4055 -The Maze~ - You stand in yet another small and damp tunnel. The ceiling hangs -quite low overhead and the passage twists off into darkness. The only -exit from here looks to be off to the west. -~ -40 ad 3 -D3 -~ -~ -0 -1 4054 -S -#4056 -The Light Cave~ - The cave you stand in now is lit by an eerie flickering light, -which comes from the enormous fire which is burning right in -front of you in the middle of this large cave. The fire gives -off more than enough light to see both the north and south ends -of the cave. -~ -40 d 2 -D0 -~ -~ -0 -1 4054 -D2 -~ -~ -0 -1 4061 -E -fire~ -The fire seems to have been burning for quite a long time. The -ceiling is covered with soot from the smoke, and ashes are littered -all over the floor of the cave. -~ -S -#4057 -The Maze~ - You stand in yet another small and damp tunnel. The ceiling hangs -quite low overhead and the passage twists off into darkness. The only -exits from here look to be off to the north and south. -~ -40 ad 3 -D0 -~ -~ -0 -1 4055 -D2 -~ -~ -0 -1 4062 -S -#4058 -The Maze~ - You stand in yet another small and damp tunnel. The ceiling hangs -quite low overhead and the passage twists off into darkness. The only -exits from here look to be off to the south and west. -~ -40 ad 3 -D2 -~ -~ -0 -1 4063 -D3 -~ -~ -0 -1 4057 -S -#4059 -The Tunnel~ - You are standing in a tunnel deep inside the heart of Mount Moria. A -small rivulet of water runs alongside the wall to the north as the tunnel -seems to lead slightly down towards the east. - The tunnel continues on to the east as it plunges deeper into the earth, -and upwards a bit towards the west where the air seems to be quite damp. -~ -40 acd 3 -D1 -~ -~ -0 -1 4060 -D3 -~ -~ -0 -1 4024 -S -#4060 -The Tunnel~ - You stand in a section of this small tunnel which seems to be -almost level. There is a small pool of water collecting beside -the north wall indicating perhaps a low spot on the floor. The -pool is being fed by a small rivulet which is coursing along the -northern wall from the west, but yet the water level in the pool -does not seem to be changing. - Looking either way down the tunnel, you can see that the tunnel -climbs to the west, and to the east, a strange flickering light -shows that the tunnel opens up into a cave of sorts. -~ -40 ad 3 -D1 -~ -~ -0 -1 4061 -D3 -~ -~ -0 -1 4059 -S -#4061 -The Light Cave~ - The cave you stand in now is lit by an eerie flickering light, -which probably comes from the enormous fire which is burning a -short distance to the north in what looks to be the middle of -the cave. The flickering light creates some really strange and -almost frightening shadows on the walls, almost hiding the two -tunnels that lead away from here, one to the west and one to the -south. -~ -40 d 2 -D0 -~ -~ -0 -1 4056 -D2 -~ -~ -0 -1 4065 -D3 -~ -~ -0 -1 4060 -S -#4062 -The Maze~ - You stand in yet another small and damp tunnel. The ceiling hangs -quite low overhead and the passage twists off into darkness. The only -exits from here look to be off to the east and west. -~ -40 ad 3 -D1 -~ -~ -0 -1 4063 -D3 -~ -~ -0 -1 4061 -S -#4063 -The Maze~ - You stand in yet another small and damp tunnel. The ceiling hangs -quite low overhead and the passage twists off into darkness. The only -exits from here look to be off to the east and north. -~ -40 ad 3 -D0 -~ -~ -0 -1 4058 -D1 -~ -~ -0 -1 4064 -S -#4064 -The Tunnel~ - You stand in a small chamber beneath the earth. The chamber -closes down to tunnel size to the west as the only obvious exit -leads away in that direction. Before heading off that way, you -decide to look around the cave. The walls are slightly damp to -the touch, and the ceiling is very smooth. Almost right in the -centre of the ceiling, a well rounded hole has been made. -~ -40 ad 3 -D3 -~ -~ -0 -1 4063 -D4 -~ -~ -0 -1 4020 -S -#4065 -The Maze~ - You stand in yet another small and damp tunnel. The ceiling hangs -quite low overhead and the passage twists off into darkness. The only -exits from here look to be off to the east and north. To the north, -you can see the entrance to what looks to be a large and well lit cave. -~ -40 ad 3 -D0 -~ -~ -0 -1 4061 -D1 -~ -~ -0 -1 4066 -S -#4066 -The Maze~ - You stand in yet another small and damp tunnel. The ceiling hangs -quite low overhead and the passage twists off into darkness. The only -exits from here look to be off to the east, south, and north. To the -south, the tunnel looks to open up into a cavern. -~ -40 ad 3 -D0 -~ -~ -0 -1 4062 -D1 -~ -~ -0 -1 4067 -D2 -~ -~ -0 -1 4069 -S -#4067 -The Maze~ - You stand in yet another small and damp tunnel. The ceiling hangs -quite low overhead and the passage twists off into darkness. The only -exits from here look to be off to the west and north. -~ -40 ad 3 -D0 -~ -~ -0 -1 4063 -D3 -~ -~ -0 -1 4066 -S -#4068 -The Large Cave~ - You find yourself in what is perhaps the largest cave you -have ever been in. It stretches through the darkness to the -east and south. The cave is nigh filled with echoes created -by the sound of your breathing. Stalactites and stalagmites -hang down from the ceiling and climb upwards from the ground -of the cavern respectively. -~ -40 ad 2 -D1 -~ -~ -0 -1 4069 -D2 -~ -~ -0 -1 4070 -S -#4069 -The Large Cave~ - You find yourself in what is perhaps the largest cave you -have ever been in. It stretches through the darkness to the -west and south. The cave is nigh filled with echoes created -by the sound of your breathing. Stalactites and stalagmites -hang down from the ceiling and climb upwards from the ground -of the cavern respectively. A narrow tunnel leads away from -the cave to the north. -~ -40 ad 2 -D0 -~ -~ -0 -1 4066 -D2 -~ -~ -0 -1 4071 -D3 -~ -~ -0 -1 4068 -S -#4070 -The Large Cave~ - You find yourself in what is perhaps the largest cave you -have ever been in. It stretches through the darkness to the -east and north. The cave is nigh filled with echoes created -by the sound of your breathing. Stalactites and stalagmites -hang down from the ceiling and climb upwards from the ground -of the cavern respectively. -~ -40 ad 2 -D0 -~ -~ -0 -1 4068 -D1 -~ -~ -0 -1 4071 -S -#4071 -The Large Cave~ - You find yourself in what is perhaps the largest cave you -have ever been in. It stretches through the darkness to the -west and south. The cave is nigh filled with echoes created -by the sound of your breathing. Stalactites and stalagmites -hang down from the ceiling and climb upwards from the ground -of the cavern respectively. A narrow tunnel leads away from -the cave to the east. -~ -40 ad 2 -D0 -~ -~ -0 -1 4069 -D1 -~ -~ -0 -1 4072 -D3 -~ -~ -0 -1 4070 -S -#4072 -The Tunnel~ - You stand in a narrow tunnel. It makes a turn from east to south -here as it heads through the rock of the mountain. The western wall -of the tunnel looks to have broken through a small, natural crack in -the rock to lead into what appears to be a fairly large cave. -~ -40 ad 3 -D1 -~ -~ -0 -1 4073 -D2 -~ -~ -0 -1 4074 -D3 -~ -~ -0 -1 4071 -S -#4073 -The End Of The Tunnel~ - The tunnel comes to a sudden halt here. How very bizarre. The -only exit is back to the west, where the tunnel leads back through -the mountain. There is absolutely nothing of any interest down at -the end of this passageway either. How odd. -~ -40 ad 3 -D3 -~ -~ -0 -1 4072 -S -#4074 -The Hole~ - You are at a small hole in the floor. Alas, you can only leave -north because to leave down into the unknown, you must be able to -fit through the hole, which is far too small for you! -~ -40 ad 3 -D0 -~ -~ -0 -1 4072 -D5 -The small hole in the floor refuses to give up its secrets about -what can be found below. -~ -~ -0 -1 -1 -E -hole floor~ -The small hole in the floor refuses to give up its secrets about -what can be found below. -~ -S -#4075 -The Copse Of Trees~ - Standing in this copse of trees gives you an eerie feeling. Off to -the east you can see the plains, and just to the north a strange shadow -seems to be changing shape constantly and almost seems to beckon you to -enter it. -~ -40 0 4 -D0 -There is a strange shadow forming before you. -~ -~ -0 -1 2500 -D1 -~ -~ -0 -1 4036 -S -#4076 -On A Mountain Trail~ - You find yourself on a mountain trail twisting down towards a small -hidden valley located in the shadow of another mountain a short distance -to the east. The trail is fairly rough going and looks to dip down into -the small valley before climbing up the side of the other mountain. As -you look at the valley from a closer vantage point, you realize that it -is much smaller than you had expected, being maybe thirty feet long. It -is quite surprising how deceptive distances can be this high up in the -mountains, isn't it? -~ -40 0 5 -D3 -~ -~ -0 -1 4040 -D5 -~ -~ -0 -1 4077 -S -#4077 -In The Hidden Valley~ - This valley seems to be a complete waste of a climb down the -mountainside. Of course, there is always the carefully hidden -trail that you just noticed on the eastern side of the valley, -leading up the eastern mountain that is blocking most of the sky -from you. -~ -40 0 5 -D1 -~ -~ -0 -1 6400 -D4 -~ -~ -0 -1 4076 -S -#4078 -In The Hidden Valley~ - This small valley is hidden away in the shadow of the large -mountain to the east. The trail leading up it to the east seems -to vanish before your eyes, but you are quickly able to find it -once again. A trail leads up the mountain to the west as well. -~ -40 0 5 -D1 -~ -~ -0 -1 6400 -D4 -~ -~ -0 -1 4076 -S -#4100 -The Tunnel~ - As you continue along this tunnel which heads deeper and deeper into -the earth, you notice that the tunnel must be a lot steeper than you -previously expected as there is a small rivulet of water gushing down -the one side of the tunnel. The tunnel appears to extend straight to -the east for quite some distance. -~ -40 acd 3 -D1 -~ -~ -0 -1 4101 -D3 -~ -~ -0 -1 4052 -S -#4101 -The Long Tunnel~ - The tunnel seems to be slightly sloped here as it continues in its -east-west direction. The tunnel walls are far apart, almost allowing -for four people to travel abreast with ease. The walls do not seem to -be very damp, but there is a small rivulet running along the northern -wall of the tunnel. -~ -40 ad 3 -D1 -~ -~ -0 -1 4102 -D3 -~ -~ -0 -1 4100 -S -#4102 -The Long Tunnel~ - As you travel along this long tunnel, you begin to wonder just -how long it is. The walls are fairly far apart, but you can see -that they begin to close in rather rapidly to the east. In fact, -the manner in which they come together almost reminds you of a -funnel. -~ -40 ad 3 -D1 -~ -~ -0 -1 4103 -D3 -~ -~ -0 -1 4101 -S -#4103 -The Long Tunnel~ - You are standing in a long east-west tunnel. It is not all that -wide at this point, perhaps wide enough for two people to stand side -by side without impeding each other. Off to the west it appears that -the tunnel opens up some more while to the east it dives further down -into the earth, and you can see a small hole about two feet in diameter -about waist height in the southern wall. -~ -40 ad 3 -D1 -~ -~ -0 -1 4104 -D2 -~ -~ -0 -1 4106 -D3 -~ -~ -0 -1 4102 -S -#4104 -The Long Tunnel~ - You find yourself in a small bulbous cavern ending. The somewhat -circular 'room' is about thirty feet in diameter and you can see one -exit from it; a tunnel leading sharply upwards from the western wall. -The walls of this cavern are quite indistinct and you cannot see any -moss or dampness on them whatsoever. -~ -40 ad 3 -D3 -~ -~ -0 -1 4103 -S -#4105 -The Golden Cave~ - You are standing in what appears to be the north-east corner of -this large cavern. The cave is lit by the eerie, soft, golden light -which looks to be emanating from the walls themselves. The cave -itself is enormous, extending quite a distance to the west and south. -~ -40 d 1 -D2 -~ -~ -0 -1 4108 -D3 -~ -~ -0 -1 4106 -E -light gold golden~ -It looks good, but as you look closely you notice that it has no value. -~ -S -#4106 -The Golden Cave~ - You are standing in what appears to be the north-west corner of -this large cavern. The cave is lit by the eerie, soft, golden light -which looks to be emanating from the walls themselves. The cave -itself is enormous, extending quite a distance to the east and south. -There is a hole in the northern wall, about two feet in diameter. -All that can be seen through the hole is darkness. -~ -40 d 1 -D0 -~ -~ -0 -1 4103 -D1 -~ -~ -0 -1 4105 -D2 -~ -~ -0 -1 4109 -E -light gold golden~ -It looks good, but as you look closely you notice that it has no value. -~ -S -#4107 -The Passage~ - You are standing at the elbow turn of a small passageway. It turns -quite sharply to the south and west. To the south, it appears that the -passage continues, but to the west you can see what almost appears to -be a golden light. -~ -40 ad 3 -D2 -~ -~ -0 -1 4113 -D3 -~ -~ -0 -1 4108 -S -#4108 -The Golden Cave~ - You are standing in what appears to be the south-east corner of -this large cavern. The cave is lit by the eerie, soft, golden light -which looks to be emanating from the walls themselves. The cave -itself is enormous, extending quite a distance to the west and north. -A crack in the wall to the east appears to lead into a passageway of -sorts. -~ -40 d 1 -D0 -~ -~ -0 -1 4105 -D1 -~ -~ -0 -1 4107 -D3 -~ -~ -0 -1 4109 -E -light gold golden~ -It looks good, but as you look closely you notice that it has no value. -~ -S -#4109 -The Golden Cave~ - You are standing in what appears to be the middle of the western -wall of this large cavern. The cave is lit by the eerie, soft, golden -light which looks to be emanating from the walls themselves. The cave -itself is enormous, extending quite a distance to the east, south, -and north. -~ -40 d 1 -D0 -~ -~ -0 -1 4106 -D1 -~ -~ -0 -1 4108 -D2 -~ -~ -0 -1 4114 -E -light gold golden~ -It looks good, but as you look closely you notice that it has no value. -~ -S -#4110 -The Hole~ - You find yourself standing in a small alcove as the tunnel comes to -a somewhat sudden end. Looking about you suddenly notice a rather big -hole in the floor of the tunnel. In fact, it seems that another step -forward and you would have fallen into it. - The tunnel itself leads to the west, and looking down into the hole -in the floor reveals little beyond the fact that it seems to be very -deep and very dark. There is a very strange smell emanating from the -hole, it almost smells like something down there is rotting. -~ -40 acd 3 -D3 -~ -~ -0 -1 4111 -D5 -Before you head down, you drop a rock to see how deep the hole is... -After about five minutes, it still hasn't hit bottom. Thus, for -reasons of sanity, you decide not to go this way. -~ -~ -0 -1 -1 -E -hole floor~ -Before you head down, you drop a rock to see how deep the hole is... -After about five minutes, it still hasn't hit bottom. Thus, for -reasons of sanity, you decide not to go this way. -~ -S -#4111 -The Tunnel~ - The walls of this small tunnel are almost completely covered in a -strange orange moss that flakes off to the touch. The tunnel leads -in an east-west direction and the air within is very damp and very -stagnant. There is no detectable breeze at all but a strange smell -emanates from the east. There is a small, almost unnoticed hole in -the southern wall. -~ -40 ad 3 -D1 -~ -~ -0 -1 4110 -D2 -The hole looks very small. You will probably have to crawl through -it. -~ -~ -0 -1 4126 -D3 -~ -~ -0 -1 4112 -E -moss walls wall~ -The moss on the walls is orange. When you touch it, it feels very -scrubby and flakes off to the touch leaving a slight orange tinge -on your fingertips. -~ -S -#4112 -The Tunnel~ - The tunnel in which you currently stand is fairly wide (very wide -relative to almost all the other tunnels around here it seems) and -yet the air is quite damp. The walls have a thin coating of moisture -upon them which looks and feels somewhat oiley. The tunnel leads in -an east-west direction. -~ -40 ad 3 -D1 -~ -~ -0 -1 4111 -D3 -~ -~ -0 -1 4113 -E -wall walls moisture coat coating~ -The coating of moisture on the walls has strange little patterns of -colour weaving through it, almost as if someone had spilled oil on -a horizontal water surface. -~ -S -#4113 -The Passage~ - This north-south passageway looks to be a natural creation, except -that the walls looks to have been roughly hewn in order to smooth them -a somewhat to make passage easier. The walls still meander as the -passage makes its way deeper into the bowels of the earth. A bizarre -shadow in the eastern wall leads you to suspect that a small passage -meets the tunnel there. -~ -40 ad 3 -D0 -~ -~ -0 -1 4107 -D1 -~ -~ -0 -1 4112 -D2 -~ -~ -0 -1 4116 -S -#4114 -The Golden Cave~ - You are standing in what appears to be the south-west corner of -this large cavern. The cave is lit by the eerie, soft, golden light -which looks to be emanating from the walls themselves. The cave -itself is enormous, extending quite a distance to the north and a -strange shadow formation seems to indicate a passage entrance to the -west. -~ -40 d 1 -D0 -~ -~ -0 -1 4109 -D3 -~ -~ -0 -1 4115 -E -light gold golden~ -It looks good, but as you look closely you notice that it has no value. -~ -S -#4115 -The Dark Passage~ - You find yourself in a small passage ending. It is quite dark in here. -As you look about the damp walls, you notice that the passageway almost -appears to curve upwards towards the ceiling. Looking up, you notice that -there is a small hole, just large enough to pass through. Looking closely -at the curved part of the wall, it appears that someone (or something) has -carved small handholds into the wall to ease passage upwards. The tunnel -itself leads off to the east. -~ -40 ad 3 -D1 -~ -~ -0 -1 4114 -D4 -~ -~ -0 -1 4021 -S -#4116 -The Passage~ - You find yourself in quite an ordinary passageway which leads north -and south. It looks to be wide enough for two people to walk side by -side with plenty of room. The passage appears to be almost rectangular -in form. Far off to the south you can see the pinpoint of a light. -~ -40 ad 3 -D0 -~ -~ -0 -1 4113 -D2 -~ -~ -0 -1 4120 -E -light~ -Well, you can't see where it comes from... -~ -S -#4117 -The Secret Tunnel~ - You are currently standing in a narrow passageway that does not seem -to have been heavily visited at any time. It leads northwards towards -a lit room and south towards what appears to be a chamber. -~ -40 ad 3 -D0 -~ -~ -0 -1 4114 -D2 -~ -~ -0 -1 4122 -S -#4118 -The Cave~ - This rather large cave is surprisingly very well lit. There are -about twenty torches spread about the room set in sconces which hang -several feet above your head. The dancing shadows created by the -flickering flames catch your eyes for a few minutes and threaten to -hold you entranced. - Looking about the cave, it appears to continue to the west and -south. In the north wall a strange vertical crack looks as if it may -lead somewhere. -~ -40 d 1 -D0 -It looks like quite the tight fit. -~ -~ -0 -1 4126 -D2 -~ -~ -0 -1 4123 -D3 -~ -~ -0 -1 4119 -S -#4119 -The Cave~ - This rather large cave is surprisingly very well lit. There are -about twenty torches spread about the room set in sconces which hang -several feet above your head. The dancing shadows created by the -flickering flames catch your eyes for a few minutes and threaten to -hold you entranced. - Looking about the cave, it appears to continue to the east and -south. -~ -40 d 1 -D1 -~ -~ -0 -1 4118 -D2 -~ -~ -0 -1 4124 -D3 -The rock wall to the west looks odd for some strange reason. -~ -wall rock~ -1 -1 4121 -S -#4120 -The Passage~ - You stand in a fairly normal passage, slightly wider than is -necessary for one person, but not quite wide enough for two. The -ceiling dips here rather surprisingly, or wait, is that because the -floor climbs upwards toward it? The tunnel seems to narrow slightly -more as you look to the south, and widens up somewhat as you look -northward. The light to the south continues to flicker. -~ -40 ad 3 -D0 -~ -~ -0 -1 4116 -D2 -~ -~ -0 -1 4125 -E -light~ -It nearly is enough to light the passage. -~ -S -#4121 -The Secret Tunnel~ - You stand in a very unnatural hallway, about ten feet across and -about ten or twelve feet up. The passageway funnels down towards -the west where it leads to a doorway that looks to be about five feet -across. The east end of the tunnel comes to a sudden end at a very -smooth rock wall. -~ -40 ad 3 -D1 -The rock wall to the east looks like it might be able to be moved. -~ -wall rock~ -1 -1 4119 -D3 -~ -~ -0 -1 4122 -E -wall rock~ -The rock wall to the east looks like it might be able to be moved. -~ -S -#4122 -The Secret Chamber~ - You stand in a small chamber that you never would have thought -could exist. This small, almost perfectly round cave does not -appear to be a natural formation at all, since the walls are far -too smooth and the doorways to the north and east are both almost -exactly five feet wide and eleven feet tall. -~ -40 ad 3 -D0 -~ -~ -0 -1 4117 -D1 -~ -~ -0 -1 4121 -S -#4123 -The Cave~ - This rather large cave is surprisingly very well lit. There are -about twenty torches spread about the room set in sconces which hang -several feet above your head. The dancing shadows created by the -flickering flames catch your eyes for a few minutes and threaten to -hold you entranced. - Looking about the cave, it appears to continue to the west and -north. -~ -40 d 1 -D0 -~ -~ -0 -1 4118 -D3 -~ -~ -0 -1 4124 -S -#4124 -The Cave~ - This rather large cave is surprisingly very well lit. There are -about twenty torches spread about the room set in sconces which hang -several feet above your head. The dancing shadows created by the -flickering flames catch your eyes for a few minutes and threaten to -hold you entranced. - Looking about the cave, it appears to continue to the east and -north. There is a passageway leading out of the western wall of the -cave which looks to turn northwards. -~ -40 d 1 -D0 -~ -~ -0 -1 4119 -D1 -~ -~ -0 -1 4123 -D3 -~ -~ -0 -1 4125 -S -#4125 -The Passage~ - You are at the end of a narrow passage which leads away from -here to the north. The southern wall is bare and almost seems to -dance with the shadows created by the flickering light emanating -from the cave to the east. -~ -40 d 3 -D0 -~ -~ -0 -1 4120 -D1 -~ -~ -0 -1 4124 -S -#4126 -The Crawlway~ - You are in a very narrow crawlway. To back out of it, you would have -to move carefully in order to not catch anything on the jutting rocks of -the ceiling and walls. The diameter of the crawlway is about two feet, -and is a rather tight squeeze. You'd better hope that there aren't any -worms or similar creatures down this way since it might be difficult to -defend yourself in here. -~ -40 acdfgij 5 -D0 -You can see a small hole marking the north exit of the crawlway. -~ -~ -0 -1 4111 -D2 -You can see the light emanating from the southern exit of the crawlway. -~ -~ -0 -1 4118 -S -$ diff --git a/lc-mud/circle/world/wld/50.wld b/lc-mud/circle/world/wld/50.wld deleted file mode 100644 index f3fecdd8eef844b017c1b9e567f6d4a2ee85dac6..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/50.wld +++ /dev/null @@ -1,1483 +0,0 @@ -#5001 -A Long Tunnel~ - You encounter some rapids as you enter this tunnel cut out of -the mountains by the river. -~ -50 ad 7 -D1 -~ -~ -0 -1 5002 -D3 -There appear to be some bars here, making passage to the west -difficult. -~ -~ -0 -1 3205 -S -#5002 -A Long Tunnel~ - The tunnel branches off north. -~ -50 ad 7 -D0 -~ -~ -0 -1 5008 -D1 -~ -~ -0 -1 5003 -D3 -~ -~ -0 -1 5001 -S -#5003 -A Long Tunnel~ - The tunnel branches off south. -~ -50 ad 7 -D1 -~ -~ -0 -1 5004 -D2 -~ -~ -0 -1 5017 -D3 -~ -~ -0 -1 5002 -S -#5004 -A Tunnel Intersection~ - The tunnel branches off to the north and south. -~ -50 ad 7 -D0 -~ -~ -0 -1 5643 -D1 -~ -~ -0 -1 5005 -D2 -~ -~ -0 -1 5018 -D3 -~ -~ -0 -1 5003 -S -#5005 -An Underground Lake~ - You are floating on a jet-black underground lake fed by dripping -water and lime from above. The tunnel continues to the east and the -river leads back west. Leading upwards to the northwest is a roughly -hewn hallway. -~ -50 ad 7 -D0 -~ -~ -0 -1 5671 -D1 -~ -~ -0 -1 5006 -D2 -~ -~ -0 -1 5023 -D3 -~ -~ -0 -1 5004 -S -#5006 -A Long Narrow Tunnel~ - The tunnel rises sharply to the east. Another narrow tunnel -leads away to the north. -~ -50 adi 5 -D0 -~ -~ -0 -1 5016 -D1 -~ -~ -0 -1 5007 -D3 -~ -~ -0 -1 5005 -S -#5007 -A Wide Tunnel~ - The tunnel continues east and west. To the east the tunnel dives -down into a bright light. A small passage way opens to the north. -~ -50 ad 5 -D1 -~ -~ -0 -1 5026 -D3 -~ -~ -0 -1 5006 -S -#5008 -The Cave-In~ - You stand at the edge of a large pile of rubble created from the last -rockslide. -~ -50 ad 5 -D2 -~ -~ -0 -1 5002 -D5 -You can easily slide down the rocks without getting hurt. -~ -~ -0 -1 5009 -S -#5009 -At The Foot Of The Rubble~ - You are at the bottom of a large pile of rubble. A tunnel branches -off to the north and east. -~ -50 ad 5 -D0 -~ -~ -0 -1 5010 -D1 -~ -~ -0 -1 5012 -D4 -~ -~ -0 -1 5008 -S -#5010 -A Cave Entrance~ - You stand in the middle of a large and beautiful cave. A path leads -deeper into the darkness. -~ -50 ad 5 -D2 -~ -~ -0 -1 5009 -D5 -You look down into the cave. Bones are strewn about everywhere. -~ -~ -0 -1 5011 -S -#5011 -A Giant Cave~ - This cavern overwhelms you. The walls and ceiling seem miles away. -Bones of previous adventurers lie strewn on the cavern floor. There is -a passage that spirals downwards in the northeast corner of the cavern. -~ -50 ad 5 -D4 -~ -~ -0 -1 5010 -D5 -The passageway spirals down into the gloom. -~ -~ -0 -1 5100 -S -#5012 -A Narrow Bend~ - The tunnel turns to the south and west. -~ -50 ad 5 -D2 -~ -~ -0 -1 5013 -D3 -~ -~ -0 -1 5009 -S -#5013 -A Large Cave~ - You are standing in a large cave. Many furs are spread out on the floor. -~ -50 ad 5 -D0 -~ -~ -0 -1 5012 -D1 -~ -~ -0 -1 5014 -S -#5014 -A Damp Hallway~ - The walls here are extremely damp, as well as the floor. -~ -50 ad 5 -D1 -You hear drops of water. -~ -~ -0 -1 5015 -D3 -~ -~ -0 -1 5013 -S -#5015 -An Underground Pool~ - You are wading in a knee deep pool of lime-water. -~ -50 ad 6 -D1 -~ -~ -0 -1 5016 -D3 -~ -~ -0 -1 5014 -S -#5016 -A Damp Hallway~ - The walls of the tunnel are extremely damp here. The tunnel -leads sharply upwards to the south as it starts to get narrow. -~ -50 ad 5 -D2 -~ -~ -0 -1 5006 -D3 -You hear drops of water. -~ -~ -0 -1 5015 -S -#5017 -A Narrow Crawlway~ - This crawlway is just big enough for a human to crawl through or a -halfling to walk through. -~ -50 ad 5 -D0 -~ -~ -0 -1 5003 -D1 -~ -~ -0 -1 5018 -D2 -You smell the fragrant odor of fungus. -~ -~ -0 -1 5019 -S -#5018 -A Large Cavern~ - You have entered a very large cavern. The rock formations would amaze -almost any dwarf. -~ -50 ad 5 -D0 -~ -~ -0 -1 5004 -D3 -~ -~ -0 -1 5017 -S -#5019 -A Fungus Patch~ - As you walk through the fungus patch, you are shot at by many millions of -spores. You can hardly breathe. -~ -50 ad 5 -D0 -~ -~ -0 -1 5017 -D1 -The fragrant smell of fungus spores continues to the east. -~ -~ -0 -1 5020 -S -#5020 -The Fungus Path~ - As you walk along the path, millions of spores are shot at you. It is -difficult to breathe. -~ -50 ad 5 -D2 -A giant mushroom temple stands to the south. -~ -~ -0 -1 5021 -D3 -The fragrant smell of spores continues to the west. -~ -~ -0 -1 5019 -S -#5021 -The Fungus Temple~ - You find yourself standing inside of a giant mushroom. The inside -is decorated in the fashion of a temple. -~ -50 ad 5 -D0 -~ -~ -0 -1 5020 -D1 -~ -~ -0 -1 5022 -S -#5022 -A Sloping Passage~ - You follow a path sloping down from the fungus temple. -~ -50 ad 5 -D0 -~ -~ -0 -1 5023 -D2 -~ -~ -0 -1 5021 -S -#5023 -A Sloping Passage~ - You are on a path that gently slopes up from the underground pool. -~ -50 ad 5 -D0 -You hear sounds of trickling water. -~ -~ -0 -1 5005 -D2 -~ -~ -0 -1 5022 -S -#5024 -The Great Eastern Desert~ - A vast desert stretches for miles, the sand constantly shifting around -you. A pyramid lies to the east and a snow-capped mountain range to the -west. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5030 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5034 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5025 -S -#5025 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the east and a snow-capped mountain range to the -west. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5024 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5031 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5026 -S -#5026 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the east and a snow-capped mountain range to the -west. The hole which you tumbled out of is too high for you to reach. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5025 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5036 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5027 -S -#5027 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the east and a snow-capped mountain range to the -west. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5026 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5033 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5028 -S -#5028 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the north-east and a snow-capped mountain range to -the west. You spy a narrow dirt trail leading away to the west into the -foothills. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5027 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5033 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5029 -D3 -A small dirt trail leads off to the west where it joins a large clay road -some distance away. -~ -~ -0 -1 12068 -S -#5029 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the north-east and a snow-capped mountain range to -the west. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5028 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5037 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5044 -S -#5030 -A Small Oasis~ - You stand beside a small pool of crystal-blue water bathed in the -shade of a few scarce palm trees. To the north you see a small -encampment stopped for the day. -~ -50 0 2 -D0 -You see three tents and some camels hitched to a stake. Shadows moving -across the tents suggest activity. -~ -~ -0 -1 5056 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5036 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5032 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5025 -S -#5031 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the east. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5031 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5031 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5032 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5024 -S -#5032 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the east. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5035 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5036 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5033 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5032 -S -#5033 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the north-east. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5037 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5037 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5043 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5028 -S -#5034 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the south-east. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5038 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5035 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5034 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5035 -S -#5035 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the east, it looks enormous, even from this distance. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5039 -D1 -Even from here, you can sense a great evil residing within the pyramid -protruding from the sand to the east. -~ -~ -0 -1 5300 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5032 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5034 -S -#5036 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the north-east. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5035 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5041 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5032 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5030 -S -#5037 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the north-east. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5048 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5033 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5042 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5033 -S -#5038 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the south. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5046 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5045 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5040 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5034 -S -#5039 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting -around you. A pyramid lies to the south. The gates of a city lie a -short distance off to the north. -~ -50 0 2 -D0 -Some city gates stand off to the north. -~ -~ -0 -1 5411 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5039 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5048 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5039 -S -#5040 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. You are standing near a gigantic pyramid located a couple hundred -meters west of you. From here you can sense the great evil which resides -within the massive structure. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5036 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5049 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5041 -D3 -The pyramid can be seen across the sands to the west. -~ -~ -0 -1 5300 -S -#5041 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the north. -~ -50 0 2 -D0 -Even from here, you can sense a great evil residing within the pyramid -protruding from the sand to the north. -~ -~ -0 -1 5040 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5048 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5041 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5037 -S -#5042 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the north. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5049 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5055 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5043 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5041 -S -#5043 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the north. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5042 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5055 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5044 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5033 -S -#5044 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the north and a ruined city to the west. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5050 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5055 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5029 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5200 -S -#5045 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the south. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5045 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5052 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5045 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5038 -S -#5046 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the south-west. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5038 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5047 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5047 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5039 -S -#5047 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the west. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5046 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5051 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5053 -D3 -Even from here, you can sense a great evil residing within the pyramid -protruding from the sand to the west. -~ -~ -0 -1 5040 -S -#5048 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the west. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5039 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5048 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5053 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5041 -S -#5049 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the north-west. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5053 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5054 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5050 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5042 -S -#5050 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the north. -~ -50 0 2 -D0 -Sand as far as the eye can see... and a pyramid in the distance. -~ -~ -0 -1 5300 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5054 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5044 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5042 -S -#5051 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the south-west and a deep canyon to the east. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5051 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5052 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5047 -S -#5052 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the south-west and a deep canyon to the east. Just -below you can make out a tiny ledge. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5051 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5053 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5045 -D5 -~ -~ -0 -1 5063 -S -#5053 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the west and a deep canyon to the east. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5052 -D1 -A rickety rope bridge stretches across the canyon... it doesn't look too safe. -~ -~ -0 -1 5062 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5054 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5049 -S -#5054 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the west and a deep canyon to the east. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5053 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5055 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5050 -S -#5055 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. A pyramid lies to the north-west and a deep canyon to the east. -~ -50 0 2 -D0 -Sand as far as the eye can see. -~ -~ -0 -1 5054 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5055 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5043 -S -#5056 -A Nomad Camp~ - This small group of desert nomads has stopped for the day to rest -and refresh themselves beside this beautiful oasis. Three tents and some -camels make up the party. From within two of the tents you hear muffled -voices, obviously surprised at your visit. -~ -50 g 2 -D0 -Some camels are tied up to a mass of stakes plugged into the ground. -~ -~ -0 -1 5058 -D1 -You see inside one of the tents a huddled mass of people, probably slaves. -~ -~ -0 -1 5057 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5030 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5025 -S -#5057 -Inside A Small Tent~ - This is a small and simple tent with few possessions in sight. Lying -here and there are young-looking men and women, possibly slaves to the -leader of this band. -~ -50 dg 2 -D3 -You see the center of the nomad camp. -~ -~ -0 -1 5056 -S -#5058 -Beside The Camels~ - Here stand about ten camels, all hitched to some stakes plugged into -the ground. To the east you see a small tent while to the north you see a -larger, fancier tent. -~ -50 g 2 -D0 -This tent seems to be the temporary abode of the nomad leader. You make a -mental note to visit it before you leave. -~ -~ -0 -1 5060 -D1 -In this tent there are very large men, all carrying weapons. -~ -~ -0 -1 5059 -D2 -You see the center of the nomad camp. -~ -~ -0 -1 5056 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5024 -S -#5059 -The Warriors' Tent~ - This tent has a few furnishings, but mainly it holds the band's -protectors. They all stare at you coldly as you enter. -~ -50 dg 2 -D3 -Outside you see some peaceful camels. -~ -~ -0 -1 5058 -S -#5060 -The Main Tent~ - This tent is as lavishly decorated on the inside as it is on the -outside. A fancy carpet lies on the sand and numerous baskets line the -walls. -~ -50 dg 2 -D1 -~ -~ -0 -1 5061 -D2 -You see some peaceful camels. -~ -~ -0 -1 5058 -S -#5061 -The Main Tent~ - This is where the leader of this band of nomads resides. He is -definitely rich as you inspect the tapestries, baskets, and a few -paintings as well. -~ -50 dg 2 -D3 -You see the entrance to this tent. -~ -~ -0 -1 5060 -S -#5062 -The Rickety Rope Bridge~ - You carefully begin to walk across the bridge, but suddenly the rope -breaks and you fall... - ... and fall - and fall - and fall - ... to your death on the rocks below. -~ -50 bd 5 -D3 -~ -~ -0 -1 5053 -S -#5063 -The Wind-Swept Ledge~ - Being very careful not to lose your balance, you look around and -find that this canyon is about a half a kilometer deep. To the west is -a dark cave leading under the desert sands and above you a rope bridge -spans the gap. -~ -50 0 5 -D3 -~ -~ -0 -1 5064 -D4 -The desert sands blow down in your face. -~ -~ -0 -1 5052 -S -#5064 -The Cave Mouth~ - The air in here is MUCH cooler than outside. From the west you hear -strange sounds, but can see nothing. The cave slopes down into the -darkness. -~ -50 ad 5 -D1 -Outside is lighter and very windy. -~ -~ -0 -1 5063 -D3 -~ -~ -0 -1 5065 -S -#5065 -The Mysterious Lair~ - You have stumbled upon the home of something. From the treasure -haphazardly strewn about and the rotting carcasses, you would guess -that this is a dragon's lair. As to what type, you can't really say. -The cave narrows out into a tunnel to the west. -~ -50 adgh 5 -D1 -~ -~ -0 -1 5064 -D3 -~ -~ -0 -1 5066 -S -#5066 -A Wide Tunnel~ - This tunnel seems to go on forever into the darkness. You carefully -feel your way along the walls. -~ -50 ad 5 -D1 -~ -~ -0 -1 5065 -D3 -~ -~ -0 -1 5067 -S -#5067 -A Narrower Tunnel~ - The tunnel becomes very narrow and you fight to squeeze your way through. -The floor seems to level off a little. -~ -50 ad 5 -D1 -~ -~ -0 -1 5066 -D2 -~ -~ -0 -1 5068 -S -#5068 -A Narrow Crack~ - This part of the tunnel is the hardest to move through as the walls -move in to meet you. -~ -50 adi 5 -D0 -~ -~ -0 -1 5067 -D3 -~ -~ -0 -1 5069 -S -#5069 -A Small Cavern~ - It is dark and damp and bats hang from the ceiling. A narrow crack is -in the east wall. The floor now slopes upwards. -~ -50 ad 5 -D1 -~ -~ -0 -1 5068 -D3 -~ -~ -0 -1 5070 -S -#5070 -A Small Shaft~ - From within this shaft you can see a narrow hole in the roof just -large enough for one person. Back east is the cavern. -~ -50 ad 5 -D1 -~ -~ -0 -1 5069 -D4 -~ -~ -0 -1 5009 -S -$ diff --git a/lc-mud/circle/world/wld/51.wld b/lc-mud/circle/world/wld/51.wld deleted file mode 100644 index 4f39116c487e5b765312d23017cc62f43f56e21a..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/51.wld +++ /dev/null @@ -1,821 +0,0 @@ -#5100 -The City Entrance~ - You are at the entrance to a small underground city. A great adamantite -gate lies open to the west allowing entrance into the city. -~ -51 acd 0 -D3 -A huge gate opens to the west allowing entrance into the city. -~ -gate~ -1 -1 5101 -D4 -A passageway opens up into a fairly large cave above. -~ -~ -0 -1 5011 -E -gate~ -A large adamantite gate with giant spider shaped emblems stands here. -~ -S -#5101 -A City Street~ - You walk along a highly ornate street going north-south. A large gate -lies to the east while a building lies to the west. -~ -51 ad 0 -D0 -~ -~ -0 -1 5123 -D1 -~ -gate~ -1 -1 5100 -D2 -~ -~ -0 -1 5102 -D3 -~ -~ -0 -1 5122 -S -#5102 -A City Street~ - You walk along a highly ornate city street going north and west. -~ -51 ad 0 -D0 -~ -~ -0 -1 5101 -D3 -~ -~ -0 -1 5103 -S -#5103 -A City Street~ - You walk along a highly ornate city street going east-west. A large house -stands to the south. -~ -51 ad 0 -D1 -~ -~ -0 -1 5102 -D2 -~ -~ -0 -1 5104 -D3 -~ -~ -0 -1 5106 -S -#5104 -The 3rd House~ - You stand inside the 3rd house of the city; it is fairly well decorated -by drow standards having a few statues, murals and such. A door leads to the -south. -~ -51 ad 0 -D0 -~ -~ -0 -1 5103 -D2 -~ -door~ -1 -1 5105 -S -#5105 -The Throne Room~ - The throne room of the 3rd house is about as decorated as the inner -courtyard except with a blood covered altar in the center of the room. -~ -51 ad 0 -D0 -~ -door~ -1 -1 5104 -S -#5106 -A City Street~ - You walk along a highly ornate city street going east-west. To the north -is a large building. -~ -51 ad 0 -D0 -~ -~ -0 -1 5118 -D1 -~ -~ -0 -1 5103 -D3 -~ -~ -0 -1 5107 -S -#5107 -A City Street~ - You walk along a highly ornate city street leading north and east. To the -south is an extremely large house. -~ -51 ad 0 -D0 -~ -~ -0 -1 5110 -D1 -~ -~ -0 -1 5106 -D2 -~ -~ -0 -1 5108 -S -#5108 -The 2nd House~ - You stand inside the 2nd house of the city. The room is highly decorated -with statues of spiders and murals everywhere. -~ -51 ad 0 -D0 -~ -~ -0 -1 5107 -D3 -~ -door~ -1 -1 5109 -S -#5109 -The Throne Room~ - The throne room of the 2nd house is just a little more decorative than -the inner courtyard having an altar in the center of the room. -~ -51 ad 0 -D1 -~ -door~ -1 -1 5108 -S -#5110 -The Main Gate~ - You are at the entrance to the 1st house of the city. A large gate, -almost as big and elegant as the one at the entrance to the city, stands -here. -~ -51 ad 0 -D0 -~ -~ -0 -1 5114 -D2 -~ -~ -0 -1 5107 -D3 -A large gate lies to the west. -~ -gate~ -1 -1 5111 -S -#5111 -The 1st House~ - You stand in the inner courtyard of the 1st and largest house in the city. -The room is extremely large and decorative. Mural and paintings hang on the -walls depicting some battles and a spider queen. -~ -51 ad 0 -D1 -~ -gate~ -1 -1 5110 -D3 -~ -~ -0 -1 5112 -S -#5112 -The Throne Room~ - The throne room of the 1st house is in one word...awesome. It is so -horrifying it is almost beautiful. -~ -51 ad 0 -D0 -~ -door~ -1 -1 5113 -D1 -~ -~ -0 -1 5111 -S -#5113 -The Main Chamber~ - This is the council chamber for the Matron Mother herself. A huge table -and chairs surrounding it sits in the center of the room. -~ -51 ad 0 -D2 -~ -door~ -1 -1 5112 -S -#5114 -A City Street~ - You walk along a highly ornate city street leading north-south and east. -~ -51 ad 0 -D0 -~ -~ -0 -1 5115 -D1 -~ -~ -0 -1 5117 -D2 -~ -~ -0 -1 5110 -S -#5115 -A City Street~ - You walk along a highly ornate city street leading south. A building is -to the west. -~ -51 ad 0 -D2 -~ -~ -0 -1 5114 -D3 -~ -~ -0 -1 5116 -S -#5116 -The Clerics' Academy~ - This is the most lavish of the academies being that it is for the clerics. -~ -51 ad 0 -D1 -~ -~ -0 -1 5115 -S -#5117 -A City Street~ - You walk along a highly ornate city street going east-west. To the north -is a giant temple. -~ -51 ad 0 -D0 -The entrance to the temple of Lloth is blocked by large ornamental gates. -~ -gates gate~ -1 -1 5119 -D1 -~ -~ -0 -1 5121 -D3 -~ -~ -0 -1 5114 -S -#5118 -The Warriors' Academy~ - This looks more like a barracks than a school. -~ -51 ad 0 -D2 -~ -~ -0 -1 5106 -S -#5119 -The Entrance To The Temple Of Lloth~ - The temple is the largest building in the city. Even its doors are beyond -imagination. Inside of the temple entrance, the walls are made of gold and -adamantite. -~ -51 ad 0 -D2 -~ -gates gate~ -1 -1 5117 -D5 -~ -~ -0 -1 5126 -S -#5120 -The Mages' Academy~ - The Mages' Academy is fairly well decorated and you can see that the -drow prefer magic over physical power greatly. -~ -51 ad 0 -D2 -~ -~ -0 -1 5121 -S -#5121 -A City Street~ - You walk along a highly ornate city street going eastward. To the north -is a building. -~ -51 ad 0 -D0 -~ -~ -0 -1 5120 -D1 -~ -~ -0 -1 5123 -D3 -~ -~ -0 -1 5117 -S -#5122 -The Slave Chamber~ - The room is in shambles. Straw is strewn all about the room as beds for -the unfortunate creatures who have fallen prey to drow imperialism. -~ -51 ad 0 -D1 -~ -~ -0 -1 5101 -S -#5123 -A City Street~ - You walk along a highly ornate city street leading west and south. To -the north is a relatively small house. -~ -51 ad 0 -D0 -~ -gate~ -1 -1 5124 -D2 -~ -~ -0 -1 5101 -D3 -~ -~ -0 -1 5121 -S -#5124 -The 4th House~ - You stand inside the 4th house of the city. Its inner courtyard is rather -dull by drow standards and rather small as well. -~ -51 ad 0 -D1 -~ -~ -0 -1 5125 -D2 -~ -gate~ -1 -1 5123 -S -#5125 -The Throne Room~ - The throne room is basically similar to the inner courtyard in regards -to decor. there is a small throne behind the altar but that is about it. -~ -51 ad 0 -D3 -~ -~ -0 -1 5124 -S -#5126 -The Entrance Hall~ - You stand in the entrance way to the temple which opens up to the north -into a large hallway going east and west. Small statues os spiders line the -entrance way's walls. -~ -51 ad 0 -D0 -~ -~ -0 -1 5127 -D4 -~ -~ -0 -1 5119 -S -#5127 -A Hallway~ - You are in a long hallway lined with adamantite. The walls are engraved -with pictures of elves and spiders. The hallway continues east and west. As -you look down the hallway you can make out one or two figures moving away from -you. -To the north is a obsidian stairway. -~ -51 ad 0 -D0 -~ -~ -0 -1 5135 -D2 -~ -~ -0 -1 5126 -D1 -~ -~ -0 -1 5128 -D3 -~ -~ -0 -1 5131 -S -#5128 -A Long Hallway~ - You are in a long hallway lined with adamantite. The walls are engraved -with pictures of elves and spiders. The hallway continues east and west. As -you look down the hallway you can make out one or two figures moving away from -you. -~ -51 ad 0 -D1 -~ -~ -0 -1 5129 -D3 -~ -~ -0 -1 5127 -S -#5129 -A Long Hallway~ - You are in a long hallway lined with adamantite. The walls are engraved -with pictures of elves and spiders. The hallway continues east and west. As -you look down the hallway you can make out one or two figures moving away from -you. -To the north is a door. -~ -51 ad 0 -D0 -~ -door~ -1 -1 5150 -D1 -~ -~ -0 -1 5130 -D3 -~ -~ -0 -1 5128 -S -#5130 -A Long Hallway~ - You are in a long hallway lined with adamantite. The walls are engraved -with pictures of elves and spiders. The hallway continues east and west. As -you look down the hallway you can make out one or two figures moving away from -you. -~ -51 ad 0 -D1 -~ -~ -0 -1 5134 -D3 -~ -~ -0 -1 5129 -S -#5131 -A Long Hallway~ - You are in a long hallway lined with adamantite. The walls are engraved -with pictures of elves and spiders. The hallway continues east and west. As -you look down the hallway you can make out one or two figures moving away from -you. -~ -51 ad 0 -D1 -~ -~ -0 -1 5127 -D3 -~ -~ -0 -1 5132 -S -#5132 -A Long Hallway~ - You are in a long hallway lined with adamantite. The walls are engraved -with pictures of elves and spiders. The hallway continues east and west. As -you look down the hallway you can make out one or two figures moving away from -you. -To the south is a door. -~ -51 ad 0 -D1 -~ -~ -0 -1 5131 -D2 -~ -door~ -1 -1 5133 -D3 -~ -~ -0 -1 5134 -S -#5133 -The Warriors' Barracks~ - The room is a complete mess. None of the beds are made, clothes and other -items have been left all about the room. Well drow warriors never were known -for neatness. -~ -51 ad 0 -D0 -~ -door~ -1 -1 5131 -S -#5134 -A Long Hallway~ - You are in a long hallway lined with adamantite. The walls are engraved -with pictures of elves and spiders. The hallway continues east and west. As -you look down the hallway you can make out one or two figures moving away from -you. -~ -51 ad 0 -D1 -~ -~ -0 -1 5132 -D3 -~ -~ -0 -1 5130 -S -#5135 -The Grand Stairway~ - You are standing at the bottom of a giant obsidian and adamantite -stairway. The edges are trimmed with gold. -~ -51 ad 0 -D2 -~ -~ -0 -1 5127 -D4 -~ -~ -0 -1 5136 -S -#5136 -The Grand Hallway~ - You are standing in the middle of a grand hallway. The walls are -of the purest adamantite with gold trim. Mosaics line the walls. -~ -51 ad 0 -D0 -~ -~ -0 -1 5138 -D1 -~ -door~ -1 -1 5137 -D5 -~ -~ -0 -1 5135 -S -#5137 -The Mages' Barracks~ - The mage's living quarters is rather clean with the exception of a few -used component containers. It is rather well decorated as well. Cots line -the floor for the mages to sleep on. The only door is to the west. -~ -51 ad 0 -D3 -~ -door~ -1 -1 5136 -S -#5138 -The Grand Hallway~ - You are walking down a grand hallway, heavily decorated with adamantite -and gold. To the north the hall goes down a flight of stairs while a door is -to the west. -~ -51 ad 0 -D2 -~ -~ -0 -1 5136 -D3 -~ -door~ -1 -1 5139 -D5 -~ -~ -0 -1 5140 -S -#5139 -The Clerics' Barracks~ - The bed chamber is brightly decorated with spider shaped statues, murals -and the like. Large beds line the floor making this a comfortable room to -live in. -~ -51 ad 0 -D1 -~ -door~ -1 -1 5138 -S -#5140 -The Grand Stairway~ - You are climbing a set of obsidian stairs surrounded by adamantite walls. -To the north are a set of large golden doors. -~ -51 ad 0 -D0 -~ -doors door golden gold~ -1 -1 5141 -D4 -~ -~ -0 -1 5138 -S -#5141 -The Main Chamber~ - This is the south side of a large auditorium used for services by the -drow priestesses. In the center is a large sacrificial pit and beyond that -is an altar. -~ -51 ad 0 -D1 -~ -~ -0 -1 5142 -D2 -~ -doors door golden gold~ -1 -1 5140 -D3 -~ -~ -0 -1 5144 -S -#5142 -The Eastern Side Of The Main Chamber~ - You are on the eastern side of the chamber overlooking the pit. To the -east is a door while to the north is an altar. -~ -51 ad 0 -D0 -~ -~ -0 -1 5145 -D1 -~ -door~ -1 -1 5146 -D2 -~ -~ -0 -1 5141 -S -#5143 -The Sacrificial Pit~ - As you climb down into the pit, thousands of spiders cover you, tearing -your fragile body to shreds. - -Lloth thanks you for your sacrifice. - -~ -51 bd 0 -S -#5144 -The Western Side Of The Main Chamber~ - You are on the western side of the main chamber overlooking a sacrificial -pit. To the north is an altar. -~ -51 ad 0 -D0 -~ -~ -0 -1 5145 -D2 -~ -~ -0 -1 5141 -S -#5145 -The Altar~ - You are standing in front of a highly and freshly bloodstained altar. -Engraved on the top of the altar is a giant spider with a human head. Looking -down from the altar you see a large sacrificial pit with thousands of swarming -spiders looking for their next meal! -~ -51 ad 0 -D0 -~ -~ -0 -1 5148 -D1 -~ -~ -0 -1 5142 -D3 -~ -~ -0 -1 5144 -D5 -Thousands of spiders eye you with undisguised hunger. -~ -~ -0 -1 5143 -S -#5146 -The Slave Cells~ - This is the main room to the cell chambers for the slaves to be -sacrificed. You notice there are no guards around. -~ -51 ad 0 -D0 -~ -cell~ -1 -1 5147 -D3 -~ -door~ -1 -1 5142 -S -#5147 -The Slave Pen~ - Rotten meat and breads lie about the floor while shackles hang from the -walls. The room reeks of death. You almost become nauseous and decide to -leave the room since you were obviously too late to save the slave. -~ -51 ad 0 -D2 -~ -cell~ -1 -1 5146 -S -#5148 -The Dias~ - You stand upon a dias behind the altar. Above you is a enormous illusion -of a female drow turning into a giant spider and back again. There is a door -to the west. -~ -51 ad 0 -D2 -~ -~ -0 -1 5145 -D3 -~ -door~ -2 5115 5149 -S -#5149 -The Treasury~ - This is obviously only a temporary storage place for the collected -treasure being rather bare. -~ -51 ad 0 -D1 -~ -door~ -2 5115 5148 -S -#5150 -The Weaponsmaster's Chamber~ - This one-person bedchamber is very elegant. The owner must be held in -high regard to get this kind of treatment. -~ -51 ad 0 -D2 -~ -door~ -1 -1 5129 -S -$ diff --git a/lc-mud/circle/world/wld/52.wld b/lc-mud/circle/world/wld/52.wld deleted file mode 100644 index 4fb18bcb45247930012de6ce792d04fd790e4157..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/52.wld +++ /dev/null @@ -1,1036 +0,0 @@ -#5200 -The Grand Gate Of Thalos~ - You stand in the archway of a gigantic stone archway. The two -steel gates have been forced open and have rusted in place. A hollow -gust of wind blows by you into the deserted, and seemingly destroyed, -city. -~ -52 0 1 -D1 -The desert sands stretch on for miles and miles. -~ -~ -0 -1 5044 -D3 -You see devastation everywhere. Houses lie in ruin and skeletons litter -the streets. You see strange beasts stalking the shadows. -~ -~ -0 -1 5201 -S -#5201 -Main Street~ - This was once a magnificent street, but now is in total ruin. The -streets are barren and windswept and the silence is unending. To the south -you see a ruined cottage while north leads into a dark back alley. Howls -and screams echo through the deserted city. -~ -52 0 1 -D0 -It seems to be a dark alley. -~ -~ -0 -1 5239 -D1 -The entrance to the city lies this way. -~ -~ -0 -1 5200 -D2 -A ruined shack lies to the south. -~ -~ -0 -1 5235 -D3 -Main Street lies this way. -~ -~ -0 -1 5202 -S -#5202 -Main Street~ - This was once a magnificent street, but now is in total ruin. The -streets are barren and windswept and the silence is unending. On one -side is a collapsed house while on the other is the entrance to a large -ruined mansion. Eerie sounds echo within the mansion. Near the center of -town you see a large domed building, relatively intact. -~ -52 0 1 -D0 -The remnants of a store lie this way. -~ -~ -0 -1 5236 -D1 -~ -~ -0 -1 5201 -D2 -It looks like what used to be the main building in the city. -~ -~ -0 -1 5232 -D3 -A withered garden path lies this way. -~ -~ -0 -1 5203 -S -#5203 -A Garden Path~ - A circular path surrounds a magnificent domed temple in the center -of the city. Flowers have withered away and the once lush trees are bare. -Vines and ivy snake up the sides of the temple and entangle themselves -around your feet. A sudden volley of howls pierces the air. -~ -52 0 1 -D0 -The garden path continues around the building. -~ -~ -0 -1 5204 -D1 -This is the main street leading to the city's entrance. -~ -~ -0 -1 5202 -D2 -The garden path continues around the building. -~ -~ -0 -1 5206 -D3 -Inside the temple, small patches of light shoot through each doorway as -well as a few holes in the ceiling. -~ -~ -0 -1 5250 -S -#5204 -A Garden Path~ - A circular path surrounds a magnificent domed temple in the center -of the city. Flowers have withered away and the once lush trees are bare. -Vines and ivy snake up the sides of the temple and entangle themselves -around your feet. -~ -52 0 1 -D0 -A side street leads of to the northern half of the city. -~ -~ -0 -1 5211 -D1 -The garden path continues around the building. -~ -~ -0 -1 5203 -D2 -Inside the temple, small patches of light shoot through each doorway as -well as a few holes in the ceiling. -~ -~ -0 -1 5250 -D3 -The garden path continues around the building. -~ -~ -0 -1 5205 -S -#5205 -A Garden Path~ - A circular path surrounds a magnificent domed temple in the center -of the city. Flowers have withered away and the once lush trees are bare. -Vines and ivy creep up the sides of the temple and entangle themselves -around your feet. -~ -52 0 1 -D0 -The garden path continues around the building. -~ -~ -0 -1 5204 -D1 -Inside the temple, small patches of light shoot through each doorway as -well as a few cracks in the ceiling. -~ -~ -0 -1 5250 -D2 -The garden path continues around the building. -~ -~ -0 -1 5206 -D3 -What looks like a market place lies this way. -~ -~ -0 -1 5207 -S -#5206 -A Garden Path~ - A circular path surrounds a magnificent domed temple in the center -of the city. Flowers have withered away and the once lush trees are bare. -Vines and ivy creep up the sides of the temple and entangle themselves -around your feet. -~ -52 0 1 -D0 -Inside the temple, small patches of light shoot through each doorway as -well as a few cracks in the ceiling. -~ -~ -0 -1 5250 -D1 -The garden path continues around the building. -~ -~ -0 -1 5203 -D2 -A small side street leads to the southern half of the city. -~ -~ -0 -1 5212 -D3 -The garden path continues around the building. -~ -~ -0 -1 5205 -S -#5207 -The Market Place~ - You stand in the middle of a large square lined on each side with -baskets, carts, and stands of all shapes and sizes. Abandoned, these -little shops still contain some of their goods once sold to a demanding -public. -~ -52 0 1 -D0 -A small table has been toppled over, spilling fine jewellery and gems -onto the ground. -~ -~ -0 -1 5225 -D1 -A small garden path encircles a large domed temple in the center of the -city. -~ -~ -0 -1 5205 -D2 -Rotted remains of fruits and vegetables lie strewn about. -~ -~ -0 -1 5220 -D3 -The market place continues. -~ -~ -0 -1 5208 -S -#5208 -The Market Place~ - You stand at the end of the market square. Stands and carts line -each side, filled with remnants of fine foods and exquisite goods. -~ -52 0 1 -D0 -Tattered carpets and ruined bales of silk sit idly by a run down stand. -~ -~ -0 -1 5222 -D1 -The center of the market lies this way. -~ -~ -0 -1 5207 -D2 -From the massive stench, this must have been a meat and poultry stand. -It lies totally bare. -~ -~ -0 -1 5217 -S -#5209 -A Side Street~ - This small side street leads east and west into back alleys while -to the south you see the temple. The incessant howling tears at your -mind. -~ -52 0 1 -D1 -~ -~ -0 -1 5243 -D2 -~ -~ -0 -1 5210 -D3 -~ -~ -0 -1 5228 -S -#5210 -A Side Street~ - You are in the common section of the city. Ruined buildings made of -clay and stone is all the view has to offer. Most of these homes are -nothing but piles of rubble, but some look almost safe enough to venture -into. - The street continues north and south and buildings line the street. -~ -52 0 1 -D0 -~ -~ -0 -1 5209 -D1 -A small doorway leads into a partially collapsed house. -~ -~ -1 -1 5244 -D2 -~ -~ -0 -1 5211 -D3 -A small clay dwelling sits here. -~ -~ -0 -1 5226 -S -#5211 -A Side Street~ - This small side street leads away from the garden path to the south. -Around you stand large piles or rubble where the houses of commoners -used to be. A lone howl makes you worry greatly about your safety here. -~ -52 0 1 -D0 -~ -~ -0 -1 5210 -D1 -An unusually tall dwelling stands looming over you. -~ -~ -0 -1 5237 -D2 -A garden path circles around the temple. -~ -~ -0 -1 5204 -D3 -Here lies a small stone house with a thatched roof. -~ -~ -0 -1 5227 -S -#5212 -A Side Street~ - This small side street leads south away from the temple into the -business section of town. The destruction that leveled this city was not -biased; these important looking buildings have been almost totally -destroyed. There is a hole in the wall of a very large structure to the -east. -~ -52 0 1 -D0 -A small garden path encircles the temple. -~ -~ -0 -1 5206 -D1 -This possibly could be the city hall. -~ -~ -0 -1 5232 -D2 -~ -~ -0 -1 5213 -D3 -Inside the building you see long pieces of metal, an oven, and some -anvils. -~ -~ -0 -1 5221 -S -#5213 -A Side Street~ - This small side street is lined with the remains of once great -buildings. To the west is a dark, foreboding structure while to the -east lies the entrance to a small tavern. The street continues north -and south. -~ -52 0 1 -D0 -~ -~ -0 -1 5212 -D1 -From the looks of it, this was once a two story abode. The entire second -floor has collapsed leaving a very little part of the bar still free -from debris. -~ -~ -0 -1 5230 -D2 -~ -~ -0 -1 5214 -D3 -This seems to be the only guild house in the entire city. Its dark nature -makes you wonder about its origins. -~ -~ -0 -1 5219 -S -#5214 -A Side Street~ - You are at the end of a long street leading to the center of the city. -A long dark alley runs east and west. -~ -52 0 1 -D0 -~ -~ -0 -1 5213 -D1 -~ -~ -0 -1 5229 -D3 -~ -~ -0 -1 5218 -S -#5215 -Under A Ruined Watchtower~ - You stand at the base of a tall watchtower built to protect the city -from invaders. From the looks of things, it did not do a good job. -~ -52 0 1 -D0 -~ -~ -0 -1 5216 -D1 -~ -~ -0 -1 5218 -D4 -~ -~ -0 -1 5247 -S -#5216 -A Back Alley~ - This alley leads to the rear of what used to be a meat stand. You wince -at the stench. South is one of the city watchtowers. -~ -52 0 1 -D0 -You see the back-side of the market place meat stand. -~ -~ -0 -1 5217 -D2 -A tall watchtower stands a silent vigil over the city. -~ -~ -0 -1 5215 -S -#5217 -The Meat Stand~ - A large stand has been set up here with metal hooks and wooden racks -in the background. Hanging on the hooks are very small scraps of meat -and other game. This stand is relatively empty, and a sudden burst of -howling and screaming makes you realize why this is so. -~ -52 0 1 -D0 -The market place lies this way. -~ -~ -0 -1 5208 -D1 -This is a cart full of rotted vegetables and fruits. -~ -~ -0 -1 5220 -D2 -~ -~ -0 -1 5216 -S -#5218 -A Back Alley~ - A narrow alley leads east to a wider street and west to one of -the city watchtowers. -~ -52 0 1 -D1 -A small side street greets you. -~ -~ -0 -1 5214 -D3 -A tall watchtower stands a silent vigil over the city. -~ -~ -0 -1 5215 -S -#5219 -The Guild House~ - You are standing in what once was this city's ONLY guild house. -Tables and chairs have been smashed and broken weapons lie strewn about -the floor as if some massive battle had taken place here. Draped along -the back wall is a tattered, jet-black banner with the symbol of the -Darkside set upon it. -~ -52 d 1 -D1 -A small side street runs past the building. -~ -~ -0 -1 5213 -S -#5220 -The Produce Stand~ - A large cart sits here carrying rotted fruit and vegetables. Flies -swarm all about what seems to be the last remaining bits of food left -in the city. -~ -52 0 1 -D0 -The market place is deserted. -~ -~ -0 -1 5207 -D3 -A strong stench emanates from the meat stand next to you. -~ -~ -0 -1 5217 -S -#5221 -The Smithy~ - In here you find tools and anvils used to make various weapons -and items. The walls have been stripped clean and only a few incomplete -pieces of armor and weaponry are left. -~ -52 d 1 -D1 -A small side street runs past the building. -~ -~ -0 -1 5212 -S -#5222 -The Tapestry Stand~ - Tattered and torn tapestries and rugs lie heaped in piles. Fancy -robes and various articles of clothing are now just rags. You stare at -the strange piles for a long time until a piercing howl makes you -think these might be beds. -~ -52 0 1 -D0 -~ -~ -0 -1 5223 -D1 -A fine jewellery stand lies in ruin next to you. -~ -~ -0 -1 5225 -D2 -The market place is deserted. -~ -~ -0 -1 5208 -S -#5223 -A Back Alley~ - A narrow alley leads north to one of the city watchtowers while -to the south there lies a market stand full of torn clothes and rugs. -~ -52 0 1 -D0 -A tall watchtower stands a silent vigil over the city. -~ -~ -0 -1 5224 -D2 -~ -~ -0 -1 5222 -S -#5224 -Under The Watchtower~ - You stand under one of the city watchtowers built to protect -the city from invaders. Obviously, it failed. -~ -52 0 1 -D1 -~ -~ -0 -1 5228 -D2 -~ -~ -0 -1 5223 -D4 -Above you looms a tall watchtower. -~ -~ -0 -1 5246 -S -#5225 -The Jewellery Stand~ - A table has been tipped over, spilling fine jewellery and gems -across the market place. Most of these trinkets are battered and -tarnished and few would have any value anymore. -~ -52 0 1 -D2 -The market place is deserted. -~ -~ -0 -1 5207 -D3 -Next to you is a stand full of ruined clothes and rugs. -~ -~ -0 -1 5222 -S -#5226 -A Ruined Clay Dwelling~ - This was once a very plain house with nothing more than a few chairs -and a bed. A cold fireplace suggests that the city has been abandoned -for quite a while. Almost nothing remains of this humble abode. -~ -52 d 1 -D1 -Outside is a small side street. -~ -~ -0 -1 5210 -S -#5227 -A Collapsed Stone Dwelling~ - This small house has completely collapsed upon itself leaving piles -of debris here and there. A few rafters still stand with thatched straw -hanging down and a hot wind gusts through the hollow dwelling. -~ -52 0 1 -D1 -A small side street runs past the house. -~ -~ -0 -1 5211 -S -#5228 -A Back Alley~ - A narrow alley leads west to one of the city watchtowers and east to -a small side street. -~ -52 0 1 -D1 -~ -~ -0 -1 5209 -D3 -~ -~ -0 -1 5224 -S -#5229 -An Abandoned Shop~ - From the outside this place looks like an ordinary pile of rubble, -but inside these cramped quarters you discover what used to be a shop -filled with armor, weapons, and various other goods. A small sign -flutters in the wind. -~ -52 d 1 -D3 -A small side street runs past the shop. -~ -~ -0 -1 5214 -S -#5230 -The Tavern Of The Sun~ - A glorious place in its prime, this tavern now lies in ruin; tables -and chairs are broken scattered, bottles and glasses shattered, and -a small performance stage crushed. Musical instruments and personal -belongings lie under the rubble, but the people they once belonged to are -not with them. Looking up you see that the entire second floor and roof -has fallen in, leaving a gaping hole above. -~ -52 0 1 -D3 -A small side street runs past the tavern. -~ -~ -0 -1 5213 -S -#5231 -The South Wing Of The City Hall~ - You stand in a large room attached to this end of the hallway which -leads back north to the reception area. Pedestals and columns have fallen -and most of the valuable items have been taken, leaving worthless debris. -A few chairs have survived, as well as a large curved desk. To the east -is a vine-covered archway leading out into a private courtyard. -~ -52 d 1 -D0 -The long hallway leads back to the main reception area of the city hall. -~ -~ -0 -1 5232 -D1 -~ -~ -0 -1 5234 -S -#5232 -The City Hall~ - This is the main reception area of Thalos' city hall. The walls have -been charred and scored massively and debris is spread from wall to wall. -A large gaping hole in the west wall allows you to see out to one of -the city's side streets. Obviously no one will be seeing you through today. -Hallways lead south and east. -~ -52 d 1 -D0 -Main street runs past the city hall. -~ -~ -0 -1 5202 -D1 -A hallway leads to the east wing of the city hall. -~ -~ -0 -1 5233 -D2 -A hallway leads to the south wing of the city hall. -~ -~ -0 -1 5231 -D3 -~ -~ -0 -1 5212 -S -#5233 -The East Wing Of The City Hall~ - Here lies the remnants of a fancy office, possibly the mayor's. A few -withered plants and broken pieces of furniture make this place anything -but fancy, though. The only thing remaining intact here is a large -glass cabinet. A long hallway leads west back to the reception area and -an ivy-covered archway leads south into a private courtyard. -~ -52 d 1 -D2 -~ -~ -0 -1 5234 -D3 -~ -~ -0 -1 5232 -S -#5234 -The Private Gardens And Courtyard Of Thalos~ - What a shame that this mass destruction also touched this once -beautiful place. The temple's garden path has nothing on this garden. -Flowers and trees have been smashed into the ground and lawn benches -thrown through walls. A large marble fountain in the center of the -courtyard still stands, though, defying any attempts to destroy its -beauty. Above stands the remnants of one of the watchtowers. Archways -north and west lead back into the city hall. -~ -52 0 1 -D0 -~ -~ -0 -1 5233 -D3 -~ -~ -0 -1 5231 -S -#5235 -A Small Guard House~ - This was once the barracks for Thalos' Cityguards. Now just an empty -shell, this small shack still stands guarding the entrance both to the -city and to the city hall. -~ -52 d 1 -D0 -Main street runs by this building. -~ -~ -0 -1 5201 -S -#5236 -A Collapsed Home~ - All that's left of this house is a few scattered piles of rubble -and a very large blast crater. Obviously someone or something important -was once housed here. A shrieking howl chills your blood. -~ -52 0 1 -D2 -Main street runs past this ruined home. -~ -~ -0 -1 5202 -S -#5237 -A Tall Dwelling~ - This seems to be the tallest structure remaining in the city. At -one time this could have been an inn of some sort, but now it is just -a mess. The back wall as been completely knocked down revealing an -entrance into another building through yet another collapsed wall. -Between the two buildings are a few blast craters and boulders. An old -set of wooden steps leads up to a creaking second floor. -~ -52 d 1 -D1 -~ -~ -0 -1 5238 -D3 -A small side street winds past the dwelling. -~ -~ -0 -1 5211 -D4 -The stairs and even the entire second floor itself looks very unsafe -for travel. Gusts of wind make them creak and shudder. -~ -~ -0 -1 5245 -S -#5238 -A Small Shack~ - This cramped dwelling could not have housed more than one person. Now -with the back wall missing, it could hold many more. Looking around you -find broken shelves and workbenches with various vials and pouches spilling -contents all across the floor. This was possibly the magic shop of the -city. The doorway to the east is blocked, making the only exit back west. -~ -52 d 1 -D3 -~ -~ -0 -1 5237 -S -#5239 -A Back Alley~ - A narrow back alley goes south to main street and north towards -a watchtower. A mass of howls catches you of guard. -~ -52 0 1 -D0 -~ -~ -0 -1 5240 -D2 -Main street runs past here. -~ -~ -0 -1 5201 -S -#5240 -A Back Alley~ - A narrow back alley leads north to one of the city watchtowers -and south towards main street. To the west is a doorway to a small -house blocked by debris. -~ -52 0 1 -D0 -A tall watchtower stands a silent vigil over the city. -~ -~ -0 -1 5241 -D2 -~ -~ -0 -1 5239 -S -#5241 -Under A Watchtower~ - You stand under a tall watchtower. Narrow back alleys lead west and -south and a very weak looking ladder leads up into the tower. Above you, -you hear the screams of tens of starving lamias! Beware! -~ -52 0 1 -D2 -~ -~ -0 -1 5240 -D3 -~ -~ -0 -1 5243 -D4 -Winds howl high above your head in the tower above. You hear the screams -of tens of howling lamias above you! -~ -~ -0 -1 5248 -S -#5242 -A Bath House~ - This was once the bath house for the commoners of the city. Hot -steamy water still wells up from a hole in the floor. Obviously there -is a hot spring located under the city (making the decision to put -a city here seem much more reasonable). Closer inspection of the water -yields a dead body floating around in it, skin melted away from months -of floating in there. The west wall has collapsed revealing another -collapsed house. -~ -52 d 1 -D0 -~ -~ -0 -1 5243 -D3 -The wall has collapsed on the adjoining house, creating a new opening -in it. -~ -~ -0 -1 5244 -S -#5243 -A Back Alley~ - A narrow back alley leads west to a small side street and east to one -of the city watchtowers. Great amounts of steam issue forth from the -building to the south. -~ -52 0 1 -D1 -A watchtower stands a silent vigil over the city. -~ -~ -0 -1 5241 -D2 -~ -~ -0 -1 5242 -D3 -A side street runs by here. -~ -~ -0 -1 5209 -S -#5244 -An Upright House~ - This home is practically the only one around that is still standing. -Except for the massive hole in the east wall, everything else looks -intact, including the windows. Great amounts of steam issue forth from -the hole in the east wall. -~ -52 d 1 -D1 -~ -~ -0 -1 5242 -D3 -A small side street runs past the house. -~ -~ -0 -1 5210 -S -#5245 -On The Second Floor~ - The minute you step off onto this floor you realize it was a mistake. -The old rotted floorboards suddenly give way and you fall down, impaling -yourself on jagged boards below. -~ -52 bd 1 -S -#5246 -The North-West Watchtower~ - You stand atop one of the city watchtowers. The view is magnificent -from here and you can see all the way to the western mountains. No wonder -this place stood for so long. -~ -52 0 1 -D5 -The city lies below. -~ -~ -0 -1 5224 -S -#5247 -The South-West Watchtower~ - You stand atop one of the city watchtowers. The view is magnificent -from here and you can see all the way to the western mountains. To the -south the desert stretches to the horizon. No wonder this place stood -for so long. -~ -52 0 1 -D5 -The city lies below. -~ -~ -0 -1 5215 -S -#5248 -The North-East Watchtower~ - You stand atop one of the city watchtowers. The view is magnificent -from here and you the desert sand stretches to the horizon. No wonder -this place stood for so long. The ladder leading down seems rotted in -some places! -~ -52 c 1 -D5 -The city lies below... far, far below. -~ -~ -0 -1 5249 -S -#5249 -Under A Watchtower~ - As you descend the ladder, the rotted rungs break, sending you quickly -to your demise far below on the city street. Splat. -~ -52 bd 1 -S -#5250 -The Temple Of Thalos~ - You stand within one of the most holy places in the realm. This -stunning domed temple once housed the city's worshipers en masse. -Unfortunately, it succumbed to the destruction brought on this city. -Long benches lie toppled and the altar desecrated. Large chunks of stone -have fallen from the walls and roof, sending sunlight streaming in on -you. A few books lie about, conveying to you a holy message in a -strange tongue. - Wind gusts through the four archways and howls and screams can be -heard from all parts of the city. -~ -52 cdh 1 -D0 -A side street leads to the northern half of the city. -~ -~ -0 -1 5204 -D1 -Main street leads out to the main gate of the city. -~ -~ -0 -1 5203 -D2 -A side street leads to the southern part of the city. -~ -~ -0 -1 5206 -D3 -The market place lies this way. -~ -~ -0 -1 5205 -S -$ diff --git a/lc-mud/circle/world/wld/53.wld b/lc-mud/circle/world/wld/53.wld deleted file mode 100644 index 4620e1aab64d281436516d7e06410eb987141870..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/53.wld +++ /dev/null @@ -1,1465 +0,0 @@ -#5300 -The Great Eastern Desert~ - A vast desert stretches for miles, the sands constantly shifting around -you. Rising out of the sand to the north you see a mighty pyramid. -~ -53 0 2 -D0 -The sands of the desert continue onward towards the pyramid. -~ -~ -0 -1 5301 -D1 -Sand as far as the eye can see. -~ -~ -0 -1 5040 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5050 -D3 -Sand as far as the eye can see. -~ -~ -0 -1 5035 -E -pyramid~ -The massive pyramid rises out of the sand, a monument to long-dead pharoahs. -~ -S -#5301 -At The Base Of The Pyramid~ - The mighty pyramid towers above you out of the hot desert sands, made -from huge blocks of stone that have been coated over with a rough sandy -plaster-like substance. The face of the pyramid is steep, but you think -you might be able to climb it. -~ -53 0 2 -D2 -Sand as far as the eye can see. -~ -~ -0 -1 5300 -D4 -The steep slope of the pyramid rises up before you. -~ -~ -0 -1 5302 -E -pyramid~ -You wonder how anyone could have built such a massive thing out in this -heat. -~ -S -#5302 -Climbing The Great Pyramid~ - Hot air rises off the sides of the pyramid, and the wind chokes you with -a flurry of sand and dust. So far you have made it halfway up the side. The -walls of the pyramid are quite steep. -~ -53 0 5 -D0 -If you are daring you could try to skirt around to the northern side. -~ -~ -0 -1 5303 -D2 -If you are daring you could try to skirt around to the southern side. -~ -~ -0 -1 5304 -D4 -It looks too dangerous to try to climb any higher. -~ -~ -0 -1 5307 -D5 -Far below you are the burning sands of the desert. -~ -~ -0 -1 5301 -E -pyramid~ -You wonder how anyone could have built such a massive thing out in this -heat. -~ -S -#5303 -Climbing The Great Pyramid~ - Hot air rises off the sides of the pyramid, and the wind chokes you with -a flurry of sand and dust. The walls of the pyramid are quite steep, and -you are having trouble keeping from sliding down into the sands below. -~ -53 0 5 -D1 -If you are daring you could try to skirt around to the eastern side. -~ -~ -0 -1 5305 -D3 -If you are daring you could try to skirt around to the western side. -~ -~ -0 -1 5302 -D4 -It looks too dangerous to try to climb any higher. -~ -~ -0 -1 5307 -D5 -This side of the pyramid has a dangerous drop before the sandy floor. -~ -~ -0 -1 5307 -E -pyramid~ -You wonder how anyone could have built such a massive thing out in this -heat. -~ -S -#5304 -Climbing The Great Pyramid~ - Hot air rises off the sides of the pyramid, and the wind chokes you with -a flurry of sand and dust. The walls of the pyramid are quite steep, and -you are having trouble keeping from sliding down into the sands below. -~ -53 0 5 -D1 -If you are daring you could try to skirt around to the eastern side. -~ -~ -0 -1 5305 -D3 -If you are daring you could try to skirt around to the western side. -~ -~ -0 -1 5302 -D4 -It looks too dangerous to try to climb any higher. -~ -~ -0 -1 5307 -D5 -This side of the pyramid has a dangerous drop before the sandy floor. -~ -~ -0 -1 5307 -E -pyramid~ -You wonder how anyone could have built such a massive thing out in this -heat. -~ -S -#5305 -Climbing The Great Pyramid~ - Here on the eastern side of the pyramid there is a little more shelter -from the heat and wind. The stone side is not nearly so slippery smooth -from the ravages of time, and you think you may be able to even reach the -top from here. -~ -53 0 5 -D0 -If you are daring you could try to skirt around to the northern side. -~ -~ -0 -1 5303 -D2 -If you are daring you could try to skirt around to the southern side. -~ -~ -0 -1 5304 -D4 -You see the apex of the pyramid many yards above you. -~ -~ -0 -1 5306 -D5 -This side of the pyramid has a dangerous drop before the sandy floor. -~ -~ -0 -1 5307 -E -pyramid~ -You wonder how anyone could have built such a massive thing out in this -heat. -~ -S -#5306 -The Apex Of The Great Pyramid~ - Bathed in sweat, you have managed to reach the summit of the great -pyramid. The four sides of the pyramid slope sharply down into the -hot sands in all four cardinal directions. -A plaque has been set into the sandy stones beneath your feet. -~ -53 0 1 -D0 -The north side of the pyramid slopes down into the sands. -It looks really dangerous. I wouldn't go that way. -~ -~ -0 -1 5307 -D1 -The east side of the pyramid slopes down into the sands. -~ -~ -0 -1 5305 -D2 -The south side of the pyramid slopes down into the sands. -It looks really dangerous. I wouldn't go that way. -~ -~ -0 -1 5307 -D3 -The west side of the pyramid slopes down into the sands. -It looks really dangerous. I wouldn't go that way. -~ -~ -0 -1 5307 -D5 -You see some sandy stones pressed closely together to form a hard surface. -~ -stones~ -1 -1 5308 -E -stones~ -As you look closer you can make out a crack in the center of the stones -beneath your feet. With some effort you might be able to lift that -section up and get inside! -~ -E -plaque~ -The plaque reads: - - The Great Pyramid - - Created by the Andersen work crew. - -~ -S -#5307 -On The Dangerous Stones~ - Here the elements have carved away at the sides of the pyramid quite a -bit. You aren't so sure of your footing anymore... - -Suddenly the wind picks up, and you lose your balance! -You tumble down the side of the pyramid, and fall to your death! - -SPLAT. - -Ouch. -~ -53 bd 0 -S -#5308 -A Ladder~ - You are climbing an ancient ladder that leads down into the depths of -the pyramid. The air around is thick with layers of dust and a strange -musty smell. Above you you see tiny beams of light coming through the -stones of the ceiling. -~ -53 cd 0 -D4 -You see the sandy stones of the ceiling. -~ -stones~ -1 -1 5306 -D5 -You see a small dusty chamber. -~ -~ -0 -1 5309 -E -stones~ -As you look closer you can make out a crack in the center of the stones -above your head. With some effort you might be able to lift that section -up and get outside! -~ -S -#5309 -A Musty Chamber~ - You are standing in a dank, musty chamber just inside the pyramid. -Footprints and other strange marks are set into the dusty floor here. -It would seem that some of the tenants of this monument are still alive. -Exits lead in all directions. The door to the west is covered with -inscriptions. -~ -53 d 0 -D0 -You see a tiny crawlway raised about three feet off the ground. -~ -~ -0 -1 5312 -D1 -A dust-covered hallway leads off to the east. -~ -~ -0 -1 5339 -D2 -You see a small crack in the wall through which you might be able to slide. -~ -~ -0 -1 5324 -D3 -You see a large stone door, covered in sigils and hieroglyphs. -~ -door stone~ -1 -1 5310 -D4 -A small rickety ladder leads up. -~ -~ -0 -1 5308 -E -door stone~ -The stone door is covered in strange inscriptions and hieroglyphs that warn -you not to proceed any further. -~ -E -sigils hieroglyphs inscriptions writing~ -You cannot understand the strange glyphs that cover the door, but most of -them seem to depict scenes of fire and massive creatures of apparently -tremendous strength. You have a feeling that the glyphs are serving as a -warning. -~ -S -#5310 -The Fire Pool~ - This room is dominated by a massive raised pool that is filled with -not water but flames of intense heat. The multicoloured flames lick out -at you, searching for things to burn. The pool proceeds to the east into -a small chamber. -~ -53 cd 0 -D1 -You see a large stone door. -~ -door stone~ -1 -1 5309 -D3 -You see a small chamber filled with fire. -~ -~ -0 -1 5311 -S -#5311 -The Chamber Of The Efreet~ - You make your way across the fire pool, and into a small stone chamber. -Here the flames are nearly as high as your head, singeing your face and -evaporating your sweat instantaneously. -~ -53 d 7 -D1 -The pool of fire ends to the east. -~ -~ -0 -1 5310 -S -#5312 -A Tiny Crawlway~ - You have to go down onto your hands and knees to fit inside this tiny -space. The crawlway is thick with sand and dust, and markings of the -passage of other creatures. -~ -53 ad 0 -D0 -The crawlway continues to the north. -~ -~ -0 -1 5313 -D2 -The crawlway ends to the south in a musty chamber. -~ -~ -0 -1 5309 -D4 -A small hole above your head leads into a dank chamber. -~ -~ -0 -1 5337 -S -#5313 -A Tiny Crawlway~ - You are on your hands and knees, inside a small crawlway that winds -through the inside of the pyramid. The crawlway is thick with sand, dust, -and markings of the passage of other creatures. -~ -53 ad 0 -D2 -The crawlway continues to the south. -~ -~ -0 -1 5312 -D3 -The crawlway continues to the west. -~ -~ -0 -1 5314 -S -#5314 -A Tiny Crawlway~ - You are on your hands and knees, inside a small crawlway that winds -through the inside of the pyramid. The crawlway is thick with sand, dust, -and markings of the passage of other creatures. -~ -53 ad 0 -D1 -The crawlway continues to the east. -~ -~ -0 -1 5313 -D3 -The crawlway gets a little tighter to the west. -~ -~ -0 -1 5315 -S -#5315 -A Tightening In The Crawlway~ - Here you are forced to slide on your belly through a particularly tight -section of the crawlway, as the stones of the pyramid close together about -you. Below you is a small, slippery-looking hole that plummets into -blackness. -~ -53 ad 0 -D1 -The crawlway gets a little larger to the east. -~ -~ -0 -1 5314 -D2 -The crawlway continues to diminish in size to the south. -~ -~ -0 -1 5316 -D5 -The hole looks very slippery and very dark. -~ -~ -0 -1 5317 -S -#5316 -The Crawlway's End~ - The crawlway shrinks away to nothing as the sandy stones of the pyramid -close together into a space through which only a snake could fit. There is -barely enough space to turn around and make your way back through the tiny -crawlway to the north. -~ -53 ad 0 -D0 -The crawlway gets a little larger to the north. -~ -~ -0 -1 5315 -S -#5317 -A Slippery Hole~ - The sides of this hole are slippery-smooth. You lower yourself in, and -proceed to move downward... when suddenly you lose your purchase! - -You fall for what seems like an eternity, and smash into the stones below... - - - -Under The Hole - You are in a small chamber underneath the slippery hole, far below -the pyramid now. The floor is strewn with bones. To the south is a -small rocky crevasse. -~ -53 acd 0 -D2 -You see a rocky crevasse that proceeds deep under the pyramid. -~ -~ -0 -1 5319 -D4 -The hole looks far too slippery to climb back up. -~ -~ -0 -1 -1 -E -bones~ -The bones have whitened and cracked in the dry air, apparently the remains -of adventurers, thieves, and creatures that did not survive the fall. -~ -S -#5318 -Under The Hole~ - You are in a small chamber underneath the slippery hole, far below -the pyramid now. The floor is strewn with bones. To the south is a -small rocky crevasse. -~ -53 ad 0 -D2 -You see a rocky crevasse that proceeds deep under the pyramid. -~ -~ -0 -1 5319 -D4 -The hole looks far too slippery to climb back up. -~ -~ -0 -1 -1 -E -bones~ -The bones have whitened and cracked in the dry air, apparently the remains -of adventurers, thieves, and creatures that did not survive the fall. -~ -S -#5319 -A Rough Crevasse~ - You are now exploring deep within a strange rocky crevasse that plunges -down into the rock on which the pyramid was constructed. To the south you -see the flickering light of a fire, and the crevasse proceeds downward. -~ -53 d 0 -D0 -You see a small stone chamber littered with bones. -~ -~ -0 -1 5318 -D2 -You see the flickering light of a small fire. -~ -~ -0 -1 5320 -D5 -The crevasse continues downward into total darkness. -~ -~ -0 -1 5321 -E -rough~ -As you look through the rough terrain, your eyes catch a small glint of light! -~ -S -#5320 -A Small Fire~ - Here a small fire burns in a nook in the rocks, providing some warmth and -comforting light in the cold, dark, dry air. -Standing here is a strange-looking old man, who stares at you balefully. -~ -53 d 0 -D0 -You see a massive crevasse that plunges into darkness. -~ -~ -0 -1 5319 -E -man old~ -The old man looks like he has been trapped down here far too long, and -has begun to lose his mind. He moves about slowly, cackling to himself. - -He turns to you and shouts, 'nope measse! nope measse!', then turns -back and stares into the fire. - -'What a strange person,' you think to yourself. - -~ -S -#5321 -Down The Crevasse~ - The crevasse proceeds downward into the dark depths of the earth. -The air about you is now cold and quite dry, and your light source -gutters in a cool breeze that wafts up from below. -~ -53 ad 0 -D4 -It is too dark for you to see any further along the crevasse. -~ -~ -0 -1 5319 -D5 -It is too dark for you to see any further along the crevasse. -~ -~ -0 -1 5322 -S -#5322 -At The Crevasse's End~ - Here the crevasse comes to an abrupt end. A chilling wind howls -at your face from a black shape to the south, but the light from your -source is too dim to see exactly what it is. -~ -53 ad 0 -D2 -You see a strange-looking black shape. -~ -sesame~ -2 5323 5323 -D4 -It is too dark for you to see anything along the crevasse. -~ -~ -0 -1 5321 -E -black shape~ -Wind howls about your ears like the roar of a tiger. As your eyes -adjust to the light the shape to the south almost seems to take the -form of a massive animal head. -~ -E -tiger head animal sesame~ -You are now certain that the wind is the cold breath of some unearthly -giant animal, whose voice rumbles lowly on the breeze, and whose -massive jaws could easily swallow you whole. - -You move closer for a better look, when suddenly a pair of eyes flashes. -A cold voice echoes: 'SEEK YE THE DIAMOND... IN THE ROUGH...' - -... Then all is silent. -~ -S -#5323 -The Vault Of The Lamp~ - The jaws of the massive stone tiger part wide to reveal a great vault. -An arched ceiling lies far above your head... and all about you is a low -guttural rumbling noise and a chill wind. -Giant heaps of ancient treasure, gold coins, and valuables surround you -on all sides. -~ -53 ad 0 -D0 -Through the jaws of the tiger you see the blackness of the crevasse. -~ -~ -2 5323 5322 -E -treasure gold coins valuables~ -You reach for some of the tasty goodies, when you hear a loud rumbling -sound and see a bright flash of light... - -Then the words: 'TAKE ONLY THE LAMP... TOUCH NOTHING ELSE.' - -... All is silent once again. -~ -S -#5324 -A Crack In The Wall~ - You exhale, and squeeze yourself into the narrow crack in the wall. -Dust fills your eyes as you disturb it, and chunks of mortar and stone -mixed with a touch of sand fall on you as you scrape your way through. -~ -53 ad 0 -D0 -You see a musty chamber. -~ -~ -0 -1 5309 -D2 -You see a tomb. -~ -~ -0 -1 5325 -S -#5325 -A Looted Tomb~ - The floor of this small tomb is littered with the lids of -smashed sarcophagi, bits of treasure dropped by thieves and -looters, and corpses pulled from their resting places. -~ -53 d 0 -D0 -You see a small crack in the wall through which you might be able to slide. -~ -~ -0 -1 5324 -D1 -To the east is another tomb. -~ -~ -0 -1 5333 -D3 -To the west is another tomb. -~ -~ -0 -1 5326 -S -#5326 -A Demolished Tomb~ - This tomb has been utterly destroyed by thieves and looters in search of -the treasures of the pharoahs. Nothing of interest remains in this room, -except a large stone coffin that leans against the western wall. -~ -53 d 0 -D1 -To the east is another tomb. -~ -~ -0 -1 5325 -D3 -You see a large stone coffin. -~ -coffin lid~ -2 5312 5327 -E -coffin lid~ -The coffin is sculpted into the form of a man, standing several heads above -you, and clad in the garments of pharoahs. It has apparently been untouched -by the ravages of time and the activities of looters. Several markings on the -side indicate spots where unsuccessful attempts were made to open the coffin. - -You can't see any way to open it. -~ -E -man garments pharoah~ -As you look closer at the figure sculpted into the stone coffin you notice a -small marking carved into its chest. It looks like a scarab or small beetle -would fit into the small space, if properly sized. - -Hmmm. -~ -S -#5327 -A Stairway~ - You stand now at the head of a stairway that goes down into darkness. -The steps and walls are smooth sandy stone, covered with a thick layer -of dust. Some inscriptions are carved into the wall here. -~ -53 ad 0 -D1 -You see the backside of the coffin lid, featureless stone. -~ -coffin lid~ -2 -1 5326 -D5 -It is too dark to see down the stairway. -~ -~ -0 -1 5328 -E -inscriptions~ -You blow dust away from the inscriptions to read: - -Beware the curse of the mummy. - -~ -E -coffin lid~ -On this side the coffin lid is smooth featureless stone. -~ -S -#5328 -A Stairway~ - You are on a stairway that disappears into darkness in both directions. -The smooth, uneven steps of the stairway have not been travelled in what -appears to be centuries. -~ -53 ad 0 -D4 -It is too dark to see up the stairway. -~ -~ -0 -1 5327 -D5 -It is too dark to see down the stairway. -~ -~ -0 -1 5329 -S -#5329 -A Stairway~ - You stand now at the base of the uneven stairway. The walls, floor, -and ceiling of this small landing are covered with strange hieroglyphics. -~ -53 ad 0 -D2 -You see a seam in the stone wall. -~ -stone~ -1 -1 5330 -D4 -It is too dark to see up the stairway. -~ -~ -0 -1 5328 -E -walls floor ceiling hieroglyphics~ -The hieroglyphics are covered with a thick layer of dust. You clear the -dust away with your hand, and find that you cannot comprehend them. -~ -S -#5330 -The Ancient Hall~ - Here the air is deathly still, motes of dust thickly obscuring your -vision. Several stone statues line the walls of the hall, depicting the -gods of an ancient society. Strange glyphs and sigils cover the walls, a -peculiar pictorial form of written language that you don't understand. - Some steps lead to a raised dais to the south. -~ -53 ad 0 -D0 -You see a seam in the stone wall. -~ -stone~ -1 -1 5329 -D2 -You see a small raised dais. -~ -~ -0 -1 5331 -E -writings glyphs sigils hieroglyphics symbols~ -You don't understand the meaning of these symbols. -~ -S -#5331 -A Raised Dais~ - You are at the southern end of the ancient hall, the dust and darkness -absorbing your light so that you cannot see past the steps of the dais. -A low pedestal rests here. You see something written into the face of it. -~ -53 ad 0 -D0 -You cannot see past the steps of the dais. -~ -~ -0 -1 5330 -D5 -You see a seam in the stone floor. -~ -tomb~ -1 -1 5332 -E -pedestal writings~ -The writings are covered in sand and worn nearly away by the passage -of time: 'I am Ramses the Damned, once counselor and aide to the mightiest -of pharoahs and queens of this land. Much time has passed since I last -walked the earth. Disturb my rest at your peril.' -~ -S -#5332 -The Tomb Of Ramses~ - You stand in an empty tomb, a cubicle no more then ten feet to a side. -~ -53 ad 0 -D4 -That leads back the way you came. -~ -tomb~ -1 -1 5331 -S -#5333 -A Ransacked Tomb~ - This tomb has been completely ransacked and destroyed by the actions -of pyramid thieves and looters. The floor is littered with junk. -~ -53 d 0 -D1 -To the east is a low-ceilinged tunnel. -~ -~ -0 -1 5334 -D3 -To the west is another tomb. -~ -~ -0 -1 5325 -S -#5334 -A Tunnel~ - The low-ceilinged tunnel runs east-west. -~ -53 ad 0 -D1 -You cannot see into the darkness of the low tunnel. -~ -~ -0 -1 5335 -D3 -You see a tomb. -~ -~ -0 -1 5333 -S -#5335 -A Fork In The Tunnel~ - Here the tunnel forks off through a gaping hole down in the -southern wall, continuing onward to the east and west as well. -~ -53 ad 0 -D1 -You cannot see into the darkness of the low tunnel. -~ -~ -0 -1 5336 -D2 -The hole is low, at the floor of the southern wall. -~ -~ -0 -1 -1 -D3 -You cannot see into the darkness of the low tunnel. -~ -~ -0 -1 5334 -D5 -Through the hole you see rubble and sand. -~ -~ -0 -1 5346 -E -hole~ -The hole is low, at the floor of the southern wall. -~ -S -#5336 -A Tunnel~ - The low-ceilinged tunnel makes a turn to the west and ends -to the north as it spills out into a dusty hallway. -~ -53 ad 0 -D0 -The mouth of the tunnel is stone that has been torn away by looters. -~ -~ -0 -1 5342 -D3 -You cannot see into the darkness of the low tunnel. -~ -~ -0 -1 5335 -S -#5337 -A Dank Chamber~ - This chamber has a dank, dusty, musty smell to it. Small footprints -in the dust betray the recent passage of some sort of creatures. A hole -in the floor lies to the west and a stairway is to the east. -~ -53 d 0 -D1 -You see a spiral stone stairway. -~ -~ -0 -1 5338 -D3 -You see only blackness through the hole in the floor. -~ -~ -0 -1 5312 -S -#5338 -A Spiral Stairway~ - Some dusty, broken stone stairs here spiral slowly in a constricted -space down towards a dusty hallway. -~ -53 d 0 -D4 -The stairs spiral up into a dank chamber. -~ -~ -0 -1 5337 -D5 -The stairs spiral down into a dusty hallway. -~ -~ -0 -1 5341 -S -#5339 -A Dust-Covered Hallway~ - This hallway is covered with dust that has accumulated over the -centuries that the pyramid has stood. Small markings and footprints -in the dust betray the recent passage of others -- perhaps thieves? -~ -53 d 0 -D1 -The hallway proceeds to the east towards a strange smell. -~ -~ -0 -1 5340 -D3 -The hallway proceeds towards the west towards a musty smell. -~ -~ -0 -1 5309 -S -#5340 -A Smelly Chamber~ - This small chamber has a sickly putrescent smell to it, the -smell of formaldehyde and other ointments used to preserve the -corpses of those who died ages ago. -~ -53 d 0 -D1 -You see a dusty hallway. -~ -~ -0 -1 5341 -D3 -You a dusty hallway. -~ -~ -0 -1 5339 -S -#5341 -A Dust-Covered Hallway~ - This hallway is covered with a thick, choking dust that rises -up to obscure your light source and sting your eyes. Small marks -and footprints in the dust betray the recent passage of others. -~ -53 d 0 -D1 -The hallway turns to the north. -~ -~ -0 -1 5342 -D3 -You smell something peculiar over there. -~ -~ -0 -1 5340 -D4 -A tightly spiralling stone stairway leads up. -~ -~ -0 -1 5338 -S -#5342 -A Turn In The Hallway~ - You are standing in an elbow turn in a dust-covered stone hallway, -that dead ends to the north and continues on to the west. To the south -the stones of the pyramid have been torn asunder by thieves, making -a low-ceilinged tunnel. -~ -53 d 0 -D0 -The hallway ends to the north. -~ -~ -0 -1 5343 -D2 -The tunnel is dark. -~ -~ -0 -1 5336 -D3 -The dust-covered hallway continues to the west. -~ -~ -0 -1 5341 -S -#5343 -A Dead End~ - The dust-covered hallway has come to an abrupt end at a stony, -featureless wall. Here and there are signs of the recent passage -of others in the dust. -~ -53 d 0 -D2 -The dusty hall continues to the south. -~ -~ -0 -1 5342 -D5 -The floor is quite dusty, and made of stone. You see some cracks. -~ -floor~ -1 -1 5344 -E -cracks~ -The cracks look like you might be able to pull away some pieces of -the floor, perhaps even fit your body through the space you make. -~ -S -#5344 -The Tomb Entrance~ - You are in a small, dark chamber that has stood undisturbed for -many years. To the north stands a massive stone tomb, which is -covered in hieroglyphics and gold-lined carvings that mark it as the -final resting place of the mighty pharoahs of this land. -~ -53 acd 0 -D0 -You see the tomb of the pharoahs. -~ -tomb~ -1 -1 5345 -D4 -The stone ceiling has some cracks in it, through which a dim light streams. -~ -ceiling~ -1 -1 5343 -E -tomb~ -The tomb looks like it has stood for many years, much like the pyramid -which encloses it. It is covered in small hieroglyphics. -~ -E -hieroglyphics carvings~ -The markings indicate that this tomb is indeed the tomb of the greatest -pharoahs of the ancient civilization that built this massive pyramid. -~ -S -#5345 -The Tomb Of The Pharoahs~ - Great golden sarcophogai line the walls of this massive tomb. It has -withstood the passage of time intact, untouched by the hands of thieves -and looters. The treasures taken by the pharoahs to their graves still -lie before your feet. -~ -53 ad 0 -D2 -That way leads back out of the tomb. -~ -tomb~ -1 -1 5344 -E -treasures~ -The treasures are dusty and fragile, but still seem quite valuable. -You decide not to take them out of respect for the ancient dead. -~ -S -#5346 -A Rubble-Strewn Hallway~ - This hallway formerly had a beautiful arch to the ceiling, now -collapsed under the weight of the slowly settling stones of the -pyramid. Now, a massive pile of rubble leads up into a hole high -in the northern portion of the hallway. To the south, through the -rubble and fallen stones you see a sandstone crypt. -~ -53 acd 0 -D2 -You see a sandstone crypt. -~ -~ -0 -1 5347 -D4 -From here you see only darkness. -~ -~ -0 -1 5335 -S -#5347 -A Sandstone Crypt~ - This small crypt is lit by a hole in the wall to the south, through -which sand pours from the desert outside. A hot wind blows in from the -desert, drying your skin instantly. To the east and north the arched -hallway continues. -~ -53 d 0 -D0 -The arched hallway collapses into rubble shortly to the north. -~ -~ -0 -1 5346 -D1 -You see a beautifully arched hallway. -~ -~ -0 -1 5348 -D2 -You see a lot of sand. -~ -~ -0 -1 5353 -S -#5348 -An Arched Hall~ - This hallway has a beautiful arch to it, formed painstakingly and -exquisitely out of the sandy stones of the pyramid. The dust that -covers most of the rest of the pyramid interior is not present here, -scoured away by the blowing of the desert winds that howl about -your ears. -~ -53 d 0 -D1 -The arched hall proceeds to the east, making a sharp southward turn. -~ -~ -0 -1 5349 -D3 -The arched hall proceeds into a sandstone crypt. -~ -~ -0 -1 5347 -S -#5349 -An Arched Hall~ - This hallway has a beautiful arch to it, formed painstakingly and -exquisitely out of the sandy stones of the pyramid. To the east is -a small, golden-coloured crypt, and the hall proceeds to the south -and north. -~ -53 d 0 -D0 -The arched hall proceeds to the north, making a sharp westward turn. -~ -~ -0 -1 5348 -D1 -A small golden crypt lies to the east. -~ -~ -0 -1 5350 -D2 -The arched hall proceeds to the south. -~ -~ -0 -1 5351 -S -#5350 -A Golden Crypt~ - You stand inside a small crypt with walls and ceiling made of -golden bricks that obscure the large sandy stones of the pyramid. -Small rugs and tapestries are scattered about the floor here, and -they appear to have been used recently. -~ -53 d 0 -D3 -You see an arched hall. -~ -~ -0 -1 5349 -E -rug rugs tapestry tapestries~ -The rugs and tapestries are very fine and worn with age, their colors -now faded. They depict scenes of life in an ancient desert city. -~ -E -bricks~ -The small golden bricks are very smooth and also quite soft. -~ -S -#5351 -An Arched Hall~ - This hallway has a beautiful arch to it, formed painstakingly and -exquisitely out of the sandy stones of the pyramid. The arched -hall proceeds to the north and ends to the south in a small vault. -~ -53 d 0 -D0 -The arched hall continues to the north. -~ -~ -0 -1 5349 -D2 -You see a small vault from which a shining light issues. -~ -~ -0 -1 5352 -S -#5352 -A Shining Vault~ - The stones of the pyramid here take on a strange, twinkling quality, -almost seeming to shine with an internal light. As you look closer you -see tiny glass-like glittery particles within the stones, that reflect -the light from your light source so perfectly that they seem to shine. -~ -53 d 0 -D0 -You see a hall with a beautifully arched ceiling. -~ -~ -0 -1 5351 -E -particles glass~ -The glassy particles reflect and refract your light source in a myriad -of dazzling colours that dance across your eyes and make you giggle. -~ -S -#5353 -A Massive Sand Dune~ - You stand now on a massive sand dune on the southern side of -the pyramid. At the foot of the sand dune to the north you see a -small hole where the stones of the pyramid have collapsed. Not -far to the south is a massive roiling sandstorm; the wind from the -storm howls and bites at your face even here. -~ -53 c 2 -D0 -You see a small hole leading back into the pyramid. -~ -~ -0 -1 5347 -D2 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5354 -E -sand dune sandstorm~ -The sand is very white, and very sandy. There sure is a lot of it. -~ -S -#5354 -A Swirling Sandstorm~ - You are caught in the midst of a massive sandstorm. Howling winds -buffet you from all sides, and the sand tears at your skin, blinding -you and choking you. You have lost all sense of direction. -~ -53 0 2 -D0 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5353 -D1 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5354 -D2 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5355 -D3 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5354 -E -sand~ -Sand is about all you CAN see right now. Unfortunately, it isn't very -interesting sand, only white, dry, and blowing all over the place. -~ -S -#5355 -A Swirling Sandstorm~ - You are caught in the midst of a massive sandstorm. Howling winds -buffet you from all sides, and the sand tears at your skin, blinding -you and choking you. You have lost all sense of direction. -~ -53 0 2 -D0 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5354 -D1 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5355 -D2 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5356 -D3 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5355 -E -sand~ -Sand is about all you CAN see right now. Unfortunately, it isn't very -interesting sand, only white, dry, and blowing all over the place. -~ -S -#5356 -A Swirling Sandstorm~ - You are caught in the midst of a massive sandstorm. Howling winds -buffet you from all sides, and the sand tears at your skin, blinding -you and choking you. You have lost all sense of direction. -~ -53 0 2 -D0 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5355 -D1 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5356 -D2 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5357 -D3 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5356 -E -sand~ -Sand is about all you CAN see right now. Unfortunately, it isn't very -interesting sand, only white, dry, and blowing all over the place. -~ -S -#5357 -A Swirling Sandstorm~ - You are caught in the midst of a massive sandstorm. Howling winds -buffet you from all sides, and the sand tears at your skin, blinding -you and choking you. You have lost all sense of direction. -~ -53 0 2 -D0 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5356 -D1 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5357 -D2 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5358 -D3 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5357 -E -sand~ -Sand is about all you CAN see right now. Unfortunately, it isn't very -interesting sand, only white, dry, and blowing all over the place. -~ -S -#5358 -A Massive Sand Dune~ - Somehow you managed to make your way through the howling winds -of the sandstorm, and clamber up on this sand dune. You can see the -storm to the north of you, and presumably the pyramid is somewhere -beyond it. Nothing but flat, featureless, open dunes of sand lie in -every other direction. -~ -53 0 2 -D0 -You see only a wall of whirling, blowing, dry sand. -~ -~ -0 -1 5357 -D2 -On the southern side of the sand dune is a small hole in the sand. -For some reason you seem unable to get to it. -~ -riddle~ -2 5317 5359 -E -sand dune~ -The sand is very white, and very sandy. There sure is a lot of it. -~ -E -riddle~ -A vision forms before your eyes, in glowing hieroglyphic symbols. -~ -E -hieroglyphics symbols~ -Like most of the ancient hieroglyphics of this land, the symbols are -totally incomprehensible to you. Perhaps the Sphinx has the answer -to this ancient riddle. -~ -S -#5359 -Through The Hole In The Sand~ - You squeeze through the small hole in the sand and land in a small -white chamber. Above you is a small hole, reachable by climbing up -the small sandy slope down which you slid. -~ -53 acd 0 -D4 -You see a sand dune. -~ -~ -0 -1 5358 -S -$ diff --git a/lc-mud/circle/world/wld/54.wld b/lc-mud/circle/world/wld/54.wld deleted file mode 100644 index 0b3272916926de29e5cf7f8c4c852f083dc92310..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/54.wld +++ /dev/null @@ -1,5167 +0,0 @@ -#5400 -The Entrance To The Dancing Daemon Inn~ - You find yourself in an entrance foyer to the Dancing Daemon Inn. -Chrome plated stairs spiral up to the reception area. To the south -you hear the sounds of merriment and drinking and from the west you -hear the bustling activity of New Thalos. -~ -54 d 0 -D2 -You see people dancing and drinking. -~ -~ -0 -1 5402 -D3 -You see people walking by on Sultan's Walk. -~ -~ -0 -1 5420 -D4 -The spiral stairs lead up to the reception area. -~ -~ -0 -1 5401 -S -#5401 -The Reception Area~ - You are now standing in the reception of New Thalos. A huge mahogany -desk is here along with two sofas and a coffee table covered in magazines. -The plush carpeting under your feet is a nice change from the rugged paths -you are used to travelling. A chrome stairway spirals downstairs to the -tavern of the Dancing Daemon Inn, and your future adventures in New Thalos. -~ -54 deh 0 -D5 -The stairs lead down to the Daemon. -~ -~ -0 -1 5400 -S -#5402 -The Dancing Daemon Inn~ - A huge circling wet-bar takes up most of the east end of the Daemon. An -old mage reclines against the mirror behind the bar absentmindedly pouring -several drinks at once with his refined telekinesis. The Lokettes, a local -band, are playing their usual gig on the stage. The large booths along the -all are filled with people drinking and having a grand time. You feel like -partying here. -The only obvious exit is to the north. -~ -54 d 0 -D0 -You see the entrance to the Daemon. -~ -~ -0 -1 5400 -E -bar~ -The bar looks slightly out of place and you can only assume the powerful -magic of the bartender allows it to revolve. -~ -S -#5403 -The Medina~ - You stand on the Medina, on the larger open areas in New Thalos. -People walk to and fro carrying on their day to day business. The -Common Square of the people opens up to the south and the Medina -continues north. -~ -54 0 1 -D0 -You see Medina. -~ -~ -0 -1 5404 -D2 -You see the Common Square. -~ -~ -0 -1 5410 -S -#5404 -The Medina~ - You are walking along a wide open expanse of road connecting -Market Square to the Common Square. Panhandlers, beggars, and -other such riff-raff wander about hoping to catch those few who -with open hearts. The Medina continues to the south and the -Market Square spreads out to the north. -~ -54 0 1 -D0 -You see Market Square. -~ -~ -0 -1 5405 -D2 -You see the Medina. -~ -~ -0 -1 5403 -S -#5405 -Southern Market Square~ - The large square of markets fills your vision. Strange sights and -sounds, those known only to the New Thalos market, barrage your senses. -The only hope of making any sense of what is going on here is to wander -around. Market Square continues north, west, and east, with the Medina -trailing off th the south. -~ -54 0 1 -D0 -~ -~ -0 -1 5406 -D1 -~ -~ -0 -1 5407 -D2 -~ -~ -0 -1 5404 -D3 -~ -~ -0 -1 5408 -S -#5406 -The Center Of Market Square~ - You are standing in the center of Market Square, the famous square -of New Thalos. A large, peculiar looking statue is standing in the -middle of the square. The square extends in every direction. -~ -54 0 1 -D0 -~ -~ -0 -1 5415 -D1 -~ -~ -0 -1 5417 -D2 -~ -~ -0 -1 5405 -D3 -~ -~ -0 -1 5409 -E -statue~ -Before you is a statue of the mighty beholder! -A great beast with multiple eyes and wicked... wicked... um.... eyes... -The mighty beholder is in Excellent condition. -~ -S -#5407 -Southeastern Market Square~ - In this corner of the market some of the largest warriors in the land -tower over you. It is easy to understand why they hang out here once you -notice the weapon shop and the armoury close by. Perhaps you might stop -in and take a look at the wares these shops have to offer. -~ -54 0 1 -D0 -~ -~ -0 -1 5417 -D1 -~ -~ -0 -1 5529 -D2 -~ -~ -0 -1 5536 -D3 -~ -~ -0 -1 5405 -S -#5408 -Southwestern Market Square~ - This area of the market seems relatively quiet, save the high pitch -banter of the shopkeepers attempting to lure you into their stores. -South you see the bread stand and west is the entrance to the general -store. - The market's sprawl continues east and north of here. -~ -54 0 1 -D0 -~ -~ -0 -1 5409 -D1 -~ -~ -0 -1 5405 -D2 -You see the grocer's. -~ -~ -0 -1 5535 -D3 -You see the general store. -~ -~ -0 -1 5528 -S -#5409 -Western Market Square~ - This area of the square seems a bit more subdued than the rest. -You notice that most of the outland adventurers mill around the -southern end of the market, while the townfolk seem to keep their -business in the northern end. - West Main street begins here and heads for the gate, the market's -expanse fills the other directions. -~ -54 0 1 -D0 -~ -~ -0 -1 5414 -D1 -~ -~ -0 -1 5406 -D2 -~ -~ -0 -1 5408 -D3 -~ -~ -0 -1 5426 -S -#5410 -The Common Square~ - People pass by talking to each other, or rest their weary bones on this -grassy field. You can hear faint sounds of the river to the south of you -as it passes through the city. Ishtar drive heads east and west from here -and the Medina is to the north. South lies the River Ishtar Bridge and the -southern gate. -~ -54 0 1 -D0 -You see the medina. -~ -~ -0 -1 5403 -D1 -~ -~ -0 -1 5437 -D2 -You see the bridge over the river. -~ -~ -0 -1 5412 -D3 -~ -~ -0 -1 5436 -S -#5411 -Outside The Southern Gate Of New Thalos~ - You see before you the expanse of the Great Eastern Desert. -You have heard many tales of the Great Pyramid, the lost city -of Old Thalos and the friendly brass dragon that lies under the -desert. - To the south lies the desert and the city of New Thalos is -to the north. -~ -54 c 1 -D0 -~ -gate~ -1 5401 5413 -D2 -~ -~ -0 -1 5039 -S -#5412 -The Southern Bridge~ - Walking over the bridge you see the rushing waters of the River -Ishtar. To the south you see the Southern Gate of New Thalos and -the Common Square stretches out to the north -~ -54 c 1 -D0 -~ -~ -0 -1 5410 -D2 -~ -~ -0 -1 5413 -D5 -~ -~ -0 -1 5485 -S -#5413 -Inside The South Gate Of New Thalos~ - Two large stone towers rise up to greet you with the massive iron -gate swinging on ornately crafted hinges and emblazoned with the crest -of New Thalos. The makers of the city spared no expense in rebuilding -the defenses or their home. The River Ishtar bridge lies to the north -and the desert to the south. -~ -54 0 1 -D0 -~ -~ -0 -1 5412 -D2 -~ -gate~ -1 5401 5411 -S -#5414 -Northwestern Market Square~ - This corner of the market contains some of the most civilized folk -in New Thalos. To the north lies the humble store of the merchant -Ahkeem, his weavings known to be the best in the city. West of here -is the entrance to the First Royal Bank of New Thalos. -~ -54 0 1 -D0 -~ -~ -0 -1 5514 -D1 -~ -~ -0 -1 5415 -D2 -~ -~ -0 -1 5409 -D3 -~ -~ -0 -1 5521 -S -#5415 -Northern Market Square~ - You stand in one of the most heavily used parts of town. To the north -lies the Palace of New Thalos and the Casbah, east west and south of here -the busy market thrives with life. -~ -54 0 1 -D0 -~ -~ -0 -1 5418 -D1 -~ -~ -0 -1 5416 -D2 -~ -~ -0 -1 5406 -D3 -~ -~ -0 -1 5414 -S -#5416 -Northeastern Market Square~ - Pandemonium. Chaos. Madness. A few other choice words come to mind -as you gaze into this corner of the market. The vegetable stand seems -quiet enough so you have to assume the noise comes from the Butchery. -You have to think for a while before you muster the will to enter this -shop. The market continues to the south and west. -~ -54 0 1 -D0 -~ -~ -0 -1 5515 -D1 -~ -~ -0 -1 5522 -D2 -~ -~ -0 -1 5417 -D3 -~ -~ -0 -1 5415 -S -#5417 -Eastern Market Square~ - You stand in the market of New Thalos, the gem of the desert. The -market is the hub of the city, all trade and commerce of any significance -is carried on here. The market spreads out in all directions save east, -here Main Street heads for the easter gate. -~ -54 0 1 -D0 -~ -~ -0 -1 5416 -D1 -~ -~ -0 -1 5427 -D2 -~ -~ -0 -1 5407 -D3 -~ -~ -0 -1 5406 -S -#5418 -Sultan's Walk~ - This cobblestone road aides your journey through town. Traveling north -will take you by the Palace and the Dancing Daemon Inn, and south will put -you on Market Square. -~ -54 0 1 -D0 -~ -~ -0 -1 5419 -D2 -~ -~ -0 -1 5415 -S -#5419 -Sultan's Walk~ - This part of the road travels between one of the sturdy walls of -the Palace and the Dancing Daemon. To the east you peer through a -small window into the Daemon, seeing many people dancing and drinking. -After you tend to your other chores you plan on visiting the Daemon. - The walk continues north and south from here. -~ -54 0 1 -D0 -~ -~ -0 -1 5420 -D2 -~ -~ -0 -1 5418 -S -#5420 -Sultan's Walk~ - The road here between the Palace and the Dancing Daemon Inn seems well -worn by the travel of horses, carts, and leather boots. From the west you -hear the faint sound of trumpets announcing the arrival of some duke or -duchess to the Palace. Safe haven awaits you to the east in the halls -of the Daemon, and Sultan's Walk continues north and south. -~ -54 0 1 -D0 -~ -~ -0 -1 5421 -D1 -~ -~ -0 -1 5400 -D2 -~ -~ -0 -1 5419 -D3 -~ -~ -0 -1 5558 -S -#5421 -Sultan's Walk~ - The main road north from the square continues here, surrounded -by the walls of the Palace and the Daemon. To the north you see -the heavily guarded gate and can make out faint sounds of trade -to the south. -~ -54 0 1 -D0 -~ -~ -0 -1 5422 -D2 -~ -~ -0 -1 5420 -S -#5422 -Inside The Northern Gate Of New Thalos~ - Two large stone towers rise up to greet you with a massive iron -gate swinging between on ornately crafted hinges and emblazend with -the crest of New Thalos. The makers of this city spared no costs -in rebuilding the defenses of their home. - Sultan's Walk runs to the south and the Casbah stretches out east -and west. To the north is wilderness. -~ -54 0 1 -D0 -~ -gate~ -1 5401 5567 -D1 -~ -~ -0 -1 5449 -D2 -~ -~ -0 -1 5421 -D3 -~ -~ -0 -1 5448 -S -#5423 -Inside The West Gate Of New Thalos~ - Two large stone towers embedded in the wall loom over you. The -massive iron gate, emblazoned with the crest of New Thalos, swings -easily on four ornately crafted hinges. It is obvious the makers -of this city spared no expense in protecting their home. - Main street heads towards the market eastward and the wilderness -beckons from the west. To the south lies the entrance the Warriors' -Guild. -~ -54 c 1 -D1 -~ -~ -0 -1 5424 -D2 -~ -~ -0 -1 5526 -D3 -~ -gate~ -1 5401 5569 -S -#5424 -West Main Street~ - This is the main road traveling though the city. To the south you -hear the hammering of the repair shop and to the north is the grassy -field known as Temple Square. Main street continues east and west. -~ -54 0 1 -D0 -~ -~ -0 -1 5520 -D1 -~ -~ -0 -1 5425 -D2 -~ -~ -0 -1 5527 -D3 -~ -~ -0 -1 5423 -S -#5425 -West Main Street~ - A foreman stands stand here watching over two construction workers -fixing a pothole. The road here branches off north and south into -two alleys behind the stores of the market. The main street continues -east and west from here. -~ -54 0 1 -D0 -~ -~ -0 -1 5471 -D1 -~ -~ -0 -1 5426 -D2 -~ -~ -0 -1 5472 -D3 -~ -~ -0 -1 5424 -S -#5426 -West Main Street~ - You are strolling on the street between the bank and general store. -To the west you hear a roadcrew at work and to the east, the sounds of -commerce taking place. The air is filled with the smell of gold and -riches. -On the wall of the store is a poster. -~ -54 0 1 -D1 -~ -~ -0 -1 5409 -D3 -~ -~ -0 -1 5425 -E -poster~ -The poster is of a wealthy looking man in red robes smiling at you. -The caption reads: - - THE SULTAN REMINDS YOU TO PAY YOUR TAXES! - -~ -S -#5427 -East Main Street~ - Here on East Main, you smell the odor of freshly slaughtered meat -and, hear the pounding of new metal from the armory. The Square is -to the west and a junction is to the East. -~ -54 0 1 -D1 -~ -~ -0 -1 5428 -D3 -~ -~ -0 -1 5417 -S -#5428 -East Main Street~ - You are on East Main Street. To the North is the beginning -of Guildsman Row. To the South is a dark alley. The road also -continues to the East. -There is a small sign on a wire hanging across the junction. -~ -54 0 1 -D0 -~ -~ -0 -1 5464 -D1 -~ -~ -0 -1 5429 -D2 -~ -~ -0 -1 5465 -D3 -~ -~ -0 -1 5427 -E -sign~ -The sign reads: - - NO LOITERING! - - (by order of the Sultan of New Thalos) - -~ -S -#5429 -East Main Street~ - As you walk by the mercenary guild a cold chill causes you to shiver -uncontrollably. You see some shady looking characters lurking about the -entrance to this house of 'helpful' people. Perhaps curiosity gets the -best of you, but you wonder what could be going on inside. To the north -you see the open doors of the apothecary shop where one may buy many -magical livations. - Main Street continues east and west from here. -~ -54 0 1 -D0 -~ -~ -0 -1 5523 -D1 -~ -~ -0 -1 5430 -D2 -~ -~ -0 -1 5530 -D3 -~ -~ -0 -1 5428 -S -#5430 -East Main Street~ - The Main street through eastern New Thalos begins here and heads -westward towards the marketplace. One of the main gates can be seen -to the east and Braheem's Magic Shop awaits your business to the north. -~ -54 0 1 -D0 -~ -~ -0 -1 5524 -D1 -~ -~ -0 -1 5431 -D3 -~ -~ -0 -1 5429 -S -#5431 -Inside the Eastern Gate of New Thalos~ - Two large stone towers imbedded in the wall loom over you. The -massive iron gate, emblazened with the crest of New Thalos, swings -easily on four ornately crafted hinges. It is obvious the makers -of this city spared no expense in protecting their home. - Main street heads towards the market westward and the wilderness -beckons from the east. To the north lies the entrance to the Mages' -Guild. -~ -54 c 1 -D0 -~ -~ -0 -1 5525 -D1 -~ -gate~ -1 5401 5568 -D3 -~ -~ -0 -1 5430 -S -#5432 -Cassandra's Catch Of The Day~ - Nothing in your life has prepared you for the odor which fills your -lungs. Not wanting to offend the beautiful shopkeeper you hold your -tongue and quietly look over her selection. -~ -54 cd 0 -D2 -~ -~ -0 -1 5441 -S -#5433 -West Ishtar Drive~ - This is the warehouse district of New Thalos. Strong men walk back -and forth from the docks to the warehouse carrying large crates loading -and unloading the boats as they sail down the river. To the north is -one of the entrances of the warehouse and West Ishtar leads east. -~ -54 0 1 -D0 -~ -~ -0 -1 5540 -D1 -~ -~ -0 -1 5434 -S -#5434 -West Ishtar Drive~ - A few men walk by almost pushing you out of the way as they go about -their business of loading and unloading the boats. An entrance to one -of the huge warehouses of New Thalos is to the north and the River Ishtar -quietly flows by to the south. Ishtar Drive continues east and west. -~ -54 0 1 -D0 -~ -~ -0 -1 5541 -D1 -~ -~ -0 -1 5435 -D3 -~ -~ -0 -1 5433 -S -#5435 -West Ishtar Drive~ - The cobblestone road is moist here, the trail of water heading down to -the boat ramp. Catching your balance as you start to slide on the slick -pavement you grab on to the handrail someone has conveniently placed here. - To the north is the Shipwright and Ishtar Drive continues east and west. -~ -54 0 1 -D0 -~ -~ -0 -1 5542 -D1 -~ -~ -0 -1 5436 -D2 -~ -~ -0 -1 5443 -D3 -~ -~ -0 -1 5434 -S -#5436 -West Ishtar Drive~ - A cool breeze blows up off the river chilling the sweat otherwise -present on your skin. Orders and sometimes curses can be heard from -the west in the direction of the warehouses. The common square opens -up to the east and Ishtar Drive continues west. -~ -54 0 1 -D1 -~ -~ -0 -1 5410 -D3 -~ -~ -0 -1 5435 -S -#5437 -East Ishtar Drive~ - Loud hammering and the sound of red hot iron cooling in water reaches -your ears as you stand in front of the blacksmith. A small boy runs up -to you with big eyes and, as you return his gaze, runs off down the road. - The common square can be seen to the west and Ishtar Drive continues -to the east. -~ -54 0 1 -D0 -~ -~ -0 -1 5544 -D1 -~ -~ -0 -1 5439 -D3 -~ -~ -0 -1 5410 -S -#5438 -East Ishtar Drive~ - The wide road bordering the south of town continues to the east west -here, bordered only by the hay-loft to the north and the River Ishtar to -the south. -~ -54 0 1 -D1 -~ -~ -0 -1 5440 -D3 -~ -~ -0 -1 5439 -S -#5439 -East Ishtar Drive~ - Small clumps of hay strewn about the ground alerts you to the fact -that you have reached the stables. Arabian stallions as well as many -other fine breeds of horses can be purchased for a price. Ishtar Drive -continues east and west. -~ -54 0 1 -D0 -~ -~ -0 -1 5545 -D1 -~ -~ -0 -1 5438 -D3 -~ -~ -0 -1 5437 -S -#5440 -East Ishtar Drive~ - Even in broad daylight, you can hardly see into the back alley -that begins here and heads north. Sounds of loud drunken folk and -the occasional screaming cat emenate from the direction. Luckily -you have the choice of going east or west down the drive as well. -~ -54 0 1 -D0 -You see murky darkness. -~ -~ -0 -1 5468 -D1 -~ -~ -0 -1 5441 -D3 -~ -~ -0 -1 5438 -S -#5441 -East Ishtar Drive~ - Your highly acute sense of smell reports you have reached the -entrance to the fish market. Although renowned for it fresh catches -and wide selection of aquarian delicacies you wonder how much longer -you can endure the smell! The River Ishtar flows alongside to the -south with the drive running along side it east to west. -~ -54 0 1 -D0 -~ -~ -0 -1 5432 -D1 -~ -~ -0 -1 5442 -D3 -~ -~ -0 -1 5440 -S -#5442 -East Ishtar Drive~ - The sound of squawking gulls and the smell of rotting fish gives you -a hint of your location. The River Ishtar flows south of you, but looks -crystal clear, so it cannot be the source of this putrid smell. -Looking north you notice a small sign hanging over the dump. -~ -54 0 1 -D0 -~ -~ -0 -1 5547 -D3 -~ -~ -0 -1 5441 -E -sign~ -#====================================================# -| | -| THE DUMP OF NEW THALOS | -| | -| | -| ----- | -| | -| Enter at your own risk. | -| -the management | -| | -#====================================================# -~ -S -#5443 -The Boat Ramp~ - This sloped slab of stone allows easy passage to and from the River -Ishtar. Boats are moored to the docks here awaiting their masters to -return from the warehouses and the pubs. The waters of the River Ishtar -lap at your feet to the south and Ishtar Drive is to the north. -~ -54 c 1 -D0 -~ -~ -0 -1 5435 -D2 -~ -~ -0 -1 5486 -S -#5444 -West Casbah~ - The air takes on a somber note as you stand before the entrance to the -jailhouse of New Thalos. Hopefully you won't ever see this structure from -the inside. The northwest tower stands here with a spiral staircase -leading up. The Avenue ends here, only exiting to the east. -~ -54 0 1 -D1 -~ -~ -0 -1 5445 -D2 -~ -gate~ -2 5493 5553 -D4 -~ -~ -0 -1 5559 -S -#5445 -West Casbah~ - You have almost reached the end of the Avenue in this direction, the -number of guards in this part of town is nearly doubled. To the north -the familiar city wall protects you from the wilderness. Looking south -marble stairs rise towards the entrance of city hall surrounded by -massive white pillars. - The Avenue continues east and west from here. -~ -54 0 1 -D1 -~ -~ -0 -1 5446 -D2 -~ -~ -0 -1 5554 -D3 -~ -~ -0 -1 5444 -S -#5446 -The Casbah~ - The wall of the Palace curves south from here, a darkened alley runs -along it in that direction. West of here you see the steps of the City -Hall and notice the increase in the number of guards. - To the east the Avenue continues. -~ -54 0 1 -D1 -~ -~ -0 -1 5447 -D2 -~ -~ -0 -1 5458 -D3 -~ -~ -0 -1 5445 -S -#5447 -The Casbah~ - As you travel down the road towards towards the City Hall you look up -at the guards walking along the wall keeping watch. South of you stands -the great walls of the Palace and the Avenue goes east and west. -~ -54 0 1 -D1 -~ -~ -0 -1 5448 -D3 -~ -~ -0 -1 5446 -S -#5448 -The Casbah~ - The cobblestone pavement runs along the north wall here. South of you -stand the great walls of the Palace and the Avenue goes east and west. -~ -54 0 1 -D1 -~ -~ -0 -1 5422 -D3 -~ -~ -0 -1 5447 -S -#5449 -The Casbah~ - The activity here is only slightly less than chaotic. Young boys run -to and fro with stern intent, and older gentleman swagger down the street -towards the Library. To the west you can see the tall towers of the -northern gate, and the Avenue continues east. -~ -54 0 1 -D1 -~ -~ -0 -1 5450 -D3 -~ -~ -0 -1 5422 -S -#5450 -The Casbah~ - Walking along the cobblestone path you feel secure with the walls of -the city towering over you. You hear the scraping sounds of metal on -stone and look up to see a large, strong guard looking out to the north. - To the east lies the intersection on Guildsman's Row and the northern -gate is a short walk to the west. -~ -54 0 1 -D1 -~ -~ -0 -1 5451 -D3 -~ -~ -0 -1 5449 -S -#5451 -The Casbah~ - The din of the guilds assaults your senses as you reach this -intersection, the sound of hammering, the smell of tanned leather, -and the smoke rising from the smithy all rush up to greet you. - The Avenue continues east and west from here and the Row leads -south. -~ -54 0 1 -D1 -~ -~ -0 -1 5452 -D2 -~ -~ -0 -1 5460 -D3 -~ -~ -0 -1 5450 -S -#5452 -The Casbah~ - You walk between the solid stone wall of the city and that of the -Masons' Guild. Young children with their nannies walk around enjoying -the saftey of the city. - The Avenue runs east and west from here. -~ -54 0 1 -D1 -~ -~ -0 -1 5453 -D3 -~ -~ -0 -1 5451 -S -#5453 -The Casbah~ - You have almost reached the end of the Avenue in this direction. -Walking towards the north-east corner of the city you notice the -population density here is much less then the rest of the town. A -few old men hobbling on canes and young men intent on studies are -the only travelers of the path to the library on a regular basis. - The Avenue continues east and west from here. -~ -54 0 1 -D1 -~ -~ -0 -1 5454 -D3 -~ -~ -0 -1 5452 -S -#5454 -The Casbah~ - The Avenue ends here, turning south to become Kali Row. Traveling in -that direction will take you to the Library and the grand dance hall of -the city. - The northeast tower of the wall is accessible here up a spiral staircase. -~ -54 0 1 -D2 -~ -~ -0 -1 5455 -D3 -~ -~ -0 -1 5453 -D4 -~ -~ -0 -1 5562 -S -#5455 -Kali Row~ - This is a small, newly added section of the town. The city's Library -can be entered through the door to the west and the Casbah begins its -journey a little ways north of here. The Row and the entrance to the -dancehall is to the south. -~ -54 0 1 -D0 -~ -~ -0 -1 5454 -D2 -~ -~ -0 -1 5456 -D3 -~ -~ -0 -1 5551 -S -#5456 -Kali Row~ - The short Row ends abruptly here at the entrance to the dance -hall of New Thalos. - The entrance to the hall is to the west and the Row continues -northward. -~ -54 0 1 -D0 -~ -~ -0 -1 5455 -D3 -~ -~ -0 -1 5552 -S -#5457 -Underground~ - The small passage continues north and south. -~ -54 ad 1 -D0 -~ -~ -0 -1 5478 -D2 -~ -~ -0 -1 5480 -S -#5458 -Alley~ - This is a dark alley running between the Palace and City Hall. Not a -lot here, unless you're partial to spiders and rats. -~ -54 0 1 -D0 -~ -~ -0 -1 5446 -D2 -~ -~ -0 -1 5459 -S -#5459 -Alley~ - The alley ends here. -~ -54 a 1 -D0 -~ -~ -0 -1 5458 -D5 -You see a manhole covering an opening in the road. -~ -manhole hole man~ -1 -1 5475 -S -#5460 -Guildsman's Row~ - This Row is a hive of activity second only to the actual Market -Square itself. Along this row stands all the guilds of the working -class citizens of New Thalos, here all the items sold in the Square -are made. Along this particular stretch of the row lie the Boyer/ -Fletcher to the west and the Masons' to the east. - The Row leads off to the south and East Casbah is to the north. -~ -54 0 1 -D0 -~ -~ -0 -1 5451 -D1 -~ -~ -0 -1 5556 -D2 -~ -~ -0 -1 5461 -D3 -~ -~ -0 -1 5555 -S -#5461 -Guildsman's Row~ - The guilds continue here, to the west is the Weavers' Guild, and -to the east stands the Craftsmans' Guild. The row of guilds continues -north and south from here. -~ -54 0 1 -D0 -~ -~ -0 -1 5460 -D1 -~ -~ -0 -1 5507 -D2 -~ -~ -0 -1 5462 -D3 -~ -~ -0 -1 5506 -S -#5462 -Guildsman's Row~ - Only one guild offers its door to this stretch of the Row, the Tanners' -Guild, to the west. To the east is a beautifully sculpted marble door -allowing entrance to the Museum of the Greater Gods. - The Row of Guilds leads north and south. -~ -54 0 1 -D0 -~ -~ -0 -1 5461 -D1 -~ -~ -0 -1 5511 -D2 -~ -~ -0 -1 5463 -D3 -~ -~ -0 -1 5564 -S -#5463 -Guildsman's Row~ - After the guilds were built the people of the city used some of the -extra space to erect a shrine to their patron saints. The result of -this labor became the Museum of the Greater Gods. - You may enter the sacred hall to the east. -~ -54 0 1 -D0 -~ -~ -0 -1 5462 -D1 -~ -~ -0 -1 5516 -D2 -~ -~ -0 -1 5464 -S -#5464 -Guildsman's Row~ - This small cramped road is worn with travel as apprentices to the -guilds run merchandise from the guildhouses to the shops on Market -Square. - The guildhouses lie to the north and Main street is to the south. -~ -54 0 1 -D0 -~ -~ -0 -1 5463 -D2 -~ -~ -0 -1 5428 -S -#5465 -Alley~ - Even with your light you cannot seem to penetrate the magical cloak of -darkness covering this alley. -~ -54 ac 1 -D0 -~ -~ -0 -1 5428 -D2 -~ -~ -0 -1 5466 -S -#5466 -Alley~ - Even with your light you cannot seem to penetrate the magical cloak of -darkness covering this alley. -~ -54 a 1 -D0 -~ -~ -0 -1 5465 -D1 -~ -~ -0 -1 5467 -D3 -~ -~ -0 -1 5537 -S -#5467 -Alley~ - Even with your light you cannot seem to penetrate the magical cloak of -darkness covering this alley. -~ -54 a 1 -D1 -~ -~ -0 -1 5538 -D2 -~ -~ -0 -1 5468 -D3 -~ -~ -0 -1 5466 -S -#5468 -Alley~ - Even with your light you cannot seem to penetrate the magical cloak of -darkness covering this alley. -~ -54 ac 1 -D0 -~ -~ -0 -1 5467 -D2 -~ -~ -0 -1 5440 -S -#5469 -Alley~ - This is a tiny corner in the alley. The temple walls are north and -west. You notice a fair amount of footprints to the east. -~ -54 a 1 -D1 -~ -~ -0 -1 5470 -D2 -~ -~ -0 -1 5471 -E -footprint~ -Kind of looks like a yeti has been here... Hmmmm. -~ -S -#5470 -Alley~ - This is a dead end to the tiny alley. There is an unusual amount of -wear apparent on the ground. -~ -54 a 1 -D3 -~ -~ -0 -1 5469 -D5 -You see a small iron circle imbedded in the ground. -~ -manhole man hole~ -1 -1 5478 -S -#5471 -Alley~ - You are in a tiny ally between the temple and the bank. You hear -some shouting and general roadwork to the south. The ground is rough -and in need of repair. In the road is a small pothole. -~ -54 ac 1 -D0 -~ -~ -0 -1 5469 -D2 -~ -~ -0 -1 5425 -E -pothole~ -Why are you looking in a pothole? Are you poor or something? -~ -S -#5472 -Alley~ - You are on a small alley between the repair shop and the general -store. Nothing much here but small rodents and dust. -~ -54 ac 1 -D0 -~ -~ -0 -1 5425 -D2 -~ -~ -0 -1 5473 -S -#5473 -Alley~ - This is a small corner in the alley behind the warehouses and the guild -of warriors. You notice some small scrapings to the west. -~ -54 a 1 -D0 -~ -~ -0 -1 5472 -D1 -~ -~ -0 -1 5474 -S -#5474 -Alley~ - The alley ends here as do the footprints you had noticed earlier. -~ -54 a 1 -D3 -~ -~ -0 -1 5473 -D5 -You see a small round iron plate set in the ground. -~ -manhole man hole~ -1 -1 5481 -S -#5475 -Underground~ - You are in a small underground passage beneath the city. You see a -small glint of light from above and the passage continues south. -~ -54 ad 1 -D2 -~ -~ -0 -1 5476 -D4 -~ -man hole manhole~ -1 -1 5459 -S -#5476 -Underground~ - The passage continues north and south. -~ -54 ad 1 -D0 -~ -~ -0 -1 5475 -D2 -~ -~ -0 -1 5477 -S -#5477 -Underground~ - The tunnel branches here going north, east, and west. -~ -54 ad 1 -D0 -~ -~ -0 -1 5476 -D1 -~ -~ -0 -1 5478 -D3 -~ -~ -0 -1 5479 -S -#5478 -Underground~ - The alley turns again here and heads south and west. You notice a -small glint of light from above. -~ -54 ad 1 -D2 -~ -~ -0 -1 5457 -D3 -~ -~ -0 -1 5477 -D4 -~ -manhole man hole~ -1 -1 5470 -S -#5479 -Underground~ - The passage ends here and you hear some low chanting from the west. -You also notice the clearing of dust on the ground but can't seem to -find any door in that direction. -~ -54 ad 1 -D1 -~ -~ -0 -1 5477 -S -#5480 -Underground~ - The small passage continues north and south from here. -~ -54 ad 1 -D0 -~ -~ -0 -1 5457 -D2 -~ -~ -0 -1 5481 -S -#5481 -Underground~ - The small passage heads north and east from here. You here the sounds -of the city above you. -~ -54 ad 1 -D0 -~ -~ -0 -1 5480 -D1 -~ -~ -0 -1 5482 -D4 -~ -manhole man hole~ -1 -1 5474 -S -#5482 -Underground~ - The tunnel continues you west and east. Hopefully you have a good sense -of direction. -~ -54 ad 1 -D1 -~ -~ -0 -1 5492 -D3 -~ -~ -0 -1 5481 -S -#5483 -River Ishtar~ - High above you on the top of the city wall guards look down to see if -you wish to exit the city via water. To do so they must open the iron -grating in front of you from above. The horrid smell of the dump wafts -down from the shore. -~ -54 0 7 -D1 -~ -~ -0 -1 5624 -D3 -~ -grating~ -1 -1 5484 -S -#5484 -River Ishtar~ - The gentle flow of the river carries you eastward, looking up you -see couples strolling along the road. To the west you see the southern -bridge and to the east you see the iron grating protecting the city from -unwanted guests. -~ -54 0 7 -D1 -~ -grating~ -1 -1 5483 -D3 -~ -~ -0 -1 5485 -S -#5485 -River Ishtar~ - You hear your voice echo as you float under the bridge above. The -city construction crews have just recently finished the small ladder -giving common-folk easy access to the river. To the west and east you -see the river flowing by the city. -~ -54 0 7 -D1 -~ -~ -0 -1 5484 -D3 -~ -~ -0 -1 5486 -D4 -~ -~ -0 -1 5412 -S -#5486 -River Ishtar~ - This part of the river seems alive with activity. Boats moored to -the docks near the ramp north of here make navigation a bit more trying. -As the river flows eastward you can see the southern bridge in that -direction. -~ -54 0 7 -D0 -~ -~ -0 -1 5443 -D1 -~ -~ -0 -1 5485 -D3 -~ -~ -0 -1 5487 -S -#5487 -River Ishtar~ - The river flows through a huge iron grating from the wilderness -through the city. Strong guards above await word to open the portal -should any citizen require exit or entry. -~ -54 0 7 -D1 -~ -~ -0 -1 5486 -D3 -~ -grating~ -1 -1 5623 -S -#5488 -A Dark Passage~ - You seem to have stumbled into a small hand made passage. The wall -to the west doesn't look quite right but searching it reveals no secret -doors. The only exit it seems is east. -~ -54 ad 1 -D1 -~ -~ -0 -1 5489 -S -#5489 -A Dark Passage~ - The small passage continues east and west from here. Again you -notice something peculiar about the wall, this time to the north, -but you fail to find any secret doors. Voices can be faintly heard -from the north. -~ -54 ad 1 -D1 -~ -~ -0 -1 5490 -D3 -~ -~ -0 -1 5488 -S -#5490 -A Dark Passage~ - The small passage continues west and east from here. -~ -54 ad 1 -D1 -~ -~ -0 -1 5491 -D3 -~ -~ -0 -1 5489 -E -boulder~ -A huge boulder stands here. In its center someone has carved out a -perfect round hole. -~ -S -#5491 -A Dark Passage~ - The small passage ends here for no apparent reason. Looking around -you find a small ladder half buried in the dirt. setting it up you find -a trap door in the ceiling. The passage continues west from here. -~ -54 ad 1 -D3 -~ -~ -0 -1 5490 -D4 -~ -secret~ -1 -1 5570 -E -fire~ -Moving closer you see this fire is actually FROZEN in place. The -flames still radiate heat, but are not actually burning. Looking -around you notice a small hole about the size of a piece of charcoal -at the base of the flames. -~ -S -#5492 -Underground~ - The small passage continues west and east. -~ -54 ad 1 -D1 -~ -~ -0 -1 5493 -D3 -~ -~ -0 -1 5482 -S -#5493 -Underground~ - The small passage continues west and east. -~ -54 ad 1 -D1 -~ -~ -0 -1 5500 -D3 -~ -~ -0 -1 5492 -S -#5500 -Underground~ - The small passage continues west and east. -~ -54 ad 0 -D1 -~ -~ -0 -1 5501 -D3 -~ -~ -0 -1 5493 -S -#5501 -Underground~ - The small passage continues west and east. -~ -54 ad 0 -D1 -~ -~ -0 -1 5502 -D3 -~ -~ -0 -1 5500 -S -#5502 -Underground~ - The small passage continues west and east. -~ -54 ad 0 -D1 -~ -~ -0 -1 5488 -D3 -~ -~ -0 -1 5501 -S -#5503 -Clerics' Sanctum~ - You walk down the staircase into the silent inner sanctum. Here sits -your guildmaster ready to assist you when the time is right. The room -is completely silent. The only obvious exit is back up the staircase -into the the Nectar. -~ -54 deh 0 -D1 -You notice the floor at the base of the eastern wall has some faint -scratches in it. -~ -secret door~ -1 -1 5479 -D4 -~ -~ -0 -1 5519 -S -#5504 -The Chamber Of The High Priest~ - You have entered the chamber of the most holy man in New Thalos. The -High Priest advises the Sultan on all matters in the world of the sacred. -From what you have heard however, this holy man has a bit of a temper, -and he doesn't look very happy that you've disturbed his prayers. - The only obvious exit is south. -~ -54 d 0 -D2 -~ -~ -0 -1 5508 -S -#5505 -By The Altar~ - You are by the temple altar in the northern end of Temple of New -Thalos. A huge altar made of highly polished black onyx is standing -in front of you. Behind this altar sits a twelve foot tall statue of -Akbal, the highest god in all the lands. -~ -54 deg 0 -D2 -~ -~ -0 -1 5509 -E -statue~ -Looking up the huge statue you see Akbal calmly gazing out across his -lands, he seems pleased. -~ -S -#5506 -The Weavers' Guild~ - Rows and rows of uncut cloth lie about waiting to be hemed up -into tailored clothes. Cotten is brought in from the country side -and spun up into cloth and dyed different colors. A young boy walks -in, grabs a pile of clothing and leaves. -~ -54 d 0 -D1 -~ -~ -0 -1 5461 -S -#5507 -The Craftsmans' Guild~ - You have entered a busy workshop filled with people running amok -with various tools and materials. The air is tense with the rush to -complete various projects and creations. -~ -54 d 0 -D3 -~ -~ -0 -1 5461 -S -#5508 -Inside The Temple~ - The temple continues here, but not on such a grand scale. The place -still looks immaculate. To the north you see the chamber of the High -Priest and a sign on the door in BIG letters thats reads 'DO NOT DISTURB' -To the south is the entrance to the Clerics' Guild. -~ -54 dg 0 -D0 -~ -~ -0 -1 5504 -D1 -~ -~ -0 -1 5509 -D2 -~ -~ -0 -1 5512 -S -#5509 -Inside The Temple~ - Huge marble pillars rise on either side of you and grab hold of -the ceiling. Between each of these, fine softstone frescoes have -been carved depicting scenes from the religous history of New Thalos. -Rows of pews face forward giving their full attention to the pulpit -rising high above the ground. The deep red carpeting underfoot shows -not a speck of wear or dirt. It is obvious that New Thalonians take -religion seriously. -~ -54 dgh 0 -D0 -~ -~ -0 -1 5505 -D1 -~ -~ -0 -1 5510 -D2 -~ -~ -0 -1 5513 -D3 -~ -~ -0 -1 5508 -S -#5510 -The Donation Room~ - This room is new to the temple, it was created during the hard times -that had struck the city in recent decades. Luckily for them the Sultan -had been hoarding some of the basic neccesities for just such an occasion. -These days the donation room depends on the generosity of wealthy -adventurers, and a curse on any that walk in to take everything. -~ -54 cd 0 -D3 -~ -~ -0 -1 5509 -S -#5511 -The Museum Of The Greater Gods~ - Four large stone statues reside in the museum. They were constructed -by the people of New Thalos to pay homage to the saints they believe to -have saved all their lives. - The museum continues to the south. -~ -54 cd 0 -D2 -~ -~ -0 -1 5516 -D3 -~ -~ -0 -1 5462 -S -#5512 -The Entrance To The Guild of Clerics~ - This hall pales in comparison to that of the main hall, but is -beautiful in its own right. Shaven heads and brown robes can be -seen milling about quitely talking to each other. North is back -inside the temple proper, and south is the entrance to the clerics' -bar. -~ -54 deh 0 -D0 -~ -~ -0 -1 5508 -D2 -~ -~ -0 -1 5519 -S -#5513 -The Temple Gates~ - You stand before the entrance way to the Temple of New Thalos. Two -large wrought iron gates lie open before you. Although they might not -ever be used the priests in the temple are ready to defend themselves, -should their city ever come under seige again. -~ -54 0 1 -D0 -~ -~ -0 -1 5509 -D2 -~ -~ -0 -1 5520 -D5 -~ -~ -0 -1 5520 -S -#5514 -Ahkeem's Stuff~ - You step into a shop swirling with smoke. Ahkeem seems to have a -liking for things not of this world... very strange stuff indeed. -~ -54 d 0 -D2 -~ -~ -0 -1 5414 -S -#5515 -Vera's Veggies~ - This is a busy place. Customers shuffle around, bartering for lower -prices on the wide selection of vegetables. You can still hear your -mother telling you 'Eat your Veggies'. That is probably why you are -spending time in the city of New Thalos and not with her. But wait... -Vera looks just like your mother! -~ -54 d 0 -D2 -~ -~ -0 -1 5416 -S -#5516 -The Museum Of The Greater Gods~ - Four large stone statues reside in the museum. They were constructed -by the people of New Thalos to pay homage to the saints they believe to -have saved all their lives. - The museum continues to the north. -~ -54 cd 0 -D0 -~ -~ -0 -1 5511 -D3 -~ -~ -0 -1 5463 -S -#5517 -The Base Of The Tower~ - You walk into a cold room whose only feature is an old wooden -staircase spirling up along the wall to a higher level. Up these -stairs you are told awaits the old mage who may be able to help -you advance in your studies. -~ -54 de 0 -D1 -~ -~ -0 -1 5518 -D2 -You see some small scratches on the floor near the base of the wall. -~ -door secret~ -1 -1 5524 -D4 -~ -~ -0 -1 5548 -S -#5518 -The Mages' Courtyard~ - You enter a small tiled courtyard with a small fountain in the middle. -Around the sides are four wrought iron benches with cushions where the -mages of the land sit and exchange ideas. To the west stands a two-story -tower where the leader of the mages' guild performs his experiments. -~ -54 e 1 -D2 -~ -~ -0 -1 5525 -D3 -~ -~ -0 -1 5517 -S -#5519 -Nectar Of The Gods~ - You are startled by the lavishness of this place. From what you -know of clerics they are supposed to be humble people, giving all their -material goods to their cause. Perhaps because only clerics are -allowed to enter this bar they have condoned making it as comfortable -as possible. In the corner stands a staircase leading down to the -meditaion chambers. -~ -54 deh 0 -D0 -~ -~ -0 -1 5512 -D5 -~ -~ -0 -1 5503 -S -#5520 -Temple Square~ - You are standing on the meeting grounds of those with holy -intentions. Monks, bards, paladins and clerics mill around -either preaching or listening to their fellows preach. Huge -marble steps lead up to the gates of the temple and Main Street -lies to the south. -~ -54 cg 1 -D0 -~ -~ -0 -1 5513 -D2 -~ -~ -0 -1 5424 -D4 -~ -~ -0 -1 5513 -S -#5521 -The Bank~ - You stand in a large building decorated with black marble and red -satin. Huge pillars support an arched ceiling far above your head. -You wonder at the skill the dwarves have for detail as you examine -the trim. Fine silver seperates the polished blocks that make up the -floor. -~ -54 de 0 -D1 -~ -~ -0 -1 5414 -S -#5522 -The Butchery~ - This shop has the aroma of freshly slaughterd beasts. You feel right -at home. You see a fairly simple set up. The corpses... er... selections -hang on hooks, still bleeding into catch pans that drain into a single -underground vat. You wonder where that leads... -~ -54 d 0 -D3 -~ -~ -0 -1 5416 -E -vat~ -You think you hear noises from the vat... naaah. -~ -S -#5523 -The Witch's Brew~ - The first thing you notice as you walk into this spacious shop is -the hundreds of candles that line the shelves. The swirling mist that -surrounds your feet makes it seem that you have stepped into a gateway -to another plane. A cluttered table stands near the far wall, opposite -the doorway. -~ -54 d 0 -D2 -~ -~ -0 -1 5429 -S -#5524 -Braheem's Magic Shop~ - You enter a shop crowded with bookshelves and clutterd with scrolls. -The owner seems to be hard at work on his latest magical creation. -You see a small sign on the wall. -~ -54 d 0 -D2 -~ -~ -0 -1 5430 -E -sign~ -The sign reads: - -Welcome to Braheem's... - -LIST - Shows you all of my wonderful creations. -VALUE - Shows what an item might be worth to me. -SELL - Allows you to rid yourself of excessive magic items. -BUY - Allows you to rid youself of excessive cash. - -~ -S -#5525 -The Entrance To The Mages' Tower~ - The entrance hall is a small poor lighted room. It would seem its -only purpose is to house the powerful sorcerer standing here guarding -the entrance. -~ -54 deh 0 -D0 -~ -~ -0 -1 5518 -D2 -~ -~ -0 -1 5431 -S -#5526 -The Entrance To The Guild of Warriors~ - This small hall is merely a check point to keep the unwanted out. -~ -54 deh 0 -D0 -~ -~ -0 -1 5423 -D2 -~ -~ -0 -1 5533 -S -#5527 -The Repair Shop~ - One of the most popular shops in New Thalos, this shop is always a -hive of activity. It is almost inhuman the way one man can fix all -types of armour singlehandedly. If you have an item in need of repair -simply give it to the man behind the counter. -There is a small sign on the counter. -~ -54 cd 0 -D0 -~ -~ -0 -1 5424 -E -sign~ -The sign reads: - -Closed for renovations - -~ -S -#5528 -The General Store~ - The new found wealth of this beautiful city is apearant in the exotic -items for sale here. You wonder what would happen if you typed... LIST... -~ -54 d 0 -D1 -~ -~ -0 -1 5408 -S -#5529 -Abdul's Armour~ - The sound of hammering metal grows louder as you enter the armoury. -Young boys run to and fro carrying buckets of water and coal. A few -dwarves work on sections of armour in the back of the shop, their -hammers working too fast to follow. The walls are adorned in all of -Abdul's prize creations. Here you can purchase suits of armour meant -to keep monsters from hacking you into little pieces. -A note on the wall beckons your attention. -~ -54 d 0 -D3 -~ -~ -0 -1 5407 -E -note~ -The note reads: - -LIST : gives you a list of items for sale. -VALUE : tells you how much an item is worth to Abdul -SELL : sells an item to Abdul for a generous sum -BUY : Abdul's FAVORITE command lets you have an item for his low, - low price. - -~ -S -#5530 -The Mercenaries' Guild~ - This guild is frowned upon by most of the population of New Thalos, -but the laws of supply and demand are irresistable. People come here -when they feel unable or are unwilling to fight their own battles. For -a small fee you may hire a henchman. -~ -54 d 0 -D0 -~ -~ -0 -1 5429 -D1 -You notice some small scratches in the floor next to the eastern wall. -~ -door secret~ -1 -1 5532 -S -#5531 -The Mercenaries Guild~ - This is the storage room for the mercenaries to be hired. -~ -54 dj 0 -S -#5532 -Entrance To The Thieves' Guild~ - This small, dark room has a single torch mounted in the wall for -light. There is a small wooden bench and a book lying on it. The -assassin guarding the entrance from 'outsiders' stands as you walk -in. -~ -54 adeh 0 -D2 -~ -~ -0 -1 5539 -D3 -~ -door secret~ -1 -1 5530 -S -#5533 -The Whet Stone~ - Very large men with very large swords drink beer from very large mugs. -Everything in this room is BIG. The large round tables are scuffed and -nicked from the numerous bar brawls that have sprung up. It might be a -good idea to hold your tounge for a while as you soak up the atmosphere. - There is an exit to the east where the master swordsman awaits pupils -to train with. -~ -54 deh 0 -D0 -~ -~ -0 -1 5526 -D1 -~ -~ -0 -1 5534 -S -#5534 -The Tournament And Practice Yard~ - This is a wide expanse of grass filled with dummies, punching bags -and swordpupils. To the north you see a man dressed in black robes, -unlike his iron clad comrades, who you assume to be your master. -~ -54 deh 0 -D1 -You see the grass near the base of the wall here is slightly torn. -~ -secret door~ -1 -1 5473 -D3 -~ -~ -0 -1 5533 -S -#5535 -The Bread Stand~ - A small stand has been set up here, showing the shopkeep's humble -selection. You notice he has added a few things to his list. -~ -54 d 0 -D0 -~ -~ -0 -1 5408 -S -#5536 -Igor's Implements Of Destruction~ - You can't help but shiver as you look at the selection of vicious -weapons. Huge swords and wicked looking axes hang on pegs around the -room. A dwarf sits at a bench in the back hammering away on his latest -creation. It is here you can buy rare and exotic items not found in -other parts of the world. -A note catches your eye. -~ -54 d 0 -D0 -~ -~ -0 -1 5407 -E -note~ -The note simply reads: - -READ THE NOTE IN THE ARMOURY - - Igor. - -~ -S -#5537 -Ye Old Leather Shoppe~ - You are standing on a thick oriental rug surrounded on all sides by -racks of numerous leather goods. A few women sit on leather cushions -sewing in some detail work on custom ordered jackets. -~ -54 d 0 -D1 -~ -~ -0 -1 5466 -S -#5538 -Smuggler's Inn~ - You are inside a filthy inn, that seemingly has been cleaned in -decades. Poker tables line the walls and everyone stares at you as -you walk in, you don't feel very welcome. The bar has numerous -knife holes in it and the bartender leans over waiting for your -order. -~ -54 d 0 -D3 -~ -~ -0 -1 5467 -S -#5539 -The Filthy Unicorn~ - A draft chills your bones as you enter, though you see no open -window or door. Hooded figures lurk around in the shadows and speak -in low voices. A flash of steel lets you know that weapons are in -great abundance in this crowd. As you quickly check your beltpouch -you notice a small staircase leading down. -~ -54 deh 0 -D0 -~ -~ -0 -1 5532 -D5 -~ -~ -0 -1 5546 -S -#5540 -The Warehouse~ - You are standing in a large room used to store merchandise made in the -city before it is shipped off. All the items here are made in New Thalos -and shipped to other parts of the land. -~ -54 d 0 -D1 -~ -~ -0 -1 5541 -D2 -~ -~ -0 -1 5433 -S -#5541 -The Warehouse~ - Men walk to and fro counting crates and writing down their findings. -This area of the warehouse is used for storing the raw materials brought -in from areas outside the city. These goods are then delivered to the -various guilds. The export area of the warehouses is to the south. -~ -54 d 0 -D2 -~ -~ -0 -1 5434 -D3 -~ -~ -0 -1 5540 -S -#5542 -The Shipwright~ - The wood under you feet creaks from years of being soaked in saltwater. -An old man with a curly, grey beard stand behind a small counter waiting -to take your order. Behind him are mounted various model sailboats and -large fish. -~ -54 d 0 -D1 -~ -~ -0 -1 5543 -D2 -~ -~ -0 -1 5435 -S -#5543 -The Drafting Room~ - The walls are covered with paper sketchings of hull designs. This room -is used by the shipwright to build his creations on paper before making a -single cut in wood. -~ -54 d 0 -D3 -~ -~ -0 -1 5542 -S -#5544 -The Forge~ - Very much like the weaponsmith this man deals in the molding of metal. -It seems that most of his creations deal with horses. On the walls you -see several horseshoes made of iron. The room is hot, hotter than the -desert just south of here, and one wonders how the smithy can stand it. -~ -54 d 0 -D2 -~ -~ -0 -1 5437 -S -#5545 -The Royal Stables~ - Nothing you wouldn't expect is here. Several stalls hold the -Sultan's choice Arabian Stallions, and each has their own trough -for drinking. A small boy wanders in sometimes with a shovel to -remove the offensive by-product of such beasts. -~ -54 d 1 -D1 -~ -~ -0 -1 5549 -D2 -~ -~ -0 -1 5439 -S -#5546 -The Secret Yard~ - This is a hidden yard known to only a few people in New Thalos. Here -you may train in the arts of stealing, picking locks, and becoming almost -invisible. - A small staircase leads back up to the Unicorn. -~ -54 deh 0 -D2 -You see some small scratches in the wall to the south. -~ -secret door~ -1 -1 5489 -D4 -~ -~ -0 -1 5539 -S -#5547 -The Dump~ - This is the place where the people of the city dump their trash. Due -to the constant winds blowing down the moutains the smell is usually blown -outside the walls and over the desert. -~ -54 0 1 -D2 -~ -~ -0 -1 5442 -S -#5548 -The Mage's Laboratory~ - You stand in the top of an old stone tower. Along the walls hundreds -of potions, scroll, and wands lie in disaray. The man you see before you -sits hunched over a small wooden table with two beakers of bubbling liquid -in front of him. He looks up as you enter and smiles broadly. -~ -54 deh 0 -D5 -~ -~ -0 -1 5517 -S -#5549 -The Hay Loft~ - Not as big as the ones you see on farms in the country, this hay loft -serves as a storage area for the horses in the stables. The young boy -you saw with the shovel seems to have takes up residence on the second -story. -~ -54 d 0 -D3 -~ -~ -0 -1 5545 -S -#5550 -The Grand Entrance~ - Nowhere have you seen such an obscene display of wealth then in this -corridor. The shaggy carpeting under your feet makes it seem as if you -are walking on a cloud. Platinum candelabras hang delicately from the -ceiling casting light on the ancient tapestries adorning the walls. The -crick in your neck tells you that it is time to stop staring. To the west -the numerous halls of the palace being and the gate lies to the east. -~ -54 d 0 -D0 -~ -~ -0 -1 5560 -D1 -~ -gate~ -2 5400 5558 -D2 -~ -~ -0 -1 5557 -D3 -~ -~ -0 -1 5605 -S -#5551 -The Library~ - This building holds the vast collection of books and documents -that have been brought here by the commitee apointed to recover the -lost knowledge of Thalos. Rows of shelves filled with book in every -condition line the walls. The air has the aroma of old parchment -and glue. -~ -54 df 0 -D1 -~ -~ -0 -1 5455 -S -#5552 -The Dance Hall~ - You seem to have missed a huge party. The janitors are here cleaning -up the confetti and pieces of food. Hundreds of empty beer mugs on the -tables surrounding the dance floor suggest that the citizens love their -drink. There is still a banner on the wall. -~ -54 d 0 -D1 -~ -~ -0 -1 5456 -E -banner~ -======================================================================== - - H A P P Y B I R T H D A Y T O U S - -======================================================================== -~ -S -#5553 -The Jail~ - You are in jail. For some reason, someone feels that you've screwed -up pretty bad and should be put away safely for a while. -~ -54 defhj 0 -D0 -~ -gate~ -2 5493 5444 -S -#5554 -City Hall~ - You stand inside the administrative head of the city. Here the -decisions regarding city policy are made. Although the Sultan's -word is law, he usually spends his time on affairs outside the city -wall. -~ -54 d 0 -D0 -~ -~ -0 -1 5445 -S -#5555 -The Boyer/Fletchers' Guild~ - The walls in this room are covered with pegs that hold various types -of bows. There are few people working here, lending to the fact that -the skills are rare to come by in the general populas. A few boys are -busy in the corner preparing feathers for the fine shafts used in making -arrows. Some Elven craftsmen are carefuly inspecting each bow as it is -finnished. -~ -54 d 0 -D1 -~ -~ -0 -1 5460 -S -#5556 -The Masons' Guild~ - There is no doubt that the Dwarves here know what they're doing. They -have been invaluable in the building of this beautiful city. Here they -are hard at work doing what they do best. The hammers fly in a blur as -these talented craftsmen work the stone into ornate bricks, pillars, trim, -and many other forms. -~ -54 d 0 -D3 -~ -~ -0 -1 5460 -S -#5557 -The Guard House~ - You stand inside the southern of the two main guard houses. The -stone interior has a spartan look to it, only the bare neccesities. -A few weapons are mounted on the walls in case they might be needed. -~ -54 d 0 -D0 -~ -~ -0 -1 5550 -S -#5558 -The Palace Gate~ - You stand before a magnificantly crafted gate wrought in solid gold. -You gape in awe at the splendor of the spirilng towers beyond the portal. -The ruler of all the eastern lands resides in this fine palace, and he is -not a poor man. The grand entrance lies byond the gate, and Sultan's Walk -is to the east. -~ -54 0 1 -D1 -~ -~ -0 -1 5420 -D3 -~ -gate~ -2 5400 5550 -S -#5559 -The Northwest Tower~ - You stand on one of the four towers guarding the city. The view from -here is great! To the west you see the tall mountains that make up the -divide between here and Midgaard. The River Ishtar slowly flows from that -direction. South you can see the entire city of New Thalos and the Great -Eastern Desert to the south. -~ -54 d 0 -D5 -~ -~ -0 -1 5444 -S -#5560 -The Guard House~ - You stand inside the northern of the two main guard houses. Strong -guards are seated here, playing cards. The stone interior is clean but -bare walled save the weapons and armor mounted in the walls. - The only exit is south. -~ -54 d 0 -D2 -~ -~ -0 -1 5550 -S -#5561 -The Kitchen~ - Your footsteps echo off the stone tiles of the kitchen. On the south -wall you see the large fire place and a huge copper pot bubbling merrily. -The chef is busy chopping up greens and other vegetables at the wooden -table for tonight's meal. Servants scurry about grabbing utensils and -preparing fresh hares. - A small door leads out into the hall northward and the doorway to the -dining hall is west. -~ -54 d 0 -D0 -~ -door~ -1 -1 5563 -D3 -~ -~ -0 -1 5571 -S -#5562 -The Northeast Tower~ - You stand on one of the four towers guarding the city. To the north -you see the wide plains and then the forset. South of here you see the -city and the Great Eastern Desert beyond. -~ -54 d 0 -D5 -~ -~ -0 -1 5454 -S -#5563 -A Hall~ - You are at the eastern end of the southern hallway. A small servants' -entrance gives access to the kitchen and the hall continues west. -~ -54 d 0 -D2 -~ -door small~ -1 -1 5561 -D3 -~ -~ -0 -1 5572 -S -#5564 -The Tanners' Guild~ - You first notice the pungent smell of freshly tanned leather goods as -you enter this strange place. The next thing that grabs your attention -is the many colors that these people have transformed the beautiful -skins into. The people are streaching the leather and cutting it into -the shapes they need. -You notice a small message on a wall. -~ -54 d 0 -D1 -~ -~ -0 -1 5462 -E -message~ -The message appears to read: - - I hate being a Tanner - -~ -S -#5565 -A Hall~ - You have come to the eastern end of the northern hallway. The only -exit is west except for the simple wooden door to the north. -There is a golden plaque above the door. -~ -54 d 0 -D0 -~ -door~ -1 -1 5566 -D3 -~ -~ -0 -1 5574 -E -plaque~ -Engraved on the plaque are the following words: - - The Holy Shrine of Allah - -~ -S -#5566 -The Shrine Of Allah~ - As you step into this room you seem to leave the material plane. -The walls here are decorated with beautiful, multi-colored tiles. -There is a strange stillness about the air. You sense the presence -of an all-mighty being. -~ -54 d 0 -D2 -~ -door~ -1 -1 5565 -S -#5567 -Outside The Northern Gate Of New Thalos~ - You stand outside the gate of New Thalos. The city lies to the south, -and wilderness to the north. -~ -54 c 1 -D0 -~ -~ -0 -1 5681 -D2 -~ -gate~ -1 5401 5422 -S -#5568 -Outside The Eastern Gate Of New Thalos~ - You stand outside the protective walls of the city. The massive iron -gate sits to the west and the unknown awaits you eastward. -~ -54 0 1 -D1 -~ -~ -0 -1 5690 -D2 -~ -~ -0 -1 5570 -D3 -~ -gate~ -1 5401 5431 -S -#5569 -Outside The West Gate Of New Thalos~ - You stand outside the city walls, the iron gate to the east. The city -lies in that direction and the road to Midgaard lies west. -~ -54 0 1 -D1 -~ -gate~ -1 5401 5423 -D3 -~ -~ -0 -1 5618 -S -#5570 -Outside The Wall~ - You are in a small clearing outside the east wall of the city. The -ground seems well trodden but you can see no apparent exit save that -to the north. -~ -54 0 2 -D0 -~ -~ -0 -1 5568 -S -#5571 -The Grand Dining Hall~ - A long oaken table, coverd with silverware, plates, and a table cloth -with gold trim, dominates the room. Although no diners occupy the room -as of yet, servants sprint about setting the table and placing condiments. - The kitchen entrance is to the east, and two huge double doors open -into the hallway north. -~ -54 d 0 -D0 -~ -doors double~ -1 -1 5572 -D1 -~ -~ -0 -1 5561 -S -#5572 -A Hall~ - You stand at a T-crossing in the long hallways. There are two large -double doors to the south. -~ -54 d 0 -D0 -~ -~ -0 -1 5573 -D1 -~ -~ -0 -1 5563 -D2 -~ -doors double~ -1 -1 5571 -D3 -~ -~ -0 -1 5577 -S -#5573 -A Hall~ - You stand at an intersection of the hallways. Wooden corridors -lead off in all directions except west, the garden of the palace -can be entered there. -~ -54 d 0 -D0 -~ -~ -0 -1 5574 -D1 -~ -~ -0 -1 5605 -D2 -~ -~ -0 -1 5572 -D3 -~ -~ -0 -1 5578 -S -#5574 -A Hall~ - You have come to a T-crossing on the hallways. The wooden corridors -continue east, west and south. There is a large iron door to the north. -~ -54 d 0 -D0 -~ -door iron heavy~ -1 -1 5575 -D1 -~ -~ -0 -1 5565 -D2 -~ -~ -0 -1 5573 -D3 -~ -~ -0 -1 5579 -S -#5575 -The Entrance To The Dungeon~ - You enter a cold damp room with bare roughly hewn stone walls. -This room seems very out of place compared to the splendor of the -rest of the Palace. - A large steel grating leads down into darkness, and an iron door -returns you to the hallway. -~ -54 d 0 -D2 -~ -door iron~ -1 -1 5574 -D5 -~ -grating steel~ -1 -1 5591 -S -#5576 -A Guest Room~ - This is a simple room used for visiting nobles. A small dresser stands -on the east wall with a mirror hung right above it. A queen sized bed made -up in satin sheets stands in the middle of the room against the south -wall under a window. The only obvious exit is north back out into the -hallway. -~ -54 d 0 -D0 -~ -door~ -1 -1 5577 -E -window~ -Looking out this window you can see the grounds of the palace that -seperate the walls of the palace from the building itself. -~ -E -mirror~ -You see a the fighting image of some armor clad humanoid wielding a weapon. -~ -S -#5577 -A Hall~ - The long hall continues here with a wooden door in the south wall. On -the north wall hangs the picture of some forgotten nobleman who once ruled -the land. -~ -54 d 0 -D1 -~ -~ -0 -1 5572 -D2 -~ -door~ -1 -1 5576 -D3 -~ -~ -0 -1 5582 -S -#5578 -The Sultan's Garden~ - You have entered the Sultan's private gardens. A light sweat breaks -out on your skin from the humidity here. All around you are thousands of -exotic plants and flowers. The sweet smell of jasmine and honeysuckle -reminds you of happier days at home. Off to the north, through the palm -trees, you see a delicate white gazebo. - A path leads out into the hallway and west towards the gazebo. -To your right stands a gold sign. -~ -54 0 2 -D1 -~ -~ -0 -1 5573 -D3 -~ -~ -0 -1 5583 -E -sign~ -========================================================================= -========================================================================= -|| || -|| || -|| || -|| || -|| Welcome to my humble garden. I have created this || -|| tiny bit of paradise for the pleasure of my people. || -|| Take only memories... Leave only footprints... || -|| || -|| || -|| || -|| The Sultan || -|| || -|| || -|| || -========================================================================= -========================================================================= -~ -S -#5579 -A Hall~ - The long stretch of hallway continues east and west from here. The -small red carpet covering the centerline is always underfoot and an -occasional bench or potted plant lines the wall. -There is a door here to the north with a plaque mounted over it. -~ -54 d 0 -D0 -~ -door~ -1 -1 5580 -D1 -~ -~ -0 -1 5574 -D3 -~ -~ -0 -1 5584 -E -plaque door~ -The plaque on the door reads: - - THE ART EXHIBIT - of - NEW THALOS - - - the management is not responsible for lost items. - -~ -S -#5580 -The Art Exhibit~ - You are standing in the Sultan's tribute to the finer virtues. -Large paintings hang from the walls displaying nature scenes, nudes, -and glorious victories in battle. Strange scupltures rest on pedestals -at each corner of the room and mirrors are placed in strategic locations -so the viewer may see an entire sculpture at a glance. - Your eyes, however, are pulled towards a painting that dominates the -far wall. -~ -54 d 0 -D2 -~ -door~ -1 -1 5579 -E -painting~ -The large painting on the west wall appears to be of the temple of New -Thalos, and occupies the entire western wall of this room. -~ -S -#5581 -A Guest Room~ - This is another room made up for visiting nobles. There is a dresser -up against the eastern wall with a mirror above it and a queen sized bed, -made up in satin sheets, against the south wall. -~ -54 d 0 -D0 -~ -door~ -1 -1 5582 -S -#5582 -A Hall~ - You have reached the western end of the southern hallway. The only -exit is east except for the doors in the southern and western walls. -~ -54 d 0 -D1 -~ -~ -0 -1 5577 -D2 -~ -door~ -1 -1 5581 -D3 -~ -door~ -2 5401 5587 -S -#5583 -The Garden Gazebo~ - Walking through the gardens you come across a small white wooden -structure. The sounds of birds, the smell of flowers, ahhh, paradise. -You believe that you have never been in a more peaceful setting. -~ -54 d 0 -D1 -~ -~ -0 -1 5578 -S -#5584 -A Hall~ - This is the western end of the northern hallway. Two doors are set -in the walls here, one to the north, another to the west. -~ -54 d 0 -D0 -~ -door~ -1 -1 5585 -D1 -~ -~ -0 -1 5579 -D3 -~ -door~ -1 -1 5589 -S -#5585 -The Guard Room~ - You stand in a barren chamber lined with nothing but cots and -footlockers. The guards come here when off duty to sleep, for -they may only leave the Palace grounds with special permission. - The only exit is to the south. -~ -54 d 0 -D2 -~ -door~ -1 -1 5584 -S -#5586 -The Guard Room~ - This is living quarters for the guards of the palace. Barren compared -to the rest of the Palace, you see only cots and footlockers here. On the -walls you see pictures of well known knights who have give a proud name to -the Sultan's Guard. -~ -54 d 0 -D0 -~ -~ -0 -1 5587 -S -#5587 -The Harem~ - This is the room where the Sultan keeps the beautiful women of his -Palace. There are ten girls here lying about the room dressed in silks -you can almost see through. In the western end of the room stands a -large mound of pillows and a beautiful young maiden sits perched atop. -It is unfortunate for you that only the Sultan is allowed in here. -~ -54 d 0 -D0 -~ -door secret~ -1 -1 5588 -D1 -~ -door~ -2 5401 5582 -D2 -~ -~ -0 -1 5586 -S -#5588 -A Small room~ - This is secret chamber allowing the Sultan direct access to his harem -at any time he chooses. -~ -54 d 0 -D0 -~ -door~ -1 -1 5589 -D2 -~ -door secret~ -1 -1 5587 -S -#5589 -The Throne Room~ - You stand in the throne room of the mighty Sultan of New Thalos. Guards -stand at attention near his side ready to make the ultimate sacrifice for -their beloved leader. The gold inlaid throne studded with jewels stands -upon a mable dias. The Sultan is not a man to be trifled with. -~ -54 d 0 -D0 -~ -throne~ -2 5400 5590 -D1 -~ -door~ -1 -1 5584 -D2 -~ -door~ -1 -1 5588 -S -#5590 -The Treasure Room~ - You have somhow managed to gain access to the treaure vault of the -Sultan. The alarm sounding in the background tells you that you must -have tripped off some kind of alarm system. It might be adviseable to -grab as much stuff as you possibly can and run for the door. -~ -54 d 0 -D2 -~ -door~ -2 5400 5589 -S -#5591 -The Jailer's Room~ - Climbing down the old wooden ladder you enter a small cave like -room. There is a small bench with some old magazines and a low -burning candle sitting off to one side. A door is set into the -stone on the north wall, and the steel grating opens up above. -~ -54 ad 0 -D1 -~ -door~ -1 -1 5592 -D4 -~ -steel~ -1 -1 5575 -S -#5592 -A Tunnel In The Dungeon~ - You stand in a roughly hewn stone tunnel with cells to the north and -south. The tunnel continues east. -~ -54 ad 0 -D0 -~ -cell~ -2 5493 5597 -D1 -~ -~ -0 -1 5593 -D2 -~ -cell~ -2 5493 5601 -D3 -~ -door~ -1 -1 5491 -S -#5593 -A Tunnel In The Dungeon~ - You stand in a roughly hewn stone tunnel with cells to the north and -south. The tunnel continues east and west. -~ -54 ad 0 -D0 -~ -cell~ -2 5493 5598 -D1 -~ -~ -0 -1 5594 -D2 -~ -cell~ -2 5493 5602 -D3 -~ -~ -0 -1 5592 -S -#5594 -A Tunnel In The Dungeon~ - You stand in a roughly hewn stone tunnel with cells to the north and -south. The tunnel continues east and west. -~ -54 ad 0 -D0 -~ -cell~ -2 5493 5599 -D1 -~ -~ -0 -1 5595 -D2 -~ -cell~ -2 5493 5603 -D3 -~ -~ -0 -1 5593 -S -#5595 -A Tunnel In The Dungeon~ - You stand in a roughly hewn stone tunnel with cells to the north and -south. The tunnel continues west and you notice a small crack in the -stone to the east. -~ -54 ad 0 -D0 -~ -cell~ -2 5493 5600 -D1 -~ -crack~ -2 5400 5596 -D2 -~ -cell~ -2 5493 5604 -D3 -~ -~ -0 -1 5594 -S -#5596 -The Secret Cell~ - This room seems more like a lair than a cell. Small bits of hay lie -strewn about the floor covering bones of unkown origin. Spatterd blood -and tufts of grey hair lie matted in one corner. As you turn to leave -you notice a pair of small red eyes peering at you from the darkness. -~ -54 adfj 0 -D3 -~ -crack~ -2 5400 5595 -S -#5597 -The Cell~ - You are in a cold, cramped chamber with only one exit. -~ -54 adfj 0 -D2 -~ -cell~ -2 5493 5592 -S -#5598 -The Cell~ - You are in a cold, cramped chamber with only one exit. -~ -54 adfj 0 -D2 -~ -cell~ -2 5493 5593 -S -#5599 -The Cell~ - You are in a cold, cramped chamber with only one exit. -~ -54 adfj 0 -D2 -~ -cell~ -2 5493 5594 -S -#5600 -The Cell~ - You are in a cold, cramped chamber with only one exit. -~ -54 adfj 0 -D2 -~ -cell~ -2 5493 5595 -S -#5601 -The Cell~ - You are in a cold, cramped chamber with only one exit. -~ -54 adfj 0 -D0 -~ -cell~ -2 5493 5592 -S -#5602 -The Cell~ - You are in a cold, cramped chamber with only one exit. -~ -54 adfj 0 -D0 -~ -cell~ -2 5493 5593 -S -#5603 -The Cell~ - You are in a cold, cramped chamber with only one exit. -~ -54 adfj 0 -D0 -~ -cell~ -2 5493 5594 -S -#5604 -The Cell~ - You are in a cold, cramped chamber with only one exit. -~ -54 adfj 0 -D0 -~ -cell~ -2 5493 5595 -S -#5605 -A Hall~ - You stand in a large cedar wood hall leading east and west. On the -floor lies a thin and narrow purple rug. The hall leads west inside the -Palace and east to the Grand Entrance. -~ -54 d 0 -D1 -~ -~ -0 -1 5550 -D3 -~ -~ -0 -1 5573 -S -#5606 -A Path Through The Mountains~ - The narrow path turns here heading south and west. -~ -54 0 5 -D2 -~ -~ -0 -1 5607 -D3 -~ -~ -0 -1 5611 -S -#5607 -A Path Through The Mountains~ - Travel is hard and slow as you almost have to climb around large -boulders strewn about the path. -~ -54 0 5 -D0 -~ -~ -0 -1 5606 -D1 -~ -~ -0 -1 5608 -S -#5608 -The Edge Of The Ravine~ - The ground drops off below down to a rushing river. A small rope -bridge sways to and fro in the wind giving you access to the other -side. -~ -54 0 5 -D1 -~ -~ -0 -1 5609 -D3 -~ -~ -0 -1 5607 -S -#5609 -On A Rope Bridge~ - The small rope bridge shudders under your weight as you make your -way across the valley. -~ -54 0 2 -D1 -~ -~ -0 -1 5627 -D3 -~ -~ -0 -1 5608 -S -#5610 -The Ledge Around The Valley~ - You are walking around a small ledge overlooking a large valley -deep within the eastern mountains. The ledge turns north following -the shape of the valley and a steep trail continues to the east. -~ -54 0 5 -D0 -This can be used to add something onto... such as the valley that is -supposed to exist here. (= -~ -~ -0 -1 -1 -D1 -~ -~ -0 -1 5611 -S -#5611 -A Path Through The Mountains~ - You are walking through a rock strewn path deep within the mountains -east of Midgaard. The going is rough and you constantly twist your -ankle on the small stones lying about. -~ -54 0 5 -D1 -~ -~ -0 -1 5606 -D3 -~ -~ -0 -1 5610 -S -#5612 -On The Eastern Edge Of The Mountains~ - You stand on the eastern edge of the eastern mountains. The high -peaks lie to the west and rolling hills and plains open up to your -east. -~ -54 0 5 -D2 -~ -~ -0 -1 5613 -D3 -~ -~ -0 -1 5629 -S -#5613 -In The Foothills~ - The path curves down the face of the mountain allowing you to -move up or down the face of this missive hunk of stone. -~ -54 0 5 -D0 -~ -~ -0 -1 5612 -D1 -~ -~ -0 -1 5614 -S -#5614 -In The Foothills~ - The path curves down the face of the mountain allowing you to -move up or down as you please. -~ -54 0 5 -D2 -~ -~ -0 -1 5615 -D3 -~ -~ -0 -1 5613 -S -#5615 -A Rocky Trail~ - The faint sound of a flowing river reaches your ears from the south and -through the trees you can see water. The path you are on continues north -and east from here. -~ -54 0 5 -D0 -~ -~ -0 -1 5614 -D1 -~ -~ -0 -1 5630 -D2 -~ -~ -0 -1 5645 -S -#5616 -On A Road~ - This long road continues to the east and south. -~ -54 0 2 -D1 -~ -~ -0 -1 5617 -D2 -~ -~ -0 -1 5633 -S -#5617 -On A Road~ - The well kept road continues east and west from here. -~ -54 0 2 -D1 -~ -~ -0 -1 5618 -D3 -~ -~ -0 -1 5616 -S -#5618 -On A Road~ - You stand on a well maintained road leading east towards New Thalos -and west towards the Eastern Mountains. To the north you can see wide -plains stretching out as far as the eye can see. South of you begins -a dark green forest. -~ -54 0 2 -D1 -~ -~ -0 -1 5569 -D3 -~ -~ -0 -1 5617 -S -#5619 -The Headwaters Of The River Of Lost Souls~ - You are at the headwaters of what is oft called the darkest river -in the land. Looking at the swampy water pooling in this rocky valley, -you can see why the water downstream is so dark. The rock walls reach -up around you blocking all exits except that to the north up onto the -banks, and to the south where the river flows. -~ -54 0 7 -D0 -There is a small path leading away from the bank just to the north. -~ -~ -0 -1 1500 -D2 -The waters of this swampy pool are flowing slowly towards the south. -~ -~ -0 -1 5634 -S -#5620 -River Ishtar~ - The river calms a bit after being thrashed in the interior of -the mountain. Although still deep within the rocks you can see -faint traces of green to the east. -~ -54 0 7 -D1 -~ -~ -0 -1 5621 -D3 -~ -~ -0 -1 5639 -S -#5621 -River Ishtar~ - The river flows east and west through the hills. -~ -54 0 7 -D1 -~ -~ -0 -1 5622 -D3 -~ -~ -0 -1 5620 -S -#5622 -River Ishtar~ - The river begins its decent out of the mountains now and continues -its flow to the east. -~ -54 0 7 -D1 -~ -~ -0 -1 5644 -D3 -~ -~ -0 -1 5621 -S -#5623 -River Ishtar~ - The river flows under the wall of the city to the east and stretches -off towards high snow capped mountains far far to the west. -~ -54 0 7 -D1 -~ -grating~ -1 -1 5487 -D3 -~ -~ -0 -1 5649 -S -#5624 -River Ishtar~ - The river flows out from the city down a long winding gully towards -the Sea of Dragons. To the south of you lies the Great Eastern Desert -and north a wide open expanse of grass. You can just barely make out -a road that seems to be traveling along side the river but the -banks are to steep for you to see very far. -~ -54 0 7 -D1 -~ -~ -0 -1 5625 -D3 -~ -~ -0 -1 5483 -S -#5625 -River Ishtar~ - The river continues its descent down the lowlands flowing ever so -gently south. It is hard to believe this is the same river that came -cascading down the mountainside. -~ -54 0 7 -D1 -~ -~ -0 -1 5626 -D3 -~ -~ -0 -1 5624 -S -#5626 -River Ishtar~ - Small animals and herd animals can be heard in the distance, though -you don't actually see any near the river. Perhaps the steep slopes -pervent them from using the river. -~ -54 0 7 -D1 -~ -~ -0 -1 5684 -D3 -~ -~ -0 -1 5625 -S -#5627 -The Edge Of The Ravine~ - You stand at the edge of a really long drop down. A small rope -bridge has conviently been placed here to allow you access to the -other side of the bridge. Unfortunately the wind seems to be kicking -up making the bridge sway slightly. The path leads off through the -mountains to the east. -~ -54 0 5 -D1 -~ -~ -0 -1 5628 -D3 -~ -~ -0 -1 5609 -S -#5628 -A Path Through The Mountains~ - The narrow path makes its way through the mountains east -and west. You hear the squawking of a large bird over head -most likely a buzzard waiting for you to drop. -~ -54 0 5 -D1 -~ -~ -0 -1 5629 -D2 -~ -~ -0 -1 4049 -D3 -~ -~ -0 -1 5627 -S -#5629 -A Path Through The Mountains~ - A large boulder suddenly decides it wants to occupy the same space -you are currently standing in. -~ -54 0 5 -D1 -~ -~ -0 -1 5612 -D3 -~ -~ -0 -1 5628 -S -#5630 -On A Road~ - The road you are on continues east and west. -~ -54 0 4 -D1 -~ -~ -0 -1 5631 -D3 -~ -~ -0 -1 5615 -S -#5631 -On A Road~ - The road you are on continues east and west. -~ -54 0 2 -D1 -~ -~ -0 -1 5632 -D3 -~ -~ -0 -1 5630 -S -#5632 -On A Road~ - The road you are on continues east and west. -~ -54 0 2 -D1 -~ -~ -0 -1 5633 -D3 -~ -~ -0 -1 5631 -S -#5633 -On A Road~ - The road bends here toward the riverbank giving access to -the River Ishtar. The road continues north and west from the -river bank. -~ -54 0 2 -D0 -~ -~ -0 -1 5616 -D2 -~ -~ -0 -1 5649 -D3 -~ -~ -0 -1 5632 -S -#5634 -The River Of Lost Souls~ - The river flows south through a valley in the mountains. You can see -a small village to the west. -~ -54 0 7 -D0 -~ -~ -0 -1 5619 -D2 -~ -~ -0 -1 5635 -S -#5635 -The River Of Lost Souls~ - The river flows south in the southern end of this wide valley. The -walls of the valley close in to the south. -~ -54 0 7 -D0 -~ -~ -0 -1 5634 -D2 -~ -~ -0 -1 5636 -S -#5636 -The River Of Lost Souls~ - The river begins to speed up as it cascades down this mountain -crevice. High above you a small rope bridge sways in the wind. -~ -54 0 7 -D0 -~ -~ -0 -1 5635 -D2 -~ -~ -0 -1 5637 -S -#5637 -The River Of Lost Souls~ - The river rapidly flows down this crack in the side of the mountain -to the south. Hopefully you will hear any aproaching rapids. -~ -54 0 7 -D0 -~ -~ -0 -1 5636 -D2 -~ -~ -0 -1 5638 -S -#5638 -The River Of Lost Souls~ - The river seems to calm a bit as the crevase widens lessens -its stranglehold on the waters. The river continues to the north -through a crack and flows to the south. -~ -54 0 7 -D0 -~ -~ -0 -1 5637 -D2 -~ -~ -0 -1 5639 -S -#5639 -A Split In The River~ - The waters of the river crash down upon a rock and split into -two bodies of water. The river you are on continues its southern -course and the new river heads off to the east. To your west you -notice that the rocks have split and crumbled as if torn asunder -by some massive force. It looks impossible to traverse. The River -of Lost Souls also continues to the north. -~ -54 0 7 -D0 -~ -~ -0 -1 5638 -D1 -~ -~ -0 -1 5620 -D2 -~ -~ -0 -1 5640 -S -#5640 -The River Of Lost Souls~ - The river continues north and south from here through a water -eroded valley. -~ -54 0 7 -D0 -~ -~ -0 -1 5639 -D2 -~ -~ -0 -1 5641 -S -#5641 -The River Of Lost Souls~ - The river continues north and south from here through a water -eroded valley. -~ -54 0 7 -D0 -~ -~ -0 -1 5640 -D2 -~ -~ -0 -1 5642 -S -#5642 -The River Of Lost Souls~ - The river continues north and south from here through a water -eroded valley. -~ -54 0 7 -D0 -~ -~ -0 -1 5641 -D2 -~ -~ -0 -1 5643 -S -#5643 -The River Of Lost Souls~ - The river makes a sharp bend here and heads south into a large -mountain and north through a valley. On a ledge above you, and to -the west, you can see movement. -~ -54 0 7 -D0 -~ -~ -0 -1 5642 -D2 -~ -~ -0 -1 5004 -S -#5644 -River Ishtar~ - The river widens here, no longer bounded by rock, and flows east -towards a plain. -~ -54 0 7 -D1 -~ -~ -0 -1 5645 -D3 -~ -~ -0 -1 5622 -S -#5645 -River Ishtar~ - The river continues here east to east. There is a landing area to -the north where you can gain access to the shore. -~ -54 0 7 -D0 -~ -~ -0 -1 5615 -D1 -~ -~ -0 -1 5646 -D3 -~ -~ -0 -1 5644 -S -#5646 -River Ishtar~ - The river meanders through the foothills of the eastern mountains. -The air is dryer on this side of the continental divide and it seems -a bit warmer. -~ -54 0 7 -D1 -~ -~ -0 -1 5647 -D3 -~ -~ -0 -1 5645 -S -#5647 -River Ishtar~ - The river continues its journey eastward flowing through the -plains. To the west you see the peaks of large snow capped -mountains and to the east you see the outline of a large city. -~ -54 0 7 -D1 -~ -~ -0 -1 5648 -D3 -~ -~ -0 -1 5646 -S -#5648 -River Ishtar~ - The river flows east and west from here. -~ -54 0 7 -D1 -~ -~ -0 -1 5649 -D3 -~ -~ -0 -1 5647 -S -#5649 -River Ishtar~ - The river slows as it widens and meanders through the lowlands. A -small dock give access to the north shore. -~ -54 0 7 -D0 -~ -~ -0 -1 5633 -D1 -~ -~ -0 -1 5623 -D3 -~ -~ -0 -1 5648 -S -#5651 -In The Mountains~ - You are walking over rocks and stones through the mountains between -the Ishtar and Dark rivers. - It is funny how all the rocks look alike. -~ -54 0 5 -D0 -~ -~ -0 -1 5652 -D1 -~ -~ -0 -1 5656 -D2 -~ -~ -0 -1 5654 -D3 -~ -~ -0 -1 5657 -S -#5652 -In The Mountains~ - You are walking over rocks and stones through the mountains between -the Ishtar and Dark rivers. - It is funny how all the rocks look alike. -~ -54 0 5 -D0 -~ -~ -0 -1 5652 -D1 -~ -~ -0 -1 5655 -D2 -~ -~ -0 -1 5652 -D3 -~ -~ -0 -1 5651 -S -#5653 -In The Mountains~ - You are walking over rocks and stones through the mountains between -the Ishtar and Dark rivers. - It is funny how all the rocks look alike. -~ -54 0 5 -D0 -~ -~ -0 -1 5654 -D1 -You see a large boulder blocking your path. -~ -boulder rock crack~ -1 -1 5639 -D2 -~ -~ -0 -1 5656 -D3 -~ -~ -0 -1 5657 -S -#5654 -In The Mountains~ - You are walking over rocks and stones through the mountains between -the Ishtar and Dark rivers. - It is funny how all the rocks look alike. -~ -54 0 5 -D0 -~ -~ -0 -1 5654 -D1 -~ -~ -0 -1 5658 -D2 -~ -~ -0 -1 5657 -D3 -~ -~ -0 -1 5660 -S -#5655 -In The Mountains~ - You are walking over rocks and stones through the mountains between -the Ishtar and Dark rivers. - It is funny how all the rocks look alike. -~ -54 0 5 -D0 -~ -~ -0 -1 5655 -D1 -~ -~ -0 -1 5659 -D2 -~ -~ -0 -1 5658 -D3 -~ -~ -0 -1 5654 -S -#5656 -In The Mountains~ - You are walking over rocks and stones through the mountains between -the Ishtar and Dark rivers. - It is funny how all the rocks look alike. -~ -54 0 0 -D0 -~ -~ -0 -1 5653 -D1 -~ -~ -0 -1 5658 -D2 -~ -~ -0 -1 5655 -D3 -~ -~ -0 -1 5651 -S -#5657 -In The Mountains~ - You are walking over rocks and stones through the mountains between -the Ishtar and Dark rivers. - It is funny how all the rocks look alike. -~ -54 0 5 -D0 -~ -~ -0 -1 5654 -D1 -~ -~ -0 -1 5658 -D2 -~ -~ -0 -1 5654 -D3 -~ -~ -0 -1 5654 -S -#5658 -In The Mountains~ - You are walking over rocks and stones through the mountains between -the Ishtar and Dark rivers. - It is funny how all the rocks look alike. -~ -54 0 5 -D0 -~ -~ -0 -1 5655 -D1 -~ -~ -0 -1 5657 -D2 -~ -~ -0 -1 5659 -D3 -~ -~ -0 -1 5654 -S -#5659 -In The Mountains~ - You are walking over rocks and stones through the mountains between -the Ishtar and Dark rivers. - It is funny how all the rocks look alike. -~ -54 0 5 -D0 -~ -~ -0 -1 5652 -D1 -~ -~ -0 -1 5659 -D2 -~ -~ -0 -1 5654 -D3 -~ -~ -0 -1 5658 -S -#5660 -The Headwaters Of The Dark River~ - A large natural spring issues forth from the heart of the mountain -and flows west down the mountain. It looks like there was a terrible -earthquake here not too long ago, and a path that leads eastwards -through the mountains is covered with rocks, making passage difficult. -~ -54 a 7 -D1 -~ -~ -0 -1 5654 -D3 -~ -~ -0 -1 5661 -S -#5661 -On The Dark River~ - The river flows down the mountain through a large crevasse to the west -and up into the mountains east. -~ -54 a 7 -D1 -~ -~ -0 -1 5660 -D3 -~ -~ -0 -1 5662 -S -#5662 -On The Dark River~ - The walls of this canyon tower overhead as the river continues east -and west from here. -~ -54 a 7 -D1 -~ -~ -0 -1 5661 -D3 -~ -~ -0 -1 5663 -S -#5663 -On The Dark River~ - The walls of rock around you slowly shrink to ground level as the river -flows out of the mountains and onto the plains. -~ -54 a 7 -D1 -~ -~ -0 -1 5662 -D3 -~ -~ -0 -1 5664 -S -#5664 -On The Dark River~ - The river continues east and west from here out of the foothills -to the east down into the mountains south of here. -~ -54 a 7 -D1 -~ -~ -0 -1 5663 -D2 -~ -~ -0 -1 5665 -S -#5665 -On The Dark River~ - The river, following a low spot in the foothills, bends and twists. -Tall mountains can be seen off to the south and east. -~ -54 a 7 -D0 -~ -~ -0 -1 5664 -D2 -~ -~ -0 -1 5666 -S -#5666 -On The Dark River~ - The river makes a wide sweeping turn here into the mountain. -~ -54 a 7 -D0 -~ -~ -0 -1 5665 -D3 -~ -~ -0 -1 5667 -S -#5667 -On The Dark River~ - The river flows west from here into the heart of the mountain and -east towards the foothills once more. -~ -54 ad 7 -D1 -~ -~ -0 -1 5666 -D3 -~ -~ -0 -1 5668 -S -#5668 -On The Dark River~ - You can barely make out what is ahead of you as the river flows -quietly through the passageway. -~ -54 ad 7 -D1 -~ -~ -0 -1 5667 -D2 -~ -~ -0 -1 5669 -S -#5669 -On The Dark River~ - The river slowly flows west towards the heart of the mountain. There -are small cracks in the passage wall to the north where you might be able -to get up out of the water. -~ -54 ad 7 -D0 -~ -~ -0 -1 5672 -D1 -~ -~ -0 -1 5668 -D3 -~ -~ -0 -1 5670 -S -#5670 -On The Dark River~ - The river continues east and west from here flowing south of a dark -ledge high above the water level. -~ -54 ad 7 -D1 -~ -~ -0 -1 5669 -D3 -~ -~ -0 -1 5671 -S -#5671 -On The Dark River~ - The river flows south through a narrowing part of the passage as it -progresses deeper into the mountain. -~ -54 ad 7 -D1 -~ -~ -0 -1 5670 -D2 -~ -~ -0 -1 5005 -S -#5672 -On A Small Ledge~ - You clamber out of the water up onto this narrow ledge to see if -it leads deeper into the mountain. Unfortunately, the ledge is only -wide enough to rest upon for a while and there does not appear to be -any other exits other than rejoining the underground river. -~ -54 ad 2 -D2 -~ -~ -0 -1 5669 -S -#5681 -On The Plains~ - You stand on an open expanse of grass extending in all directions. -To the south of you stand the might northern gates of New Thalos. East -and west of you the grassy fields continue and north, in the distance, -you see a line of trees. -~ -54 0 2 -D0 -~ -~ -0 -1 5682 -D1 -~ -~ -0 -1 5681 -D2 -~ -~ -0 -1 5567 -D3 -~ -~ -0 -1 5681 -S -#5682 -On The Plains~ - You stand on an open field of grass. The forest to the north is -closer but still a good distance away. To the south a small dirt -path has been trodden into the ground heading towards New Thalos. -~ -54 0 2 -D0 -~ -~ -0 -1 5683 -D1 -~ -~ -0 -1 5682 -D2 -~ -~ -0 -1 5681 -D3 -~ -~ -0 -1 5682 -S -#5683 -The Edge Of The Forest~ - You stand at the edge of a huge forest. The line of trees -continues as far as the eye can see to the east and west. A -large expanse of grass spreads out to the south. -~ -54 0 2 -D1 -~ -~ -0 -1 5683 -D2 -~ -~ -0 -1 5682 -D3 -~ -~ -0 -1 5683 -S -#5684 -River Ishtar~ - The river broadens even more here and the waters become murky. -The smell of saltwater has reached you from the east. The Dragon -Sea cannot be far away. To the east you can see the faint outline -of a city and to the north you see a large expanse of grass. -~ -54 0 7 -D1 -~ -~ -0 -1 5685 -D3 -~ -~ -0 -1 5626 -S -#5685 -The River Delta~ - This is where the river empties out into the Dragon Sea. The backrush -of water has kicked up a lot of sand and the blue sea is stained where -the river empties. Looking west all you can see is water... all the way -to the horizon. North of here is a small dock you think you should be -able to reach with out too much trouble. The river stretches off to the -west back towards New Thalos. -~ -54 0 7 -D1 -~ -~ -0 -1 5686 -D3 -~ -~ -0 -1 5684 -S -#5686 -The Dragon Sea~ - You are on the clear blue seas of the Dragon Sea. Water extends -in all directions as far as the eye can see. Off in the distance -you think you might see a small dock to the north. -~ -54 0 7 -D0 -~ -~ -0 -1 5687 -D1 -~ -~ -0 -1 5686 -D2 -~ -~ -0 -1 5686 -D3 -~ -~ -0 -1 5685 -S -#5687 -The Dragon Sea~ - The Dragon Sea comes up along the shore here. The deep blue waters -rolling in and crashing against the beach. To the north you see a -small dock jutting out into the surf. -~ -54 0 7 -D0 -~ -~ -0 -1 5695 -D1 -~ -~ -0 -1 5696 -D2 -~ -~ -0 -1 5686 -S -#5688 -The Dragon Sea~ - You are on the clear blue seas of the Dragon Sea. Water extends -in all directions as far as the eye can see. Off in the distance -you think you might see a small dock to the west. -~ -54 0 7 -D0 -~ -~ -0 -1 5688 -D1 -~ -~ -0 -1 5697 -D2 -~ -~ -0 -1 5695 -S -#5689 -The Dragon Sea~ - You are on the clear blue seas of the Dragon Sea. Water extends -in all directions as far as the eye can see. Off in the distance -you think you might see a small dock to the west. -~ -54 0 7 -D0 -~ -~ -0 -1 5697 -D1 -~ -~ -0 -1 5689 -D2 -~ -~ -0 -1 5696 -D3 -~ -~ -0 -1 5695 -D5 -~ -~ -0 -1 5698 -S -#5690 -On A Road~ - The people of New Thalos take great pride in the services their -city may provide. One of these services is the construction crews -the go to great lengths to keep all the roads in order. Although -the taxes in New Thalos are higher then other cities in the realm -most of the money is used for the good of the people. -~ -54 0 2 -D1 -~ -~ -0 -1 5691 -D3 -~ -~ -0 -1 5568 -S -#5691 -On A Road~ - You walk along a well used road with beautiful scenery. To the north -tall pine trees form a wall that goes on for miles. Between the road -and the trees lies a great expanse of grassy plains. South of here, -beyond the river, lies the Great Eastern Desert. The road continues -east and west. -~ -54 0 2 -D1 -~ -~ -0 -1 5692 -D3 -~ -~ -0 -1 5690 -S -#5692 -On A Road~ - The Dragon Sea can be seen to the east now spreading out to unknown -lands. The road continues east and west. To the south you hear the -sounds of boats traveling the River Ishtar delivering goods. -~ -54 0 2 -D1 -~ -~ -0 -1 5693 -D3 -~ -~ -0 -1 5691 -S -#5693 -On A Road~ - This is the man land route through the land. Merchants can bring -their goods to the coastline and have them ferried onto ships for -export. Travel by foot west will take you through New Thalos up and -over the Eastern Mountains and down into Midgaard. -~ -54 0 2 -D1 -~ -~ -0 -1 5694 -D3 -~ -~ -0 -1 5692 -S -#5694 -Near The Shore~ - The road ends here turning into a small dirt path leading down the -beach and onto a dock. To the north and south you see the coastline -stretching out before you. West of here the lowlands roll up into -huge snow capped mountains. -~ -54 0 2 -D1 -~ -~ -0 -1 5695 -D3 -~ -~ -0 -1 5693 -S -#5695 -On A Dock~ - You stand on a simple wooden dock that acts as an extension of the -road to the west. The dock seems to have been here for quite a long -time but is still sturdy. A small ladder has been built on the eastern -end to allow easy access to and from ships. -~ -54 0 1 -D0 -~ -~ -0 -1 5688 -D1 -~ -~ -0 -1 5689 -D2 -~ -~ -0 -1 5687 -D3 -~ -~ -0 -1 5694 -S -#5696 -The Dragon Sea~ - You are on the clear blue seas of the Dragon Sea. Water extends in -all directions as far as the eye can see. Off in the distance you think -you might see a small dock to the west. -~ -54 0 7 -D0 -~ -~ -0 -1 5689 -D1 -~ -~ -0 -1 5696 -D3 -~ -~ -0 -1 5687 -S -#5697 -The Dragon Sea~ - The ocean spreads out in all directions rolling gently. In the -distance you can see an island on the horizon. To the west you see -the mainland. -~ -54 0 7 -D0 -~ -~ -0 -1 5697 -D1 -~ -~ -0 -1 5697 -D2 -~ -~ -0 -1 5689 -D3 -~ -~ -0 -1 5688 -S -#5698 -Under The dock~ - You are swiming underneath the dock. You can see the four wooden -pylons that support the structure. The murky water clouds you vision -as you gaze westward, but you think you can make out an iron grating -in that direction. -~ -54 1 7 -D3 -~ -grate~ -1 -1 5699 -D4 -~ -~ -0 -1 5697 -S -#5699 -The Lair Of The Ixitxachitl~ - Blood swirls around in the water as the Ixitxachitl devours the -last of its meal. Swirling around quickly as you intrude upon his -meal the large sting ray attacks! -~ -54 1 7 -D1 -~ -grate~ -1 -1 5698 -S -$ diff --git a/lc-mud/circle/world/wld/60.wld b/lc-mud/circle/world/wld/60.wld deleted file mode 100644 index 482a0f51720d2cf41f29bd6abb54739f01bd200a..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/60.wld +++ /dev/null @@ -1,2073 +0,0 @@ -#6000 -The Edge Of The Forest~ - You are standing at the end of a dusty road, near the eastern edge of the -large forest of Haon-Dor. To the east you see the road heading back to the -walled city, Midgaard, and to the west is a narrow trail leading through the -forest. -~ -60 0 2 -D1 -To the east a dusty road takes you back to the walls of Midgaard, and its large -west gate. -~ -~ -0 -1 6090 -D3 -You see a narrow forest trail winding westward in between the trees. -~ -~ -0 -1 6001 -E -trail~ -The forest trail winds westwards through the trees. -~ -E -tree trees~ -The trees are quite tall considering most of them appear to be quite young. -On one of the trees, crude letters forming the word 'Haon-Dor' have been -carved into the bark. -~ -S -#6001 -A Trail Through The Light Forest~ - You are on a trail leading through the forest. There seems to be a small -path leading north into the shadows. To the east is the forest edge and to -the west the trail leads further into the forest. -~ -60 0 3 -D0 -You see evidence of a small path leading through a break in the trees to the -north. -~ -~ -0 -1 6060 -D1 -The trail continues eastwards out of the forest. -~ -~ -0 -1 6000 -D3 -You see the narrow forest trail winding westwards in between the trees. -~ -~ -0 -1 6002 -E -trail~ -The forest trail winds east-west through the trees. -~ -E -tree trees~ -The trees here are quite young and fresh. They seem to accommodate many kinds -of birds, insects and other small animals. -~ -E -birds insects animals~ -Very cute little creatures, they seem to enjoy life. -~ -S -#6002 -A Trail Through The Light Forest~ - You are on a narrow trail winding east and west through the forest. To the -west, the forest gradually becomes more dense. A small forest path leads off -to the south. -~ -60 0 3 -D1 -The trail continues eastwards through the young trees. -~ -~ -0 -1 6001 -D2 -The small path leads south through the young trees. -~ -~ -0 -1 6011 -D3 -You see the narrow forest trail winding westwards into the dense forest. -~ -~ -0 -1 6003 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -trail~ -The forest trail winds east-west through the trees. -~ -E -tree trees~ -The young, slender trees look beautiful, their fresh, green leaves moving -lightly in the wind. -~ -S -#6003 -A Trail Through The Dense Forest~ - You are on a trail winding east and west through the dense forest. To -the east, the forest gradually seems to become lighter. -~ -60 0 3 -D1 -The trail continues eastwards to the younger part of the forest. -~ -~ -0 -1 6002 -D3 -You see the narrow trail winding westwards through the dense forest. -~ -~ -0 -1 6004 -E -trail~ -The forest trail seems almost fragile compared to the massive trunks. -~ -E -tree trees~ -The dense crowns of the mature trees leave only a fraction of the sky to be -seen through the leaves. -~ -S -#6004 -A Trail Through The Dense Forest~ - You are on a trail winding east and west through the dense forest. To the -west, the trees are so huge and their crowns so dense that forest remains in -total darkness. A small path leads south through the trees. -~ -60 0 3 -D1 -The trail continues eastwards through the dense forest. -~ -~ -0 -1 6003 -D2 -The small path leads south through the trees. -~ -~ -0 -1 6005 -D3 -The narrow trail almost seems to disappear between the enormous trunks. -~ -~ -0 -1 6100 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -trail~ -The forest trail seems almost fragile compared to the massive trunks. -~ -E -tree trees~ -The crowns of the old trees almost cut out all light. -~ -S -#6005 -A Small Path In The Dense Forest~ - You are on a small path leading through the dense forest. The crowns of -the old trees leave the forest in an unreal twilight illumination. The path -continues north and south. -~ -60 0 3 -D0 -The small path leads north through the trees. -~ -~ -0 -1 6004 -D2 -The small path leads south through the trees. -~ -~ -0 -1 6006 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6006 -A Small Path In The Dense Forest~ - You are on a small path leading through the dense forest. The crowns of -the old trees leave the forest in an unreal twilight illumination. The path -continues north and east. -~ -60 0 3 -D0 -The small path leads north through the trees. -~ -~ -0 -1 6005 -D1 -The small path leads east through the trees. -~ -~ -0 -1 6007 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6007 -An Intersection In The Dense Forest~ - You are on a small path leading through the dense forest. The crowns of -the old trees leave the forest in an unreal twilight illumination. The forest -gradually lightens to the east. Paths lead east, west and south. -~ -60 0 3 -D1 -You can barely make out a clearing to the east. -~ -~ -0 -1 6008 -D2 -The small path leads south through the trees. -~ -~ -0 -1 6012 -D3 -The small path leads west through the trees. -~ -~ -0 -1 6006 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6008 -The Forest Clearing~ - You are in a clearing in the forest. Lots of fresh stumps of varying sizes -protrude from the ground and heavy logs are stacked neatly in a big pile -supported by stakes set into the ground. Paths lead north, east and west. -~ -60 0 3 -D0 -The small path leads north through the trees. -~ -~ -0 -1 6011 -D1 -The small path leads east through the trees. -~ -~ -0 -1 6009 -D3 -The small path leads west through the trees. -~ -~ -0 -1 6007 -E -log logs~ -Even though the logs have been chopped to shorter pieces, they are quite heavy -as they are fresh and still filled with sap. -~ -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -stake stakes~ -The stakes keep the logs from rolling down. -~ -E -stump stumps~ -There are more stumps than logs and some of the stumps are partly covered in -moss. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6009 -Outside A Small Cabin In The Forest~ - You are outside a small cabin built entirely from heavy logs. There is a -wooden door to the north and small paths lead west and south through the trees. -~ -60 0 3 -D0 -The wooden door is quite sturdy but does not appear to be equipped with a lock. -~ -door wooden~ -1 -1 6010 -D2 -The small path leads south through the dense forest. -~ -~ -0 -1 6014 -D3 -The small path leads west through the light forest. -~ -~ -0 -1 6008 -E -cabin logs log~ -It looks simple but comfortable and the slender trees make the whole place seem -pretty idyllic. It is a cabin built from wooden logs. -~ -E -path paths~ -The path is probably used by the cabin's inhabitants. -~ -E -tree trees~ -The trees are fairly young, not much more than a hundred years or so. -~ -S -#6010 -Inside The Cabin~ - You are inside a small one-room cabin made entirely from heavy logs. -It is very sparsely furnished, containing only the most basic housekeeping -equipment, such as a bed, a chair and a table. -~ -60 d 0 -D2 -The wooden door leads south. -~ -door wooden~ -1 -1 6009 -E -bed~ -It is definitely not the most comfortable bed you have seen in your life. -~ -E -chair~ -It is made from oak and looks strong and sturdy. -~ -E -table~ -A heavy table that doesn't even appear to rock. It seems to have something -carved on it. -~ -E -carving carvings carved~ -On the table is carved : - /) /) - Danny and Mari, Oct 31, 1991 ( o o ) - = x = - m m - ***(========- -~ -S -#6011 -A Small Path Through The Light Forest~ - You are on a small path leading through the forest. The trees are tall and -slender. Paths lead north and south. -~ -60 0 3 -D0 -The path leads north through the young trees. -~ -~ -0 -1 6002 -D2 -The path leads south through the young trees. -~ -~ -0 -1 6008 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are fairly young, not much more than a hundred years or so. -~ -S -#6012 -An Intersection In The Dense Forest~ - You are on a small path leading through the dense forest. The crowns of the -old trees leave the forest floor in an unreal twilight illumination. Paths -lead north, east and south. -~ -60 0 3 -D0 -The small path leads north through the trees. -~ -~ -0 -1 6007 -D1 -The small path leads east through the trees. -~ -~ -0 -1 6013 -D2 -The small path leads south through the trees. -~ -~ -0 -1 6021 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6013 -A Small Path In The Dense Forest~ - You are on a small path leading through the dense forest. The crowns of -the old trees leave the forest in an unreal twilight illumination. The path -continues east and west. -~ -60 0 3 -D1 -The small path leads east through the trees. -~ -~ -0 -1 6014 -D3 -The small path leads west through the trees. -~ -~ -0 -1 6012 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6014 -An Intersection In The Dense Forest~ - You are on a small path leading through the dense forest. The forest -gradually lightens to the north. Paths lead north, east and west. -~ -60 0 3 -D0 -The path leads north to a lighter part of the forest. -~ -~ -0 -1 6009 -D1 -The small path leads east through the trees. -~ -~ -0 -1 6015 -D3 -The small path leads west through the trees. -~ -~ -0 -1 6013 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees~ -The crowns of the old trees leave the forest in an unreal twilight -illumination. -~ -S -#6015 -A Small Path In The Dense Forest~ - You are on a small path leading through the dense forest. The crowns of -the old trees leave the forest in an unreal twilight illumination. The path -continues south and west. -~ -60 0 3 -D2 -The small path leads south through the trees. -~ -~ -0 -1 6016 -D3 -The small path leads west through the trees. -~ -~ -0 -1 6014 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6016 -A Small Path In The Dense Forest~ - You are on a small path leading through the dense forest. The crowns of -the old trees leave the forest in an unreal twilight illumination. The path -continues north, south and east. -~ -60 0 3 -D0 -The small path leads north through the trees. -~ -~ -0 -1 6015 -D1 -The small path leads east through the trees. -~ -~ -0 -1 6028 -D2 -The small path leads south through the trees. -~ -~ -0 -1 6017 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6017 -A Small Path In The Dense Forest~ - You are at a turn on a small path leading through the dense forest. The -forest seems to become lighter to the west. The path continues north and west. -~ -60 0 3 -D0 -The small path leads north through the trees. -~ -~ -0 -1 6016 -D3 -The small path leads west through the trees to a lighter part of the forest. -~ -~ -0 -1 6018 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees~ -The crowns of the old trees leave the forest in an unreal twilight -illumination. A large branch looms above you, over the path. -~ -E -up branches branch large~ -The branch of a large oak stretches out above the path from the east. -~ -S -#6018 -An Intersection In The Light Forest~ - You are on a small path leading through the forest. A path leads north to -a small field and other paths lead east and west into the dense forest. -~ -60 0 3 -D0 -The path leads north to a small, grassy field. -~ -~ -0 -1 6023 -D1 -The path leads east to a dense part of the forest. -~ -~ -0 -1 6017 -D3 -The path leads west to a dense part of the forest. -~ -~ -0 -1 6019 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees~ -The tall trees are young and slender, not much more than a hundred years or so. -~ -S -#6019 -A Small Path In The Dense Forest~ - You are on a small path leading through the dense forest. The forest seems -to become lighter to the east. The path continues north and east. -~ -60 0 3 -D0 -The small path leads north through the trees. -~ -~ -0 -1 6020 -D1 -The small path leads east through the trees to a lighter part of the forest. -~ -~ -0 -1 6018 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees~ -The crowns of the old trees leave the forest in an unreal twilight -illumination. -~ -S -#6020 -A Small Path In The Dense Forest~ - You are on a small path leading through the dense forest. The crowns of -the old trees leave the forest in an unreal twilight illumination. The path -continues south and west. -~ -60 0 3 -D2 -The small path leads south through the trees. -~ -~ -0 -1 6019 -D3 -The small path leads west through the trees. -~ -~ -0 -1 6021 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6021 -A Small Path In The Dense Forest~ - You are on a small path leading through the dense forest. To the west -you see a dark cave entrance, leading into a small hillside. The path -continues north and east. -~ -60 0 3 -D0 -The small path leads north through the trees. -~ -~ -0 -1 6012 -D1 -The small path leads east through the trees. -~ -~ -0 -1 6020 -D3 -The cave is very dark. -~ -~ -0 -1 6022 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees~ -The crowns of the old trees leave the forest in an unreal twilight -illumination. -~ -E -cave entrance~ -The irregular opening is eight feet wide and six feet tall. An acrid smell -emanates from within. -~ -S -#6022 -Inside The Cave~ - You are in a natural cave. Various sorts of debris cover the stone floor, -emitting a rather unpleasant smell that makes the air thick and hard to -breathe. The only obvious exit is east. -~ -60 ad 0 -D1 -The cave opening is to the east. -~ -~ -0 -1 6021 -E -debris~ -It consists mostly of gnawed bones mixed with small pieces of torn fur. -~ -E -cave walls floor stone~ -Quite uninteresting. -~ -E -air smell~ -Kind of transparent, but quite noticeable nevertheless. -~ -S -#6023 -A Grassy Field~ - You are in a grass covered field somewhere in the forest. The tall grass -nearly reaches your waist, and the surrounding oaks and beeches form an almost -wall-like thicket on the east side of the field. To the northeast you can see -a small lake. A small path leads south through the trees, and the field opens -up to the north and west. -~ -60 0 2 -D0 -Wind blowing in from the north carries with it the smell of a newly killed -animal, as well as the noise of many birds, which you can see circling there. -~ -~ -0 -1 6026 -D1 -The ground slopes gently downward to the eastern tree line. -~ -~ -0 -1 6024 -D2 -The small path leads south in between the trees. -~ -~ -0 -1 6018 -E -grass~ -The tall grass makes a nice hiding place for animals. -~ -E -path~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees thicket~ -The trees form a close thicket, blocking any exit to the west. -~ -E -birds bird circling~ -Many carrion birds are circling to the north, you presume they are waiting for -their turn to feast on a corpse. -~ -S -#6024 -The Lower Part Of The Grassy Field~ - You are in a lower part of the grassy field, south of a small lake. The -grass here has been trampled by the many animals coming here for water, leaving -the ground covered in tracks of different types. To the west you see a break -in the wall of trees surrounding the field, and to the north is a small lake. -~ -60 0 2 -D0 -The animal tracks lead off to the north, and around the lake there. -~ -~ -0 -1 6025 -D3 -To the south-west you see a break in the tree line, leading back to the -forest path. -~ -~ -0 -1 6023 -E -grass~ -The tall grass makes a nice hiding place for animals. -~ -E -path trampled~ -The trampled grass path leads to the lake north of here. -~ -E -tree trees thicket~ -The trees form a close thicket, blocking any exit to the south and east. -~ -S -#6025 -Beside The Lake In A Grassy Field~ - The grass stops shortly before the lake, replaced by mud covered in tracks -from the local animals. When you come close many animals scatter into the tall -grass and some even into the forest. To the west you see birds circling in the -high in the air, and to the north you see a small lake, surrounded by tall -reeds. The field continues to the south, and the forest blocks passage to the -east. -~ -60 0 2 -D0 -The lake looks inviting, and you can see some sort of water fowl floating -around among the reeds. -~ -~ -0 -1 6027 -D2 -To the south an animal trail leads of towards a the other side of the lower -field. -~ -~ -0 -1 6024 -D3 -The smell of carrion drifts down to you from higher on the field to the west. -~ -~ -0 -1 6026 -E -grass~ -The tall grass makes a nice hiding place for animals. -~ -E -lake~ -Animals from all around come here to drink. The lake itself is not very big, -but it stretches off to the north from here. -~ -E -tree trees thicket~ -The trees form a close thicket, blocking any exit to the north or east. -~ -E -birds bird circling~ -Many carrion birds are circling to the west, you presume they are waiting for -their turn to feast on a corpse. -~ -E -track tracks mud~ -You see tracks of both hooved and other sorts of animals. Evidence of all -sizes of animals is here in the mud, showing just how lively the forest is. -~ -S -#6026 -The Northern Section Of A Grassy Field~ - As you come close, scavenging animals and birds of all sorts scatter, -leaving only the boldest and stupidest encircling the corpse of a large boar. -Carrion birds circle overhead, and smaller animals stare out of the tall grass -at you. The grass here has been trampled, and a large area around the corpse -is stained by blood. A trail leads down the sloping field to a lake, and to -the south you see the path back to the forest. -~ -60 0 2 -D1 -A small lake lies down the sloping field to the east. Some of the animals -that fled from here have gone there, and are watching, waiting for you to -leave so they can resume their feasting. -~ -~ -0 -1 6025 -D2 -The field continues to the south, and you can see the path back to the forest -there. -~ -~ -0 -1 6023 -E -grass~ -The tall grass makes a nice hiding place for animals. You see some of the -animals you frightened away peeking furtively out at you. -~ -E -path~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees thicket~ -The trees form a close thicket, blocking any exit to the north and west. -~ -E -birds circling~ -Many birds of varying size circle overhead, waiting for you to leave. You -hope they don't decide that you could be a corpse with just a little effort. -~ -E -animal animals small~ -Several pairs of eyes peer out at you, urging you to leave. The just might -decide that en masse they could kill you, so you probably don't want to tarry -here. -~ -S -#6027 -On The Lake~ - You are in the middle of a small lake, fed from a small stream coming -through the forest from the northwest. The water is not that clear, but -you can see fish swimming around below you. The bank is clear to the -south, providing a safe place to get back to the field. -~ -60 0 7 -D2 -Some animals have gathered on the bank to watch you, curious about what you -are doing. -~ -~ -0 -1 6025 -E -fish~ -Trout and perhaps a catfish or two swim about below you, totally ignoring -your presence. -~ -E -lake~ -Animals from all around come here to drink. The lake itself is not very big, -but it stretches off to the north from here. -~ -E -tree trees thicket~ -Trees cover the bank on most sides, preventing you from docking there. -~ -E -reed reeds~ -Reeds grow up around the edges of the lake, providing cover for the small -water fowl that live here. -~ -S -#6028 -A Small Path In The Dense Forest~ - You are on a small path leading through the dense forest. The crowns of -the old trees leave the forest in an unreal twilight illumination. The path -continues to the west and south. -~ -60 0 3 -D2 -~ -~ -0 -1 6029 -D3 -The small path leads west through the trees. -~ -~ -0 -1 6016 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6029 -Near A Large Tree In The Dense Forest~ - You are at the end of a small path leading through the dense forest. The -crowns of the old trees leave the forest in an unreal twilight illumination. -This rough clearing is dominated by a very large oak tree, probably the -largest in this part of the forest. The path leads back to the north. -~ -60 c 3 -D0 -~ -~ -0 -1 6028 -D4 -You see the lower branches of the towering oak. -~ -~ -0 -1 6030 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -trees~ -The trees are mostly old beeches and oaks, with one large oak off to your -right. -~ -E -large oak tree~ -It has some lower branches that you think you could reach if you stretched. -You might even be able to climb all the top, though from here it looks like -something else had that idea before you. There is a faint animal shape pacing -on one of the highest branches. -~ -E -animal shape~ -From here it looks vaguely feline, though you could get a much better view -from in the tree. You are not sure if it has seen you yet. -~ -E -limb limbs~ -They look quite sturdy, certainly capable of holding your weight should you -decide to climb up the tree using them. -~ -E -top highest high~ -You could probably see most of the forest, and perhaps even the city from the -top of the tree... of course, you'd have to deal with whatever that shape is -pacing on one of the upper limbs. -~ -S -#6030 -In The Lower Branches Of A Large Oak~ - You are in a huge oak, about one third of the way to the top. The branches -above you block out much of the light, but enough filters through for you to -see. Small animals and birds scatter at your approach, rustling the leaves -all about you. You could easily climb back down to the ground, or continue up -the tree. One large branch juts outward to the west, possibly providing a -third choice of exit. -~ -60 0 5 -D3 -This limb looks large and strong enough for you to walk most of the way along -its length to the west. -~ -~ -0 -1 6031 -D4 -More large branches spread out from the tree above you. -~ -~ -0 -1 6032 -D5 -The rough clearing is just a quick climb and jump below you. -~ -~ -0 -1 6029 -E -nest nests~ -After a short period of looking, you notice a bird's nest on a limb not far -above you, and a large squirrel's nest in the crook of a large limb that -stretches out towards the west. -~ -E -animals bird birds~ -A variety of squirrels, chipmunks, and birds make their homes in this and the -surrounding trees. If you look closely you may be able to see some of their -rapidly emptying nests. -~ -E -feline~ -The shape above you moves with definite grace and confidence. You think that -it must be a Bobcat, stalking smaller tree-dwelling animals. -~ -E -pacing pace animal shape~ -From here it looks feline. You still don't think it has noticed you, despite -the noise you made while climbing up here. -~ -E -limb limbs~ -They look quite sturdy, certainly capable of holding your weight should you -decide to climb around in the tree using them. -~ -E -top highest high~ -You could probably see most of the forest, and perhaps even the city from the -top of the tree... of course, you would have to deal with whatever that shape -is that you see pacing on one of the upper limbs. -~ -S -#6031 -Out On A Limb In A Large Oak~ - This sturdy branch hangs far out over a path to the west, which you might -be able to jump down to. Several squirrels scamper into hiding as you -approach, leaving you alone and swaying slightly with the wind. To your north -you can see a small log cabin through the trees, and to the southeast there -seems to be some sort of clearing, with many birds circling above it. -~ -60 c 3 -D1 -Back to the east you see the tree trunk. It is much less precarious there -compared to here... perhaps you should go back. -~ -~ -0 -1 6030 -D5 -Below you is a small path, probably used by the forest animals. You think -that you could jump down with a little effort. -~ -~ -0 -1 6016 -E -nest nests~ -You notice that several of the squirrels sought refuge in a large nest that is -well within your reach. Looking into the nest, you see two pairs of eyes -staring back at you. -~ -E -animals bird birds~ -A variety of squirrels, chipmunks, and birds make their homes in this and the -surrounding trees. If you look closely you may be able to see some of their -rapidly emptying nests. -~ -E -feline~ -The shape above you moves with definite grace and confidence. You think that -it must be a Bobcat, stalking smaller tree-dwelling animals. -~ -E -pacing pace animal shape~ -From here it looks feline. You still don't think it has noticed you, despite -the noise you made while climbing up here. -~ -E -limb limbs~ -The limbs look quite sturdy, certainly capable of holding your weight should -you decide to climb around in the tree using them. -~ -E -top highest high~ -You could probably see most of the forest, and perhaps even the city from the -top of the tree... of course, you would have to deal with whatever that shape -is that you see pacing on one of the upper limbs. -~ -S -#6032 -Midway To The Top Of The Large Oak~ - You are in a huge oak, about midway to the top. The branches above you -block out much of the light, but enough filters through for you to see. A few -birds have remained to watch you from the fringe branches, well out of your -reach. Scratches mar the tree here, and torn bark is scattered near you on the -branch. It would seem some large forest cat lives nearby, so you had better be -careful! You can continue a bit farther up the tree, or descend to limbs that -don't sway so much. -~ -60 0 5 -D4 -Above you the tree narrows farther, but it still looks like you could climb up -there. A feline shape is pacing about above you, trying to get to a large -wounded bird. Perhaps you should try to see what sort of cat this is before -you interrupt its hunt... it might eat you instead of the bird. -~ -~ -0 -1 6033 -D5 -~ -~ -0 -1 6030 -E -nest nests~ -A medium sized bird's nest is close to you here, and it looks like it has some -nice looking eggs in it too! -~ -E -animal animals bird birds~ -A variety of squirrels, chipmunks, and birds make their homes in this and the -surrounding trees. If you look closely you may be able to see some of their -rapidly emptying nests. -~ -E -feline cat pacing pace shape~ -It looks like a Bobcat, and it seems quite intent on getting to a large bird -that it has wounded. It has not seen you yet, or perhaps just thinks you are -too easy a meal. -~ -E -limb limbs~ -They look quite sturdy, certainly capable of holding your weight should you -decide to climb around in the tree using them. -~ -E -top highest high~ -You could probably see most of the forest, and perhaps even the city from the -top of the tree... of course, you would have to deal with whatever that shape -is that you see pacing on one of the upper limbs. -~ -S -#6033 -High In The Large Oak~ - The tree top gently sways in the wind, and you think you are as high as -you can safely go in the tree. The limbs here show evidence of a small battle, -with ripped bark and loose feathers scattered everywhere. Looking around, you -can see the forest stretching out below you in all directions. To the east you -see Midgaard, and to the south the river runs through a deep chasm. North and -west of here you can see another small village, and on the western horizon you -see a large mountain. -~ -60 0 5 -D5 -Below you many of the animals you frightened earlier have returned to their -various nests and homes. You can see a small hint of the path far below you -through the branches. -~ -~ -0 -1 6032 -E -around trees everywhere woods forest~ -Off to the southwest you can see a grass covered field, and a small lake; -nortwest of you is a small cabin and a large pile of wood. Far to west the -treetops form a tight canopy, blocking out almost all sunlight and your view. -It is said that large wolves live there. You've also heard rumors of horrible -spiders and drow living there. You'd be best off leaving that area to more -experienced adventurers. -~ -E -mountain range northeast~ -A long mountain range stretches across the horizon to the north and northeast. -You have heard rumors of many different sorts of creatures living there, -varying from Dwarves and Humans to Ogres and various humanoid creatures. Some -say that evil Dark Elves dwell in the underworld deep below the lands of the -Dwarves. The caves of Moria also are found there, populated by all sorts of -evil creatures. -~ -E -river chasm~ -To the south you see a river flowing roughly from the northeast to the west. -It emerges from a dark opening in the side of a mountain and flows through -Midgaard, and on into the forest. It has eroded a deep chasm in the soft stone -under the forest floor, and is not visible for long after it enters the forest -proper. -~ -S -#6060 -A Shaded Path Through The Forest~ - You are on a small shaded path leading through the trees. The forest -gradually lightens to the east. The path continues to the north, and to the -south you see the main trail. -~ -60 0 3 -D0 -The path winds its way between the trees. -~ -~ -0 -1 6065 -D2 -Through a break in the tree line you see the main trail that heads back towards -Midgaard. -~ -~ -0 -1 6001 -E -path paths shaded~ -The shaded path is probably used by the small animals living in the forest. -~ -E -tree trees~ -They are mostly young oaks and tall beeches. -~ -S -#6061 -A Shaded Path Through The Forest~ - You are at a turn on a small shadowed path leading through the forest. The -forest seems to become lighter to the west. The path continues north and west. -~ -60 0 3 -D0 -The path winds its way between the trees. -~ -~ -0 -1 6066 -D3 -The path winds its way between the trees. -~ -~ -0 -1 6062 -E -path paths shaded shadowed~ -The shadowy path is probably used by the small animals living in the forest. -~ -E -tree trees~ -The crowns of the old trees leave the forest in an unreal twilight -illumination. A large branch looms above you, over the path. -~ -S -#6062 -A Shaded Path Through The Dense Forest~ - You are on a small shaded path leading through the dense forest. The -crowns of the old trees leave the forest floor in an unreal twililght -illumination. To the north you see a small clearing. Paths lead east and -west. -~ -60 0 3 -D0 -Through the underbrush you see a small clearing. -~ -~ -0 -1 6067 -D1 -The path winds its way between the trees. -~ -~ -0 -1 6061 -D3 -The path winds its way between the trees. -~ -~ -0 -1 6063 -E -path paths shaded shadowy~ -The shaded path is probably used by the small animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6063 -A Shaded Path Through The Dense Forest~ - You are on a small shaded path through the dense forest. The crowns of -the old trees leave the forest in an unreal twilight illumination. The path -continues north and east. -~ -60 0 3 -D0 -The path winds its way between the trees. -~ -~ -0 -1 6068 -D1 -The path winds its way between the trees. -~ -~ -0 -1 6062 -E -path paths shaded~ -The shaded path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6064 -A Shadowy Path Through The Dense Forest~ - You are on a small shadowy path leading through the dense forest. The -crowns of the old trees leave the forest in an unreal twilight illumination. -The path continues north and south. -~ -60 0 3 -D0 -The path winds its way between the trees. -~ -~ -0 -1 6069 -D2 -The path winds its way into darkness. -~ -~ -0 -1 6100 -E -path paths shadowy~ -The shadowy path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6065 -A Shaded Path Through The Forest~ - You are at a turn on a small shaded path winding through the trees. The -forest gradually becomes more dense to the west. The path continues west and -south from here. -~ -60 0 3 -D2 -Through the trees to the south you can almost see the main trail leading back -to Midgaard. -~ -~ -0 -1 6060 -D3 -The path winds its way between the trees. -~ -~ -0 -1 6066 -E -path paths shaded~ -The shadowed path is probably used by the small animals living in the forest. -~ -E -tree trees~ -The trees are mostly young oaks and tall beeches. -~ -S -#6066 -A Fork On The Shaded Path Through The Forest~ - You are at a fork in the small shaded path winding through the trees. The -forest gradually becomes more dense to the west. The path branches to the -north and south here, and also continues to the east. -~ -60 0 3 -D0 -The path winds its way between the trees. -~ -~ -0 -1 6071 -D1 -The path winds its way between the trees. -~ -~ -0 -1 6065 -D2 -The path winds its way between the trees. -~ -~ -0 -1 6061 -E -path paths shaded~ -The shaded path is probably used by the small animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6067 -At The Fallen Tree~ - You are standing in a small clearing, beside a large fallen tree. A large -amount of the tree has already decomposed, but some pieces remain, scattered -about the clearing. Paths border the clearing to the north and south. -~ -60 0 3 -D0 -A shaded path winds its way northeast between the trees. -~ -~ -0 -1 6072 -D2 -A shaded path winds its way east between the trees. -~ -~ -0 -1 6062 -E -path paths~ -The shaded paths are probably used by the animals living in the forest. -~ -E -fallen rotten decomposed tree~ -The tree has mostly rotted away, providing nourishment to many small plants -growing here in the clearing. The few pieces that remain are not all that -large, but one log in particular catches your eye and seems to remind you of -something. Under one of these logs would be a great place for an animal to -make its den... -~ -E -clearing clear~ -When the large tree fell it must have brought a few of the smaller trees down -with it in order to make a clearing like this. -~ -E -under animal den~ -Under a log you think you see some sort of hole, or animal's den. Looking -closer, you can make out the form of what you believe to be a Badger resting -inside of the den. -~ -S -#6068 -An Intersection On The Shaded Path~ - You are on a small shaded path leading through the dense forest. The -crowns of the old trees leave the forest in an unreal twilight illumination. -The path continues north, south, and west. -~ -60 0 3 -D0 -The path winds its way between the trees. -~ -~ -0 -1 6073 -D2 -The path winds its way between the trees. -~ -~ -0 -1 6063 -D3 -The path winds its way between the trees. -~ -~ -0 -1 6069 -E -path paths shaded~ -The shaded path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6069 -A Shadowy Path Through The Dense Forest~ - You are on a small shadowy path leading through the dense forest. The -crowns of the old trees leave the forest in an unreal twilight illumination. -The path continues south and east. -~ -60 0 3 -D1 -The path winds its way between the old trees. -~ -~ -0 -1 6068 -D2 -The path winds its way between the trees. -~ -~ -0 -1 6064 -E -path paths shaded shadowy~ -The shadowy path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6070 -Off Of The Path In The Shaded Forest~ - You are wandering amongst the trees in the light forest, without the aid -of a path or trail. More sunlight trickles through the treetops here, making -your travel a bit easier. Small animals scurry away as you approach. You -are no longer on a path, so you may go whichever way you please. -~ -60 0 3 -D0 -The trees seem to part, exposing a trail into the shade. -~ -~ -0 -1 6078 -D1 -The trees seem to part, exposing a trail into the shade. -~ -~ -0 -1 6070 -D2 -The trees seem to part, exposing a trail into the shade. -~ -~ -0 -1 6061 -D3 -The trees seem to part, exposing a trail into the shade. -~ -~ -0 -1 6072 -E -path paths~ -The path is long behind you now... you aren't sure which direction it lies -in anymore. -~ -E -tree trees~ -The trees are younger here than to those to the west. -~ -S -#6071 -A Shaded Path Through The Forest~ - You are on a small shaded path leading in between the trees. The forest -gradually lightens to the east. Paths lead west and south, and you think you -see a small path leading eastward. -~ -60 0 3 -D1 -It looks like a small path begins between two trees to the east, but you -aren't quite certain. -~ -~ -0 -1 6070 -D2 -The path winds its way through the trees to an split in the path. -~ -~ -0 -1 6066 -D3 -The path winds its way between the trees. -~ -~ -0 -1 6072 -E -path paths shadowy shadowed~ -The shadowy path is probably used by the small animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6072 -A Shaded Path Though The Forest~ - You are on a small shaded path leading between the trees. The forest -gradually becomes more dense to the west. Paths lead north and east, and you -see a small clearing to the south. -~ -60 0 3 -D0 -The path winds its way between the trees. -~ -~ -0 -1 6075 -D1 -The path winds its way between the trees. -~ -~ -0 -1 6071 -D2 -A lightly traveled path heads southward to a small clearing. -~ -~ -0 -1 6067 -E -path paths shaded~ -The shaded path is probably used by the small animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6073 -A Shadowy Path Through The Dense Forest~ - You are on a small shadowy path leading through the dense forest. To the -north the terrain becomes quite hilly and rough. The crowns of the old trees -leave the forest in an unreal twilight illumination. The path continues north -and south. -~ -60 0 4 -D0 -The path winds its way into the hills and denser forest. -~ -~ -0 -1 6076 -D2 -The path winds its way between the trees. -~ -~ -0 -1 6068 -E -path paths shadowy~ -The shadowy path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -E -hill hills terrain~ -To the northwest you see hills covered by dense forest. -~ -S -#6074 -A Small Trail Through The Forest~ - You have just left the shaded path, and you are now standing at the head of -a very short trail. It looks like someone begin clearing away the underbrush -here, but didn't get finished. You may leave in any direction, but the path -is to the west. -~ -60 0 3 -D0 -The trees seem to part, exposing a trail into the shade. -~ -~ -0 -1 6074 -D1 -The trees seem to part, exposing a trail into the shade. -~ -~ -0 -1 6070 -D2 -The trees seem to part, exposing a trail into the shade. -~ -~ -0 -1 6070 -D3 -Through the underbrush you see a small path winding its way northward. -~ -~ -0 -1 6075 -E -path paths~ -The narrow path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -S -#6075 -A Shaded Path Through The Forest~ - You are on a small shaded path leading between the trees. The forest -gradually becomes more dense to the west, and to the northwest the terrain -is quite hilly. The path continues north and south. To the east you see a -trail winding through the younger section of the forest. -~ -60 0 3 -D0 -The path winds its way between the trees. -~ -~ -0 -1 6078 -D1 -You think you see the beginnings of a small trail through the younger part of -the forest. -~ -~ -0 -1 6074 -D2 -The path winds its way between the trees. -~ -~ -0 -1 6072 -E -path paths shaded~ -The shaded path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -E -hills hill terrain~ -To the northwest the ground becomes more hilly. You have heard that a halfling -village is somewhere in the hills. -~ -E -trail~ -You think you see the beginnings of a small trail to the east, winding through -the younger part of the forest. -~ -S -#6076 -In The Dense Forest Between The Hills~ - You are standing among tightly packed trees between several hills. You -lost track of the path long ago, and now must rely on your instincts to guide -you. The ground is very rough and rocky here, and only the most hardy plants -survive. The crowns of the old trees leave the hills in an unreal twilight -illumination. -~ -60 c 4 -D0 -All you see are trees and hillsides. -~ -~ -0 -1 6081 -D1 -All you see are trees and hillsides. -~ -~ -0 -1 6077 -D2 -All you see are trees and hillsides. -~ -~ -0 -1 6076 -D3 -All you see are trees and a shadowy path. -~ -~ -0 -1 6073 -E -path paths~ -The path is probably around here somewhere... if only you had paid more -attention. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -E -hills hill~ -Hills rise up all around you, blocking your view of the terrain. -~ -S -#6077 -In The Dense Forest Between The Hills~ - You are standing among tightly packed trees between several hills. You -lost track of the path long ago, and now must rely on your instincts to guide -you. The ground is very rough and rocky here, and only the most hardy plants -survive. The crowns of the old trees leave the hills in an unreal twilight -illumination. -~ -60 c 4 -D0 -All you see are trees and hillsides. -~ -~ -0 -1 6081 -D1 -All you see are trees and hillsides. -~ -~ -0 -1 6076 -D2 -All you see are trees and hillsides. -~ -~ -0 -1 6079 -D3 -All you see are trees and hillsides. -~ -~ -0 -1 6077 -E -path paths~ -The path is probably around here somewhere...if only you had paid more -attention. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -E -hills hill~ -Hills rise up all around you, blocking your view of the terrain. -~ -S -#6078 -In The Dense Forest Between The Hills~ - You are at the end of a small shaded path leading between the trees. The -forest is quite thick here, and the ground is very rough and hilly, halting -your progress. The path lies to the south. -~ -60 0 4 -D2 -The path winds its way between the trees. -~ -~ -0 -1 6075 -E -path paths shaded~ -The shaded path is probably used by the animals living in the forest. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -E -hills hill~ -The terrian is very hilly and rough to the north and west. You have heard -that there is a halfling village somewhere in the hills. -~ -S -#6079 -In The Dense Forest Between The Hills~ - You are standing among tightly packed trees between several hills. You -lost track of the path long ago, and now must rely on your instincts to guide -you. The ground is very rough and rocky here, and only the most hardy plants -survive. The crowns of the old trees leave the hills in an unreal twilight -illumination. -~ -60 c 4 -D0 -All you see are trees and hillsides. -~ -~ -0 -1 6081 -D1 -All you see are trees and hillsides. -~ -~ -0 -1 6078 -D2 -All you see are trees and a shadowy path. -~ -~ -0 -1 6073 -D3 -All you see are trees and hillsides. -~ -~ -0 -1 6080 -E -path paths~ -The path is probably around here somewhere...if only you had paid more -attention. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -E -hills hill~ -Hills rise up all around you, blocking your view of the terrain. -~ -S -#6080 -In The Dense Forest Between The Hills~ - You are standing among tightly packed trees between several hills. You -lost track of the path long ago, and now must rely on your instincts to guide -you. The ground is very rough and rocky here, and only the most hardy plants -survive. The crowns of the old trees leave the hills in an unreal twilight -illumination. -~ -60 c 4 -D0 -All you see are trees and hillsides. -~ -~ -0 -1 6081 -D1 -All you see are trees and hillsides. -~ -~ -0 -1 6082 -D2 -All you see are trees and hillsides. -~ -~ -0 -1 6076 -D3 -All you see are trees and hillsides. -~ -~ -0 -1 6081 -E -path paths~ -The path is probably around here somewhere...if only you had paid more -attention. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -E -hills hill~ -Hills rise up all around you, blocking your view of the terrain. -~ -S -#6081 -In The Dense Forest Between The Hills~ - You are standing among tightly packed trees between several hills. You -lost track of the path long ago, and now must rely on your instincts to guide -you. The ground is very rough and rocky here, and only the most hardy plants -survive. The crowns of the old trees leave the hills in an unreal twilight -illumination. -~ -60 c 4 -D0 -All you see are trees and hillsides. -~ -~ -0 -1 6078 -D1 -All you see are trees and hillsides. -~ -~ -0 -1 6077 -D2 -All you see are trees and hillsides. -~ -~ -0 -1 6076 -D3 -All you see are trees and a shadowy path. -~ -~ -0 -1 6073 -E -path paths~ -The path is probably around here somewhere...if only you had paid more -attention. -~ -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -E -hills hill~ -Hills rise up all around you, blocking your view of the terrain. -~ -S -#6082 -In The Dense Forest Between The Hills~ - You are standing among tightly packed trees on a medium sized hill. The -dense forest spreads out all around you, and the crowns of the old trees leave -the hills in an unreal twilight illumination. -~ -60 c 4 -D0 -All you see are trees and hillsides. -~ -~ -0 -1 6081 -D1 -All you see are trees and hillsides. -~ -~ -0 -1 6079 -D2 -All you see are trees and hillsides. -~ -~ -0 -1 6076 -E -tree trees~ -The trees are mostly old beeches and oaks. -~ -E -hills hill~ -Hills rise up all around you, blocking your view of the terrain. -~ -S -#6090 -A Road Through The Plains~ - You are on a dust covered east-west road through the western plains. An -occasional hunter or adventurer can be seen, heading to or from the forest. -To the east is the walled city, Midgaard, and to the west the road ends at -the head of a narrow trail into a large forest. -~ -60 c 2 -D1 -Far to the east you see the large walls guarding Midgaard. -~ -~ -0 -1 6091 -D3 -To the west the dusty trail ends, and becomes a narrow trail into the cool -shadows of the forest. -~ -~ -0 -1 6000 -E -trail~ -The forest trail winds westwards through the trees. -~ -E -tree trees forest~ -The trees are quite tall considering most of them appear to be quite young. -~ -E -road dust dusty~ -The road is well used, and quite dusty. -~ -S -#6091 -A Road Through The Plains~ - You are on a dust covered east-west road through the western plains. An -occasional hunter or adventurer can be seen, heading to or from the forest. -To the east is the walled city, Midgaard, and to the west the road continues -towards a large forest. -~ -60 c 2 -D1 -Far to the east you see the walls and western gate of Midgaard. -~ -~ -0 -1 6092 -D3 -You see the large forest, Haon-Dor, stretching out far to the west, and to the -northwest you the forest gives way to hills. -~ -~ -0 -1 6090 -E -forest haondor haon-dor~ -The large forest of Haon-Dor spreads out to the west. Small and large game -is plentiful there... as is adventure, and of course, danger! -~ -E -tree trees~ -Some small trees grow amongst the underbrush of the plains. These slowly gain -in height as you travel farther westward towards Haon-Dor -~ -E -road dust dusty~ -The road is well used, and quite dusty. -~ -S -#6092 -A Road Through The Plains~ - You are on a dust covered east-west road crossing the grassy plains between -Midgaard the forest of Haon-Dor. An occasional hunter or adventurer can be -seen, heading to or from the forest. To the east is the walled city, Midgaard, -and to the west the road continues towards a large forest. -~ -60 c 1 -D1 -To the east you see the walls and West Gate of Midgaard. -~ -~ -0 -1 3052 -D3 -To the west the road continues towards the forest. -~ -~ -0 -1 6091 -E -forest~ -The large forest of Haon-dor spreads out to the west. Small and large game -is plentiful there...as is adventure, and of course, danger! -~ -E -road dust dusty~ -The road is well used, and quite dusty. -~ -S -$ diff --git a/lc-mud/circle/world/wld/61.wld b/lc-mud/circle/world/wld/61.wld deleted file mode 100644 index c676fe2302b4f761d771d59cb4959ad33fa1eef4..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/61.wld +++ /dev/null @@ -1,1347 +0,0 @@ -#6100 -A Narrow Trail Through The Deep, Dark Forest~ - You are on a narrow trail winding its way between the enormous, grey -trunks. The crowns of the trees must be very dense, as they leave the -forest floor in utter darkness. The trail leads east and west. -~ -61 ad 3 -D0 -A small shadowy path leads away to the north. -~ -~ -0 -1 6064 -D1 -The narrow trail leads east to a somewhat lighter part of the forest. -~ -~ -0 -1 6004 -D3 -The narrow, dusty trail leads west through the forest. -~ -~ -0 -1 6101 -E -trail~ -The dark and dusty trail seems fragile compared to the massive trunks, and in -some places, giant grey roots have broken up through its surface. -~ -E -tree trees trunk trunks~ -These ancient trees must have been here for many, many years. It is impossible -to catch even a glimpse of anything above the lowest branches. -~ -S -#6101 -A Narrow Trail Through The Deep, Dark Forest~ - You are on a dusty trail winding its way east-west between huge, -ancient trees whose grey trunks remind you of ancient pillars in a -enormous, deserted hall. To the south, a frail path leads away from -the trail. -~ -61 ad 3 -D1 -The narrow, dusty trail leads east through the forest. -~ -~ -0 -1 6100 -D2 -The path leads south - away from the trail. -~ -~ -0 -1 6104 -D3 -The narrow, dusty trail leads west through the forest. -~ -~ -0 -1 6102 -E -trail~ -The dark and dusty trail seems fragile compared to the massive trunks, and in -some places, giant grey roots have broken up through its surface. -~ -E -path~ -The path seems fragile and unsafe compared to the enormous trunks that loom -around it. -~ -E -tree trees trunk trunks~ -These ancient trees must have been here for many, many years. It is impossible -to catch even a glimpse of anything above the lowest branches. -~ -S -#6102 -A Narrow Trail Through The Deep, Dark Forest~ - You are on a dusty trail winding its way east-west between huge, -ancient trees that stand close on all sides. Not a sound is to be -heard - everything is ominously quiet. -~ -61 ad 3 -D1 -The narrow, dusty trail leads east through the forest. -~ -~ -0 -1 6101 -D3 -The narrow, dusty trail leads west through the forest. -~ -~ -0 -1 6103 -E -trail~ -The dark and dusty trail seems fragile compared to the massive trunks, and in -some places, giant grey roots have broken up through its surface. -~ -E -path~ -The path seems fragile and unsafe compared to the enormous trunks that loom -around it. -~ -E -tree trees trunk trunks~ -These ancient trees must have been here for many, many years. It is impossible -to catch even a glimpse of anything above the lowest branches. -~ -S -#6103 -A Narrow Trail Through The Deep, Dark Forest~ - You are where the dusty trail bends, as to avoid conflict with a -colossal trunk to the west. Not a sound is to be heard - everything -is ominously quiet. The trail leads east and south and there is a -small path leading off the trail to the north. -~ -61 ad 3 -D0 -A small path leads north off the trail. -~ -~ -0 -1 6150 -D1 -The narrow, dusty trail leads east through the forest. -~ -~ -0 -1 6102 -D2 -The narrow, dusty trail leads south through the forest. -~ -~ -0 -1 6108 -E -trail~ -The dark and dusty trail seems fragile compared to the massive trunks, and in -some places, giant grey roots have broken up through its surface. -~ -E -trees trunks~ -These ancient trees must have been here for many, many years. It is impossible -to catch even a glimpse of anything above the lowest branches. -~ -S -#6104 -A Small Path In The Deep, Dark Forest~ - You are on a narrow path leading through the deep, dark forest. You -feel as if the ancient trees observe you in watchful silence. The path -continues north and south. -~ -61 ad 3 -D0 -The narrow path winds its way through the trees to the north. -~ -~ -0 -1 6101 -D2 -The narrow path winds its way through the trees to the south. -~ -~ -0 -1 6105 -E -tree trees trunk trunks~ -The ancient grey giants seem to observe you silently. -~ -E -path~ -The path seems all too frail. One of the giant roots could probably crush it -in a single blow. -~ -S -#6105 -A Small Path In The Deep, Dark Forest~ - You are on a narrow path leading through the deep, dark forest. Ancient -grey trees loom all around you. The path continues north and west. -~ -61 ad 3 -D0 -The narrow path winds its way through the trees to the north. -~ -~ -0 -1 6104 -D3 -The narrow path winds its way through the trees to the west. -~ -~ -0 -1 6106 -E -tree trees trunk trunks~ -The ancient grey giants seem to observe you silently. -~ -E -path~ -The path seems all too frail. One of the giant roots could probably crush it -in a single blow. -~ -S -#6106 -A Junction In The Deep, Dark Forest~ - You are by a junction where three paths meet. Ancient grey trees tower -above you on all sides. Paths lead east, south and west. -~ -61 ad 3 -D1 -The narrow path winds its way through the trees to the east. -~ -~ -0 -1 6105 -D2 -The narrow path winds its way through the trees to the south. -~ -~ -0 -1 6117 -D3 -The narrow path winds its way through the trees to the west. -~ -~ -0 -1 6107 -E -tree trees trunk trunks~ -The ancient grey giants seem to observe you silently. -~ -E -path paths~ -The path seems all too frail. One of the giant roots could probably crush it -in a single blow. -~ -S -#6107 -A Small Path In The Deep, Dark Forest~ - You are on a narrow path leading through the deep, dark forest. Ancient -grey trees loom all around you. The path continues north and east. -~ -61 ad 3 -D0 -The narrow path winds its way through the trees to the north. -~ -~ -0 -1 6108 -D1 -The narrow path winds its way through the trees to the east. -~ -~ -0 -1 6106 -E -tree trees trunk trunks~ -The ancient grey giants seem to observe you silently. -~ -E -path~ -The path seems all too frail. One of the giant roots could probably crush it -in a single blow. -~ -S -#6108 -A Narrow Trail Through The Deep, Dark Forest~ - You are on a dusty trail winding its way between huge, ancient trees -standing close on all sides. The trail leads north and west and to the -south, a frail path leads away from the trail. -~ -61 ad 3 -D0 -The narrow, dusty trail leads north through the forest. -~ -~ -0 -1 6103 -D2 -The path leads south - away from the trail. -~ -~ -0 -1 6107 -D3 -The narrow, dusty trail leads west through the forest. -~ -~ -0 -1 6109 -E -trail~ -The dark and dusty trail seems fragile compared to the massive trunks, and in -some places, giant grey roots have broken up through its surface. -~ -E -path~ -The path seems fragile and unsafe compared to the enormous trunks that loom -around it. -~ -E -tree trees trunk trunks~ -These ancient trees must have been here for many, many years. It is impossible -to catch even a glimpse of anything above the lowest branches. -~ -S -#6109 -A Narrow Trail Through The Deep, Dark Forest~ - You are on a dusty trail winding its way east-west between huge, ancient -trees that stand close on all sides. Not a sound is to be heard - everything -is ominously quiet. -~ -61 ad 3 -D1 -The narrow, dusty trail leads east through the forest. -~ -~ -0 -1 6108 -D3 -The narrow, dusty trail leads west through the forest. -~ -~ -0 -1 6110 -E -trail~ -The dark and dusty trail seems fragile compared to the massive trunks, and in -some places, giant grey roots have broken up through its surface. -~ -E -tree trees trunk trunks~ -These ancient trees must have been here for many, many years. It is impossible -to catch even a glimpse of anything above the lowest branches. -~ -S -#6110 -A Narrow Trail Through The Deep, Dark Forest~ - You are on a dusty trail winding its way between huge, ancient trees that -stand close on all sides. The trail leads east and south. To the west, a -narrow path leads away from the trail. -~ -61 ad 3 -D1 -The narrow, dusty trail leads east through the forest. -~ -~ -0 -1 6109 -D2 -The narrow, dusty trail leads south through the forest. -~ -~ -0 -1 6111 -D3 -The narrow path leads west between the giant trees. -~ -~ -0 -1 6130 -E -trail~ -The dark and dusty trail seems fragile compared to the massive trunks, and in -some places, giant grey roots have broken up through its surface. -~ -E -path~ -The path seems fragile and unsafe compared to the enormous trunks that loom -around it. -~ -E -tree trees trunk trunks~ -Some of the trunks to the west are covered in a thin, almost transparent -substance. It looks like small threads woven carefully together. -~ -S -#6111 -A Narrow Trail Through The Deep, Dark Forest~ - You are on a dusty trail winding its way north-south between huge, ancient -trees that loom ominously above you. -~ -61 ad 3 -D0 -The narrow, dusty trail leads north through the forest. -~ -~ -0 -1 6110 -D2 -The narrow, dusty trail leads south through the forest. -~ -~ -0 -1 6112 -E -trail~ -The dark and dusty trail seems fragile compared to the massive trunks, and in -some places, giant grey roots have broken up through its surface. -~ -E -tree trees trunk trunks~ -These ancient trees must have been here for many, many years. It is impossible -to catch even a glimpse of anything above the lowest branches. -~ -S -#6112 -A Narrow Trail Through The Deep, Dark Forest~ - You are on a dusty trail winding its way between huge, ancient trees -standing close on all sides. The trail leads north and west and to the -east, a frail path leads away from the trail. -~ -61 ad 3 -D0 -The narrow, dusty trail leads north through the forest. -~ -~ -0 -1 6111 -D1 -The path leads east - away from the trail. -~ -~ -0 -1 6113 -D3 -The narrow, dusty trail leads west through the forest. -~ -~ -0 -1 6127 -E -trail~ -The dark and dusty trail seems fragile compared to the massive trunks, and in -some places, giant grey roots have broken up through its surface. -~ -E -path~ -The path seems fragile and unsafe compared to the enormous trunks that loom -around it. -~ -E -tree trees trunk trunks~ -These ancient trees must have been here for many, many years. It is impossible -to catch even a glimpse of anything above the lowest branches. -~ -S -#6113 -A Small Path In The Deep, Dark Forest~ - You are on a narrow path leading through the deep, dark forest. Ancient -grey trees loom in all directions. The path continues south and west. -~ -61 ad 3 -D2 -The narrow path winds its way through the trees to the south. -~ -~ -0 -1 6114 -D3 -The narrow path winds its way through the trees to the west. -~ -~ -0 -1 6112 -E -tree trees trunk trunks~ -The ancient grey giants seem to observe you silently. -~ -E -path~ -The path seems all too frail. One of the giant roots could probably crush it -in a single blow. -~ -S -#6114 -A Junction In The Deep, Dark Forest~ - You are by a junction where three paths meet. Ancient grey trees tower -above you on all sides. Paths lead north, east and west. -~ -61 ad 3 -D0 -The narrow path winds its way through the trees to the north. -~ -~ -0 -1 6113 -D1 -The narrow path winds its way through the trees to the east. -~ -~ -0 -1 6115 -D3 -The narrow path winds its way through the trees to the west. -~ -~ -0 -1 6122 -E -tree trees trunk trunks~ -The ancient grey giants seem to observe you silently. -~ -E -path paths~ -The path seems all too frail. One of the giant roots could probably crush it -in a single blow. -~ -S -#6115 -A Small Path In The Deep, Dark Forest~ - You are on a narrow path leading through the deep, dark forest. You feel -as if the ancient trees observe you in watchful silence. The path continues -north and west. -~ -61 ad 3 -D0 -The narrow path winds its way through the trees to the north. -~ -~ -0 -1 6116 -D3 -The narrow path winds its way through the trees to the west. -~ -~ -0 -1 6114 -E -tree trees trunk trunks~ -The ancient grey giants seem to observe you silently. -~ -E -path~ -The path seems all too frail. One of the giant roots could probably crush it -in a single blow. -~ -S -#6116 -A Small Path In The Deep, Dark Forest~ - You are on a narrow path leading through the deep, dark forest. Giant, -grey trees loom ominously on all sides. The path continues east and south. -~ -61 ad 3 -D1 -The narrow path winds its way through the trees to the east. -~ -~ -0 -1 6117 -D2 -The narrow path winds its way through the trees to the south. -~ -~ -0 -1 6115 -E -tree trees trunk trunks~ -The ancient grey giants seem to observe you silently. -~ -E -path~ -The path seems all too frail. One of the giant roots could probably crush it -in a single blow. -~ -S -#6117 -A Junction In The Deep, Dark Forest~ - You are by a junction where three paths meet. Ancient, grey trees seem -to observe you silently you from all sides. Paths lead north, east and west. -~ -61 ad 3 -D0 -The narrow path winds its way through the trees to the north. -~ -~ -0 -1 6106 -D1 -The narrow path winds its way through the trees to the east. -~ -~ -0 -1 6118 -D3 -The narrow path winds its way through the trees to the west. -~ -~ -0 -1 6116 -E -tree trees trunk trunks~ -The ancient grey giants seem to observe you silently. -~ -E -path paths~ -The path seems all too frail. One of the giant roots could probably crush it -in a single blow. -~ -S -#6118 -A Small Path In The Deep, Dark Forest~ - You are on a narrow path leading through the deep, dark forest. Ancient, -grey trees loom everywhere. The path continues south and west. -~ -61 ad 3 -D2 -The narrow path winds its way through the trees to the south. -~ -~ -0 -1 6119 -D3 -The narrow path winds its way through the trees to the west. -~ -~ -0 -1 6117 -E -tree trees trunk trunks~ -The ancient grey giants seem to observe you silently. -~ -E -path~ -The path seems all too frail. One of the giant roots could probably crush it -in a single blow. -~ -S -#6119 -A Small Path In The Deep, Dark Forest~ - You are on a narrow path leading through the deep, dark forest. Huge, -ancient trees are on all sides. The path continues north and south. -~ -61 ad 3 -D0 -The narrow path winds its way through the trees to the north. -~ -~ -0 -1 6118 -D2 -The narrow path winds its way through the trees to the south. -~ -~ -0 -1 6120 -E -tree trees trunk trunks~ -You feel as if they are watching you. -~ -E -path~ -The path seems all too frail. One of the giant roots could probably crush it -in a single blow. -~ -S -#6120 -On The River Bank In The Deep, Dark Forest~ - You are on a narrow path leading through the deep, dark forest. To the -south a fast river is flowing westward through the forest. Ancient grey -trees loom on both banks. The path continues north and west. -~ -61 ad 3 -D0 -The narrow path winds its way through the trees to the north. -~ -~ -0 -1 6119 -D2 -It looks as if you can enter the fast flowing river just to the -south. -~ -~ -0 -1 901 -D3 -The narrow path winds its way through the trees to the west. -~ -~ -0 -1 6121 -E -river~ -The river flows fast and strong. It is black or looks so in the gloom. -~ -E -bank banks tree trees trunk trunks~ -The ancient crowns of trees on both banks reach together forming a dense roof -above the dark river. -~ -E -path~ -The path seems all too frail. One of the giant roots could probably crush it -in a single blow. -~ -S -#6121 -A Dead End Path On The River Bank In The Deep, Dark Forest~ - You are on a narrow path leading through the deep, dark forest. The -ancient trees stand so close that the path disappears between the dusty -roots. To the south a dark river flows from east to west. The only exit -appears to be east. -~ -61 ad 3 -D1 -The narrow path winds its way through the trees to the east. -~ -~ -0 -1 6120 -E -river~ -The river flows fast and strong. It is black or looks so in the gloom. -~ -E -bank banks tree trees trunk trunks~ -The ancient crowns of trees on both banks reach together forming a dense roof -above the dark river. -~ -E -path~ -The path seems all too frail. One of the giant roots could probably crush it -in a single blow. -~ -S -#6122 -A Small Path In The Deep, Dark Forest~ - You are on a narrow path leading through the deep, dark forest. Giant, -grey trees loom ominously all around. The path continues east and south. -~ -61 ad 3 -D1 -The narrow path winds its way through the trees to the east. -~ -~ -0 -1 6114 -D2 -The narrow path winds its way through the trees to the south. -~ -~ -0 -1 6123 -E -tree trees trunk trunks~ -The ancient grey giants seem to observe you silently. -~ -E -path~ -The path seems all too frail. One of the giant roots could probably crush it -in a single blow. -~ -S -#6123 -A Junction On The River Bank In The Deep, Dark Forest~ - You are by a junction where three paths meet. Ancient, grey trees seem -to observe you silently you from all around. To the south a dark river -flows from east to west through the forest. Paths lead north, east and west. -~ -61 ad 3 -D0 -The narrow path winds its way through the trees to the north. -~ -~ -0 -1 6122 -D1 -The narrow path winds its way through the trees to the east. -~ -~ -0 -1 6124 -D3 -The narrow path winds its way through the trees to the west. -~ -~ -0 -1 6125 -E -river~ -The river flows fast and strong. It is black or looks so in the gloom. -~ -E -bank banks tree trees trunk trunks~ -The ancient crowns of trees on both banks reach together forming a dense roof -above the dark river. -~ -E -path paths~ -The path seems all too frail. One of the giant roots could probably crush it -in a single blow. -~ -S -#6124 -A Dead End Path In The Deep, Dark Forest~ - You are on a narrow path leading through the deep, dark forest. The -ancient trees stand so close that the path disappears between the dusty -roots. To the south a dark river flows from east to west. The only exit -appears to be west. -~ -61 ad 3 -D3 -The narrow path winds its way through the trees to the west. -~ -~ -0 -1 6123 -E -river~ -The river flows fast and strong. It is black or looks so in the gloom. -~ -E -bank banks tree trees trunk trunks~ -The ancient crowns of trees on both banks reach together forming a dense roof -above the dark river. -~ -E -path~ -The path seems all too frail. One of the giant roots could probably crush it -in a single blow. -~ -S -#6125 -A Small Path On The River Bank In The Deep, Dark Forest~ - You are on a narrow path leading through the deep, dark forest. -Ancient grey trees loom everywhere. To the south a dark river flows -westward through the forest. The path continues north and east. -~ -61 ad 3 -D0 -The narrow path winds its way through the trees to the north. -~ -~ -0 -1 6126 -D1 -The narrow path winds its way through the trees to the east. -~ -~ -0 -1 6123 -E -river~ -The river flows fast and strong. It is black or looks so in the gloom. -~ -E -bank banks tree trees trunk trunks~ -The ancient crowns of trees on both banks reach together forming a dense roof -above the dark river. -~ -E -path~ -The path seems all too frail. One of the giant roots could probably crush it -in a single blow. -~ -S -#6126 -A Narrow Trail Through The Deep, Dark Forest~ - You are on a dusty trail winding its way between huge, ancient trees -standing close on all sides. The trail leads north and west, and to the -south a frail path leads away from the trail. -~ -61 ad 3 -D0 -The narrow, dusty trail leads north through the forest. -~ -~ -0 -1 6127 -D2 -The path leads south - away from the trail. -~ -~ -0 -1 6125 -D3 -The narrow, dusty trail leads west through the forest. -~ -~ -0 -1 6128 -E -trail~ -The dark and dusty trail seems fragile compared to the massive trunks, and in -some places, giant grey roots have broken up through its surface. -~ -E -path~ -The path seems fragile and unsafe compared to the enormous trunks that loom -around it. -~ -E -tree trees trunk trunks~ -These ancient trees must have been here for many, many years. It is impossible -to catch even a glimpse of anything above the lowest branches. -~ -S -#6127 -A Narrow Trail Through The Deep, Dark Forest~ - You are on a dusty trail winding its way between huge, ancient trees -standing close on all sides. The trail leads east and south. -~ -61 ad 3 -D1 -The narrow, dusty trail leads east through the forest. -~ -~ -0 -1 6112 -D2 -The narrow, dusty trail leads south through the forest. -~ -~ -0 -1 6126 -E -trail~ -The dark and dusty trail seems fragile compared to the massive trunks, and in -some places, giant grey roots have broken up through its surface. -~ -E -tree trees trunk trunks~ -These ancient trees must have been here for many, many years. It is impossible -to catch even a glimpse of anything above the lowest branches. -~ -S -#6128 -A Narrow Trail Through The Deep, Dark Forest~ - You are on a dusty trail winding its way east-west between huge, ancient -trees that stand close on all sides. Not a sound is to be heard - everything -is ominously quiet. -~ -61 ad 3 -D1 -The narrow, dusty trail leads east through the forest. -~ -~ -0 -1 6126 -D3 -The narrow, dusty trail leads west through the forest. -~ -~ -0 -1 6129 -E -trail~ -The dark and dusty trail seems fragile compared to the massive trunks, and in -some places, giant grey roots have broken up through its surface. -~ -E -tree trees trunk trunks~ -These ancient trees must have been here for many, many years. It is impossible -to catch even a glimpse of anything above the lowest branches. -~ -S -#6129 -A Narrow Trail Through The Deep, Dark Forest~ - You are on a dusty trail winding its way east-west between huge, ancient -trees that stand close on all sides. Not a sound is to be heard - everything -is ominously quiet. -~ -61 ad 3 -D1 -The narrow, dusty trail leads east through the forest. -~ -~ -0 -1 6128 -D3 -The narrow, dusty trail leads west through the forest. -~ -~ -0 -1 6135 -E -trail~ -The dark and dusty trail seems fragile compared to the massive trunks, and in -some places, giant grey roots have broken up through its surface. -~ -E -tree trees trunk trunks~ -These ancient trees must have been here for many, many years. It is impossible -to catch even a glimpse of anything above the lowest branches. -~ -S -#6130 -A Narrow Trail Through The Deep, Dark Forest~ - You are on a dusty trail winding its way westward between huge, ancient -trees that stand close on all sides. The tree trunks seem to be covered in -some sticky substance which gets much stickier towards the west! Beware! -~ -61 ad 3 -D1 -The narrow, dusty trail leads east through the forest. -~ -~ -0 -1 6110 -D3 -The sticky substance is hanging like ropes between the trees just above the -path. To the west the path seems to be covered with these giant threads -covered with glue. You can sense the forces of evil coming from the west -and your bones tell you it may not be such a good idea to proceed. -~ -~ -0 -1 6131 -D4 -~ -~ -0 -1 6132 -E -substance rope ropes thread threads~ -The substance reminds you of giant threads covered with glue. If it hadn't -been for the size you could have sworn it was part of a spider web. -~ -E -trail~ -The dark and dusty trail seems fragile compared to the massive trunks, and in -some places, giant grey roots have broken up through its surface. -~ -E -tree trees trunk trunks~ -The sticky substance is hanging like ropes between the ancient trees, crossing -the path just out of reach. It might be possible to climb one of the sticky -trunks. -~ -S -#6131 -The Deadly Spider Web~ - You are walking along the narrow path, ducking under the sticky ropes -as you advance... - -> -A huge, poisonous spider drops from above! -A huge, poisonous spider drops from above! -A huge, poisonous spider drops from above! - -> -The huge, poisonous spider stings you! You resist the poison! -The huge, poisonous spider stings you! You are poisoned! -The huge, poisonous spider stings you! You are poisoned! - -You are dead. -~ -61 bd 3 -D1 -~ -~ -0 -1 6130 -D3 -~ -~ -0 -1 6134 -D4 -~ -~ -0 -1 6133 -S -#6132 -Up In The Tree~ - You are hanging on the outside of a huge tree trunk covered in a sticky -substance. Directly to the west is an immense spider web suspended between -numerous of the giant trees including the one you are hanging on. To the -north is what looks like a large webbed entrance. -~ -61 acd 6 -D0 -To the north is what looks like a large expanse of webbing which extends -very far into the trees. -~ -~ -0 -1 6301 -D3 -To the west is the immense spider web. It seems to move softly. -~ -~ -0 -1 6133 -D5 -Downwards is the narrow forest path. -~ -~ -0 -1 6130 -E -web~ -The spider web stretches out to the west. It looks as if it is possible to -walk on it. -~ -S -#6133 -On The spider web~ - You are balancing carefully on the giant sticky threads that holds the -giant web in place. To the east is a giant tree trunk and to the west is -an entrance to a cave-like structure made from many layers of spider web. -~ -61 ad 6 -D1 -To the east is the giant tree trunk. -~ -~ -0 -1 6132 -D3 -To the west is the entrance to the cave-like structure. -~ -~ -0 -1 6134 -E -web~ -The immense spider web moves softly. -~ -E -cave structure~ -It covers a ground area corresponding to an irregular circle with a diameter -of about 20 feet and is nearly 10 feet tall. It looks very old. -~ -S -#6134 -The Den Of The Queen Spider~ - You are inside a cave-like structure that seems to be made entirely -from countless layers of spider web. Temperature and humidity is very -high making it hard to breathe the foul air that lingers here. The walls -are covered with open cocoons. -~ -61 ad 6 -D1 -Compared to this place the east exit looks inviting. -~ -~ -0 -1 6133 -E -web wall walls~ -The sticky walls are covered with open cocoons. -~ -E -cocoon cocoons~ -The cocoons are burst open as if something inside really wanted to get -out. They are at the size of a human head. -~ -S -#6135 -A Dusty Trail In The Deep, Dark Forest~ - You are on a dusty trail leading through the deep, dark forest. Ancient -grey trees loom all around you. The trail continues north and east. -~ -61 ad 3 -D0 -The dusty trail leads north through the trees. -~ -~ -0 -1 6136 -D1 -The dusty trail leads east through the trees. -~ -~ -0 -1 6129 -E -tree trees trunk trunks~ -The ancient grey giants seem to observe you silently. -~ -S -#6136 -A Dusty Trail In The Deep, Dark Forest~ - You are on a dusty trail leading through the deep, dark forest. Ancient, -grey trees loom everywhere. The trail continues south and west. A broad -irregular path leads eastward away from the trail. -~ -61 ad 3 -D1 -The trees standing on the sides of the path have scratch marks on them. -~ -~ -0 -1 6142 -D2 -The dusty trail leads south through the trees. -~ -~ -0 -1 6135 -D3 -The dusty trail leads west through the trees. -~ -~ -0 -1 6137 -E -tree trees trunk trunks~ -To the east the ancient grey giants have many marks as if something with huge -claws has been tearing at them in rage. -~ -E -path~ -The trees standing on the sides of the path have scratch marks on them. -~ -E -trail~ -The dark and dusty trail seems fragile compared to the massive trunks, and in -some places, giant grey roots have broken up through its surface. -~ -S -#6137 -At The End Of The Trail Through The Deep, Dark Forest~ - You are on a dusty trail leading through the deep, dark forest. Ancient -grey trees loom all around you. A small trail leads northwards and the only -other exit is east, along the main trail. -~ -61 ad 3 -D0 -A narrow trail leads northwards through the underbrush. -~ -~ -0 -1 6138 -D1 -The dusty trail leads east through the trees. -~ -~ -0 -1 6136 -E -tree trees trunk trunks~ -The ancient grey giants seem to observe you silently. -~ -S -#6138 -On The Narrow Trail~ - The trail continues to the north and south as it leads through -the heavy underbrush of this part of the Haon-Dor Forest. Ancient -grey trees loom all around you. The brush seems to be bending -closely over the path in a somewhat ominous manner, but you easily -shrug it off. The trail looks to open up somewhat a short distance -to the south. -~ -61 ad 3 -D0 -The narrow trail continues northwards through the underbrush. -~ -~ -0 -1 6139 -D2 -The dusty trail leads east through the trees. -~ -~ -0 -1 6137 -E -tree trees trunk trunks~ -The ancient grey giants seem to observe you silently. -~ -S -#6139 -On The Narrow Trail~ - The trail continues to the north and south as it leads through -the heavy underbrush of this part of the Haon-Dor Forest. The -trail looks surprisingly well trodden along this part. The brush -seems to be bending closely over the path in a somewhat ominous -manner, but you easily shrug it off. -~ -61 ad 3 -D0 -A short distance to the north, you can see something shimmering. -~ -~ -0 -1 6203 -D2 -The path leads southwards through the underbrush. -~ -~ -0 -1 6138 -S -#6142 -Outside A Cave In The Deep, Dark Forest~ - You are at the end of a broad, irregular path. To the north is a very -large ominous-looking cave opening. The trees here have many marks as if -something with huge claws has been tearing at them in rage. -~ -61 ad 3 -D0 -The disgusting smell of a large reptile emanates from the cave opening. -~ -~ -0 -1 6143 -D3 -The path winds its way westward. -~ -~ -0 -1 6136 -E -tree trees~ -The ancient grey giants have many marks as if something with huge claws has -been tearing at them in rage. -~ -E -cave opening~ -The disgusting smell of a large reptile emanates from the cave opening. -~ -S -#6143 -The Cave Of The Green Dragon~ - You are in a big natural cave. The floor is littered with bones of -all sorts and the stench is so massive that you could cut it with a -knife. The only exit is to the south. -~ -61 ad 3 -D2 -The exit leads out into the forest. -~ -~ -0 -1 6142 -E -bone bones floor~ -Most of the bones on the floor appear to be of human origin. -~ -S -#6150 -The Narrow Trail~ - This trail looks much spookier than any other that's you have seen. The -usual animal claw marks and bites on the trees are becoming few and far -between. The trail continues north. -~ -61 ad 3 -D0 -The narrow trail continues north. -~ -~ -0 -1 6151 -D2 -The trail intersects the main forest path. -~ -~ -0 -1 6103 -S -#6151 -The Narrow Trail~ - This area of the trail is also very peculiar. You can see no signs of -animal life what so ever. The structure of the surrounding trees forces -the path to make a sharp turn to the east. -~ -61 ad 3 -D1 -The trail bends east. -~ -~ -0 -1 6152 -D2 -The start of the trail. -~ -~ -0 -1 6150 -S -#6152 -The Circle Of Trees~ - The trees here seem to form a circle around the enormous tree in -the center. You notice a wooden door carved into the huge tree to -the east. The trail that you followed to get here seems to end at -the base of the tree. -~ -61 ad 3 -D1 -The tree door is carved beautifully. -~ -door~ -1 -1 6153 -D3 -The bend on the trail. -~ -~ -0 -1 6151 -S -#6153 -Inside The Great Tree~ - You have stepped inside of this hollowed tree. From here steps lead down -into darkness or you can exit the tree by going west. -~ -61 ad 3 -D3 -The door is carved beautifully. -~ -door~ -1 -1 6152 -D5 -The steps look appear like they will hold your weight. -~ -~ -0 -1 6154 -S -#6154 -The Underground Hallway~ - This hallway is apparently one of the roots of the tree hollowed out. -The hall leads south to a room where you hear strange noises or you can -go up the steps. -~ -61 ad 3 -D2 -The hallway looks quite grand. -~ -~ -0 -1 6155 -D4 -The steps appear like they will hold your weight. -~ -~ -0 -1 6153 -S -#6155 -The Cultist Temple~ - This temple, built to a god you don't worship, is a nice place to -visit but you feel very uncomfortable about spending any amount of -time here. The wooden altar seems to almost glow as you enter the -room. The only exit is the way you came in. -~ -61 ad 3 -D0 -The hallway to the north looks quite grand. -~ -~ -0 -1 6154 -S -$ diff --git a/lc-mud/circle/world/wld/62.wld b/lc-mud/circle/world/wld/62.wld deleted file mode 100644 index e2689349eb02afd00a9f32036322c877566423b3..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/62.wld +++ /dev/null @@ -1,1486 +0,0 @@ -#6200 -In The Forest~ - The trail ends here where the mountains begin abruptly. -Looking up, you note that the climb would be rough, -hazardous, and probably not worth the effort; the energy -barrier continues up the mountain side out of sight. The -only exit is back to the east. -~ -62 0 3 -D1 -~ -~ -0 -1 6201 -E -barrier energy~ -You can faintly see the woods continue beyond it, but it -seems there's no way through. The field rises high up -into the air, and seems to form a ceiling above the woods, -preventing a flying entrance. You'd also bet it extends -deep into the ground. -~ -S -#6201 -In The Forest~ - To the west the mountains rise high up, rocky and -lifeless. The trail you are walking on heads west -to the end of the forest, and back east. Each way the -strange energy barrier stands just to the north, -inscrutable, magical, and impenetrable. -~ -62 0 3 -D1 -~ -~ -0 -1 6202 -D3 -~ -~ -0 -1 6200 -E -barrier energy~ -You can faintly see the woods continue beyond it, but it -seems there's no way through. The field rises high up -into the air, and seems to form a ceiling above the woods, -preventing a flying entrance. You'd also bet it extends -deep into the ground. -~ -S -#6202 -In The Forest~ - This trail runs parallel to the energy barrier to your -north, seemingly all the way up to the mountains to the -west that form the boundries of this valley. Walking -along, you scare a small squirrel, which leaps through -the barrier without a second thought! Your hand is still -repulsed by the magical field, however. -~ -62 0 3 -D1 -~ -~ -0 -1 6203 -D3 -~ -~ -0 -1 6201 -E -barrier energy~ -You can faintly see the woods continue beyond it, but it -seems there's no way through. The field rises high up -into the air, and seems to form a ceiling above the woods, -preventing a flying entrance. You'd also bet it extends -deep into the ground. -~ -S -#6203 -In The Forest~ - The northern pathway stops abruptly here, halted by -some sort of glowing energy barrier running through the -woods. A game trail, seemingly well traveled, runs east- -west along the magical barrier's length. Very strange. -~ -62 0 3 -D1 -~ -~ -0 -1 6204 -D2 -~ -~ -0 -1 6139 -D3 -~ -~ -0 -1 6202 -E -barrier energy~ -You can faintly see the woods continue beyond it, but it -seems there's no way through. The field rises high up -into the air, and seems to form a ceiling above the woods, -preventing a flying entrance. You'd also bet it extends -deep into the ground. -~ -S -#6204 -In The Forest~ - The energy barrier runs through the woods on its east- -west course here, just north of the trail you are walking -on. A faint humming seems to eminate from the glowing -field, pushing the normal sounds of the forest into the -background. For a short moment, you wonder if the field -is keeping something in, or you out. It makes you -wonder... -~ -62 0 3 -D1 -~ -~ -0 -1 6205 -D3 -~ -~ -0 -1 6203 -E -barrier energy~ -You can faintly see the woods continue beyond it, but it -seems there's no way through. The field rises high up -into the air, and seems to form a ceiling above the woods, -preventing a flying entrance. You'd also bet it extends -deep into the ground. -~ -S -#6205 -In The Forest~ - The energy field makes a sudden ninety-degree turn -here, running to the north and west out of sight through -the thickening woods. The trail you are on curves to -skirt the edge of the magical barrier in either direction. -Curious... who or what is keeping this field in place, -and for what purpose? -~ -62 0 3 -D0 -~ -~ -0 -1 6206 -D3 -~ -~ -0 -1 6204 -E -barrier energy~ -You can faintly see the woods continue beyond it, but it -seems there's no way through. The field rises high up -into the air, and seems to form a ceiling above the woods, -preventing a flying entrance. You'd also bet it extends -deep into the ground. -~ -S -#6206 -In The Forest~ - The woods thicken here, and surpisingly, you see a tree -completely cut in half by the magical barrier running -north-south here. The tree looks healthy and unaffected -by the energy field passing right through its center. -Odd... -~ -62 0 3 -D0 -~ -~ -0 -1 6207 -D2 -~ -~ -0 -1 6205 -E -barrier energy~ -You can faintly see the woods continue beyond it, but it -seems there's no way through. The field rises high up -into the air, and seems to form a ceiling above the woods, -preventing a flying entrance. You'd also bet it extends -deep into the ground. -~ -S -#6207 -In The Forest~ - The magical energy barrier runs straight north-south, -unaffected by dips in the grounds, intervening rocks and -trees, everything. From the north, you hear a faint -rushing noise above the humming of the field. The trail -you are on continues to the north and south, only a few -feet away from the barrier it follows. -~ -62 0 3 -D0 -~ -~ -0 -1 6208 -D2 -~ -~ -0 -1 6206 -E -barrier energy~ -You can faintly see the woods continue beyond it, but it -seems there's no way through. The field rises high up -into the air, and seems to form a ceiling above the woods, -preventing a flying entrance. You'd also bet it extends -deep into the ground. -~ -S -#6208 -In The Forest~ - Here the field changes color, becoming almost -transparent. Beyond, you think you can make out a few -shapes, but nothing too terribly distinct. From the north -comes the rushing sound of water, and through the trees -you believe you can see a river cutting through the -forest. The trail you are on leads north-south through -the woods, following the energy barrier all along its -length. -~ -62 0 3 -D0 -~ -~ -0 -1 6209 -D2 -~ -~ -0 -1 6207 -D3 -~ -~ -0 -1 6210 -E -barrier energy~ -You can see a clearing beyond, the barrier not fully blocking -out the area behind. You think it might be possible to push -your way through, if the damn thing doesn't kill you first. -~ -S -#6209 -The River's Edge~ - A river flows through the forest here, its water clean -and clear. The energy barrier runs right out into the -middle of the river, and then makes another ninety-degree -turn to the west. The water seems to have no problem -penetrating the magical field, however. - The river seems too wide and too swift to cross here. -It appears the only way to go is back to the south. -~ -62 0 3 -D2 -~ -~ -0 -1 6208 -E -barrier energy~ -You can faintly see the woods continue beyond it, but it -seems there's no way through. The field rises high up -into the air, and seems to form a ceiling above the woods, -preventing a flying entrance. You'd also bet it extends -deep into the ground. -~ -S -#6210 -Just Passing Through...~ - The energy barrier seems to push against you -ineffectively as you shove your way through it. All your -hairs stick up on your body from the static electricity, -and electric shocks sting your body from every metallic -piece of equipment you are carrying. You think with a -final shove, you can break through to the other side... -~ -62 c 5 -D1 -~ -~ -0 -1 6208 -D3 -~ -~ -0 -1 6211 -S -#6211 -By The Barrier~ - To the west the magical energy barrier crackles and -hums to itself, almost looking harmless. Almost -- all -around on the ground are charred corpses and bodies. -Several poles with skulls on top face to the west, warning -travellers on the forest paths away from here. The air -smells of death and decay, and the air is very still. You -feel uncomfortable. -~ -62 c 3 -D1 -~ -~ -0 -1 6210 -D3 -~ -~ -0 -1 6212 -E -corpse body bodies corpses skull skulls~ -Demi-human, from the size. The foreheads slop down to a -blocky brow, and the braincase seems rather small. On -a hunch, you check one of the feet of a torched body. -Cloven, like a pig's... Orcs. -~ -S -#6212 -A Clearing In The Forest~ - Several trails in the forest intersect here in a small -clearing. The dirt seems matted down, and you see many -footprints in the soil. Nearby you hear a bird's chirp -abruptly cut off in a loud squawk, and then silence. The -paths seem well-traveled, the undergrowth matted down and -the foilage hacked away to leave plenty of room or a -traveller to pass in every cardinal direction, excepting -the west path seems fairly overgrown... - You feel watched. -~ -62 0 3 -D0 -~ -~ -0 -1 6213 -D1 -~ -~ -0 -1 6211 -D2 -~ -~ -0 -1 6217 -D3 -~ -~ -0 -1 6228 -E -foot footprint footprints print prints~ -Cloven hoofs, two feet... they walk erect whatever they are. -~ -S -#6213 -A Forest Trail~ - The northern trail winds through the trees, heading -from a forest clearings to the south to where there appears -to be a river's edge to the north. This trail appears to -be well-used and you spot many tracks in the earth. Again -the hairs on the back of your neck stand up, and you wonder -if you're being spied upon. -~ -62 0 3 -D0 -~ -~ -0 -1 6214 -D2 -~ -~ -0 -1 6212 -S -#6214 -The River's Edge~ - A beautiful river flows swiftly by, the current looking -quite dangerous in fact. Out in the center of the river -you spot the energy barrier enclosure... no way out here. -Looking up, you see a bird fly right through the barrier -overhead and wonder as to the force field's nature. This -path leads south into the forest, and westwards along the -river's edge. -~ -62 0 2 -D2 -~ -~ -0 -1 6213 -D3 -~ -~ -0 -1 6215 -S -#6215 -The River's Edge~ - The river flows on its course, unhampered by the energy -barrier passing right down its center for as far as you -can see in both directions. The path you are on travels -along the length of the river to the east and west -inbetween the water and the forest's edge. Once again you -shiver and feel that unmistakeable sense that you are -being watched. Disturbing. -~ -62 0 2 -D1 -~ -~ -0 -1 6214 -D3 -~ -~ -0 -1 6216 -S -#6216 -The River's Edge~ - A large out-cropping of rock blocks this path along the -river to the west, and you don't spot any way around it; -the woods are too thick to the south, the river too swift -to the north, the magical barrier above you. This is a -nice area, however, as evidenced by the amount of traffic -this path gets. From the marks in the grass, you guess -that this is a favored resting spot. -~ -62 0 2 -D1 -~ -~ -0 -1 6215 -S -#6217 -A Forest Trail~ - This well-used forest trail leads south. Among the -foot-tracks in the dirt, you spot a few animal tracks as -well, leading you to believe that these trails are used by -hunters. Why would they be enclosed in this manner, -however? - There is a clearing to the north, and the path -continues to the south. -~ -62 0 3 -D0 -~ -~ -0 -1 6212 -D2 -~ -~ -0 -1 6219 -S -#6218 -A Forest Trail~ - This trail leads north-south... obviously a gaming -trail. The woods, mostly deciduous trees with the -accompanying ground foilage, crowd in to either side. -A shrub to your left shows a fresh cutting wound... -looks like a sharp object like a knife or machete did -the damage. - A crackle in the leaves spins you around, to see -nothing. Something is watching you, you feel it. -Where? -~ -62 0 3 -D0 -~ -~ -0 -1 6233 -D2 -~ -~ -0 -1 6226 -S -#6219 -A Forest Trail~ - The trail changes direction here, turning to the north -and west. A large tree to your south bears an interesting -artifact; a rusty arrowhead embedded in the wood. It -looks as if the arrow had been broken off at the head, -the wood scratched at, and the arrowhead left behind. -Otherwise, there doesn't seem to be much of interest in -this particular section of the woods. -~ -62 0 3 -D0 -~ -~ -0 -1 6217 -D3 -~ -~ -0 -1 6220 -S -#6220 -A Forest Trail~ - This is a winding east-west path through the thickening -forest. The grass along the path is matted down from -frequent traffic. The path continues to the east, and -there seems to be a small clearing to the west. - A faint noise makes you stand stock still. You could -have sworn you heard a voice nearby. Whatever it was, it -wasn't speaking common. -~ -62 0 3 -D1 -~ -~ -0 -1 6219 -D3 -~ -~ -0 -1 6221 -S -#6221 -A Small Clearing~ - In the middle of this small clearing in the forest is a -fairly large rock sticking up out of the ground. Paths -lead away to the east, west, and south from here. The -trees above block out the sky fairly effectively, also -blotting out the glowing energy barrier above your head. -~ -62 0 3 -D1 -~ -~ -0 -1 6220 -D2 -~ -~ -0 -1 6222 -D3 -~ -~ -0 -1 6227 -E -rock boulder~ -There is dried blood on it. -~ -S -#6222 -A Forest Trail~ - A smaller northern path leads away from the main east- -west trail here towards a clearing. The main path leads -windingly around the trees to the east and west, the woods -blocking out whatever may be ahead. Again you get that -strange feeling of being watched. -~ -62 0 3 -D0 -~ -~ -0 -1 6221 -D1 -~ -~ -0 -1 6223 -D3 -~ -~ -0 -1 6225 -S -#6223 -A Forest Trail~ - The trail leads east and west here through the forest. -To the west you spot an area where a smaller path breaks -off from the main track. Eastwards seems to be another -small clearing that seems to be well used; there are many -tracks leading in that direction. -~ -62 0 3 -D1 -~ -~ -0 -1 6224 -D3 -~ -~ -0 -1 6222 -S -#6224 -The Dead End~ - The ground has been cleared of vegetation in this small -clearing, and several large, man-made salt licks lie on -the ground and stand on poles here. There are many animal -tracks in the earth -- the salt licks must attract -wildlife for miles around. You think this would be a good -place to hide and wait for dinner if you were a hunter... -~ -62 0 3 -D3 -~ -~ -0 -1 6223 -S -#6225 -A Forest Trail~ - This trail leads east-west through the forest foilage, -around the trees and up and down the slight rises. The -area is quiet and serene, except for the energy barrier -keeping you in to the south. For just a moment, you wonder -if you're still being watched... -~ -62 0 3 -D1 -~ -~ -0 -1 6222 -D3 -~ -~ -0 -1 6226 -S -#6226 -A Forest Trail~ - The trail bends here, leading away to the north and -east. Far off the the distance you hear the squawk of a -large bird-of-prey searching the skies for a meal. The -ferns around you rustle gently in the light breeze. -Somehow, the threatening aura that pervades over the rest -of the area seems absent here. You feel almost relaxed... -~ -62 c 3 -D0 -~ -~ -0 -1 6218 -S -#6227 -A Forest Trail~ - A bend in the forest trail allows you to go east and -north here. To the east you spot a small clearing, while -northwards this trail seems to join a much larger one -leading through the woods. On the ground is half of a -broken knife handle, made of bone and dried leather, -useless now. You wonder if the owner is watching you -now -- something certainly is. -~ -62 0 3 -D0 -~ -~ -0 -1 6232 -D1 -~ -~ -0 -1 6221 -S -#6228 -A Forest Trail~ - This path leads from the main clearing to the west to -intersect with a north-south path just to the east. A -small sapling on the north side of the trail has a rope -tied around one of its top branches; an unused snare -evidently. You still feel as if you're being watched in -the back of your mind, and adrenaline pumps into your -brain like a lightning fuzz. -~ -62 0 3 -D1 -~ -~ -0 -1 6212 -D3 -~ -~ -0 -1 6229 -S -#6229 -A Forest Trail~ - A north-south trail leads through the woods here, with -a small side trail leading off to the east. The trees -provide adequate cover from the sky, but through a few -holes in the foilage you spot the magical barrier above -you, keeping you from escaping by flight. You feel -slightly captured. -~ -62 0 3 -D1 -~ -~ -0 -1 6228 -D2 -~ -~ -0 -1 6230 -S -#6230 -A Forest Trail~ - Two trails come together here, a large northern path -heading away from tracks leading to the east and west. -The western path seems to be the most traveled, and the -east hardly at all. There seems to be less trees around -here... it seems as if many have been cut down by some -sort of crude tools. This land clearing appears to be -especially true to the east. -~ -62 0 3 -D0 -~ -~ -0 -1 6229 -D1 -~ -~ -0 -1 6231 -D3 -~ -~ -0 -1 6232 -S -#6231 -A Clearing~ - The trees have been cut down around here, and many of -the trunks hollowed out with sharp stones and lined with -treated leather to make almost-waterproof tubs. A foul -smelling brown fluid, tannin evidently, fills many of -these, soaking into various bits and pieces of animal -hides. Crude, but workable. -~ -62 0 3 -D3 -~ -~ -0 -1 6230 -S -#6232 -A Forest Trail~ - The trail is widening to the west, where the path leads -all the way up to the side of the mountains that enclose -this valley. Many of the trees have been cut down around -here, and it definitely looks as if the forest is ending. -Eastwards the trail leads on into the thick of the forest. -A small split off trail leads away to the south here. -~ -62 0 3 -D1 -~ -~ -0 -1 6230 -D2 -~ -~ -0 -1 6227 -D3 -~ -~ -0 -1 6233 -S -#6233 -A Forest Trail~ - The ground is growing more rocky here. The trees and -other foilage in the forest grow sparse here, finding it -hard to find purchase in the soil. The forest ends just -to the west, with the trail you are on leading right on up -to the side of the mountains. A side trail leads south -here, and the trail also leads back into the thick of the -forest to the east. -~ -62 0 3 -D1 -~ -~ -0 -1 6232 -D2 -~ -~ -0 -1 6218 -D3 -~ -~ -0 -1 6234 -S -#6234 -A Rocky Trail~ - The ground is getting very rocky here, causing the -trees of the woods to become more sparse. Several bushes -have found purchase in the soil, but not near enough to -block free movement in this area. The trail leads on up -to what appears to be a cave in the side of the mountain -to the west, and a side trail runs along the forest's edge -to the north. To the east, the trail runs deep into the -forest out of sight. -~ -62 0 4 -D0 -~ -~ -0 -1 6241 -D1 -~ -~ -0 -1 6233 -D3 -~ -~ -0 -1 6242 -S -#6235 -A Forest Trail~ - The trail you are on bends around a large double- -trunked tree and leads away to the north and west. The -green canopy of leaves overhead make this area fairly dark -and ominous, and that creepy 'watched' feeling returns to -hit you with full force. -~ -62 0 3 -D2 -~ -~ -0 -1 6229 -D3 -~ -~ -0 -1 6236 -S -#6236 -A Forest Trail~ - The trail continues here to the east and west, with a -small trail splitting off towards a large clearing to the -south. Two wooden poles with skulls on top warn you away -from the south, and succeed in making you feel quite -uncomfortable. Strange... -~ -62 0 3 -D1 -~ -~ -0 -1 6235 -D2 -~ -~ -0 -1 6237 -D3 -~ -~ -0 -1 6238 -S -#6237 -A Large Clearing~ - The earth has been upturned many times here, and -several white rocks stick up from the ground in odd -positions. - Graveyard. - This must be where they bury their dead -- just dig a -hole and throw the corpse inside, ignoring any previous -occupants in the ground. How uncivilized... you hope you -aren't taken care of in this matter when your time -comes... -~ -62 0 2 -D0 -~ -~ -0 -1 6236 -S -#6238 -A Forest Trail~ - The trail splits here, one fork heading north towards -the rushing sounds of a river, and west where the forest -seems to be thinning out a lot. A sudden motion out of -the corner of your eye catches your eyes, and you turn -your head. Nothing, there's nothing there at all. - You wonder if you're being stalked. -~ -62 0 3 -D0 -~ -~ -0 -1 6239 -D1 -~ -~ -0 -1 6236 -D3 -~ -~ -0 -1 6241 -S -#6239 -A River's Edge~ - The river flows swiftly on its course to the north. -The trail you are on leads on by the water's edge to the -west, and back into the forest to the south. A large -boulder is just to the west, blocking all travel in that -direction. Out in the center of the river, the 'roof' of -the energy field meets the northern 'wall'. The water -passes right on through the magical barrier, however... -the barrier is obviously porous to some materials. -~ -62 0 2 -D2 -~ -~ -0 -1 6238 -D3 -~ -~ -0 -1 6240 -S -#6240 -A River's Edge~ - The river pours down the side of the mountains to the -west, originating from a large hole in the face of one of -the sheer rock protuberances. The energy barrier climbs -right up the mountain, and seals off any means of escape -by that means. The trail you are on runs by the side of -the river to the east, and a path leads by the forest side -to the south. -~ -62 0 2 -D1 -~ -~ -0 -1 6239 -D2 -~ -~ -0 -1 6241 -S -#6241 -A Rocky Trail~ - The forest is just to your west, with a side trail -leading deep inside from here. The main trail you are on, -however, heads north towards the river, and south near -where a trail leads up to a cave in the mountain side. -There doesn't seem to be a whole lot to capture your -attention here... -~ -62 0 4 -D0 -~ -~ -0 -1 6240 -D1 -~ -~ -0 -1 6238 -D2 -~ -~ -0 -1 6234 -S -#6242 -A Cave Entrance~ - You are half blinded by the differences of the outdoors -illumination and the pure darkness of the cave. A deep, -cloying stench flows out from the cave mouth; the smells -of decay, unwashed bodies, and sickness in one roiling -odor. Your stomach turns involuntarily, and you wonder -about going back down the hill to the east, instead of -going even further down the western tunnel. -~ -62 d 5 -D1 -~ -~ -0 -1 6234 -D3 -~ -~ -0 -1 6243 -S -#6243 -A Tunnel Forking~ - The tunnel forks here, one branch leading north, the -other west. Additionally, you can head back outside to -the east, which seems like a very good idea to your -tortured nasal passages. Your eyes water from the stench, -and you clench your left hand tightly to keep control of -your bile. - Forcing your eyes open, you notice the warning signs -painted around the tunnel to the north. -~ -62 ad 4 -D0 -~ -~ -0 -1 6255 -D1 -~ -~ -0 -1 6242 -D3 -~ -~ -0 -1 6244 -E -painting sign signs~ -They are orcish, and you could swear they were all warning -symbols. -~ -S -#6244 -A Tunnel~ - The floor is slick with the humidity that boils out of -the lower reaches of this cave, bringing that most awful -smell with it. Again, you consider saving your nose the -trip west and down the tunnel, and heading back east to -the cave entrance. -~ -62 ad 4 -D1 -~ -~ -0 -1 6243 -D3 -~ -~ -0 -1 6245 -S -#6245 -A Tunnel~ - The tunnel takes a deep dip here, and opens up into a -largish cave to the west. There seems to be a few faint -lights from inside, and you hear some heavy breathing and -low grunts from that direction. The cave entrance to the -east seems far too far away for your comfort... -~ -62 ad 5 -D1 -~ -~ -0 -1 6244 -D3 -~ -~ -0 -1 6251 -S -#6246 -A Cave~ - Heaps of rotting meat and cups of near-drinkable water -sit here; the orc food stores. You stand here and wonder -in near-disbelief at how the orcs could find this stuff -palatable. They're orcs; its their nature and their -stomachs you guess. Oddly enough, you don't even care to -catalog what they have available -- there's no chance you're -going to take any of this... -~ -62 d 4 -D1 -~ -~ -0 -1 6247 -D2 -~ -~ -0 -1 6249 -S -#6247 -A Cave~ - A single corpse lies here, well away from a pile of -similars to the east. There are several sharpened stakes -and rocks sitting about conveniently. The way the corpse -is lying, the stone next to its hand... this is a suicide -area! You look down upon the orc and comprehend its -suffering in its twisted form. How sad. -~ -62 d 4 -D1 -~ -~ -0 -1 6248 -D2 -~ -~ -0 -1 6250 -D3 -~ -~ -0 -1 6246 -S -#6248 -A Cave~ - There are bodies here... corpses. Orcs, the lot of -them, every single one of them horribly disfigured in -some senseless way; one whose arms were removed, another -who lacks anything that could sensibly be called a face. -A few twitch feebly with the last remains of life, the -rest just decompose. The dim sense of horror budding in -your head blossoms as you realize the pile in the corner -consists of dead orc children awaiting burial. -~ -62 cd 4 -D2 -~ -~ -0 -1 6251 -D3 -~ -~ -0 -1 6247 -S -#6249 -A Cave~ - A few sleeping pallets, made of moldy straw and -stinking furs are arranged around a small firepit here. -A wooden cup, carved by a crude tool and cruder hands -sits near the ashes filled with water you consider -undrinkable. Somewhere to the east you hear an orc -child's whining cry, and a voice hushes it urgently. -Beware, orcs! Adventurers are here! Hide your children! -~ -62 d 4 -D0 -~ -~ -0 -1 6246 -D1 -~ -~ -0 -1 6250 -D2 -~ -~ -0 -1 6252 -S -#6250 -A Cave~ - Several grass sleeping pallets are here, clustered -around the remains of an old fire. The sloping of the -cave's ceiling allow for smoke ventilation towards the -surface in here you note, lucky for the orcs. A few -strings of burnt meat still hang over the fire, untended -and uneaten. On the floor near your feet you spy a small, -twisted piece of wire... one orc's idea of a treasured ring, -no doubt. Kicking the trinket away, you try to push the -pity out of your heart for these wretches. -~ -62 d 4 -D0 -~ -~ -0 -1 6247 -D1 -~ -~ -0 -1 6251 -D2 -~ -~ -0 -1 6253 -D3 -~ -~ -0 -1 6249 -S -#6251 -A Cave~ - You are standing just inside a largish cave, about a -hundred feet in diameter. A few dim make-shift lanterns -burning animal fat illuminate the area, just enough so you -can see the rotted food on the floor, and a few bodies -sprawled throughout the whole area. Your disgust quickly -turns to horror as you see a horrible creature, half... -well, half something and half orc dash between two -stalagmites. -~ -62 d 4 -D0 -~ -~ -0 -1 6248 -D1 -~ -~ -0 -1 6245 -D2 -~ -~ -0 -1 6254 -D3 -~ -~ -0 -1 6250 -S -#6252 -A Cave~ - This must be the orc chief's area. There's an old -prize -- a stolen timeworn human armchair sitting near -the south wall as a throne. A mammoth sleeping pallet -made of piled furs is nearby. Next to that is the pile -of orc treasure; a pile of well-polished coppers. You -look at the pile of worthless coins and wonder at the -image of orcish raiders. - These orcs aren't raiders, they are victims. -~ -62 d 4 -D0 -~ -~ -0 -1 6249 -D1 -~ -~ -0 -1 6253 -S -#6253 -A Cave~ - Many sleeping pallets are arranged near the walls, each -made of heavy fur padding for comfort and warmth. Many -are covered with blood and other, unidentifiable -substances. Looking around, your only coherent thought -is, 'Don't want to know... don't want to know...' -~ -62 d 4 -D0 -~ -~ -0 -1 6250 -D1 -~ -~ -0 -1 6254 -D3 -~ -~ -0 -1 6252 -S -#6254 -A Cave~ - This area of the cave is one vast orc sickroom. -Mutated and mangled orcs lie on the floor, seeming quiet, -lifeless. They're not even worth your time, you think, -unless you've the mercy to put them out of their misery. - You look at the corruption of nature's design and -wonder what forces are at work here... the barrier, the -orcs... What's going on here? -~ -62 d 4 -D0 -~ -~ -0 -1 6251 -D3 -~ -~ -0 -1 6253 -S -#6255 -A Tunnel~ - This forking off from the mail tunnel seems odd; the -walls are strangely smooth, as if they were carved out by -forces unknown. The end is abrupt and short, but there is -a steel door inset in the wall of the west side of the -tunnel. The smell from the lower tunnel doesn't seem -nearly as bad here... this might be a good place to rest -and catch your breath. -~ -62 acd 4 -D2 -~ -~ -0 -1 6243 -D3 -A large steel door. There seems to be no hinges or knob, -but there is a small keyhole in the exact center of it. -~ -door steel~ -2 6200 6256 -S -#6256 -A Tunnel~ - This section of man-made tunnel heads north from here, -doors on either side. A few glowing spots on the ceiling -illuminate the area to almost a daylight level. From the -north you hear some horrible cries of pain and anguish -that make you cringe inside and think twice about heading -in that direction. -~ -62 d 0 -D0 -~ -~ -0 -1 6258 -D1 -~ -door steel~ -2 6200 6255 -D3 -This is a normal, wooden door. -~ -door wooden~ -1 -1 6257 -S -#6257 -A Bedroom~ - This is a bedroom, catered to someone with a definite -sense of taste. There's a chest of drawers made of a -solid section of oak tree. In fact, most of the furniture -here has that 'natural look' about it. The bed is filled -with soft down with an ornate table lamp close by. Nice -place. -~ -62 d 0 -D1 -A normal, wooden door. -~ -door wooden~ -1 -1 6256 -S -#6258 -A Tunnel~ - This tunnel opens up into a large room to the north, -and to the south, leads towards a set of doors. The light -is crisp and bright, clearly showing the lack of tool -marks on the hewn walls... magic? The room just ahead is -large, and also well-lighted, giving it an almost clinical -atmosphere. Somewhere in the recesses of that room -something cries out in a horrible crackling voice. Not -good. -~ -62 d 0 -D0 -~ -~ -0 -1 6266 -D2 -~ -~ -0 -1 6256 -S -#6259 -The Laboratory~ - A full fledge operating table is set up here, outfitted -with a full set of restraints. A ledge nearby has a whole -array of sterile medical equipment on it, covered over by -a clear lid. There's a drain in the floor with gradients -leading to it to carry away the blood. For some reason, -you don't imagine this as a voluntary operating theatre... -~ -62 d 0 -D1 -~ -~ -0 -1 6260 -D2 -~ -~ -0 -1 6262 -S -#6260 -The Laboratory~ - Another table is set up will all sorts of alchemical -apparatus here, vials and beakers, distillation equipment -and et cetera. The stuff looks expensive, but bulky and -fragile; not good treasure to cart away with you at all. -~ -62 d 0 -D1 -A steel cell door. -~ -door steel~ -1 6200 6261 -D2 -~ -~ -0 -1 6263 -D3 -~ -~ -0 -1 6259 -S -#6261 -A Cage~ - This is a small, dirty cage, with only a bucket for -wastes, another bucket for food, and a dirty towel for a -bed. The whole room has a terrible stench about it. -~ -62 d 0 -D3 -A steel cell door. -~ -door steel~ -1 6200 6260 -S -#6262 -The Laboratory~ - Some small cages sit here, containing many different -types of rodents. Leaning down to look better, you are -very surprised as a tiny, common garden mouse growls at -you and tries to rip your face off through the bars. -There are some bulges on its back, and it doesn't seem to -be in a very good mood. It quivers some, not fully in -control of its motor functions. Poor thing. -~ -62 d 0 -D0 -~ -~ -0 -1 6259 -D1 -~ -~ -0 -1 6263 -D2 -~ -~ -0 -1 6265 -S -#6263 -The Laboratory~ - A rack stands near the cages on the eastern wall, -filled with shackles and manacles, bullwhips and worse. -They all look well-used. You give a shiver, and carry on. -~ -62 d 0 -D0 -~ -~ -0 -1 6260 -D1 -A steel cell door. -~ -door cell~ -1 6200 6264 -D2 -~ -~ -0 -1 6266 -D3 -~ -~ -0 -1 6262 -S -#6264 -A Cage~ - This is a small, dirty cage, with only a bucket for -wastes, another bucket for food, and a dirty towel for a -bed. The whole room has a terrible stench about it. -~ -62 d 0 -D3 -A steel cell door. -~ -door steel~ -1 6200 6263 -S -#6265 -The Laboratory~ - This is the southwest corner of the lab. There's no -equipment here, merely several pairs of heavy steel -shackles on the southern wall. There's also some a few -small bloodstains on the floor beneath the shackles. -~ -62 d 0 -D0 -~ -~ -0 -1 6262 -D1 -~ -~ -0 -1 6266 -S -#6266 -The Laboratory~ - This is a fairly roomy laboratory that extends to the -north, with cages set on the east side of the room. A -metal table here is empty, although you can see some -outlines in the dust that suggest books had laid here -once. -~ -62 d 0 -D0 -~ -~ -0 -1 6263 -D1 -A steel cell door. -~ -cell door~ -1 6200 6267 -D2 -~ -~ -0 -1 6258 -D3 -~ -~ -0 -1 6265 -S -#6267 -A Cage~ - This is a small, dirty cage, with only a bucket for -wastes, another bucket for food, and a dirty towel for a -bed. The whole room has a terrible stench about it. -~ -62 d 0 -D3 -A steel cell door. -~ -door cell~ -1 6200 6266 -S -$ diff --git a/lc-mud/circle/world/wld/63.wld b/lc-mud/circle/world/wld/63.wld deleted file mode 100644 index fd8eed895f673616590b14c9f681aa85adf0d7c3..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/63.wld +++ /dev/null @@ -1,844 +0,0 @@ -#6301 -The Webbed Entrance~ - Sticky, sticky, sticky! The ground is cluttered with leaves, -decayed remains of webbed crickets, beetle, rats, dogs, and even -humans. You begin to wonder about what lies ahead. The air is -damp here, and even the little light that shines through the -canopy seems to be absorbed into the webbing. -~ -63 c 1 -D0 -~ -~ -0 -1 6302 -D2 -~ -~ -0 -1 6132 -S -#6302 -The Webby Passage~ - You find that footing here is very good, almost too good. The -limbs are coated with cobwebs and seem unusually strong for tree -branches. Paths lead in four directions. The eastward path goes -down a bit. -~ -63 0 2 -D0 -~ -~ -0 -1 6304 -D1 -~ -~ -0 -1 6305 -D2 -~ -~ -0 -1 6301 -D3 -~ -~ -0 -1 6303 -S -#6303 -The Wasp Hive~ - Drones scuttle about in this room. The cells on the walls are -honeycomb in shape and many of the maggots and wasps you see have -fang-marks on their bodies. You sense some order in their markings. -~ -63 0 2 -D1 -~ -~ -0 -1 6302 -S -#6304 -The Webby Passage~ - Another webby passage, all sticky and wet. Tiny ballooning -spiders fill the air. It seems that these young ones are newborns. -~ -63 0 2 -D1 -~ -~ -0 -1 6305 -D2 -~ -~ -0 -1 6302 -S -#6305 -Beneath The Busy Path~ - You here the sounds of crawling arachnids above. The rhythms of -the footsteps suggest a primitive order in there movement. The light -seems brighter upwards. -~ -63 0 2 -D3 -~ -~ -0 -1 6304 -D4 -~ -~ -0 -1 6306 -S -#6306 -On The Busy Path~ - Spiders, spiders, everywhere! It is almost ant-like in efficiency -with one big difference. The spiders here are carrying ant-corpses, -as well as rats, wolves, and humans. -~ -63 0 2 -D2 -~ -~ -0 -1 6307 -D5 -~ -~ -0 -1 6305 -S -#6307 -On The Busy Path~ - Spiders, spiders, everywhere! It is almost ant-like in efficiency -with one big difference. The spiders here are carrying ant-corpses, -as well as cats, wolves, and humans. -~ -63 0 2 -D0 -~ -~ -0 -1 6306 -D1 -~ -~ -0 -1 6308 -S -#6308 -On The Busy Path~ - Spiders, spiders, everywhere! It is almost ant-like in efficiency -with one big difference. The spiders here are carrying ant-corpses, -as well as cats, dogs, and humans. -~ -63 0 2 -D0 -~ -~ -0 -1 6307 -D1 -~ -~ -0 -1 6306 -D2 -~ -~ -0 -1 6305 -D3 -~ -~ -0 -1 6309 -S -#6309 -A Split In The Path~ - As always, there is a split in the road. One road is strewn with -cricket feelers. The other is well-kept and suitable for smooth -travelling. The webbing that was prevalent in earlier rooms is almost -non-existant now. -~ -63 0 2 -D0 -~ -~ -0 -1 6310 -D1 -~ -~ -0 -1 6308 -D2 -~ -~ -0 -1 6320 -S -#6310 -A Fuzzy Tree Limb~ - You are on a 'fuzzy' tree limb. Interesting, since the branches -seem to have 'hairs' sprouting from its bark. As you look closer -you see millions of aphids covering each limb. -~ -63 0 2 -D2 -~ -~ -0 -1 6309 -D3 -~ -~ -0 -1 6311 -S -#6311 -The Tree Trunk~ - You feel that you can rest here safely. There is evidence of -webbing here, but it is of a finer quality. -~ -63 c 2 -D1 -~ -~ -0 -1 6310 -D2 -~ -~ -0 -1 6312 -S -#6312 -The Tree Lair Entrance~ - It seems the inhabitant of this place does not web her victims, -as evidenced by the remains before you. The area is cluttered with -desiccated corpses, apparently bitten but unwebbed, and drained of -their life juices. -~ -63 0 2 -D0 -~ -~ -0 -1 6311 -D3 -~ -~ -0 -1 6313 -S -#6313 -The Wolf Spider Lair~ - Very dark, as all lairs of spiders are. Not much of furnishings -save an exit. The wolf spider keeps no corpses here, but rather -throws them out at her leisure. -~ -63 0 2 -D1 -~ -~ -0 -1 6312 -S -#6320 -The Webless Path~ - Strange. No webbing here. In fact, no sounds whatsoever. -The path continues northward, where you find that you may have -to tightrope your way across a ravine. -~ -63 0 2 -D0 -~ -~ -0 -1 6309 -D3 -~ -~ -0 -1 6321 -S -#6321 -Above The Ravine~ - Stranger still. Your feet get a real firm grip on the spiderline. -You are above a deep ravine. This line connects you between two trees. -Below you can see a prismatic web with lots of animal bones caught in it: -some bear and small deer bones in fact. No human skeletons are visible -(yet). -~ -63 0 2 -D1 -~ -~ -0 -1 6320 -D2 -~ -~ -0 -1 6323 -D5 -~ -~ -0 -1 6322 -S -#6322 -The Rainbow Web~ - This is the rainbow web -- each strand, each link, a hue of violently -sharp colors and contrasts. The resident here seems to have a command -of light as well. -~ -63 0 2 -D4 -~ -~ -0 -1 6321 -S -#6323 -The Web Forest~ - The trees here take on a different appearance -- they are not trees -anymore, but disjointed make-shift silken made shafts, sticky to the -touch, and webby in texture. This is another world it would appear. -~ -63 0 2 -D0 -~ -~ -0 -1 6321 -D5 -~ -~ -0 -1 6324 -S -#6324 -The Slave Pit~ - You have entered the slave pit. A voice blares in the distance, -'Get back to work, maggots!' Rails upon rails of mined gold and silver -clutter the trail beneath you. -~ -63 0 2 -D0 -~ -~ -0 -1 6325 -D4 -~ -~ -0 -1 6323 -S -#6325 -The Tether Path~ - Another tether path just like the rest of them. Surprisingly -well-lit by the golden orbs that hang from the sides, you can see -the paths become finer and finer in quality. -~ -63 0 2 -D1 -~ -~ -0 -1 6326 -D3 -~ -~ -0 -1 6324 -S -#6326 -A Road Crossing~ - Another shifty little strand of webs, almost ethereal in nature. -~ -63 0 2 -D3 -~ -~ -0 -1 6325 -D4 -~ -~ -0 -1 6327 -S -#6327 -A Leader Strand~ - This strand is weightier, more sturdy. It shimmers as you step on -it. You are definitely not in the Midgaardian realms anymore. Just -where you are you can't tell. It feels like you're moving through -ether. You can still get back down to more surer lands. -~ -63 0 2 -D0 -~ -~ -0 -1 6328 -D5 -~ -~ -0 -1 6326 -S -#6328 -The Entrance Of The Ethereal Web~ - You are at the entrance to ethereal web. Flickering in and out, -in and out, each strand reveals a different hue from black to green -to blue. -~ -63 0 2 -D2 -~ -~ -0 -1 6331 -S -#6330 -The Young Wormkin's Crib~ - A playpen of sorts, with maggots of wasps and other baby -vermin lying about. You feel that humans have been played with -here too, and eaten later. You sense that the maker of this -place has an appetite for dragon meat, and uses this room as a -breeding area. -~ -63 0 2 -D4 -~ -~ -0 -1 6331 -S -#6331 -The Base Of The Web~ - Large strands connect at this point. The node shimmers and -flickers within the ether. You see many flying creatures -- -insects, pegasi, and dragon wormkins -- navigate the dangerous -passages of the web. Exits go in many directions. -~ -63 0 2 -D0 -~ -~ -0 -1 6330 -D1 -~ -~ -0 -1 6332 -D2 -~ -~ -0 -1 6333 -D3 -~ -~ -0 -1 6334 -S -#6332 -Through The Trees~ - This part of the web intersects through the branches of some -trees. Various leaves and other debris that the many drones have -not picked up yet lie here. -~ -63 0 2 -D1 -~ -~ -0 -1 6331 -D2 -~ -~ -0 -1 6335 -D3 -~ -~ -0 -1 6333 -S -#6333 -Above The Clouds~ - You can see all of Midgaard in this ethereal web. Many -of the larger dragons that do wish to fly seem to fly away -from the sticky strands of the web. -~ -63 0 2 -D1 -~ -~ -0 -1 6331 -D2 -~ -~ -0 -1 6334 -D3 -~ -~ -0 -1 6335 -S -#6334 -On A Cloud~ - This cloud is rather thick in consistency. You suddenly realize -this is not a typical cloud, but it might be the nest of an aerial -creature. -~ -63 0 2 -D5 -~ -~ -0 -1 6331 -S -#6335 -A Link In The Ethereal Web~ - This is another link in the ethereal web. Various creatures seem -to get caught (or hypnotized) by its sticky strands. -~ -63 0 2 -D1 -~ -~ -0 -1 6336 -D3 -~ -~ -0 -1 6331 -S -#6336 -The Tenuous Strand~ - Very windy here since it goes up into the sky somewhat. Still, it -is safe enough to move around. -~ -63 0 2 -D2 -~ -~ -0 -1 6340 -D3 -~ -~ -0 -1 6341 -D5 -~ -~ -0 -1 6331 -S -#6340 -The Elder Wormkin's Room~ - A more mature wormkin it seems resides here. Various tomes -of arcane lore clutter the area, along with shards of armor and -weaponry. -~ -63 0 2 -D5 -~ -~ -0 -1 6331 -S -#6341 -Another Tree Limb~ - Once again the web crosses another tree limb. To the side you -see the possible entrance to another creature's lair. -~ -63 0 2 -D1 -~ -~ -0 -1 6342 -D2 -~ -~ -0 -1 6334 -D3 -~ -~ -0 -1 6345 -S -#6342 -The Bird Spider's Lair~ - This is a big game hunter among most spiders. Crushed -jewels and weapons suggest the inhabitant must have powerful -jaws. Beware! -~ -63 0 2 -D5 -~ -~ -0 -1 6331 -S -#6345 -A Link In The Ethereal Web~ - This is another link in the ethereal web. Various creatures -seem to get caught (or hypnotized) by its sticky strands. -~ -63 0 2 -D2 -~ -~ -0 -1 6350 -D3 -~ -~ -0 -1 6346 -D4 -~ -~ -0 -1 6345 -S -#6346 -The Quiet Tree Top~ - This is a quiet tree top. Downwards you can see a familiar path -that may lead back to Midgaard. -~ -63 0 2 -D1 -~ -~ -0 -1 6345 -D3 -~ -~ -0 -1 6347 -D5 -~ -~ -0 -1 6132 -S -#6347 -On The Web~ - RRRRRRRRRRROOOOOOOOOOOOOAAAAAAAAAAAAAARR! You hear the roar -of a powerful beast. Dragon, you think. You shiver in your boots -as you tiptoe along this section of the web. -~ -63 0 2 -D1 -~ -~ -0 -1 6346 -D2 -~ -~ -0 -1 6355 -D5 -~ -~ -0 -1 6331 -S -#6350 -The Ki-Rin Chamber~ - A wise ki-rin was entrapped here many years ago. It is from her -that the ruler of this realm draws magical strength. -~ -63 0 2 -D0 -~ -~ -0 -1 6347 -S -#6355 -A Link In The Ethereal Web~ - This is another link in the ethereal web. Various creatures -seem to get caught (or hypnotized) by its sticky strands. To -the north you sense the heavy breathing of a fiery animal. -~ -63 0 2 -D0 -~ -~ -0 -1 6360 -D2 -~ -~ -0 -1 6365 -S -#6360 -Yevaud's Lair~ - Yevaud, the Usurper of Midgaard, resides here. A voice cries -out, 'BEWARE, the Usurper of Midgaard lives here! FLEE while you can!' -But even Yevaud has his master... or so you deduce. -~ -63 0 2 -D2 -~ -~ -0 -1 6355 -S -#6365 -A Link In The Ethereal Web~ - This is another link in the ethereal web. Various creatures -seem to get caught (or hypnotized) by its sticky strands. A -single spider line lies to the north, while ghastly seemings are -due southward. The grim entrance of Arachnos' Lair is downward. -~ -63 0 2 -D0 -~ -~ -0 -1 6371 -D1 -~ -~ -0 -1 6331 -D2 -~ -~ -0 -1 6366 -D5 -~ -~ -0 -1 6390 -S -#6366 -The Entrance To The Donjonkeep~ - A dark path at the end of the web strand, you see ahead -a torch lit chamber where the souls of unavenged adventurers -come and gnash their teeth. The howls and screams of many -echo through the hall ways. You see one definite path ahead. -~ -63 0 2 -D0 -~ -~ -0 -1 6367 -S -#6367 -The Guardian's Room~ - A chair sits here for a tireless guardian who ensures that no -soul escapes. Other than that, the room is undecorated. -~ -63 0 2 -D0 -~ -~ -0 -1 6368 -E -chair~ -An ordinary chair, well used, glued to the ground by spiderweb. -~ -S -#6368 -The Realm Of The Hopeless~ - Here you see many misguided souls who think they still live. -They search for those who killed them without warrant, and seek -the free souls of living beings to inhabit and perhaps adventure -once more. -~ -63 0 2 -D0 -~ -~ -0 -1 6369 -S -#6369 -The Realm Of The Hopeless~ - Here you see many misguided souls who think they still live. -They search for those who killed them without warrant, and seek -the free souls of living beings to inhabit and perhaps adventure -once more. -~ -63 0 2 -D0 -~ -~ -0 -1 6368 -D2 -~ -~ -0 -1 6370 -S -#6370 -The Donjonkeep~ - No souls have ever lived in this place. The wails of slaves and -the howls of wolves are the only way you can describe the sounds you -hear. The walls are thin and wispy. The only light you receive is -the shimmering from the strand of the ethereal web you used to get -here. -~ -63 0 2 -D1 -~ -~ -0 -1 6371 -S -#6371 -The Single Spider Line~ - A single spider line supports you once more. As you look across -the ether you seen a single shack up ahead with a light in the window. -You sense a great evil coming from the north and feel inclined to go -back on the ethereal web and take your chances there. -~ -63 0 2 -D0 -~ -~ -0 -1 6331 -D2 -~ -~ -0 -1 6372 -S -#6372 -The Single Spider Line~ - A single spider line supports you once more. The shack comes -closer into view and you are even more inclined to go back now. -~ -63 0 2 -D0 -~ -~ -0 -1 6371 -D2 -~ -~ -0 -1 6373 -S -#6373 -The Hermit's Corner~ - Here you see evidence of a vagrant's abode. The shack is to the -north, if you dare enter it. You get the sneaking feeling you should -go back now. The skies above you darken and roar with the laughter -of thunder. -~ -63 0 2 -D0 -~ -~ -0 -1 6372 -D2 -~ -~ -0 -1 6380 -S -#6380 -Mahatma's Inescapable Trap~ - Mahatma, that silly thief, is here, and he steals everything you -have. He says 'Here, have a quick trip to the Temple of Midgaard.' -He plunges a black dagger into your back... -~ -63 bd 0 -S -#6390 -The Entrance To The Arachnos' Lair~ - All strands inevitably lead here, the center of the web, the -entrance to Arachnos' Lair. -~ -63 0 2 -D1 -~ -~ -0 -1 6391 -S -#6391 -The Sticky Chamber~ - You can still bail out since your knees are shaking from the -anticipation (or is it fear?). The sky is clear on this strand of -web, surprisingly unsticky. The strand does not vibrate like the -others. A few ballooning spiders pass by, cackling 'You're gonna -die, you're gonna fry. Good bye!' -~ -63 0 2 -D1 -~ -~ -0 -1 6392 -D5 -~ -~ -0 -1 6331 -S -#6392 -The Great Door~ - Before you you see a large, web-like door. Various designs -of ancient runes and names of Midgaard heroes are etched into -the webwork. Perhaps lists of victims? You can't tell. -~ -63 d 2 -D0 -~ -door~ -2 6300 6399 -D3 -~ -~ -0 -1 6391 -S -#6399 -The Lair Of Arachnos~ - This is the lair of the Empress Spider, Arachnos. You can -see a lavishly adorned rainbow web, her lair allows her to move -to any universe she wishes by using her magical strands to the -Prime Material Plane. Coffers upon coffers of gold, magical -jewels and gems await. Unfortunately Arachnos is a baggy spider -too, and webs all her treasures to her beautiful silken body. -~ -63 g 2 -D2 -~ -door~ -2 6300 6392 -S -$ diff --git a/lc-mud/circle/world/wld/64.wld b/lc-mud/circle/world/wld/64.wld deleted file mode 100644 index 8191016f0b5b8c3e6a44f8794a81e38a1f9ee836..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/64.wld +++ /dev/null @@ -1,845 +0,0 @@ -#6400 -A Mountain Trail~ - This trail leads up, up, up into the mountains. You -hope you don't fall down, because that would hurt, hurt, -hurt! The trail continues to the east, and you can go -back down to the small hidden valley to the west. -~ -64 0 5 -D1 -~ -~ -0 -1 6401 -D3 -~ -~ -0 -1 4078 -S -#6401 -A Mountain Trail~ - You're really high up now. You can keep going even -farther up into the mountains to the east, or go back -down to the west. -~ -64 0 5 -D1 -~ -~ -0 -1 6402 -D3 -~ -~ -0 -1 6400 -S -#6402 -A Mountain Trail~ - Wispy clouds are beginning to surround you now, and -your ears pop due to the altitude. To the east, you see -the summit of the mountain, and from the way the nearby -mountains are arranged behind it, you believe you're -on your way to a big valley. You can also go down -to the west. -~ -64 0 5 -D1 -~ -~ -0 -1 6403 -D3 -~ -~ -0 -1 6401 -S -#6403 -Near The Mountain's Peak~ - The peak of this mountain is another couple hundred -feet above you, but here is where the trail leads down -into the valley... What an odd valley! - The valley seems to have been filled up by a hundreds -of feet of lava many years ago. It gives the valley an -odd, 'flat' look and darkish ground. The path leads -down east into the valley, and west back to civilization. -~ -64 0 5 -D1 -~ -~ -0 -1 6404 -D3 -~ -~ -0 -1 6402 -S -#6404 -The Trail To The Valley~ - The trail leads down into the valley, where, by judging -by the height of the trees, the lava had cooled tens -of decades ago. Down below you see the path lead into -the small forest in the valley, and disappear out of -sight. East leads into the valley, West back to civilization. -~ -64 0 5 -D1 -~ -~ -0 -1 6405 -D3 -~ -~ -0 -1 6403 -S -#6405 -In The Valley~ - The ground has taken on the texture of dirt on the top, -but this valley is far too flat and too rocky to disguise -the catastrophe that happened here so long ago. Looking -up to the mountains ringing this area, you notice several -mountains look as if they had 'exploded', which is strange, -considering that they are not volcanos. - The path leads into the woods to the east, and back up -the mountain to the west. -~ -64 0 3 -D1 -~ -~ -0 -1 6406 -D3 -~ -~ -0 -1 6404 -S -#6406 -In A Clearing~ - You come to a small clearing now, after walking for several -minutes through the silent woods. An odd block sticks up -here and there in the ground... wait a minute. These -stones seem a little too regular, and from the circle -formation and size you could almost swear that they were... -crenellations? Could some sort of building been buried -by the lava here? A rusty ring sticks out of the earth -in the center... a trapdoor? This is almost too good to -be true! -~ -64 0 3 -D3 -~ -~ -0 -1 6405 -D5 -An ancient trapdoor, grimed with earth and age. -~ -trapdoor trap~ -1 -1 6407 -S -#6407 -A Stairwell~ - This small room is the top of a stairwell leading down -deep into the tower. A small trapdoor overhead leaks -the light of day around its edges. To the south is a -wooden door, preserved through the ages by means -unknown. To the west is a short hall. -~ -64 ad 0 -D2 -~ -door~ -1 -1 6408 -D3 -~ -~ -0 -1 6409 -D4 -An ancient trapdoor, grimed with earth and age. -~ -trapdoor trap~ -1 -1 6406 -D5 -~ -~ -0 -1 6413 -S -#6408 -A Linen Closet~ - This small room holds many types of linen on shelves -along the walls. They are undoubtedly preserved by -magic against the toil of the ages, since they seem -freshly washed and folded. You wonder what sort of -mage could wield so much power to waste on such little -things. -~ -64 ad 0 -D0 -~ -door~ -1 -1 6407 -E -linen shelf shelves~ -White sheets, pillow-cases, etc. Not really anything that -you need, but interesting. -~ -S -#6409 -A Corridor~ - This is only a clean corridor, that leads back to the -stairwell to the east, and has doors leading to other -rooms to the north and south. -~ -64 ad 0 -D0 -~ -door~ -1 -1 6411 -D1 -~ -~ -0 -1 6407 -D2 -~ -door~ -1 -1 6410 -S -#6410 -A Bathroom~ - This is some sort of bathroom, like you've never seen -before... Water appliances leading from nowhere deliver -hot and cold running water to basins that drain to... -where? How strange! -~ -64 ad 0 -D0 -~ -door~ -1 -1 6409 -S -#6411 -The Master Bedroom~ - This is an opulent room, decorated in silks and gold. -There is an ebony desk against one wall, cooled lava rock -spilling over its surface from the window it once looked -out at. A nice, spacious closet is filled with clothes -just cleaned and pressed. -~ -64 ad 0 -D2 -~ -door~ -1 -1 6409 -E -desk~ -The desk is basically uninteresting, as are the papers -on top of it... -~ -E -closet~ -Nice clothes, but not your size at all. -~ -S -#6412 -The Library~ - A great mages' library is contained on this floor of -the tower. You feel you could learn anything you wanted -to if you only looked and read long enough. A door -opens up back on the stairwell to the east. -~ -64 ad 0 -D1 -~ -door~ -1 -1 6413 -D3 -A big bookcase, that looks rather odd. -~ -bookcase~ -1 -1 6414 -E -book books~ -There are lots of books about everything here! -~ -S -#6413 -The Stairwell~ - This stairwell continues up and down, and there is -a door to the west. -~ -64 ad 0 -D3 -~ -door~ -1 -1 6412 -D4 -~ -~ -0 -1 6407 -D5 -~ -~ -0 -1 6415 -S -#6414 -A Hidden Hall~ - This is a small hidden hall with a secret entrance to the -library on the north end of the west wall, and a trapdoor -on the south end. -~ -64 ad 0 -D1 -The backside of a movable bookcase. -~ -book bookcase~ -1 -1 6412 -D5 -~ -trapdoor trap~ -1 -1 6416 -S -#6415 -A Stairwell~ - This stairwell continues up and down, and there is a door -to the west opening up onto this level. -~ -64 ad 0 -D3 -~ -door~ -1 -1 6417 -D4 -~ -~ -0 -1 6413 -D5 -~ -~ -0 -1 6422 -S -#6416 -The Hidden Treasure Room~ - Jackpot! A small room filled with treasure chests! Go get them! -~ -64 ad 0 -D4 -~ -trapdoor trap~ -1 -1 6414 -S -#6417 -A Hallway~ - This hall runs through the tower. There's more hall to -the west, and doors to your north and south. A door to -the east leads back to the stairwell. -~ -64 ad 0 -D0 -~ -door~ -1 -1 6419 -D1 -~ -door~ -1 -1 6415 -D2 -~ -door~ -1 -1 6418 -D3 -~ -~ -0 -1 6420 -S -#6418 -A Servant's Room~ - This seems to be a small servant's bedroom, sparsely -decorated and outfitted with a bed, nightstand, chair -and table, etc. Nothing real important here. -~ -64 ad 0 -D0 -~ -door~ -1 -1 6417 -S -#6419 -A Servant's Room~ - This seems to be a small servant's bedroom, sparsely -decorated and outfitted with a bed, nightstand, chair -and table, etc. Nothing real important here. -~ -64 ad 0 -D2 -~ -door~ -1 -1 6417 -S -#6420 -A Hallway~ - This hallway continues to the east, and has a door to -the north. You could swear that the way this level is -arranged... nah, couldn't be. -~ -64 ad 0 -D0 -~ -door~ -1 -1 6421 -D1 -~ -~ -0 -1 6417 -S -#6421 -A Servant's Room~ - This seems to be a small servant's bedroom, sparsely -decorated and outfitted with a bed, nightstand, chair -and a table, etc. Nothing real important here. -~ -64 ad 0 -D2 -~ -door~ -1 -1 6420 -S -#6422 -The Stairwell~ - This stairwell leads up and down, and there is a big -open room to your west. -~ -64 ad 0 -D3 -~ -~ -0 -1 6423 -D4 -~ -~ -0 -1 6415 -D5 -~ -~ -0 -1 6425 -S -#6423 -The Dining Hall~ - This is a large dining hall, with a long table that runs -down the length of it. Chairs are set up along the sides -to accomodate approximately 10 people. There are paintings -and tapestries on the walls, adding color to the stonework, -The cooled lava that had poured in the windows makes the place -seem eerie somehow . There is a door to the north, and -the stairwell is to the east. -~ -64 ad 0 -D0 -~ -door~ -1 -1 6424 -D1 -~ -~ -0 -1 6422 -E -tapestry tapestries painting paintings~ -Many of these show scenes of high magic and heroism. -Just like almost every tapestry and painting you've seen. -~ -S -#6424 -The Kitchen Area~ - This is a well-stocked kitchen, the larders still fresh -and full as if by magic. Perhaps this would be a good -place to take a break. -~ -64 ad 0 -D2 -~ -door~ -1 -1 6423 -S -#6425 -The Stairwell~ - The stairwell leads up and down here, and there is a hall -you can enter to the west. -~ -64 ad 0 -D3 -~ -~ -0 -1 6426 -D4 -~ -~ -0 -1 6422 -D5 -~ -~ -0 -1 6429 -S -#6426 -A Hall~ - This area of the tower seems dank and oppressive. The -hall runs north-south, and there is an empty cell to your -west. The stairwell is to your east. -~ -64 ad 0 -D0 -~ -~ -0 -1 6427 -D1 -~ -~ -0 -1 6425 -D2 -~ -~ -0 -1 6428 -E -cell cells~ -It is open, empty, and uninteresting. -~ -S -#6427 -A Hall~ - This is the northern end of the hall. There are cells to -your right and left, empty and awaiting occupants. -~ -64 ad 0 -D2 -~ -~ -0 -1 6426 -E -cell cells~ -It is open, empty, and uninteresting. -~ -S -#6428 -A Hall~ - This is the southern end of the hall. There are cells to -your right and left, empty and awaiting occupants. -~ -64 ad 0 -D0 -~ -~ -0 -1 6426 -E -cell cells~ -It is open, empty, and uninteresting. -~ -S -#6429 -A Stairwell~ - The stairwell continues up and down here. A large room -opens up to the west. -~ -64 ad 0 -D3 -~ -~ -0 -1 6430 -D4 -~ -~ -0 -1 6425 -D5 -~ -~ -0 -1 6431 -S -#6430 -A Mage's Office~ - A small desk here is cluttered with magically preserved -papers and documents. None seem of value, except perhaps -to a historian. This place seems vaguely uninteresting... -~ -64 ad 0 -D1 -~ -~ -0 -1 6429 -E -paper papers documents document~ -Well, one of the papers relate a story about how the mage -of this tower, Rand, angered many kings, and relates how -they set his armies on him. You wonder if the lava -outside was a failed attempt to destroy the armies... -~ -E -desk~ -It is cluttered with all sorts of papers. Some look -half interesting, actually. -~ -S -#6431 -The Stairwell~ - The stairs go up and down here, and there is a room to the -west... -~ -64 ad 0 -D3 -~ -~ -0 -1 6432 -D4 -~ -~ -0 -1 6429 -D5 -~ -~ -0 -1 6433 -S -#6432 -A Sitting Room~ - This is a simply furnished room, with chairs all about. -A fireplace is inset into an inner wall, the chimney -undoubtedly directed by magic... - This would be a nice place to rest awhile... -~ -64 cd 0 -D1 -~ -~ -0 -1 6431 -S -#6433 -The Stairwell~ - This is where the stairwell finally ends. There is a hall -to your west. -~ -64 ad 0 -D3 -~ -~ -0 -1 6434 -D4 -~ -~ -0 -1 6431 -S -#6434 -A Hallway~ - This small hallway on the former 'ground floor' ran north- -south. To the east is the stairwell that leads up into -the shadowy recesses of the tower. To the west is the -entrance way to the tower. The north is completely blocked -off by lava, and the way south is still clear. -~ -64 ad 0 -D1 -~ -~ -0 -1 6433 -D2 -~ -~ -0 -1 6437 -D3 -~ -~ -0 -1 6435 -S -#6435 -The Entranceway~ - This is a grand chamber with giant double-doors to the -west. To the east is the main floor of the tower. This -room is arranged highly attractively and very impressively, -with sculptures and tapistries everywhere. The doors seem -impenetrable... you don't think you'd be able to get through -them if you really had to... -~ -64 ad 0 -D1 -~ -~ -0 -1 6434 -D3 -These doors seem incredible. Unfortunately, they're locked. -~ -door double~ -1 0 6436 -E -sculpture tapestry sculptures tapestries~ -They look nice, but aren't very valuable. -~ -S -#6436 -The Doorway~ - This was the entrance to the tower. Now lava has blocked -it up completely. However: - It seems when the lava came down a man was outside the -doors. He was blasted into the doors, and died instantly, -but his skeleton still clutches a staff in perfect -condition... -~ -64 ad 0 -D1 -These double doors have the outline of a man blasted into them... -~ -double doors~ -1 0 6435 -S -#6437 -The Hallway~ - This is the southern part of the hallway. There is -a door to the west, barred with gleaming bands of lights. -To the north is more hallway. -~ -64 ad 0 -D0 -~ -~ -0 -1 6434 -D3 -~ -door~ -1 -1 6438 -S -#6438 -The Stairs~ - Stairs lead down here into the tower's basement, or you -can head east into the main floor of the tower. -~ -64 ad 0 -D1 -~ -door~ -1 -1 6437 -D5 -~ -~ -0 -1 6439 -S -#6439 -The Stairs~ - Stairs lead up here to the main level, or you can go east -to the basement of the tower. -~ -64 ad 0 -D1 -~ -~ -0 -1 6440 -D4 -~ -~ -0 -1 6438 -S -#6440 -An Alcove~ - This alcove leads into a huge room to your north, and -to stairs leading down to the east, and stairs going -up to your west. -~ -64 ad 0 -D0 -~ -~ -0 -1 6441 -D1 -~ -~ -0 -1 6442 -D3 -~ -~ -0 -1 6439 -S -#6441 -The Laboratory~ - This laboratory has lots of stuff in it. Beakers, -flasks, burners, tongs, mortars and pestles, jars filled -with normal things, jars filled with abnormal things, jars -filled with things you'd rather not think about... -A search could reveal many things... -~ -64 ad 0 -D2 -~ -~ -0 -1 6440 -E -beaker beakers flask flasks burner burners tong tongs~ -Looks like normal, fragile lab equipment to you. -~ -E -mortar mortars pestle pestles jar jars~ -Looks like normal, fragile lab equipment to you. -~ -S -#6442 -The Stairs~ - Stairs lead down here to the second level of the basement, -or back west to the alcove. -~ -64 ad 0 -D3 -~ -~ -0 -1 6440 -D5 -~ -~ -0 -1 6443 -S -#6443 -The Stairs~ - Stairs lead up here to the first level of the basement, or -you can go east to another big room. -~ -64 ad 0 -D1 -~ -~ -0 -1 6444 -D4 -~ -~ -0 -1 6442 -S -#6444 -The Summoning Room~ - This room is darkly lit by a giant glowing pentagram in -the center of the room. Bands of force encircle some -sort of being trapped inside. You think that going -inside would be an EXTREMELY BAD idea... -~ -64 d 0 -D0 -~ -~ -0 -1 6445 -D3 -~ -~ -0 -1 6443 -E -pentagram~ -It is centuries old. You don't think standing close by -would be a good idea. -~ -E -being~ -You can't see it clearly through the energy field of the -pentagram, but you sense that whatever it is, it is very, -very, very, very angry. -~ -S -#6445 -Inside A Pentagram~ - The small god entrapped by the wizard looks at you with -an insane expression. Four hundred years of imprisonment -doesn't do much for one's... - - OOPS! - - He killed you! - You are dead, R.I.P. -~ -64 bd 0 -D2 -~ -~ -0 -1 6444 -S -$ diff --git a/lc-mud/circle/world/wld/65.wld b/lc-mud/circle/world/wld/65.wld deleted file mode 100644 index 2b140b88d2fb0239e3ae081eafe1890a65558c93..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/65.wld +++ /dev/null @@ -1,856 +0,0 @@ -#6500 -The Path To The Dwarven Village~ - You are walking down a path that leads to the dwarven village. Above -you, you can see the Turning Point, and to the north the path continues -toward the mountains. -~ -65 c 2 -D0 -The path continues. -~ -~ -0 -1 6501 -D4 -You can see the city of Midgaard. -~ -~ -0 -1 3502 -S -#6501 -The Path At The Base Of The Mountain~ - Now you are at the bottom of a rugged mountain. The forest around you -is very dense, and it seems very dark to the north. -~ -65 0 4 -D0 -The path coninues up the mountain. -~ -~ -0 -1 6502 -D2 -The path heads toward the main city of Midgaard. -~ -~ -0 -1 6500 -S -#6502 -The Path At The Middle Of The Mountain~ - Standing on the middle of the mountain, you can easily see the city to -the south, and the top of the mountain is very near to the north. -~ -65 0 5 -D0 -The top of the mountain is easily seen from here. -~ -~ -0 -1 6503 -D2 -The base of the mountain is near. -~ -~ -0 -1 6501 -S -#6503 -The Top Of The Mountain~ - You are now on the top of the mountain. To the south you see a path -leading down the mountain. To the east and west you see entrances to -what seems like mines. -~ -65 0 4 -D1 -An entrance to the mountain which seems to lead underground. -~ -~ -0 -1 6540 -D2 -The path leads down the mountain to the main city of Midgaard. -~ -~ -0 -1 6502 -D3 -There is an entrance to the mountain. -~ -~ -0 -1 6505 -S -#6504 -The Narrow Path~ - This is a narrow path leading to the Dwarven Kingdom. It looks less -travelled than the others, and it is very creepy. The path opens up to -the south, and continues to the north. -~ -65 d 0 -D0 -~ -~ -0 -1 6506 -D2 -~ -~ -0 -1 6540 -S -#6505 -The Entrance To The Mountain~ - Here is an entrance to the mountain. The door looks very well built, -and you can hear noise coming from within. -~ -65 0 2 -D1 -~ -~ -0 -1 6503 -D3 -~ -door~ -2 6515 6513 -S -#6506 -A Bend In The Narrow Path~ - This is a narrow path that bends to the east here. The trees hang -over the path, and it is very overgrown. The narrow path continues to -the south and to the east. -~ -65 d 0 -D1 -~ -~ -0 -1 6507 -D2 -~ -~ -0 -1 6504 -E -tree trees~ -They hang over the road in the most ominous of ways. -~ -S -#6507 -The Narrow Path~ - This path is very narrow, and it continues to the north and west. -~ -65 d 0 -D0 -~ -~ -0 -1 6508 -D3 -~ -~ -0 -1 6506 -S -#6508 -The Narrow North-South Path~ - This path leads to the north and south. To the north you can see a -door, and to the south the path continues. -~ -65 d 0 -D0 -~ -~ -0 -1 6509 -D2 -~ -~ -0 -1 6507 -S -#6509 -The Door To The Kingdom~ - Here the path turns to the west. You can see a door in front of you, -and the path continues to the west and south. -~ -65 d 0 -D0 -~ -door~ -2 6503 6510 -D2 -~ -~ -0 -1 6508 -D3 -~ -~ -0 -1 6522 -S -#6510 -On The Path To The Castle~ - You are on a path that will eventually lead to the castle. It -continues north to the castle, and there is a door in the southern -wall. -~ -65 d 0 -D0 -~ -~ -0 -1 6511 -D2 -~ -door~ -2 6503 6509 -S -#6511 -Still On The Path To The Castle~ - You are still on the path to the castle, or back to the Dwarven -village, whichever way you wish to go. The path continues to the -north and south. -~ -65 d 0 -D0 -~ -~ -0 -1 6512 -D2 -~ -~ -0 -1 6510 -S -#6512 -The Door To The Castle~ - Here there is a door to the castle to the east. The castle is -elegantly designed, and looks much like a roll of toilet paper -standing on its end. There is a sign which says: - - ****************************************** - * WELCOME TO THE CASTLE OF STRANGELOVE * - * Here, celibacy is uninvited * - ****************************************** - -~ -65 d 0 -D1 -~ -door~ -2 6503 6525 -D2 -~ -~ -0 -1 6511 -S -#6513 -Inside The Entrance~ - Everything here is covered in soot and very grimy. The path continues -to the east and north, and there is a door to the west. -~ -65 d 0 -D0 -The little underground path continues to the north. -~ -~ -0 -1 6514 -D1 -The path leads outside the entrance. -~ -door~ -2 6515 6505 -D3 -This looks like an entrance to some type of store room. -~ -~ -0 -1 6526 -S -#6514 -The Path~ - You are on a path in the dwarven village which leads north to the shops -and south to the corner of the area. -~ -65 d 0 -D0 -~ -~ -0 -1 6515 -D2 -~ -~ -0 -1 6513 -S -#6515 -A Turn In The Road~ - You are on a path that leads to the Hide & Tooth shop to the west, and -the path continues to the south. -~ -65 d 0 -D2 -~ -~ -0 -1 6514 -D3 -The Hide & Tooth shop can be seen to the west. -~ -~ -0 -1 6516 -S -#6516 -The Hide & Tooth Shop~ - You are in the Hide & Tooth shop. Here you may buy the finest in Dwarven -weapons and armors. The path continues to the north and east. -~ -65 df 0 -D0 -~ -~ -0 -1 6517 -D1 -~ -~ -0 -1 6515 -S -#6517 -The Path To The North Of The Shop~ - You are on a path to the north of the Hide & Tooth shop. The path -continues to the north, and there is Granite Head's bakery to the west. -~ -65 d 0 -D0 -~ -~ -0 -1 6518 -D2 -~ -~ -0 -1 6516 -D3 -~ -~ -0 -1 6535 -S -#6518 -North Of The Shops~ - Here the path bends to the east towards the barracks. To the south -you can see the shops. -~ -65 d 0 -D1 -~ -~ -0 -1 6519 -D2 -~ -~ -0 -1 6517 -S -#6519 -A Path By The Hospital~ - Here the path passes by the Hospital to the north. It continues -to the east to the barracks, and to the west. -~ -65 d 0 -D0 -~ -~ -0 -1 6534 -D1 -~ -~ -0 -1 6520 -D3 -~ -~ -0 -1 6518 -S -#6520 -A Path Next To The Barracks~ - Here the path continues west, and east to the barracks. -~ -65 d 0 -D1 -~ -~ -0 -1 6521 -D3 -~ -~ -0 -1 6519 -S -#6521 -The Entrance To The Barracks~ - Here there is an entrance to the barracks to the south, and the path -continues to the west. -~ -65 d 0 -D2 -~ -door~ -1 -1 6523 -D3 -~ -~ -0 -1 6520 -S -#6522 -A Guard House~ - You are in the guard house to the west of the entrance to the castle. -There are nudie posters covering the walls. -~ -65 d 0 -D1 -~ -~ -0 -1 6509 -E -poster~ -There is a wall poster of a nude Minne Pearl. -~ -S -#6523 -The First Barrack Room~ - Here is the first of two main rooms of barracks. The barracks -continue to the south, and you can leave the room to the north. -~ -65 d 0 -D0 -~ -door~ -1 -1 6521 -D2 -~ -~ -0 -1 6524 -S -#6524 -The Back Of The Barracks~ - Here is the back of the dwarven barracks. There are rows of beds -here, and there is a stench that is unbearable. -~ -65 d 0 -D0 -~ -~ -0 -1 6523 -S -#6525 -Inside Of Castle Strangelove~ - You are just inside the castle. It is very tubular in shape, -and it is very featureless. There is a set of stairs that lead -up, and the door leads out of the castle to the west. -~ -65 d 0 -D3 -~ -door~ -2 6514 6512 -D4 -~ -~ -0 -1 6528 -S -#6526 -A Store Room~ - There is a layer of dust on the floor at least 3 inches thick! It is -probable that not many people have been in here for many months. -~ -65 ad 0 -D1 -A lighted area that looks like a well worn path. -~ -~ -0 -1 6513 -D5 -After blowing all the dust off the floor, you notice a trapdoor! -~ -trapdoor~ -1 -1 6527 -E -floor dust~ -After blowing all the dust off the floor, you notice a trapdoor! -~ -S -#6527 -The Wine Cellar~ - This room smells like wine, and you can only assume it used to be -a wine cellar at one time. -~ -65 ad 0 -D4 -~ -trapdoor~ -1 -1 6526 -S -#6528 -On The Stairs In Castle Strangelove~ - The stairs continue to circle up and down here. -~ -65 d 0 -D4 -~ -~ -0 -1 6529 -D5 -~ -~ -0 -1 6525 -S -#6529 -On The Stairs~ - You are still circling around on the stairs. You are starting to -get dizzy from going around and around and around and around and -around. The stairs continue up and down. -~ -65 d 0 -D4 -~ -~ -0 -1 6530 -D5 -~ -~ -0 -1 6528 -S -#6530 -At The Top Of The Stairs~ - You are at the top of the stairs in the castle. There is an exit -to the east, and the stairs lead down. -~ -65 d 0 -D1 -~ -~ -0 -1 6531 -D5 -~ -~ -0 -1 6529 -S -#6531 -The Queen's Waiting Room~ - This is the Queen's waiting room. Here the men literally -'wait' for the queen. You've heard that the queen really -likes to get to 'know' her people, in the biblical sense. - The Queen's bedroom is to the north, and you can see stairs -to the west. -~ -65 d 0 -D0 -~ -door~ -1 -1 6532 -D3 -~ -~ -0 -1 6530 -S -#6532 -The Queen's Bedroom~ - This is the Queen's bedroom. The bed is all ruffled, and there -is a stack of dirty sheets piled in the corner. There is a ladder -that leads down, out of the castle, and you can leave the room -to the south. There is also a small wooden door to the west. -There is a sign that says: - - ------------------------- - | I'm busy right now, | - | and don't know when | - | Ill be back, but if | - | there is a key here | - | take it and PLEASE, | - | try to get my birth | - | control pills back! | - | I've heard they can | - | be found somewhere, | - | deep in the mines.. | - ------------------------- - -~ -65 d 0 -D2 -~ -door~ -1 -1 6531 -D3 -~ -door wooden~ -2 6500 6554 -D5 -~ -~ -0 -1 6533 -S -#6533 -The North Side Of Castle Strangelove~ - You are standing on the north side of Castle Strangelove. You -notice that you are no longer inside the mountain anymore either. -Along the southern horizon you see towering mountains. - The only exit, however, is back up the ladder into the Queen's -Bedroom. -~ -65 0 0 -D4 -~ -~ -0 -1 6532 -S -#6534 -The Hospital~ - You are inside the Dwarven Hospital. It smells like rubbing -alcohol, and there is blood all over the walls. -~ -65 d 0 -D2 -~ -~ -0 -1 6519 -S -#6535 -Granite Head's Bakery~ - The aroma coming from this room is astonishing. You can almost taste -the pastries dissolving in your mouth. -~ -65 dh 0 -D1 -~ -~ -0 -1 6517 -S -#6540 -The Dark Path~ - This path is very well worn, and there is an entrance to the mines to the -east, while the path continues to the north and west. -~ -65 d 0 -D0 -~ -~ -0 -1 6504 -D1 -~ -door~ -1 6502 6541 -D3 -~ -~ -0 -1 6503 -S -#6541 -The Mine Entrance~ - The little path here leads down toward the mines, while the worn path -continues to the west. -~ -65 d 0 -D3 -~ -door~ -1 6502 6540 -D5 -~ -~ -0 -1 6542 -S -#6542 -At The Bottom Of The Mineshaft~ - You are at the bottom of the mineshaft. The air here is very sooty, and -it is very hard to breath. The mineshaft leads up and east. -~ -65 ad 0 -D1 -~ -~ -0 -1 6543 -D4 -~ -~ -0 -1 6541 -S -#6543 -On The Path Inside The Mine~ - You are deep inside the mine, and you feel very uncomfortable. The -path continues to the east, and leads to the mineshaft to the west. -~ -65 ad 0 -D1 -~ -~ -0 -1 6544 -D3 -~ -~ -0 -1 6542 -S -#6544 -The Mine Crossroad~ - You are at a crossroad in the mine. There is a door to the north, -and the path continues to the south, east, and west. -~ -65 ad 0 -D0 -~ -door~ -2 6516 6546 -D1 -~ -~ -0 -1 6545 -D2 -~ -~ -0 -1 6551 -D3 -~ -~ -0 -1 6543 -S -#6545 -The Coal Room~ - You are inside the storage area for the raw materials that are -found down here. The room is very unsturdy as the supports are -very rickety. -~ -54 ad 0 -D3 -~ -~ -0 -1 6544 -S -#6546 -The Mine Maze~ - You have entered the maze of the mines. To the east you can see -some inscriptions, and you can exit to the south. -~ -65 ad 0 -D1 -~ -~ -0 -1 6547 -D2 -~ -door~ -2 6516 6544 -S -#6547 -At The Maze Inscription~ - You are inside the maze, but not far enough in that you could -get lost. There is an enscription on the wall which says: - - 1 3 2 4 - N W N S - -This isn't too tough, so don't take it so rough. -~ -65 ad 0 -D0 -~ -~ -0 -1 6548 -D1 -~ -~ -0 -1 6544 -D3 -~ -~ -0 -1 6546 -S -#6548 -The Maze~ - You are in a maze. -~ -65 ad 0 -D0 -~ -~ -0 -1 6549 -D2 -~ -~ -0 -1 6547 -D3 -~ -~ -0 -1 6548 -S -#6549 -The Maze~ - You are in a maze. -~ -65 ad 0 -D0 -~ -~ -0 -1 6548 -D2 -~ -~ -0 -1 6548 -D3 -~ -~ -0 -1 6550 -S -#6550 -The Maze~ - You are in a maze. -~ -65 ad 0 -D0 -~ -~ -0 -1 6549 -D1 -~ -~ -0 -1 6549 -D2 -~ -~ -0 -1 6552 -D3 -~ -~ -0 -1 6548 -S -#6551 -The Mining Equipment Room~ - This is the storage room for equipment used by the Dwarven miners. -It is very small, and you can tell that not many miners actually use -equipment. -~ -65 ad 0 -D0 -~ -~ -0 -1 6544 -S -#6552 -The End Of The Maze~ - You have solved the maze. You can tell by the last few moves -that there is no way that a dumb worker could have figured that -out. It seems pretty desolate here. To the south is a bleak -room. To the north, you see the maze. There is a sign above -the south exit: - -THOSE WHO ENTER, PLAN ON A TIMELY DEATH. -(ESPECIALLY IF YOU'RE LOYAL TO THE QUEEN) - -~ -65 ad 0 -D0 -~ -~ -0 -1 6550 -D2 -~ -~ -0 -1 6553 -S -#6553 -The Mazekeeper's Room~ - You have entered the Mazekeeper's room. There are pictures of -the Queen with darts thrown at it. Spraypainted on the wall are -things like 'the queen shall suffer' and 'Catholics Rule'. -~ -65 ad 0 -D0 -~ -~ -0 -1 6552 -S -#6554 -The Treasury~ - This room appears to be the Queen's Treasury. There is one -exit, back to the east. -~ -65 dj 1 -D1 -~ -door~ -2 6500 6532 -S -$ diff --git a/lc-mud/circle/world/wld/70.wld b/lc-mud/circle/world/wld/70.wld deleted file mode 100644 index 7c6370a986a3b553bf6c8330a6b0494543a84005..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/70.wld +++ /dev/null @@ -1,1399 +0,0 @@ -#7000 -The Fissure Under The Ledge~ - This is a small fissure in the solid rock. Under you lies the deep dark -pool. The water trickles quietly down from the ledge above you. The water -smells like the water in a sewer. -~ -70 acd 5 -D4 -~ -~ -0 -1 7070 -D5 -The water's edge. -~ -~ -0 -1 7100 -S -#7001 -The Muddy Sewer~ - You are standing in mud to your knees. This is not the kind of place -for a picnic. The muddy sewer stretches further into the south. -~ -70 ad 5 -D2 -You see the muddy sewer continuing into the darkness to the south. -~ -~ -0 -1 7002 -E -mud~ -It is as dark as tar and looks like something out of a toilet, on top of -that, the smell is absolutely overwhelming. -~ -S -#7002 -The Muddy Sewer Junction~ - The muddy sewer stretches into the dark to the south. It looks as if -no person has ever put his foot here before. It is too muddy for that -anyway. The sewer leads north, south and east from here. -~ -70 ad 5 -D0 -The muddy sewer stretches into the dark to the north. -~ -~ -0 -1 7001 -D2 -South. The muddy sewer ends in a mudhole that way. -~ -~ -0 -1 7003 -D1 -East. The muddy sewer leads into a bend that goes south. -~ -~ -0 -1 7007 -E -mud~ -It is as dark as tar and looks like something out of a toilet, on top of -that, the smell is absolutely overwhelming. -~ -S -#7003 -The Mudhole~ - You stand in mud all the way up to your thighs and it is not too -comfortable since you are used to a somewhat different environment. -The sewer leads to the north of here. In the middle you can just -make out an enormous drainpipe leading down. -~ -70 acd 5 -D0 -North. The muddy junction lies in that direction. -~ -~ -0 -1 7002 -D5 -The muddy drainpipe leads down through the mud, otherwise it is utterly dark. -~ -~ -0 -1 7101 -E -mud~ -It is as dark as tar and looks like something out of a toilet, on top of -that, the smell is absolutely overwhelming. -~ -S -#7004 -The Dark Pit~ - You are standing by the edge of a dark pit that leads down into even -deeper darkness. >BWWAAADDRR< - The smell from down there is unbearable. -The sewer stretches into the darkness to the east. -~ -70 ad 0 -D1 -East. The sewer leads into the sewer junction. -~ -~ -0 -1 7009 -D5 -The Dark Pit leads down and down and down... well you can't see the -bottom anyway. There are bars that could function as a ladder on -the side. -~ -~ -0 -1 7102 -S -#7005 -The Muddy Sewer~ - You are standing in the middle of a bend of the sewer pipe. It is very -dark around here and the mud is sticking to your legs, not very pleasant. -The pipe leads east and south from here. -~ -70 ad 4 -D1 -East. The mud stretches on into the darkness. -~ -~ -0 -1 7011 -D2 -South. There is even more mud in that direction than where you are now. -Incredible. -~ -~ -0 -1 7006 -E -mud~ -It is as dark as tar and looks like something out of a toilet, on top of -that, the smell is absolutely overwhelming. -~ -S -#7006 -The Muddy Sewer~ - You are standing in something that reminds you very much of porridge, -this has the advantage that it is not hot, it is rather cold actually. -The pipe bends to the north and east. -~ -70 ad 5 -D1 -The pipe leads into a bend that goes south. Interesting, there is mud on -the ground there as well. -~ -~ -0 -1 7012 -D0 -The muddy sewer pipe leads into a bend that goes east. -~ -~ -0 -1 7005 -E -mud~ -It is as dark as tar and looks like something out of a toilet, on top of -that, the smell is absolutely overwhelming. -~ -S -#7007 -The Muddy Sewer Bend~ - This isn't your idea of a place to stay too long. You're in up to -your knees in something that resembles mud, but you're not quite sure. -The bend in which you stand leads west and south. -~ -70 ad 5 -D3 -The pipe (still filled with mud) leads into a intersection that goes north -and south. Interesting. -~ -~ -0 -1 7002 -D2 -The pipe leads into a intersection that goes south and east. The floor here -is still covered in mud. -~ -~ -0 -1 7008 -E -mud~ -It is as dark as tar and looks like something out of a toilet, on top of -that, the smell is absolutely overwhelming. -~ -S -#7008 -A Muddy Intersection~ - You have both your feet safely stuck in mud. It isn't the mud that is -wrong it is the smell, the sounds, the total darkness that surrounds you. -Everything here is so depressing. The pipe leads on with a trail of thick -mud to the north, east and south. -~ -70 ad 4 -D0 -North. The pipe goes into a bend with a load of mud all the way up the walls. -The bend leads west. -~ -~ -0 -1 7007 -D1 -East. This way looks like a place for the annual mud festival, although the -stench wouldn't allow any happiness at all. The pipe leads into a bend that -leads north. -~ -~ -0 -1 7014 -D2 -South. There is much less mud in that direction. Your light doesn't -uncover enough space for you to see much more than that it leads into -some sort of junction. -~ -~ -0 -1 7009 -E -mud~ -It is as dark as tar and looks like something out of a toilet, on top of -that, the smell is absolutely overwhelming. -~ -S -#7009 -The Sewer Junction~ - You stand in the middle of a huge junction of sewer pipes right under -what you'd think was an air shaft. The sewer pipes lead to the north, -south, east and west. It look quite impossible to force your way up. -~ -70 ad 3 -D0 -North. Mud is the floor basis in that direction. Yummy. -~ -~ -0 -1 7008 -D1 -YYEEUUCH! BOOH! THAT looks like a nice place for creepy crawlies. -~ -~ -0 -1 7017 -D2 -South. This direction looks quite nice actually. The pipe leads into -a bend that goes east. -~ -~ -0 -1 7010 -D3 -A few yards ahead - away from this junction - there is a pit leading down, -but the smell from there...>PHEWW<. -~ -~ -0 -1 7004 -E -mud~ -It is as dark as tar and looks like something out of a toilet, on top of -that, the smell is absolutely overwhelming. -~ -S -#7010 -A Bend In The Sewer Pipe~ - You are in a bend in the sewer pipe. A strong smell seeps in from the -north. The sewer goes north and east. -~ -70 ad 2 -D0 -North. You are staring into a huge junction with exits in all directions. -~ -~ -0 -1 7009 -D1 -East. The Pipe leads into utter darkness that way. -~ -~ -0 -1 7018 -S -#7011 -The Muddy Sewer Pipe~ - You have entered a kind of tube intersection that leads south, west -and east. Your legs are covered in mud up to the knees. REAL yucky! -~ -70 ad 5 -D1 -East. There is less mud in that direction, or that's your impression. -~ -~ -0 -1 7024 -D2 -That way is lost in darkness, though you sense less mud in that direction, -perhaps even a complete end to this sludge that surrounds you. -~ -~ -0 -1 7021 -D3 -West. The mud reaches that way too, all the way up the walls. -~ -~ -0 -1 7005 -E -mud~ -It is as dark as tar and looks like something out of a toilet, on top of -that, the smell is absolutely overwhelming. -~ -S -#7012 -The Bend In The Muddy Sewer~ - This is not your idea of a holiday. You stand in mud up to your knees. -It is absolutely inconceivable how all this mud could have been placed -here. The pipe leads to the west and south. -~ -70 ad 5 -D2 -South. There is even more mud that way, incredible! Although it looks -like an intersection in the sewer system that leads east and south. -~ -~ -0 -1 7013 -D3 -West. All you can see, is that the pipe leads into a bend that goes -north. But there is less mud in that direction, however odd that sounds. -~ -~ -0 -1 7006 -E -mud~ -It is as dark as tar and looks like something out of a toilet, on top of -that, the smell is absolutely overwhelming. -~ -S -#7013 -A Muddy Intersection~ - You wouldn't want to know the true feeling of standing in this mud up to -your hips. >BWAADR<. All that fills your mind right now is the dream of -a hot bath. This is NOT very clean mud you know, remember you're in the -sewer! The pipes leads north, south and east. -~ -70 ad 5 -D0 -North. Sludge and sediment fills this corridor of the sewer that leads -into a bend going west. -~ -~ -0 -1 7012 -D1 -East. You can see absolutely nothing of interest in that direction (Maybe -that is why it is so damn interesting...) There is no mud in that direction -either, GREAT! -~ -~ -0 -1 7026 -D2 -South. All you can see is more mud! Although the pipe goes into a bend -leading west. -~ -~ -0 -1 7014 -E -mud~ -It is as dark as tar and looks like something out of a toilet, on top of -that, the smell is absolutely overwhelming. -~ -E -sediment~ -It is NOT the kind of matter that would concern you too much, normally, but -as you are in the middle of it, it just might become your main concern. -REAL YUCKY! -~ -S -#7014 -The Muddy Sewer~ - You stand in a bend of the pipe system of the sewer with mud up to your -thighs. Contemplating a higher level of existence here would be utterly -inappropriate, as the smell would keep any intelligent creature from even -thinking of anything but getting away from this foul end of the WORLD. -The bend goes from north to west. -~ -70 ad 5 -D0 -North. Filled with mud, that place looks like an impassable intersection -with pipes leading north and east. -~ -~ -0 -1 7013 -D3 -West. There is less mud that way, maybe you're on your way out of this foul -place. -~ -~ -0 -1 7008 -E -mud~ -It is as dark as tar and looks like something out of a toilet, on top of -that, the smell is absolutely overwhelming. -~ -S -#7015 -The Old Well~ - You are standing by an old and worn well from before this century. The -sewer leads to the east from here and the well leads down into darkness. -Metal bars implanted in the side of the well lead down as a ladder. -~ -70 ad 3 -D1 -East. You see, because of the utter darkness that surround you, absolutely -nothing. Your light isn't of much use for that kind of distance. -~ -~ -0 -1 7028 -D5 -Down the well there is even less light than up here, so... sorry, you can't -see a thing. There are metal bars in the side leading down into the darkness. -~ -~ -0 -1 7105 -E -bars~ -These look like they're pretty slippery, and not very safe, but perhaps safe -enough for you to climb down, WITH both hands on them. -~ -S -#7016 -The Ordinary Bend~ - You are in the middle of a bend in the pipe system of the sewer system, -WHAT a place!!! The pipe leads to the south and the east. -~ -70 ad 1 -D2 -South. You see nothing at all in that direction it is too dark anyway. -~ -~ -0 -1 7017 -D1 -East. What a quiet place you've found there. It is an intersection that has -pipeways going north and east. -~ -~ -0 -1 7021 -S -#7017 -The Sewer Junction~ - You are in a junction that leads north, west and south. -~ -70 ad 1 -D0 -North. You see a bend. -~ -~ -0 -1 7016 -D3 -West. There is a junction with four pipelines in that direction. -~ -~ -0 -1 7009 -D2 -South. It looks like a pipe junction just like this one. Only that one -leads east and west. -~ -~ -0 -1 7018 -S -#7018 -The Ordinary Junction~ - This looks like an ordinary junction, actually it seems very quiet -here. The pipelines lead west, east and north. -~ -70 acd 1 -D0 -To the north you can see a junction like this one, leading north and west. -~ -~ -0 -1 7017 -D1 -To the east there is nothing of particular interest, though there is a -junction with pipelines leading north and east. -~ -~ -0 -1 7031 -D3 -There is a bend to the west leading north. -~ -~ -0 -1 7010 -S -#7021 -A Quiet Pipe Junction~ - This is the kind of place to rest, though the smell could be a LOT -better than this. The sewer goes east, north and west from here. -~ -70 acd 1 -D0 -In that direction, you can't see anything. It is just too dark. -~ -~ -0 -1 7011 -D1 -There is an ordinary junction in the pipe system to the east. -~ -~ -0 -1 7029 -D3 -West. There is an ordinary bend leading south into the sewer system in -that direction. -~ -~ -0 -1 7016 -S -#7022 -The Odd Room With Smooth Walls~ - As you enter you hear a loud click from one of the walls... and you fall -and fall and fall... -. -. -. -. -... And come to an abrupt end. THIS is strange indeed. There is an arched -entryway leading down. -~ -70 ad 5 -D5 -Down. It is utterly dark that way, though you can make out an intersection -of sewer pipes leading west, north and east. -~ -~ -0 -1 7112 -S -#7024 -The Sewer~ - You are standing in mud up to your ankles. This is an intersection with -sewer pipes leading east, south and west. -~ -70 acd 1 -D1 -To the east there is a peculiar looking round room. -~ -~ -0 -1 7037 -D2 -To the south there is another intersection with pipes going south and east. -~ -~ -0 -1 7025 -D3 -To the west there is another intersection like this one, with sewer pipes -leading south and west. -~ -~ -0 -1 7011 -S -#7025 -Another Intersection~ - You have never seen anything so BORING... This is an intersection with -pipes leading north, south and east. -~ -70 ad 1 -D0 -To the north there is an intersection, where the pipes are leading west and -east. You notice that the floor to the west is covered in mud. -~ -~ -0 -1 7024 -D1 -East. You see nothing of interest in that direction, just another -intersection. This one leads east and south. -~ -~ -0 -1 7038 -D2 -Another intersection lies to the south. It leads west and south. -~ -~ -0 -1 7026 -S -#7026 -A Junction~ - This one seems interesting, a big difference from all the other junctions. -It seems cleaner than the rest of them. Weird. Something that looks like -an air shaft leads upwards, but it looks far too slippery to climb. -The pipes lead to the south, west and north. -~ -70 acd 0 -D0 -North. You see an intersection there, leading north and east. -~ -~ -0 -1 7025 -D2 -To the south there is ANOTHER junction leading west and east. -~ -~ -0 -1 7028 -D3 -To the west you see a load of mud and sediment in the sewer. That should -be an intersection there but you're not quite sure. -~ -~ -0 -1 7013 -E -mud~ -It is as dark as tar and looks like something out of a toilet, on top of -that, the smell is absolutely overwhelming. -~ -S -#7028 -The Sewer Junction~ - You stand in a junction of sewer pipes leading north, east and west. -~ -70 ad 1 -D0 -~ -~ -0 -1 7026 -D1 -To the east you can see a bend in the pipe going south. -~ -~ -0 -1 7034 -D3 -To the west you can just make out an old well. -~ -~ -0 -1 7015 -S -#7029 -The Triple Junction~ - You stand in the middle of a huge junction of concrete sewer pipes. The -pipes lead into three different directions: east, south and west. -~ -70 ad 1 -D1 -East. You can see a bend in the sewer pipe leading north. -~ -~ -0 -1 7035 -D2 -To the south there is an ENORMOUS quadruple sewer junction, all lit up by -an odd light. -~ -~ -0 -1 7030 -D3 -To the west you can just make out another junction similar to the one -you are standing in. -~ -~ -0 -1 7021 -S -#7030 -The Quadruple Junction Under The Dump~ - You are standing in something that reminds you of an entry to an ant hive. -There are enormous concrete pipes leading north, south, east and west. -There is also a metal ladder built into the concrete wall leading up through -a layer of garbage. -~ -70 acd 1 -D0 -To the north you can see a huge triple junction with sewer pipes leading -west and east. -~ -~ -0 -1 7029 -D1 -East. You can see a pit in the floor. -~ -~ -0 -1 7036 -D2 -To the south there is a huge junction with pipes leading east and west. -~ -~ -0 -1 7031 -D3 -To the west there is an odd looking room with totally smooth walls. -~ -~ -0 -1 7022 -D4 -Up through the garbage you can just make out what looks like the dump in -Midgaard. -~ -~ -2 3005 3030 -E -ladder~ -It looks as if it is made of stainless steel, and it would function -as a club of considerable power, but alas... You can't take at all -since it is firmly set into the concrete wall. -~ -S -#7031 -A Triple Junction~ - You stand in a junction with pipes leading west, north and east. -~ -70 ad 1 -D0 -To the north there is an ENORMOUS quadruple sewer junction, all lit up by -an odd light. -~ -~ -0 -1 7030 -D1 -East. You can just make out a triple junction leading north and east. -~ -~ -0 -1 7044 -D3 -West. You can just make out a triple junction leading north and west. -~ -~ -0 -1 7018 -S -#7034 -A Bend In The Sewer Pipe~ - You can look in two directions where the pipe leads: south and west. -~ -70 ad 2 -D3 -West. You can just make out a triple junction leading north and west. -~ -~ -0 -1 7028 -D2 -To the south you can see another bend leading west. -~ -~ -0 -1 7035 -S -#7035 -The Sewer Pipe Bend~ - You can look in two different directions where the pipe goes: west and -north. -~ -70 ad 2 -D0 -North. You see another bend leading west. -~ -~ -0 -1 7034 -D3 -You can see another junction although this one is a triple one with pipes -going south and west. -~ -~ -0 -1 7029 -S -#7036 -The Pit~ - You stand in a section of a pipe that leads to a dead end. In the floor -there is a pit leading down. There are bars set in the side of the pit -wall functioning as a ladder. -~ -70 ad 5 -D3 -West. You can see a dimly lit quadruple junction with an exit up. -~ -~ -0 -1 7030 -D5 -Down the pit it is so utterly dark that you can't see a thing. -~ -~ -0 -1 7122 -S -#7037 -The Round Room~ - As you enter the room it starts rotating - at first slowly, then faster -and faster - You get totally confused as to where up and down is, but -you are certain that the doorway is in the opposite direction of what -it was when you entered. It now leads east. There is only this one -exit. -~ -70 ad 1 -D1 -You can just make out a smaller room with a chair. -~ -~ -0 -1 7050 -S -#7038 -The Three Way Junction~ - You are standing in a junction of pipes that lead west, east and south. -~ -70 ad 1 -D1 -East. You can make out a dimly lit Guard Room. -~ -~ -0 -1 7045 -D2 -To the south you can see what looks like a store room. -~ -~ -0 -1 7039 -D3 -West. You see another junction similar to this one leading north and south. -~ -~ -0 -1 7025 -S -#7039 -The Sewer Store Room~ - You stand in a small room lit by a single torch set in the wall. The only -way out of here is to the north. -~ -70 d 1 -D0 -To the north you see a pipe junction. -~ -~ -0 -1 7038 -S -#7041 -The Shaft~ - You are standing by the edge of a deep, dark shaft leading down. A single -ladder is your tool to work your way down if you so wish. The sewer pipe -leads south from here. -~ -70 ad 1 -D2 -To the south you can see the pipe leading further south into darkness. -~ -~ -0 -1 7043 -D5 -Down and utter darkness. There is absolutely nothing to be seen in that -direction. -~ -~ -0 -1 7123 -E -ladder~ -Firmly set into the wall of the shaft it is impossible to even move, in your -estimate. -~ -S -#7043 -The Sewer Entrance~ - You stand in the middle of a pipe that leads from north to south. Above -you an air shaft leads up into sunlight. It seems totally impossible to go -up that way. -~ -70 ad 1 -D0 -To the north you can just make out a huge shaft leading down. -~ -~ -0 -1 7041 -D2 -To the south you can see a triple junction leading west and east. -~ -~ -0 -1 7044 -S -#7044 -The Junction Going Three Ways~ - You are in a passageway in the pipes of the sewer system leading north, -east and west. -~ -70 ad 1 -D0 -You see a sewer pipe leading north. -~ -~ -0 -1 7043 -D1 -~ -~ -0 -1 7049 -D3 -West. You see another junction very similar to this one that leads north -and west. -~ -~ -0 -1 7031 -S -#7045 -The Sewer Room~ - You are standing in a large room with chairs set in the walls. You have -the feeling of being watched. To the south there is an entrance to a -larger room. The room is lit by five torches, also set in the walls. To -the west there is a doorway leading out to the sewers. -~ -70 d 1 -D2 -You can see an even larger room than this one, filled with light. -~ -~ -0 -1 7046 -D3 -To the west you can see the sewers. -~ -~ -2 -1 7038 -S -#7046 -The Sewer Room~ - This is a Room with walls that glitters like gold though not quite like -it. This is strange as it looks as if the glitter lights the whole room. -It looks very bright. To the south the floor is covered with yucky water. -The north leads to a sort of a guard room. -~ -70 d 1 -D0 -To the north you can see the guard room. -~ -~ -0 -1 7045 -D2 -To the south there is nothing but water and an exit leads east from there. -~ -~ -0 -1 7047 -S -#7047 -The Pool In The Sewer~ - You stand in water to your waist. To the north is the entrance to this -room. A single door leads east. -~ -70 d 1 -D0 -To the north you see the entrance to this room. -~ -~ -0 -1 7046 -D1 -You can see an enormous hall through the doorway. -~ -door~ -1 -1 7053 -S -#7048 -The Sewers~ - You stand in a dead end of the sewer. The only way out is south. -You can see a shaft leading up but it looks too difficult to go up -that way. -~ -70 ad 1 -D2 -~ -~ -0 -1 7049 -S -#7049 -The Junction~ - You stand in a junction leading north, west and east. -~ -70 ad 1 -D0 -~ -~ -0 -1 7048 -D1 -Darkness has closed in on that part of the sewer system, you can't see -a thing in that direction. -~ -~ -0 -1 7060 -D3 -West. You see another junction very similar to this one that leads north -and west. -~ -~ -0 -1 7044 -S -#7050 -The Small Room~ - The only thing in this room of interest is a chair, and that appears -to have been bolted to the rock floor. A doorway leads south and another -leads east into darkness. -~ -70 ad 1 -D1 -Utter darkness... -~ -~ -0 -1 7055 -D2 -You can see a room with a lot of light in it. You can't make out any details. -~ -~ -0 -1 7051 -S -#7051 -The Sewer Pipe~ - You are in what reminds you of a foul sewer, as if you liked being here! -You can see two exits leading either north or south. -~ -70 d 1 -D0 -~ -~ -0 -1 7050 -D2 -To the south you can see a strange light flowing from there. -~ -~ -0 -1 7052 -S -#7052 -The Grand Sewer~ - You are in a grand sewer pipe. This stretches toward the south. It is -large indeed! A doorway leads to the east from here. -~ -70 d 1 -D0 -To the north you can see a doorway. -~ -~ -0 -1 7051 -D1 -You can't see anything in that darkness. -~ -~ -0 -1 7056 -D2 -In the south end of the pipe the "floor" is completely covered with water. -~ -~ -0 -1 7053 -S -#7053 -The South End Of The Grand Pipe~ - You stand in water to your knees. A doorway leads west from here. The -pipe stretches north. -~ -70 d 1 -D0 -You see a lot of pictures decorating the walls. -~ -~ -0 -1 7052 -D3 -~ -door~ -1 -1 7047 -S -#7055 -The Edge Of The Water Sewer~ - You stand in a room where half of the floor is covered in water. The -water leads east and a doorway leads west. -~ -70 ad 3 -D1 -You can hardly make out much more than that the next place is in a pipe -with more water. -~ -~ -0 -1 7061 -D3 -~ -~ -0 -1 7050 -E -water~ -It looks dark and murky, and emanates a foul stench. -~ -S -#7056 -The Dark Hallway~ - You can't see much of this, even with a light. The hallway goes into a -passageway to the south. A doorway leads west. -~ -70 ad 1 -D2 -You can see nothing at all because it is completely dark in that direction. -~ -~ -0 -1 7057 -D3 -You see a lot of light, bright as daylight, but nothing of interest. -~ -~ -0 -1 7052 -S -#7057 -The Dark Passageway~ - You can't see anything but the ground where you put your feet. The -passageway seems to continue south and north. -~ -70 ad 1 -D0 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7056 -D2 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7058 -S -#7058 -The Dark Passageway~ - You can't see anything but the ground where you put your feet. The -passageway seems to continue south and north. -~ -70 ad 1 -D0 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7057 -D2 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7059 -S -#7059 -The Dark Passageway~ - You can't see anything but the ground where you put your feet. The -passageway seems to continue south and north. -~ -70 ad 1 -D0 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7058 -D2 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7060 -S -#7060 -The Dark Passageway~ - You can't see anything but the ground where you put your feet. -The passageway seems to continue west and north. To the east there -is water covering the floor and that leads through an arched entry -to a watery sewer. -~ -70 ad 1 -D0 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7059 -D1 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7068 -D3 -You can just make out a triple junction leading north and west. -~ -~ -0 -1 7049 -E -water~ -It looks dark and murky, and emanates a foul stench. -~ -S -#7061 -The Watery Sewer Bend~ - You can't see anything but the water you're in up to your hips. The sewer -seems to bend and lead south and west. -~ -70 ad 5 -D2 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7062 -D3 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7055 -E -water~ -It looks dark and murky, and emanates a foul stench. -~ -S -#7062 -The Watery Sewer~ - You can't see anything but the water you're in up to your hips. The sewer -seems to lead south and north. -~ -70 ad 5 -D0 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7061 -D2 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7063 -E -water~ -It looks dark and murky, and emanates a foul stench. -~ -S -#7063 -The Watery Sewer~ - You can't see anything but the water you're in up to your hips. The sewer -seems to lead south and north. -~ -70 ad 5 -D0 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7062 -D2 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7064 -E -water~ -It looks dark and murky, and emanates a foul stench. -~ -S -#7064 -The Watery Sewer Junction~ - You can't see anything but the water you're in up to your hips. The sewer -seems to lead into a junction going south, north and east. -~ -70 ad 5 -D0 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7063 -D1 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7069 -D2 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7065 -E -water~ -It looks dark and murky, and emanates a foul stench. -~ -S -#7065 -The Watery Sewer~ - You can't see anything but the water you're in up to your hips. The sewer -seems to lead south and north. -~ -70 ad 5 -D0 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7064 -D2 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7066 -E -water~ -It looks dark and murky, and emanates a foul stench. -~ -S -#7066 -The Watery Sewer Junction~ - You can't see anything but the water you're in up to your hips. The sewer -seems to lead into a junction that goes north, south and east. -~ -70 ad 5 -D0 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7065 -D1 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7070 -D2 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7067 -E -water~ -It looks dark and murky, and emanates a foul stench. -~ -S -#7067 -The Watery Sewer~ - You can't see anything but the water you're in up to your hips. The sewer -seems to lead south and north. -~ -70 ad 5 -D0 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7066 -D2 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7068 -E -water~ -It looks dark and murky, and emanates a foul stench. -~ -S -#7068 -The Watery Sewer Bend~ - You can't see anything but the water you're in up to your hips. The sewer -seems to bend and lead west and north. -~ -70 ad 5 -D0 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7067 -D3 -You can't see anything in that direction and your light isn't enough to light -that far. -~ -~ -0 -1 7060 -E -water~ -It looks dark and murky, and emanates a foul stench. -~ -S -#7069 -A Ledge By A Dark Pool~ - You can't see much here but the echo tells you that there is quite a drop -down. You can just make out a huge dark pool out there in the darkness, -mostly because of the trickling of water. The water from the sewer actually -washes over this ledge and makes it quite slippery. From here it drops, -like a waterfall, into the pool far down. -~ -70 ad 5 -D2 -You can't see a thing. It is too dark. -~ -~ -0 -1 7070 -D3 -You can't see a thing. It is too dark. -~ -~ -0 -1 7064 -E -water~ -It looks dark and murky, and emanates a foul stench. -~ -S -#7070 -A Ledge By A Dark Pool~ - You can't see much here but the echo tells you that there is quite a drop -down. You can just make out a huge dark pool out there in the darkness, -mostly because of the trickling of water. The water from the sewer actually -washes over this ledge and makes it quite slippery. From here it drops, -like a waterfall, into the pool far down. Under you there is a small fissure -in the rock. It seems big enough to contain a few people. -~ -70 ad 5 -D0 -You can't see a thing. It is too dark. -~ -~ -0 -1 7069 -D3 -You can't see a thing. It is too dark. -~ -~ -0 -1 7066 -D5 -~ -~ -0 -1 7000 -E -water~ -It looks dark and murky, and emanates a foul stench. -~ -S -$ diff --git a/lc-mud/circle/world/wld/71.wld b/lc-mud/circle/world/wld/71.wld deleted file mode 100644 index 8b9d1e1549f4683c3e7aa510d2546b5fdcd9ed68..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/71.wld +++ /dev/null @@ -1,667 +0,0 @@ -#7100 -The Edge Of The Water~ - The pool side is dimly lit up by your light. You can see absolutely -nothing else nearby. The darkness her seems enormously oppressive here. -The air is damp and the rock on which you stand is slippery. The pool -seems too dark to make anything clear. The pool seems to extend to the -east. The rock can be climbed upwards from here. -~ -71 acd 5 -D1 -The pool extends eastwards, but you cannot find enough room to move in that -direction. -~ -~ -0 -1 -1 -D4 -~ -~ -0 -1 7000 -S -#7101 -Under The Mudhole~ - You stand in a small room with a great big opening in the ceiling. From -this opening there is mud dripping down in large lumps. >YUCK<. You can -smell the foul stench of the slimy sediment as you try not to get covered -by the falling sludge. To the east there is an entryway leading out from -here and it seems absolutely impossible to force the muddy descent. -~ -71 acd 5 -D1 -East. You see nothing of interest. -~ -~ -0 -1 7103 -E -mud~ -You never saw such disgusting matter before, it nearly makes you puke. -~ -S -#7102 -Under The Dark Pit~ - Nice place you found yourself in. You stand in the middle of a room -with only two exits, up and east. A tall ladder has been left here so -that you can climb up through the pit without the use of a rope. -~ -71 ad 1 -D1 -~ -~ -0 -1 7104 -D4 -Up. You can't see a thing up there, it is way too dark. -~ -~ -0 -1 7004 -D5 -~ -trapdoor~ -1 -1 7300 -E -ladder~ -This is funny enough a wooden ladder and, after closer inspection, you -discover it is magically held to the wall! You can't, even with your -greatest effort, move it at ALL! -~ -S -#7103 -A Muddy Bend In The Sewer System~ - You are standing in what looks like a bend in the pipe system of the -sewer. The 'floor' is covered completely by mud! This includes covering -your legs up to your knees as well. The pipe leads west and south. -~ -71 ad 4 -D2 -To the south there is less mud than here! It actually seems to end there! -You have a felling it would be nice to have your feet free from mud again. -~ -~ -0 -1 7104 -D3 -You can see a room in which mud drips from the roof onto the floor in -great cakes of sludge. There doesn't seem to be any exits from that room -apart from in you direction. -~ -~ -0 -1 7101 -E -mud~ -You never saw such disgusting matter before, it nearly makes you puke. -~ -S -#7104 -A Junction In The Sewer Pipes~ - You stand in the middle of what looks like a triple junction of pipes -going east, west and north. -~ -71 ad 1 -D0 -You can see a mud area starting in that direction. -~ -~ -0 -1 7103 -D1 -East. You can't even make out what it might look like, it is just too dark. -~ -~ -0 -1 7112 -D3 -West. There is a room with a ladder leading up. -~ -~ -0 -1 7102 -S -#7105 -Down The Old Well~ - You are dangling on the slippery sides of the old well leading down and -up. The only secure point here is the metal bars that are cemented into the -sides, the ones that you cling frantically to so that you don't fall. Who -knows how deep this well is? The bars lead down and up and nowhere else. -~ -71 ad 5 -D4 -There is a slight, dim light from above, or maybe it is just your imagination. -Anyway it SEEMS darker down here than up there, if that is possible. -~ -~ -0 -1 7015 -D5 -Down there nothing at all can be spotted. The darkness that engulfs this -decent seems utterly impossible in a mortal world. It is so thick that a -torch down there would be utterly useless... or so it seems to you. Not -the kind of thing to cheer you up on this voyage, Eh? -~ -~ -0 -1 -1 -E -bars~ -These look like they're pretty slippery, and not very safe, but perhaps safe -enough for you to climb down, WITH both hands on them. -~ -S -#7106 -The Northwestern Corner Of The Ledge~ - You stand, swaying out from the ledge, with only a couple of inches of -safe, solid ledge under your feet. The ledge continues to the east but not -back south. It seems that the ledge is too narrow to turn on so you'll have -to continue forward. -~ -71 acd 5 -D1 -The ledge continues east. -~ -~ -0 -1 7113 -D2 -The ledge continues south. -~ -~ -0 -1 7107 -D5 -The Abyss lies down there. Who knows what might lurk down there? -~ -rock step edge~ -1 -1 7279 -E -edge odd-looking~ -This is truly a weird piece of craftsmanship in your eyes. The edge seems to -form a step leading down, but WHAT a STEP DOWN. The Abyss opens down there -leading to seemingly total destruction. -~ -E -step~ -A small rock sticks out right under it, otherwise the way is DOWN, DOWN, and -SPLAT!!! -~ -E -rock~ -It looks as if it can be opened in a door-like fashion. Maybe this will lead -the way down. -~ -S -#7107 -The Narrow Ledge~ - You are in the process of walking all the way around the ledge since -there is no way of turning around on this all too narrow path. There IS -another exit from here but that leads right into mid-air and with high -probability of a free fall session afterwards. -~ -71 acd 5 -D0 -North. The ledge leads into a corner and turns eastward. -~ -~ -0 -1 7106 -D1 -You stare into mid-air, and right under there is absolutely nothing but -darkness. You shiver by the thought of falling an utterly unknown distance. -~ -~ -0 -1 7190 -D2 -South. The ledge leads further south into utter darkness. -~ -~ -0 -1 7108 -S -#7108 -The Narrow Ledge~ - You are in the process of walking all the way around the ledge since -there is no way of turning around on this all too narrow path. There IS -another exit from here but that leads right into mid-air and with high -probability of a free fall session afterwards. -~ -71 acd 5 -D0 -North. The ledge leads further north. -~ -~ -0 -1 7107 -D1 -You stare into mid-air, and right under there is absolutely nothing but -darkness. You shiver by the thought of falling that distance. -~ -~ -0 -1 7190 -D2 -The ledge continues further south into darkness. -~ -~ -0 -1 7109 -S -#7109 -The Narrow Ledge~ - You are in the process of walking all the way around the ledge since -there is no way of turning around on this all too narrow path. There IS -another exit from here but that leads right into mid-air and with high -probability of a free fall session afterwards. -~ -71 acd 5 -D0 -North. The ledge leads further north. -~ -~ -0 -1 7108 -D1 -You stare into mid-air, and right under there is absolutely nothing but -darkness. You shiver by the thought of falling that distance. -~ -~ -0 -1 7190 -D2 -The ledge continues south into darkness. -~ -~ -0 -1 7110 -S -#7110 -The Narrow Ledge~ - You are in the process of walking all the way around the ledge since -there is no way of turning around on this all too narrow path. There IS -another exit from here but that leads right into mid-air and with high -probability of a free fall session afterwards. -~ -71 acd 5 -D0 -North. The ledge leads further north. -~ -~ -0 -1 7107 -D1 -You stare into mid-air, and right under there is absolutely nothing but -darkness. You shiver by the thought of falling that distance. -~ -~ -0 -1 7190 -D2 -South. You can just make out the south-western corner of this ledge. -~ -~ -0 -1 7111 -S -#7111 -The Southwestern Corner Of The Ledge~ - This seems like a ledge that is a little broader than the one just to -the north of here. The ledge seems to lead around some sort of Abyss of -total darkness. The ledge seems to have an odd-looking edge here. -~ -71 acd 5 -D0 -North. The ledge leads further north. -~ -~ -0 -1 7110 -D1 -You see a broad ledge leading eastward. -~ -~ -0 -1 7115 -D2 -South of here is the exit from the ledge. -~ -~ -0 -1 7112 -D5 -The Abyss lies down there. Who knows what might lurk down there? -~ -rock step edge~ -1 -1 7279 -E -edge odd-looking~ -This is truly a weird piece of craftsmanship in your eyes. The edge seems to -form a step leading down, but WHAT a STEP DOWN. The Abyss opens down there -leading to seemingly total destruction. -~ -E -step~ -A small rock sticks out right under it, otherwise the way is DOWN, DOWN, and -SPLAT!!! -~ -E -rock~ -It looks as if it can be opened in a door-like fashion. Maybe this will lead -the way down. -~ -S -#7112 -An Odd Intersection~ - You stand in a rather odd intersection of pipes. The pipes actually -don't resemble pipes anymore. They look more like a real stone tunnel, -or a passageway hewn directly into the rock. The ways from here lead -north, east and west. -~ -71 ad 1 -D0 -North. You see a ledge to something that looks like an abyss. -~ -~ -0 -1 7111 -D1 -~ -~ -0 -1 7122 -D3 -~ -~ -0 -1 7104 -S -#7113 -The Narrow Ledge Going East To West~ - You are in the process of walking all the way around the ledge since -there is no way of turning around on this all too narrow path. There IS -another exit from here but that leads right into mid-air and with high -probability of a free fall session afterwards. -~ -71 acd 5 -D1 -The ledge leads further east. -~ -~ -0 -1 7116 -D2 -You stare into mid-air, and right under there is absolutely nothing but -darkness. You shiver by the thought of falling that distance. -~ -~ -0 -1 7190 -S -#7114 -Mid-Air~ - You've just stepped into the most unlucky position in the whole of -CircleMUD. The result of such a foolish act should be punished with -death, you know. With an acceleration of approximately 9.82 meters -per second squared, you are now descending the Abyss. What awaits you -at the bottom will continue to be a mystery. Good-bye cruel world. -~ -71 bd 0 -D0 -~ -~ -0 -1 7119 -D1 -~ -~ -0 -1 7118 -D2 -~ -~ -0 -1 7120 -D3 -~ -~ -0 -1 7117 -D4 -~ -~ -0 -1 7115 -S -#7115 -The Broad Ledge~ - You are standing on a ledge that seems quite a lot larger than the -rest of the ledges. This one leads to the west and the east, plus it -has an exit going to the south. Though you could jump into mid-air, -but it probably wouldn't be such a good idea. The way south is in -utter darkness. -~ -71 acd 4 -D0 -~ -~ -0 -1 7114 -D1 -~ -~ -0 -1 7121 -D2 -~ -~ -0 -1 7129 -D3 -~ -~ -0 -1 7111 -S -#7116 -The Northeastern Corner Of The Ledge~ - You stand, swaying out from the ledge, with only a couple of inches of -safe, solid ledge under your feet. The ledge continues to the west and -leads south from here into darkness. -~ -71 acd 5 -D2 -~ -~ -0 -1 7117 -D3 -The ledge continues west. -~ -~ -0 -1 7113 -D5 -You can just make out the outline of a trapdoor here in the soil. The earth -is probably there to conceal a secret entrance. This looks as if it leads -down into the seemingly solid rock face of the ledge. -~ -trapdoor secret entrance~ -1 -1 7280 -E -ground ledge rock~ -The ground here seems a little different from all the other ledges along the -Abyss. There is a kind of soft soil on this ledge, maybe you should look -carefully at this. It seems to be of some interest. -~ -E -soil soft earth~ -You can just make out the outline of a trapdoor here in the soil. The earth -is probably there to conceal a secret entrance. This looks as if it leads -down into the seemingly solid rock face of the ledge. -~ -S -#7117 -The Narrow Eastern Ledge~ - You are in the process of walking all the way around the ledge since -there is no way of turning around on this all too narrow path. There IS -another exit from here but that leads right into mid-air and with high -probability of a free fall session afterwards. And THAT is west of here -so watch your step. -~ -71 acd 5 -D2 -The ledge leads further south. -~ -~ -0 -1 7118 -D3 -You stare into mid-air, and right under there is absolutely nothing but -darkness. You shiver by the thought of falling that distance. -~ -~ -0 -1 7114 -S -#7118 -The Narrow Eastern Ledge~ - You are in the process of walking all the way around the ledge since -there is no way of turning around on this all too narrow path. There IS -another exit from here but that leads right into mid-air and with high -probability of a free fall session afterwards. And THAT is west of here -so watch your step. -~ -71 acd 5 -D2 -The ledge leads further south. -~ -~ -0 -1 7119 -D3 -You stare into mid-air, and right under there is absolutely nothing but -darkness. You shiver by the thought of falling that distance. -~ -~ -0 -1 7114 -S -#7119 -The Narrow Eastern Ledge~ - You are in the process of walking all the way around the ledge since -there is no way of turning around on this all too narrow path. There IS -another exit from here but that leads right into mid-air and with high -probability of a free fall session afterwards. And THAT is west of here -so watch your step. -~ -71 acd 5 -D2 -The ledge leads further south. -~ -~ -0 -1 7120 -D3 -You stare into mid-air, and right under there is absolutely nothing but -darkness. You shiver by the thought of falling that distance. -~ -~ -0 -1 7114 -S -#7120 -The Narrow Eastern Ledge~ - You are in the process of walking all the way around the ledge since -there is no way of turning around on this all too narrow path. There IS -another exit from here but that leads right into mid-air and with high -probability of a free fall session afterwards. And THAT is west of here -so watch your step. You also see a small opening to the east. -~ -71 acd 5 -D1 -East. You stare into darkness. -~ -~ -0 -1 7123 -D2 -The ledge leads further south. -~ -~ -0 -1 7121 -D3 -You stare into mid-air, and right under there is absolutely nothing but -darkness. You shiver by the thought of falling that distance. -~ -~ -0 -1 7114 -S -#7121 -The Southeastern Corner Of The Ledge~ - This seems like a ledge that is a little broader than the one just to the -north of here. The ledge seems to lead around some sort of abyss of total -darkness. -~ -71 acd 5 -D0 -North of here you can see a ledge. -~ -~ -0 -1 7120 -D3 -The ledge leads further west. -~ -~ -0 -1 7115 -D5 -The Abyss lies down there. Who knows what might lurk down there? -~ -rock step edge~ -2 -1 7279 -E -edge odd-looking~ -This is truly a weird piece of craftsmanship in your eyes. The edge seems to -form a step leading down, but WHAT a STEP DOWN. The Abyss opens down there -leading to seemingly total destruction. -~ -E -step~ -A small rock sticks out right under it, otherwise the way is DOWN, DOWN, and -SPLAT!!! -~ -E -rock~ -It looks as if it can be opened in a door-like fashion. Maybe this will lead -the way down. -~ -S -#7122 -Under The Pit~ - You stand in a completely dark cavern leading west. The wall looks -weird here. -~ -71 ad 0 -D3 -~ -~ -0 -1 7112 -E -wall~ -There is a crack here that looks like it has been made recently. -~ -S -#7123 -Under The Shaft~ - A ladder leads up from here to the Shaft. A small opening leads west -from here. -~ -71 ad 5 -D3 -You can see a narrow ledge going north and south. -~ -~ -0 -1 7120 -D4 -It is too dark up there. -~ -~ -0 -1 7041 -S -#7129 -The Sewer Line~ - You are in a narrow part of the sewer. Down the sewer continues and to -the north is the ledge. -~ -72 9 3 -D0 -You can see the southern part of the ledge. -~ -~ -0 -1 7115 -D5 -You look deeper down into the drain. -~ -~ -0 -1 7221 -S -#7190 -Mid-Air~ - You've just stepped into the most unlucky position in the whole of -CircleMUD. The result of such a foolish act should be punished with -death, you know. With an acceleration of approximately 9.82 meters -per second squared, you are now descending the Abyss. What awaits you -at the bottom will continue to be a mystery. Good-bye cruel world. -~ -71 bd 0 -D0 -~ -~ -0 -1 7109 -D1 -~ -~ -0 -1 7108 -D2 -~ -~ -0 -1 7110 -D3 -~ -~ -0 -1 7107 -D4 -~ -~ -0 -1 7113 -S -$ diff --git a/lc-mud/circle/world/wld/72.wld b/lc-mud/circle/world/wld/72.wld deleted file mode 100644 index 67b8afe91c86253192a736a13d649373330ed0e4..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/72.wld +++ /dev/null @@ -1,1834 +0,0 @@ -#7200 -The Treasury~ - You are in a small but well equipped treasury. You can see some writing -on the wall. The ceiling has a funny glow, which enables you to see. You -can get back into the inner lair through the stone door which is east. -~ -72 cd 0 -D1 -You look back through the opening into the inner lair. -~ -door stone~ -2 7205 7201 -E -door stone~ -This is a heavy black stone door it looks very solid. -~ -E -writing~ -You read the number '666'. -~ -S -#7201 -The Inner Lair~ - You are in a octagonal room with smooth purple stone walls. The floor is -made from black stone. In the western wall you see a large black stone door. -~ -72 ad 0 -D2 -You look back through the door into the lair. -~ -door wooden~ -1 -1 7202 -D3 -You see the treasury. -~ -door stone~ -2 7205 7200 -S -#7202 -The Lair~ - On the floor you see a lot of human decay, like bones and skulls. You -also see a lot of slime. On the wall is a torch sitting in its sconce. To -the north is a wooden door. -~ -72 d 1 -D0 -You can see the inner lair. -~ -door wooden~ -1 -1 7201 -D1 -You see another part of the lair. -~ -~ -0 -1 7205 -D2 -You see another part of the lair. -~ -~ -0 -1 7203 -E -skull skulls bones decay~ -On all the skulls you notice that there is a three inch hole in the -forehead. All the bones are broken and old. -~ -E -slime~ -The slime is slimy and uninteresting. -~ -E -torch sconce~ -The torch is bolted to the sconce and the sconce to the wall. -~ -S -#7203 -The Lair~ - On the floor you see a lot of human decay, like bones and skulls. You -also see a lot of slime. On the wall is a torch sitting in its sconce. -~ -72 d 1 -D0 -You see another part of the lair. -~ -~ -0 -1 7202 -D1 -You see another part of the lair. -~ -~ -0 -1 7206 -D2 -You see another part of the lair. -~ -~ -0 -1 7204 -E -skull skulls bones decay~ -On all the skulls you notice that there is a three inch hole in the -forehead. All the bones are broken and old. -~ -E -slime~ -The slime is slimy and uninteresting. -~ -E -torch sconce~ -The torch is bolted to the sconce and the sconce to the wall. -~ -S -#7204 -The Lair~ - On the floor you see a lot of human decay, like bones and skulls. You -also see a lot of slime. On the wall is a torch sitting in its sconce. -~ -72 d 1 -D0 -You see another part of the lair. -~ -~ -0 -1 7203 -D1 -You see another part of the lair. -~ -~ -0 -1 7207 -D2 -You see the lair entrance. -~ -door wooden~ -1 -1 7208 -E -skull skulls bones decay~ -On all the skulls you notice that there is a three inch hole in the -forehead. All the bones are broken and old. -~ -E -slime~ -The slime is slimy and uninteresting. -~ -E -torch sconce~ -The torch is bolted to the sconce and the sconce to the wall. -~ -S -#7205 -The Lair~ - On the floor you see a lot of human decay, like bones and skulls. You -also see a lot of slime. On the wall is a torch sitting in its sconce. -~ -72 d 1 -D2 -You see another part of the lair. -~ -~ -0 -1 7206 -D3 -You see another part of the lair. -~ -~ -0 -1 7202 -E -skull skulls bones decay~ -On all the skulls you notice that there is a three inch hole in the -forehead. All the bones are broken and old. -~ -E -slime~ -The slime is slimy and uninteresting. -~ -E -torch sconce~ -The torch is bolted to the sconce and the sconce to the wall. -~ -S -#7206 -The Lair~ - On the floor you see a lot of human decay, like bones and skulls. You -also see a lot of slime. On the wall is a torch sitting in its sconce. -~ -72 cd 1 -D0 -You see another part of the lair. -~ -~ -0 -1 7205 -D2 -You see another part of the lair. -~ -~ -0 -1 7207 -D3 -You see another part of the lair. -~ -~ -0 -1 7203 -E -bones decay~ -All the bones are broken and old. -~ -E -slime~ -The slime is slimy and uninteresting. -~ -E -torch sconce~ -The torch is bolted to the sconce and the sconce to the wall. -~ -S -#7207 -The Lair~ - On the floor you see a lot of human decay, like bones and skulls. You -also see a lot of slime. On the wall is a torch sitting in its sconce. -~ -72 d 1 -D0 -You see another part of the lair. -~ -~ -0 -1 7206 -D3 -You see another part of the lair. -~ -~ -1 -1 7204 -E -skull skulls bones decay~ -On all the skulls you notice that there is a three inch hole in the -forehead. All the bones are broken and old. -~ -E -slime~ -The slime is slimy and uninteresting. -~ -E -torch sconce~ -The torch is bolted to the sconce and the sconce to the wall. -~ -S -#7208 -The Lair Entrance~ - You are in a dry part of the sewer. To the north is a wooden door, -you can see some slime at the lower part of the door. You also see -some skulls and some broken bones. -~ -72 acd 2 -D0 -You can see the lair. -~ -door wooden~ -1 -1 7204 -D1 -You see a crawlway. -~ -~ -0 -1 7209 -E -slime~ -The slime is slimy and uninteresting. -~ -S -#7209 -The Crawlway~ - You are in a narrow crawlway. It is rather boring here. -~ -72 ad 3 -D1 -You see a four-way junction. -~ -~ -0 -1 7210 -D3 -You see the entrance to a lair. -~ -~ -0 -1 7208 -S -#7210 -The Four-Way Junction~ - You are in a sewer junction. To the north is a small hole, to the west -is a narrow crawlway and to the east and south the sewer continues. -~ -72 ad 3 -D0 -You can see a small cave-like room. -~ -~ -0 -1 7211 -D1 -You can see a sewer drain. -~ -~ -0 -1 7212 -D2 -You can see a sewer drain. -~ -~ -0 -1 7215 -D3 -You can see a narrow crawlway. -~ -~ -0 -1 7209 -S -#7211 -The Small Cave~ - You are in a collapsed sewer drain, which now is more like a small cave. -~ -72 ad 3 -D2 -You look back into the four-way junction. -~ -~ -0 -1 7210 -S -#7212 -The Sewer Drain~ - You are in a dry sewer drain which bends to the north. -~ -72 ad 3 -D0 -You can see the drain continuing north. -~ -~ -0 -1 7213 -D3 -You can see the four-way junction. -~ -~ -0 -1 7210 -S -#7213 -The Sewer Drain~ - You are in a dry sewer drain which bends to the east. -~ -72 ad 3 -D1 -You can see the drain continuing east. -~ -~ -0 -1 7214 -D2 -You can see the drain continuing south. -~ -~ -0 -1 7212 -S -#7214 -The End Of The Drain~ - You are at the end of the drain around you the sewer has collapsed, the -only exit is west. -~ -72 ad 3 -D3 -You see the sewer drain. -~ -~ -0 -1 7213 -S -#7215 -The Half-Wet Drain~ - You are in a sewer drain where the floor is covered with water. To -the north it looks more dry, south however the drain runs down into -some water. -~ -72 ad 4 -D0 -To the north lies a dry four-way junction. -~ -~ -0 -1 7210 -D2 -To the south you see a sewer drain filled with water. -~ -~ -0 -1 7216 -E -water~ -The water is dirty but it looks like you would be able to swim in it. -~ -S -#7216 -Under Water In The Sewer~ - You are swimming in some dirty water and are holding your breath. You'd -better continue onwards before you drown. It is a good thing that you can -hold your light above the water-level. -~ -72 ad 6 -D0 -It is hard to see, but it looks like the drain runs slightly upwards. -~ -~ -0 -1 7215 -D2 -It is hard to see, but it looks like the drain runs a little bit upwards. -~ -~ -0 -1 7217 -S -#7217 -The Half-Dry Drain~ - You are in a half-dry sewer drain. To the north the drain runs a little -bit downwards into some water to the east you can see a small hole. To the -west you see another drain. -~ -72 ad 4 -D0 -You see the drain running down into some water. -~ -~ -0 -1 7216 -D1 -Through the hole you can just make out a very small room. -~ -~ -0 -1 7218 -D3 -You see a drain running to the west. -~ -~ -0 -1 7219 -E -water~ -The water is dirty but it looks like you would be able to swim in it. -~ -E -hole~ -Through the hole you can just make out a very small room. -~ -S -#7218 -The Very Small Room~ - You are in a very small room, it is pretty uninteresting. -~ -72 ad 3 -D3 -Through the little hole you can see a half-dry drain. -~ -~ -0 -1 7217 -S -#7219 -A Dry Sewer Drain~ - You are in a dry but dirty sewer drain. The drain continues east and -south. -~ -72 ad 3 -D1 -You see a half-dry drain. -~ -~ -0 -1 7217 -D2 -You see another boring sewer drain. -~ -~ -0 -1 7220 -S -#7220 -A Boring Drain~ - You are in yet another sewer drain. -~ -72 ad 3 -D0 -You see a sewer drain continuing to the north. -~ -~ -0 -1 7219 -D1 -You can see another drain to the east. -~ -~ -0 -1 7221 -S -#7221 -The Sewer Drain~ - You are in a sewer drain, there is nothing special in here, except for a -loud echo. -~ -72 ad 3 -D1 -You can see another sewer drain. -~ -~ -0 -1 7222 -D3 -You can make out a sewer drain to the west. -~ -~ -0 -1 7220 -D4 -You can see a sewer line. -~ -~ -0 -1 7129 -S -#7222 -The Sewer Drain~ - You are in a drain, with some slimy water on the floor. -~ -72 ad 3 -D1 -You see a sewer bend. -~ -~ -0 -1 7223 -D3 -You see a sewer drain. -~ -~ -0 -1 7221 -E -slimy water~ -The water floats to the east from here. -~ -S -#7223 -The Sewer Bend~ - You find yourself in an ordinary sewer bend, which bends from west to -north. -~ -72 ad 3 -D0 -You see a sewer drain. -~ -~ -0 -1 7224 -D3 -You see a sewer drain. -~ -~ -0 -1 7222 -S -#7224 -The Sewer Junction~ - You stand in a junction of three sewer drains. You see some odd -scratches on the pipe wall, as if from a gigantic rat. North and -south the sewer continues as usual, but west it looks a little -strange. -~ -72 ad 3 -D0 -You see nothing but a sewer drain. -~ -~ -0 -1 7225 -D2 -You see nothing but a sewer drain. -~ -~ -0 -1 7223 -D3 -You see a strange sewer pipe. -~ -~ -0 -1 7229 -S -#7225 -The Sewer~ - You are in a sewer, where the slimy water runs down through a tiny hole. -You see some odd scratches on the pipe wall, as from a gigantic rat. There -is a sewer drain south. -~ -72 ad 3 -D2 -You see a sewer drain. -~ -~ -0 -1 7224 -S -#7229 -The Strange Sewer~ - You are in a very strange sewer indeed, there are some odd scratches on -the pipe wall, as from a gigantic rat. And you can see a lot of organic -decay like bones from animals AND humans. West the drain runs slightly -upwards. -~ -72 ad 3 -D1 -You see a sewer junction. -~ -~ -0 -1 7224 -D3 -You see a slimy sewer drain. -~ -~ -0 -1 7230 -S -#7230 -The Damp Sewer~ - You are in a sewer drain with a funny damp substance on the floor, in the -substance you see a lot of decay. You see some odd scratches on the wall, -as if from a gigantic rat. Both to the east and west the pipe seems to run -down. -~ -72 acd 3 -D1 -You see a sewer. -~ -~ -0 -1 7229 -D3 -You see a sewer. -~ -~ -0 -1 7231 -S -#7231 -The Strange Sewer~ - You are in an ordinary sewer except for a lot of scratches on the sewer -wall, and a lot of debris on the floor. -~ -72 ad 3 -D1 -You see a sewer. -~ -~ -0 -1 7230 -D3 -You see another sewer. -~ -~ -0 -1 7232 -E -debris~ -You see a lot of organic decay on the floor. -~ -S -#7232 -The Sewer~ - You are in a sewer with more scratches on the walls. And of course a whole -lot of decay. The drain runs east and north. -~ -72 ad 3 -D0 -You see yet another sewer line. -~ -~ -0 -1 7233 -D1 -You see a sewer pipe. -~ -~ -0 -1 7231 -S -#7233 -The Sewer Drain~ - You stand in a sewer drain, you are able to see some kind of cave-like -room. You see some odd scratches on the drain wall, as if from a gigantic -rat. The sewer leads south. -~ -72 ad 3 -D1 -You see a cave-like room. -~ -~ -0 -1 7234 -D2 -You see a sewer. -~ -~ -0 -1 7232 -S -#7234 -The Rat's Lair~ - You are in a little cave. You are able to see quite a lot of debris on -the floor. There is a sewer drain west of here. -~ -72 ad 3 -D3 -You see the sewer system that way. -~ -~ -0 -1 7233 -S -#7279 -The Wall Of The Abyss~ - You hang onto some steps leading down into utter darkness. There is an -exit leading up as well, though you'll have to open the tiny rock again to -do so. -~ -72 ad 5 -D4 -~ -rock~ -1 -1 7111 -D5 -~ -~ -0 -1 7299 -S -#7280 -The Entrance~ - You are in a very dark room. You notice that some faces are staring at -you from inside the walls. In the middle of the room there is a small altar. -To the north there is a small round door. -~ -72 ad 1 -D0 -A beam of red light seeps through a hole in the door. -~ -door small round~ -1 -1 7281 -D4 -~ -altar secret~ -1 -1 7116 -E -altar~ -This altar is very special. Faces appear to be smiling from it. There -is a triangle engraved in the top of it. -~ -E -triangle~ -The triangle is filled with small symbols. They seem to be a language -you have never seen before. -~ -S -#7281 -The Corridor~ - The corridor is glowing oppressively in a red hue. You can hear wailing -through an open black hole to the east. To the south there is a round door. -~ -72 d 1 -D1 -The hole seems more black than the night. It is appears to be "eating" the -red light around it. -~ -~ -0 -1 7282 -D2 -~ -door small round~ -1 -1 7280 -E -small round door~ -The door is completely round without a keyhole. -~ -E -red light~ -The red light glows from the walls. -~ -E -walls~ -The walls look alive. -~ -S -#7282 -The Realm Of Lost Souls~ - You are standing in nothing. All around you there are stars. -Sometimes a shadow flies closely by you, wailing very loudly. To -the north there is a small bright hole. To the west there is a -small red hole. -~ -72 d 0 -D0 -You look into a very bright hole. -~ -~ -0 -1 7283 -D3 -You look into a red hole. -~ -~ -0 -1 7281 -E -shadow~ -The shadow looks like a man in great pain. -~ -S -#7283 -The T-Crossing~ - You are in a small hallway. There are doors to the east and to -the west. To the south there are a black hole. There is writing -in the wall. Wails can be heard from the south. -~ -72 acd 1 -D1 -It is too dark to tell. -~ -~ -0 -1 7286 -D2 -A black hole in the wall. -~ -~ -0 -1 7282 -D3 -You can see a big fire to the west. It looks like a unhealthy -place to enter! -~ -~ -0 -1 7284 -E -writing~ -The writing says 'The one to the east, belongs to the beast. -To the west you will surely END your quest!'. -~ -S -#7284 -The Firedeath~ - This room is very hot. There are flames surrounding you. You can -see no exits at all! Skeletons are lying all over the floor. -~ -72 cd 1 -E -skeletons~ -The skeletons looks like they had suffered the death of hunger. -One of them looks like he has written something at the wall. -~ -E -writing wall~ -The writing says 'A prayer to the GODS will not be heard, though -the only exit is death... Mother, I love you'. -~ -S -#7285 -The Torture Room~ - You are standing in a middle of a square room. Along the walls skeletons -are hanging in rusty chains. In the middle of the room there is a big metal -box, covered with dust. To the south you can just make out a small exit. -~ -72 d 1 -D2 -It is too dark to tell. -~ -door iron~ -1 -1 7286 -E -skeletons~ -When you look at the skeletons, you can see that they once had been in great -pain. They are hanging in their arms, and some of them were killed with a -sharp instrument. -~ -E -big metal box~ -The metal box is covered with dust. You notice that it was once filled with -coal, as you see some small pieces of it. -~ -S -#7286 -The Hell Yard~ - You are standing in a lot of mud. A disgusting smell surrounds -the place, and makes you feel sick. Small flames sometimes shoot -up from the hot mud. To the west there is a small door. To the -north you can see an iron door. -~ -72 cd 5 -D0 -It is too dark to tell. -~ -door iron~ -1 -1 7285 -D3 -It is too dark to tell. -~ -~ -0 -1 7283 -S -#7299 -On The Walls Of The Abyss~ - You are clutching the steps on the wall so that you don't fall to the -ground down below. You cannot see anymore handholds below you and thus -this stops your journey down, as the only exit is up. -~ -72 ad 5 -D4 -~ -~ -0 -1 7279 -S -#7300 -Cave Entrance~ - You are standing in the cave entrance. It is very dark down here. There -is writing on the wall. There is an exit to the north. A stairway leads up. -~ -73 ad 1 -D0 -To the north you can see a small tunnel. -~ -~ -0 -1 7301 -D4 -You can see the stairs going up into darkness. -~ -~ -2 -1 7102 -E -writing wall~ -The writing says 'BEWARE adventurer!' -~ -S -#7301 -Cave Tunnel~ - You are walking in a tunnel. It is very cold. You can feel the presence -of a living thing... SOMEWHERE. -~ -73 ad 1 -D0 -To the north you can see the tunnel continuing. -~ -~ -0 -1 7302 -D2 -To the south tunnel continuing. -~ -~ -0 -1 7300 -S -#7302 -Cave Room~ - You are standing in a room. It is much cooler now. The walls are glowing. -~ -73 d 1 -D1 -To the east you see the tunnel going downwards. -~ -~ -0 -1 7303 -D2 -To the south you see a dark cave tunnel. -~ -~ -0 -1 7301 -D3 -~ -~ -0 -1 7321 -S -#7303 -The Cave T-Cross~ - You are standing in a mudlike substance. The smell here is awful, it is -rotten. To the west you can see some light. -~ -73 ad 2 -D1 -To the east the tunnel still goes downwards. -~ -~ -0 -1 7304 -D2 -~ -~ -0 -1 7308 -D3 -You can see some light to the west. -~ -~ -0 -1 7302 -E -mud~ -When you examine the mud, you notice small worms crawling around. -~ -E -worms~ -The worms are purple. They do not look edible. -~ -S -#7304 -The Cave Turning-Point~ - The mud is getting deeper. You are wondering, 'Would it be an idea to -leave, before I disappear?'. To the south you notice a flat round stone -is blocking the way. To the west you can see mud. -~ -73 ad 2 -D2 -You can see an opening behind the stone. -~ -stone flat round~ -1 -1 7305 -D3 -~ -~ -0 -1 7303 -E -flat round stone~ -The stone looks very uninteresting. BUT as you are about to turn away, you -see a strip of light coming through a small hole. Conclusion: The stone is -moveable. -~ -S -#7305 -The Secret Room~ - There is dust all over the place. It looks like nobody has been here -for ages. In the middle of the room you see a socket with a crystal globe. -The globe glows with a pulsing light. To the north you see a stone door. -To the south you see a grey block. -~ -73 d 1 -D0 -You see a round stone door. -~ -door round stone~ -1 -1 7304 -D2 -You see a grey block. -~ -block grey~ -1 -1 7306 -E -socket~ -The socket looks like the work of a dwarf. It is VERY beautiful. -~ -E -crystal globe~ -The crystal globe is glowing with a pulsing light. It looks like there is -smoke inside it. -~ -S -#7306 -The Mudhole~ - You are standing in a lot of mud. The mud goes to your chest. You feel -the presence of something IN the mud. The only obvious exit is to the west. -~ -73 ad 6 -D0 -You can see nothing at all. -~ -block grey~ -1 -1 7305 -D3 -~ -~ -0 -1 7307 -S -#7307 -A Tunnel~ - The mud goes to your knees. Otherwise the tunnel looks very normal. -~ -73 ad 5 -D0 -~ -~ -0 -1 7308 -D1 -You can see a mudhole. -~ -~ -0 -1 7306 -D2 -~ -~ -0 -1 7309 -S -#7308 -The Long Tunnel~ - Here there is almost no mud, as you stand at the top of a small rock. Just -beside you there are a sign which says 'WARNING! The worms are dangerous!' -~ -73 ad 1 -D0 -You can see a lot of mud... Yuck! -~ -~ -0 -1 7303 -D2 -The tunnel goes a little downwards. -~ -~ -0 -1 7307 -S -#7309 -The Hot Room~ - You are very surprised, as this room for a change are hot instead of -cold. To the north it goes downwards into some mud. There are also an -exit to the west. -~ -73 ad 1 -D0 -You see a lot of mud. -~ -~ -0 -1 7307 -D3 -You see a entrance to a small room. -~ -~ -0 -1 7310 -S -#7310 -The Small Room~ - As you look around you notice a small statue. There are exits to the west -and to the east. -~ -73 ad 1 -D1 -It is pitch dark out there. -~ -~ -0 -1 7309 -D3 -You see a VERY long hallway. -~ -~ -0 -1 7311 -E -small statue~ -This is a statue of a imp, pointing to the west. The imp looks like a man -with horns and a tail. -~ -S -#7311 -The Stalagmite Cave~ - You are standing in a stalagmite cave. Water is dripping from the walls. -It is very cold in here. -~ -73 ad 2 -D0 -~ -~ -0 -1 7314 -D1 -You see a long hallway, and some mud. -~ -~ -0 -1 7310 -D2 -~ -~ -0 -1 7312 -E -stalagmite~ -The stalagmites are very tall, and looks very beautiful. -~ -S -#7312 -The Stalagmite Tunnel~ - You has entered a small tunnel. Here it is quite dry. Maybe it would be a -good idea to rest here. -~ -73 ad 1 -D0 -You can see a small cave to the north. -~ -~ -0 -1 7311 -D3 -~ -~ -0 -1 7313 -S -#7313 -The Spongy Room~ - You definitely do NOT like this area. It is very dank, and most of the -room is wet. -~ -73 cd 3 -D1 -~ -~ -0 -1 7312 -D3 -~ -~ -0 -1 7345 -S -#7314 -The Stalagmite T-Cross~ - You are standing in a cross. To the north you can see some light. -Otherwise it is dark. -~ -73 cd 1 -D0 -You see some light ahead. -~ -~ -0 -1 7317 -D1 -~ -~ -0 -1 7315 -D2 -~ -~ -0 -1 7311 -S -#7315 -The Blind End Room~ - This room is obviously a blind end. To the north you see a primitive -picture. -~ -73 ad 1 -D0 -You see a primitive picture of some people dancing around a huge sun. The -sun is about 7 feet in diameter, which shows the size of the picture. -~ -sun~ -1 -1 7316 -D3 -~ -~ -0 -1 7314 -E -primitive picture~ -You see some people dancing around a huge sun. The sun is about 7 feet in -diameter, which shows the size of the picture. -~ -S -#7316 -The Treasure Room~ - This room is richly ornamented. The walls have been carved to show -people dancing around a moon which is drawn on the floor. It looks very -old, and it is very dusty. To the south you see the back side of a secret -door. -~ -73 adj 1 -D2 -You can see a picture with some peeple crawling around a huge moon. -~ -moon door~ -1 -1 7315 -S -#7317 -The Square Lair~ - You are standing in the south-east part of the lair. You can see a skeleton -lying in the corner. -~ -73 d 1 -D0 -Another part of the lair. -~ -~ -0 -1 7318 -D3 -Another part of the lair. -~ -~ -0 -1 7320 -D2 -~ -~ -0 -1 7314 -E -skeleton~ -It looks like a adventurer who wasn't lucky. You'd better watch out... -~ -S -#7318 -The Square Lair~ - You are standing in the north-east part of the lair. -You see a sign on the wall. -~ -73 ad 1 -D1 -You see a wooden door. -~ -door wooden~ -1 -1 7321 -D2 -Another part of the lair. -~ -~ -0 -1 7317 -D3 -Another part of the lair. -~ -~ -0 -1 7319 -E -sign wall~ -The sign says 'Gods of War I call you, my sword is by my side, - I seek a light free from all false pride' - Reyemle Grug... -~ -S -#7319 -The Square Lair~ - You are standing in the north-west part of the lair. Here there is another -sign. There is an exit from the lair to the north. -~ -73 ad 1 -D0 -You see a small tunnel leading north. -~ -~ -0 -1 7322 -D1 -Another part of the lair. -~ -~ -0 -1 7318 -D2 -Another part of the lair. -~ -~ -0 -1 7320 -E -sign~ -The sign says 'I'm wandering around in a everlasting tale, - seeking the light to regain my pride - Corama... -~ -S -#7320 -The Lair End~ - You can see a table in front of you. It is very dusty. Five skeletons are -sitting around the table. Exits are north and east. -~ -73 ad 1 -D0 -The northern part of the lair. -~ -~ -0 -1 7319 -D1 -The eastern part of the lair. -~ -~ -0 -1 7317 -E -table~ -On the table there is dust, in the center there is a small statue of a -Dragon sleeping. -~ -E -skeleton skeletons~ -They've obviously been killed somehow, but it doesn't look like it was by -sword or club. -~ -E -dragon statue~ -It looks like a silver dragon. It is nailed onto the table. The dragon sits -on a red dragon that looks dead. But the eyes of the red dragon are glowing, -pulsating red. You feel drained. -~ -S -#7321 -The East Tunnel~ - You are standing in dark tunnel, the exits are east and west. To the west -you see a wooden door. -~ -73 cd 1 -D3 -You can see a wooden door. -~ -door wooden~ -1 -1 7318 -D1 -You can see a muddy tunnel. -~ -~ -0 -1 7302 -S -#7322 -The North Tunnel~ - You are standing in a dark tunnel, it leads upwards. -~ -73 ad 1 -D0 -The dark tunnel continues. -~ -~ -0 -1 7323 -D2 -You can see the lair. -~ -~ -0 -1 7319 -D3 -You can see a cave entrance. -~ -~ -0 -1 7336 -S -#7323 -The L-Shaped Room~ - You are standing in deep darkness. To the south there is a small exit. -To the east you can see a gaping hole. -~ -73 ad 1 -D1 -~ -~ -0 -1 7324 -D2 -~ -~ -0 -1 7322 -S -#7324 -The Circular Hall~ - You are standing in round hall. To the north, east and south you can see -a stone head hanging on the walls. -~ -73 ad 1 -D0 -You see a red dragon's head hanging on the wall. -~ -head red~ -2 0 7324 -D1 -You see a green dragon's head hanging on the wall. -~ -head green~ -1 -1 7325 -D2 -You see a blue dragon's head hanging on the wall. -~ -head blue~ -2 0 7324 -D3 -You see a room far away. -~ -~ -0 -1 7323 -E -head heads~ -When you study the faces of the heads you see that they are faces of dragons. -The face to the north is red, the face to the east is green, and the face to -the south is blue. -~ -E -green~ -This looks like an evil dragon. -~ -E -red~ -This looks like a neutral dragon. -~ -E -blue~ -This looks like a good dragon. -~ -S -#7325 -A Dusty Tunnel~ - You are standing in dust. This place has not been touched for a long time. -Otherwise it is quite boring here, looks like a place to rest! To the west -you see the outline of a door. A tunnel leads to the east. -~ -73 cd 1 -D1 -You see a tunnel which leads downwards. It is quite dark. -~ -~ -0 -1 7326 -D3 -You can see the outline of a door. Just like in the description! -~ -door~ -1 -1 7324 -S -#7326 -The Crossing~ - You are standing in a crossing of hallways. You can leave this place -in every direction, except up and down. In the dust you notice strange -footprints. -~ -73 ad 1 -D0 -~ -~ -0 -1 7331 -D1 -~ -~ -0 -1 7330 -D2 -~ -~ -0 -1 7327 -D3 -~ -~ -0 -1 7325 -E -footprints foot~ -You have never seen this kind of footprint before! -~ -S -#7327 -The L-Shaped Room~ - You are standing in a L-shaped room. You can hear noises from the long -tunnel to the east. You feel very afraid! -A sign is hanging on the wall. -~ -73 ad 2 -D0 -~ -~ -0 -1 7326 -D1 -~ -~ -0 -1 7328 -E -sign~ -The sign says: - -DANGER!! - -~ -S -#7328 -The Dragon's Lair~ - You can see burned walls, the floorstones are fiery red. All kinds -of bones are scattered all over the floor. On the walls you can see -some burned shapes. You smell burnt flesh. Two creatures are half -melted into the floor. -~ -73 d 2 -D0 -You can see a long tunnel. -~ -~ -0 -1 7329 -D3 -You can see nothing but darkness. -~ -~ -0 -1 7327 -S -#7329 -The Burnt Room~ - You are in a room, which once has at one time been quite burnt. There -is writing on the wall. -~ -73 ad 1 -D2 -You can see a red glow... -~ -~ -0 -1 7328 -D3 -~ -~ -0 -1 7330 -E -writing~ -The writing says: - - DANGER - -~ -S -#7330 -The Windy Tunnel~ - You are standing in a tunnel. Above you, you can feel a breeze. -~ -73 ad 1 -D1 -It is too dark to tell. -~ -~ -0 -1 7329 -D3 -~ -~ -0 -1 7326 -E -breeze~ -The breeze comes from a hole above you. NO way to get up there. -~ -S -#7331 -The Glittering Room~ - This room is very bright. On the walls you can see some silver. Exits -are west, east and south. -~ -73 d 1 -D1 -~ -~ -0 -1 7332 -D2 -~ -~ -0 -1 7326 -D3 -~ -~ -0 -1 7333 -E -glitter walls silver~ -The glittering silver looks like it is INSIDE the walls. -~ -S -#7332 -The Secret Passageway~ - You have entered a tiny room. There is only an exit to the west. -~ -73 ad 1 -D3 -You can see a light to the west. -~ -~ -0 -1 7331 -S -#7333 -The End Of Long Tunnel~ - You are at a end of a long tunnel. Right in front of you, you can see a -grey mass. To the east you can see a tremendously long tunnel, but you know -that, you were just there. -~ -73 ad 5 -D1 -A long tunnel. JUST like in the description! -~ -~ -0 -1 7331 -D3 -A grey mass is blocking the way. -~ -mass grey~ -1 -1 7334 -E -grey mass~ -The mass is nothing but a mass, but it is quite suspicious! -~ -S -#7334 -The Stair-Room~ - You are standing in a small room. Drawings of faces in pain are on the -walls. You can feel that darkness is ruling the place. There is one exit: -south. -~ -73 ad 1 -D2 -Nothing but darkness... -~ -~ -0 -1 7335 -S -#7335 -A Dark Tunnel~ - You are standing in a dark tunnel. It continues to the north and to the -south. Bones are spread on the floor. -~ -73 ad 1 -D0 -~ -~ -0 -1 7334 -D2 -~ -~ -0 -1 7336 -E -bones bone~ -It looks like bones of a human. -~ -S -#7336 -The Entrance To The Lair~ - The smell here is awful. To the south you can see some smoke. A tunnel -leads north and east. -~ -73 acd 2 -D0 -~ -~ -0 -1 7335 -D2 -The only thing you can see is smoke. -~ -~ -0 -1 7337 -D1 -A small cave is to the east. -~ -~ -0 -1 7322 -S -#7337 -The North-Eastern Part Of The Basilisk's Cave~ - It is hard to see here because of the smoke. To the north you can barely -see a small tunnel. Other exits are to the south and to the west. -~ -73 ad 2 -D0 -~ -~ -0 -1 7336 -D2 -~ -~ -0 -1 7338 -D3 -~ -~ -0 -1 7339 -S -#7338 -The South-Eastern Part Of The Basilisk's Cave~ - There is a very small hole in wall from which the smoke is coming from. -Otherwise it is pitch black. Exits are north and west. -~ -73 ad 2 -D0 -You can see nothing but smoke. -~ -~ -0 -1 7337 -D3 -You can see nothing but smoke. -~ -~ -0 -1 7340 -E -hole small~ -It seems to be a small hole, about one foot in diameter. -~ -S -#7339 -The North-Western Part Of The Basilisk's Cave~ - You can see some hay spread on the floor. The smell is awful here, and it -makes you feel sick. This place where the Basilisk sleeps. Watch out... -maybe it is not far from here... -~ -73 ad 2 -D1 -~ -~ -0 -1 7337 -D2 -~ -~ -0 -1 7340 -E -hay~ -The hay is very dirty. The smell of it makes you feel sick. -~ -S -#7340 -The South-Western Part Of The Basilisk's Cave~ - You can see nothing but smoke. -~ -73 ad 5 -D0 -~ -~ -0 -1 7339 -D1 -~ -~ -0 -1 7338 -D2 -~ -~ -0 -1 7341 -S -#7341 -The Small Cave~ - You are standing in small cave. You can see some light at the end. Exits -are north and south. -~ -73 acd 2 -D0 -You can see only smoke. -~ -~ -0 -1 7340 -D2 -You can see a blue glow. And you feel a fresh breeze... ahhhh... -~ -~ -0 -1 7342 -S -#7342 -The Northern End Of The Pool~ - You have wet feet, you are standing in water. The water looks calm. You -can see that it is a big lake. Light seeps from the water. -~ -73 d 4 -D0 -You can see a small cave. -~ -~ -0 -1 7341 -D1 -You can see more water. -~ -~ -0 -1 7343 -D2 -You can see water. -~ -~ -0 -1 7344 -S -#7343 -The Pool~ - You are swimming in water. It is getting deep here. It is also dark in -this end. -~ -73 ad 6 -D2 -You can see some bubbles in the water. -~ -~ -0 -1 7345 -D3 -You see calm water. -~ -~ -0 -1 7342 -S -#7344 -The South End Of The Pool~ - You standing in water up to your neck! You can only see water. -~ -73 d 5 -D0 -You can see calm water. -~ -~ -0 -1 7342 -D1 -To dark to tell, but you can feel something nearby. -~ -~ -0 -1 7345 -S -#7345 -The Pool~ - You are swimming in DARKNESS. You feel something touching your right leg. -~ -73 ad 6 -D0 -To dark to tell. -~ -~ -0 -1 7343 -D1 -You can feel a warm breeze. -~ -~ -0 -1 7313 -D3 -~ -~ -0 -1 7344 -S -$ diff --git a/lc-mud/circle/world/wld/79.wld b/lc-mud/circle/world/wld/79.wld deleted file mode 100644 index b1b796c2119f7bfe9a8f31de17e3d66d19e00a0d..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/79.wld +++ /dev/null @@ -1,494 +0,0 @@ -#7900 -Outside Redferne's Residence~ - A huge cloud forms the plateau on which you are now standing. The -wind here is absolutely quiet and the sun is shining warmly upon you. -From under the cloud you can hear the faint sounds of Midgaard. Right -before you to the north lies the grand Mansion of Naris. -~ -79 cj 0 -D0 -You see an enormous arched gate leading into this magnificent building. -~ -gate huge arched~ -2 7901 7901 -D5 -You see a Huge Chain that anchors the Mansion of Naris to the ground. -~ -~ -0 -1 7918 -S -#7901 -The Southern End Of The Hall~ - You are standing in a vast hall that is dimly lit, but wherever the -light comes from, is a mystery. The walls seem to radiate warmth and -give the pleasent feeling of being welcome here. A large portrait is -hanging on one of the walls. A large wooden staircase leads up into -the tower. To the east there is a high passage away from the hall. -This ends shortly after by a tall oak door. The enormous hall extends -further north from here. To the south you can see a huge, and VERY -heavy-looking iron-wrought door. It looks like this is the only exit -from this magnificent old house. -~ -79 cdj 0 -D0 -The hallway continues that way. You can see more doorways under the -wooden staircase in that direction. -~ -~ -0 -1 7904 -D1 -You see a tall oak door there. It looks quite tightly closed to you. -On it little runes are chiselled into the wood. -~ -door oak tall~ -1 -1 7910 -D2 -Here you see a REAL door. It would be more proper to call this a -'GATE', rather than a 'door'. It is really HUGE! On it hangs a -large sign with very large letters spelling: - - EMERGENCY EXIT - -~ -gate iron huge~ -2 7901 7900 -D3 -This looks like a 'door' in the meaning of the word. The ashen wood -is painted in a peculiar yellow color. Small letters are written -with black on it. -~ -door ashen ash yellow~ -1 -1 7902 -D4 -You see the staircase extending upwards into the very high tower. -It ends in what seems like a large bedroom up there. -~ -~ -0 -1 7909 -E -runes~ -These runes are utterly strange to you, but you are in luck today: -Under the runes you can just make out a sentence in Common. It -reads: - -Stay out, if you treasure your life. That is if you are mortal. - -~ -E -letters~ -They read: - - LIBRARY - -~ -S -#7902 -Redferne's Library~ - This is truly a magnificent place! Books and scrolls lie together -on every shelf. A large globe, with the map of the world upon it, -stands in the dimly lit north-western corner of the room. Two large -and comfortable looking leather armchairs adorn the center of the -library together with a huge oak desk. Dim light radiates from an -enormous crystal chandelier hanging down from the ceiling approximately -10 feet off the floor. To the east there is a great old ashen door. A -large glass window is set in the west wall. -~ -79 cdj 0 -D1 -You can see an old ashen door, painted in a peculiar yellow color. -~ -door ash ashen~ -1 -1 7901 -E -globe world map~ -You see a large world map stretch out on the enormous globe. It has towns -drawn in every spot available for such. In the middle of the map you can -spot a large town with the name 'MIDGAARD' written over it. The rest is -mountains, woods, plains and water. -~ -E -midgaard town city~ -You see a small speck with woods on the west from it, plains to the east -from it and mountains to the north from it. To the east of it you can -see a thin trail lead to a large castle. Finally you notice a rather -large river pour in from the east and go through Midgaard in the middle. -~ -E -chairs leather armchairs chair armchair~ -These two chairs are exactly alike one another. They look incredibly -comfortable. They are both made from old leather, and yet they seem -so worn that they can be nothing but a perfect place for a long needed -rest. -~ -E -window glass~ -These windows are really BIG! They reach from about 20 inches above the -floor to approximately 10 inches under the ceiling. If you try and -'look out', you might see what might lie beyond these windows. -~ -E -out outside beyond~ -The clouds muster and form the ground on which this entire building is set. -Through the thinnest of the clouds you can just make out Midgaard with all -of its magnificent activity. -~ -E -river~ -You see a large and winding river cut through the landscape, starting at an -enormous inland lake, it seeps through Midgaard and finally ends up in the -Grand Sea on the west coast of the land. -~ -S -#7903 -The Artifact Room Of Naris~ - This is gloomy and dark room with only a faint light radiating from the -walls. A bunch of funny-looking items fill the center of the room. There -is no furniture here what-so-ever. The only way out seems to be west, -through the low steel door. -~ -79 cdj 0 -D3 -You see only the back of a safe's steel door. -~ -door steel safe~ -2 7900 7910 -S -#7904 -The Northern End Of The Hall~ - You are standing in the northern end of the huge hall. This part is -under the grand wooden staircase so the light seems to be a little less -bright here, but this doesn't affect your sight at all. To the north -lies the kitchen. To the south lies the southern end of the hall. To -the east there is a huge metal door. To the west there is a large -aspenwood door. -~ -79 cdj 0 -D0 -~ -~ -0 -1 7906 -D1 -You see a huge metal door. From it a foul stench emanates. The smell is -the most awful experience in your entire life. A thought seeps through this -terrible stench and into your mind: 'Monsters', you feel BAD about opening -that door. -~ -door metal huge~ -2 -1 7913 -D2 -The rest of the hall lies in that direction, and so does the exit. -~ -~ -0 -1 7901 -D3 -The door has 'SITTING ROOM' written on it. It is made from Aspenwood and -is beautifully carved with small elves as main issue of sculpture. -~ -door aspen wood~ -1 -1 7905 -S -#7905 -The Sitting Room Of Naris~ - You are standing in the middle of a really comfortable place. The -walls are decorated with paintings of smiling Kings and Queens. The -most attractive picture is one of a Prince in shining armour. By one -of the walls there is an old armchair. The only exit is through the -aspenwood door to the east. -~ -79 cdj 0 -D1 -The door seems to be a very HEAVY door, carved completely from the trunk of -an Aspen tree. -~ -door aspen heavy~ -1 -1 7904 -E -chair armchair~ -This is truly a wonderful relic of the past. In it is a large cushion. -~ -S -#7906 -The Kitchen Of Naris~ - This must be the place of food and drink. You can hear the faint noise -of rats feasting on meat and bread from somewhere undeterminable. The sound -makes you feel the agony of HUNGER. The only visible exit is south to the -Northern end of the hall. -~ -79 cdj 0 -D0 -It is dark in there. But the sounds from there are unmistakable. The rats -are here for your information. -~ -larder wooden cupboard~ -1 -1 7907 -D1 -You can see the fridge from here. There are drinks all over the place. -~ -fridge~ -1 -1 7908 -D2 -You can see the northern end of the hall. -~ -~ -0 -1 7904 -S -#7907 -The Larder~ - You can see food all over. Among the heaps of food you notice HUGE rats -scuttling around, nibbling pieces off the heaps here and there. -~ -79 cdj 0 -D2 -~ -door wooden larder~ -1 -1 7906 -S -#7908 -The Fridge~ - This place is LOADED with drink, water and booze. -~ -79 cdj 0 -D3 -~ -door fridge~ -1 -1 7906 -S -#7909 -On The Stairs~ - You can see up and down the stairway. It seems to take forever, either -going up OR down. It is just a seemingly insurmountable climb, either way. -Up is the bedroom of Redferne, and down leads to the southern end of the -hall. -~ -79 cdj 0 -D4 -~ -~ -0 -1 7911 -D5 -~ -~ -0 -1 7901 -S -#7910 -The Treasure Room~ - This place is gloomy. A HUGE safe is cemented into the west wall. The -only visible exit is west, through the oak door. -~ -79 cdj 0 -D1 -~ -safe steel~ -2 7900 7903 -D3 -You see a tall oak door. -~ -door oak tall~ -1 -1 7901 -S -#7911 -Redferne's Bedroom~ - This is a snugly set bedroom with all the necessities for a romantic -evening. A large fireplace adorns the east wall, and sizzling away is -the wood that is ablaze within. The bed is enormous, covering at least -HALF of this great room. The room stretches at least 140 feet, so can -you imagine the BED? A large staircase leads down to the hall. A couple -of doors open up to a broad balcony to the south. -~ -79 cdj 0 -D2 -The sun seems to shine out there, warmly and comforting. -~ -doors~ -1 -1 7912 -D5 -~ -~ -0 -1 7909 -S -#7912 -Redferne's Balcony~ - You see a splendid of the most of this world. The valleys stretch as -far as the eye reaches to the south from here. Down below you can see -the entrance of this magnificent building. To the north are the doors -to Redferne's bedroom. -~ -79 cj 0 -D0 -You see the comfortable bedroom of Naris. -~ -doors~ -1 -1 7911 -D5 -You see the ground on which this castle is set. Funnily it seems to you -that it is no more than clouds. -~ -~ -0 -1 -1 -S -#7913 -The Monster Pen~ - This looks like the cage in which a large carnivore is being kept. -Judging by the state the walls are in, this could very well be a large -AGGRESSIVE animal. This makes you pretty insecure, this stating your -feeling about the place quite mildly. -~ -79 dj 0 -D3 -This looks like the only exit from here. -~ -door cage metal pen~ -1 -1 7904 -S -#7914 -On The Huge Chain~ - This place has quite a good view over Midgaard. Your possibilities of -movement seem to extend only to the up and down directions. Unless you -want to let go of the secure and seemingly unmovable chain, then those are -the directions you should take from here. -~ -79 c 5 -D4 -Upwards, you see the chain disappearing into the clouds above. -~ -~ -0 -1 7915 -D5 -Down below, you see the huge chain anchored to the ground at the Road -Crossing of southern Midgaard. -~ -~ -0 -1 3120 -S -#7915 -The Chain Where It Is Too Windy~ - Hanging on to the chain you figure out that there is no way of leaving -down from here. The wind pulls you from left to right and back. This -seems like a totally impossible task. The ascend is the only way ahead -for you. Otherwise you would risk death by falling to the hard ground -below. DO NOT DESCEND NOW OR YOU WILL SURELY DIE!!!! -~ -79 c 5 -D4 -That way seems to be the only way away from here. -~ -~ -0 -1 7916 -D5 -THAT WAY IS CERTAIN DEATH!!!! You can see the wind tearing at the chain -down below you. It swings like a furious serpent from side to side! The -descent is ABSOLUTELY out of the QUESTION. -~ -~ -0 -1 7920 -S -#7916 -On The Great Chain Of Naris~ - You are approximately on the middle of the treacherous Chain. One false -step and death will come and collect you quickly. The chain leads upwards -and down. No way are you going to descend now... You've only just begun -your climb. Besides it could cost you your life. Look down and you'll -see why. -~ -79 c 5 -D4 -There seems to be only one way from here and that's up. -~ -~ -0 -1 7918 -D5 -The chain down there is swinging wildly back and forth. Going down there -will be pretty risky! -~ -~ -0 -1 7915 -S -#7917 -The Chain~ - As you descend, the chain seems to absorb all weather around it, making -it swing less and less in the very powerful wind tearing at it. The Chain -seems to chuckle quietly, and as you descend further you hear a soft whisper -originating from within the Chain *ITSELF*. It says 'Welcome back some -other time, stranger. Your company is always... hmmm... interesting. God -Speed.' The chain extends further down through the now spreading clouds. -~ -79 c 5 -D4 -It seems to you that the Chain is dissolving again. Maybe it is just an -illusion, but still... -~ -~ -0 -1 -1 -D5 -That way seems safe enough... now. -~ -~ -0 -1 7914 -S -#7918 -The Mighty Chain Of Naris~ - This place truly a splendid view of the WHOLE COUNTRY SIDE! A magnificent -light shines upon you and the way up through the clouds is opened. Up there -you can now see the Mansion of Naris, Residence of the Greater God Redferne. -The chain beneath you seems to evaporate in the mustering clouds that -surround you by now. -~ -79 c 5 -D4 -You see the sunny top of the clouds. Beyond these, the Mansion towers before -your eyes. Beautiful!! -~ -~ -0 -1 7900 -D5 -You see nothing but the thick clouds. They've closed completely around the -Chain. -~ -~ -0 -1 7917 -S -#7920 -The Free Fall From The Chain~ - This is probably the third worst place to be in this entire MUD right -now. You fall -. -. -. -and fall -. -. -. -and fall -. -. -. -and HIT THE GROUND WITH SUCH A *SPLUTCH* that you die horribly, but instantly. -Good-bye cruel world. -~ -79 bd 0 -D0 -~ -~ -0 -1 7914 -D1 -~ -~ -0 -1 7915 -D2 -~ -~ -0 -1 7916 -D3 -~ -~ -0 -1 7917 -D4 -~ -~ -0 -1 7918 -D5 -~ -~ -0 -1 3120 -S -$ diff --git a/lc-mud/circle/world/wld/9.wld b/lc-mud/circle/world/wld/9.wld deleted file mode 100644 index 8c492a4bbc02ed9ca0c211ce710d8634d307168c..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/9.wld +++ /dev/null @@ -1,398 +0,0 @@ -#900 -On The Swift Flowing River~ - As the river exits the city of Midgaard it picks up speed and whisks -you along high banks flanked by the trees of Haon-Dor. As the city -fades in the east, you approach a gloomy forest to the west. -~ -9 0 7 -D1 -~ -~ -0 -1 3200 -D3 -~ -~ -0 -1 901 -S -#901 -The Riverbank~ - The river is deep, and runs swiftly in an east-west direction. To the -north the river eddies and enters a backwash where a small bank extends -down from a dark, thick stand of trees. It doesn't look particulary -inviting however. -~ -9 0 7 -D0 -~ -~ -0 -1 6120 -D1 -~ -~ -0 -1 900 -D3 -~ -~ -0 -1 902 -S -#902 -The Twisty Part Of The River~ - The river twists and turns and nearly tosses you out of your boat. -The water is dark, cold, almost reptilian in sheen. It seems almost -alive. The river runs east and south. -~ -9 0 7 -D1 -~ -~ -0 -1 901 -D2 -~ -~ -0 -1 903 -S -#903 -The Scenic Route~ - The dark forest of Haon-Dor recedes behind you to the northeast. -The river continues in a westerly direction toward the river delta, -where you can just make out a large island. -~ -9 0 7 -D1 -~ -~ -0 -1 902 -D3 -~ -~ -0 -1 904 -S -#904 -The Swift River Delta~ - You are at the edge of the river delta, where the river empties -out on its way to the sea. The water here is Black. Deep. Dark. -Deadly. The tidal waves sweep you around and around up and down. -~ -9 0 7 -D0 -~ -~ -0 -1 911 -D1 -~ -~ -0 -1 903 -D2 -~ -~ -0 -1 906 -D3 -~ -~ -0 -1 905 -S -#905 -Near The Rocks~ - You bob up and down in the waves comming dangerously close to some -large, jagged rocks on the eastern shore of an unusual looking island. -There is no way you could possibly land there without getting killed. -~ -9 0 7 -D1 -~ -~ -0 -1 904 -D2 -~ -~ -0 -1 906 -S -#906 -The South River Delta~ - You are making your way along a channel in the river delta between -the island to the west and the shore to the south and east. To the -south an aging broken down looking pier juts out from land and toward -the west the channel works it way close to the island as it moves around -its southern tip. -~ -9 0 7 -D0 -~ -~ -0 -1 905 -D1 -~ -~ -0 -1 904 -D2 -~ -~ -0 -1 907 -D3 -~ -~ -0 -1 908 -S -#907 -The Pier~ - You float next to a crumbling pier long since neglected. -To the west the water gets sluggish and there are many weeds and -some seaweed floating about. -~ -9 0 7 -D0 -~ -~ -0 -1 906 -D3 -~ -~ -0 -1 908 -S -#908 -Mired In Seaweed~ - The going is rough here. The tide struggles with the normal flow -of the river and here near the edge of the sea there is a large -amount of growth. To the west the channel passes the southern tip of -the island and heads for open waters. -~ -9 0 7 -D0 -~ -~ -0 -1 906 -D1 -~ -~ -0 -1 907 -D3 -~ -~ -0 -1 909 -S -#909 -The Last Stop~ - The delta meets the sea here. To the west you see nothing but -ocean on the horizon. Sea birds squawk noisily at your approach -and take flight from a nearby beach head on the island. It looks -as though this could be the last stop for those heading out to sea. -~ -9 0 7 -D0 -~ -~ -0 -1 910 -D1 -~ -~ -0 -1 908 -S -#910 -The Beach Head~ - This is a secluded looking beach on the southern tip of the island. -There isn't much to see here and there is no way to cross the steep -rocky cliffs that wall in this place. -~ -9 0 2 -D2 -~ -~ -0 -1 909 -S -#911 -The North Channel~ - The river splits as runs up against the island and a navigatble -channel slips off to the north and west. -~ -9 c 7 -D0 -~ -~ -0 -1 912 -D2 -~ -~ -0 -1 904 -D3 -~ -~ -0 -1 912 -S -#912 -The North Channel~ - The river current carries you swiftly westward as the channel -begins to narrow as it squeezes past the north end of the island. -~ -9 0 7 -D1 -~ -~ -0 -1 911 -D2 -~ -~ -0 -1 911 -D3 -~ -~ -0 -1 913 -S -#913 -Near The Isle~ - You are sitting just off a small landing on the island that -appears to be nothing more than a short path that leads to the -side of a hill. -~ -9 c 7 -D1 -~ -~ -0 -1 912 -D2 -~ -~ -0 -1 914 -S -#914 -The Lane Of The Lying~ - Bodies lie everywhere. Commoner, peasant, duke, duchess. The Gods -will not hear you call here. Hence they will not answer you. To the -south the path ends at a dark cave entrance. -A sign has been posted beside the entrance. -~ -9 0 1 -D0 -~ -~ -0 -1 913 -D2 -~ -~ -0 -1 915 -E -sign cave~ -A sign beside the dark cave opening reads: - - WARNING! Only fools and dead people pass this way. - The tests of Minos, our glorious ruler, await. - -~ -S -#915 -The First Trial Of Minos~ - Ah... you find yourself in Minos' battlefield playground. -Minos loves to torture his people through these places. He -collects the monsters of the world and puts them here. -~ -9 ad 1 -D1 -~ -~ -0 -1 916 -S -#916 -The Second Trial Of Minos~ - Minos' voice reveberates from the four walls of this room: -'Get some rest and make sure you're healed. You'll need it for -the next monster in my playground. Or are you strong enough?' - To the south is the entrance to the next challenge of Minos' -stronghold. -~ -9 ad 1 -D2 -~ -~ -0 -1 917 -S -#917 -The Third Trial Of Minos~ - You go inside a red room. Very red. As if the Minos King used -them to disembowel his guests. The path continues eastward. You -see blue lights in that direction. -~ -9 ad 0 -D1 -~ -~ -0 -1 918 -S -#918 -The Fourth Trial Of Minos~ - Minos must be a monster hacking machine. You see a blue light -flicker on and off. A voice crackles, 'WHY ARE YOU HERE!' -~ -9 ad 0 -D2 -~ -~ -0 -1 919 -S -#919 -The Fifth Trial Of Minos~ - This is General Woundwort's quarters. Hraka abound. The frayed -corpses of rabbits lie scattered about this hell-hole. The General -is not a very neat person as you can tell. -~ -9 ad 0 -D1 -~ -~ -0 -1 920 -S -#920 -The Sixth Trial Of Minos~ - Dare we surmise how many more rooms Minos has? The paths appear to be -endless. You shudder the sounds of death cries from the east. A loud -voice bellows another warning: 'Leave now or face my wrath!' -There is a crawlway leading upwards at the far end of the room and -there is a fresh breeze comming from there. -~ -9 ad 0 -D2 -~ -~ -0 -1 921 -D4 -~ -~ -0 -1 923 -S -#921 -The Final Trial Of Minos~ - This is Minos' room. What else did you expect? The room is lavishly -decorated for this bovine king. Everything is so opulent that it makes -your eyes bulge. Survive and reap his fortune! The only exit is a large -oak door in the east wall. -~ -9 ad 0 -D1 -You see a rather large oak door bound with iron and securely locked. -~ -door oak~ -2 900 922 -S -#922 -The Royal Chamber~ - The treasure room of Minos is dark save for your lantern. -Hopefully it has not been looted yet by the many legendary thieves -of Midgaard. A clever looking secret passage leads upward from here. -~ -9 adj 0 -D4 -~ -~ -0 -1 910 -S -#923 -Above, On The Beach~ - You sit amongst the rocks above a small beach at the southern -end of the island. You could clamber down easy enough, but getting -back up would be another story. -~ -9 0 4 -D5 -~ -~ -0 -1 910 -S -$ diff --git a/lc-mud/circle/world/wld/index b/lc-mud/circle/world/wld/index deleted file mode 100644 index 311fd86da1c44ee9e674b2c4faedbcdc47a7f9fb..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/index +++ /dev/null @@ -1,31 +0,0 @@ -0.wld -9.wld -12.wld -15.wld -25.wld -30.wld -31.wld -33.wld -35.wld -36.wld -40.wld -50.wld -51.wld -52.wld -53.wld -54.wld -60.wld -61.wld -62.wld -63.wld -64.wld -65.wld -70.wld -71.wld -72.wld -79.wld -120.wld -150.wld -186.wld -$ - diff --git a/lc-mud/circle/world/wld/index.mini b/lc-mud/circle/world/wld/index.mini deleted file mode 100644 index 7ccec458c41fd92704397253c049274a2e1f199b..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/wld/index.mini +++ /dev/null @@ -1,4 +0,0 @@ -0.wld -12.wld -30.wld -$ diff --git a/lc-mud/circle/world/zon/0.zon b/lc-mud/circle/world/zon/0.zon deleted file mode 100644 index 518e081b22e52b79e903ed0bd37ebf2796fc9f34..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/0.zon +++ /dev/null @@ -1,9 +0,0 @@ -#0 -Limbo - Internal~ -0 99 10 2 -* -* Mobiles -M 0 1 1 1 Puff -* -S -$ diff --git a/lc-mud/circle/world/zon/12.zon b/lc-mud/circle/world/zon/12.zon deleted file mode 100644 index cd5ad66e99bd7e910753beef2dee7aeaeda9f379..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/12.zon +++ /dev/null @@ -1,21 +0,0 @@ -#12 -God Simplex~ -1200 1299 10 2 -* -* Edited and added to by Taz of Tazmania -* -* Mobiles -M 0 1201 1 1205 Immortal Postman -M 0 1200 1 1201 Immortal Innkeeper -M 0 1202 2 1201 Wandering Spirit -M 0 1202 2 1200 Wandering Spirit -* Boards -R 0 1206 3096 -O 0 3096 5 1206 Social Bulletin Board -O 0 3097 1 1202 Frozen Bulletin Board -O 0 3098 1 1204 Immort Bulletin Board -R 0 1203 3099 -O 0 3099 2 1203 Mortal Bulletin Board -* -S -$ diff --git a/lc-mud/circle/world/zon/120.zon b/lc-mud/circle/world/zon/120.zon deleted file mode 100644 index eab238d32d9ee466746828fa90880c4082e93bbf..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/120.zon +++ /dev/null @@ -1,279 +0,0 @@ -#120 -Rome~ -12000 12099 45 2 -* -* Created by Onivel of Jedi -* -* Mobiles -M 0 12000 3 12001 Adjudicator -E 1 3022 100 16 Long Sword -E 1 3042 100 11 Shield -M 0 12000 3 12001 Adjudicator -E 1 3022 100 16 Long Sword -E 1 3042 100 11 Shield -M 0 12000 3 12001 Adjudicator -E 1 3022 100 16 Long Sword -E 1 3042 100 11 Shield -M 0 12001 1 12001 Scorekeeper -E 1 3021 100 16 Small Sword -E 1 3042 100 11 Shield -M 0 12003 10 12003 Spectator -M 0 12003 10 12004 Spectator -M 0 12003 10 12008 Spectator -M 0 12003 10 12022 Spectator -M 0 12003 10 12023 Spectator -M 0 12003 10 12003 Spectator -M 0 12003 10 12004 Spectator -M 0 12003 10 12008 Spectator -M 0 12003 10 12022 Spectator -M 0 12003 10 12023 Spectator -M 0 12004 3 12002 Nobleman -E 1 3042 100 11 Shield -E 1 3022 100 16 Long Sword -G 1 12033 1 Key To Judge's Booth -M 0 12004 3 12028 Nobleman -E 1 3022 100 16 Long Sword -E 1 12001 3 13 Bronze Belt -M 0 12004 3 12043 Nobleman -E 1 3022 100 16 Long Sword -E 1 12000 5 1 Pewter Ring -M 0 12005 5 12021 Slave -E 1 3023 100 16 Club -M 0 12005 5 12021 Slave -E 1 3023 100 16 Club -M 0 12005 5 12021 Slave -E 1 3023 100 16 Club -M 0 12005 5 12006 Slave -E 1 3023 100 16 Club -M 0 12005 5 12049 Slave -E 1 3023 100 16 Club -M 0 12006 5 12010 Gladiator -E 1 3022 100 16 Long Sword -M 0 12006 5 12010 Gladiator -E 1 3022 100 16 Long Sword -M 0 12006 5 12010 Gladiator -E 1 3022 100 16 Long Sword -M 0 12006 5 12009 Gladiator -E 1 3022 100 16 Long Sword -M 0 12006 5 12009 Gladiator -E 1 3022 100 16 Long Sword -E 1 12002 2 6 Roman Helmet -M 0 12007 4 12016 Chariot Driver -E 1 3021 100 16 Small Sword -E 1 12008 100 8 Leather Sandals -M 0 12007 4 12009 Chariot Driver -E 1 3021 100 16 Small Sword -E 1 12008 100 8 Leather Sandals -M 0 12007 4 12016 Chariot Driver -E 1 3021 100 16 Small Sword -E 1 12008 100 8 Leather Sandals -M 0 12007 4 12016 Chariot Driver -E 1 3021 100 16 Small Sword -E 1 12008 100 8 Leather Sandals -M 0 12008 1 12009 Coach -E 1 3021 100 16 Small Sword -E 1 3043 100 5 Leather Jacket -G 1 12003 100 Coach's Whistle -M 0 12009 1 12011 Roman Doctor -E 1 3022 100 16 Long Sword -E 1 3043 100 5 Leather Jacket -E 1 3042 100 11 Shield -E 1 12004 6 3 Stethoscope -G 1 12028 3 Staff Of Kodarta -M 0 12010 1 12011 Nurse -E 1 3021 100 16 Small Sword -E 1 3043 100 5 Leather Jacket -E 1 12005 3 6 Hairpin -G 1 12027 5 Staff Of Latumfus -M 0 12011 1 12006 Titus' Shopkeeper -G 1 3020 100 Dagger -G 1 3021 100 Small Sword -G 1 3022 100 Long Sword -G 1 3023 100 Wooden Club -G 1 3024 100 Warhammer -G 1 3025 100 Flail -G 1 12008 100 Leather Sandals -E 1 3022 100 16 Long Sword -E 1 12008 100 8 Leather Sandals -G 1 12034 1 Key To The Back Room -M 0 12012 1 12032 Peddler -E 1 12008 100 8 Leather Sandals -G 1 12006 100 Apple -G 1 12007 100 Orange -M 0 12013 2 12043 Page -E 1 3020 100 16 Dagger -E 1 12008 100 8 Leather Sandals -M 0 12013 2 12037 Page -E 1 3020 100 16 Dagger -E 1 12008 100 8 Leather Sandals -M 0 12014 1 12050 Plaintiff -E 1 3022 100 16 Long Sword -E 1 12011 2 15 Silver And Gold Bracelet -M 0 12015 3 12025 Ticket Master -E 1 3022 100 16 Long Sword -M 0 12015 3 12025 Ticket Master -E 1 3022 100 16 Long Sword -M 0 12015 3 12025 Ticket Master -E 1 12015 1 16 Tempered Sword -M 0 12016 3 12004 Stadium Vendor -G 1 12010 25 Hotdog -M 0 12016 3 12008 Stadium Vendor -G 1 12010 25 Hotdog -M 0 12016 3 12023 Stadium Vendor -G 1 12010 25 Hotdog -M 0 12017 15 12012 Common Citizen -M 0 12017 15 12032 Common Citizen -M 0 12017 15 12021 Common Citizen -M 0 12017 15 12031 Common Citizen -M 0 12017 15 12018 Common Citizen -M 0 12017 15 12032 Common Citizen -M 0 12017 15 12045 Common Citizen -M 0 12017 15 12034 Common Citizen -M 0 12017 15 12039 Common Citizen -M 0 12017 15 12040 Common Citizen -M 0 12017 15 12046 Common Citizen -M 0 12017 15 12033 Common Citizen -M 0 12017 15 12019 Common Citizen -M 0 12017 15 12024 Common Citizen -M 0 12017 15 12013 Common Citizen -M 0 12018 5 12051 Gate Guard -E 1 3022 100 16 Long Sword -M 0 12018 5 12029 Gate Guard -E 1 3022 100 16 Long Sword -M 0 12018 5 12035 Gate Guard -E 1 3022 100 16 Long Sword -M 0 12018 5 12051 Gate Guard -E 1 3022 100 16 Long Sword -M 0 12018 5 12005 Gate Guard -E 1 3022 100 16 Long Sword -M 0 12019 3 12006 Soldier -E 1 3021 100 16 Small Sword -E 1 12008 100 8 Leather Sandals -M 0 12019 3 12042 Soldier -E 1 3021 100 16 Small Sword -E 1 12019 2 8 Combat Boots -M 0 12019 3 12045 Soldier -E 1 3021 100 16 Small Sword -E 1 12008 100 8 Leather Sandals -E 1 12018 2 5 Combat Plate -M 0 12020 1 12036 Julius Caesar -E 1 3022 100 16 Long Sword -E 1 12017 1 10 Moorish Bracers -G 1 12024 7 Musty Scroll -M 0 12021 2 12036 Royal Bodyguard -E 1 3022 100 16 Long Sword -E 1 3042 100 11 Shield -E 1 3046 100 5 Breast Plate -M 0 12021 2 12036 Royal Bodyguard -E 1 3022 100 16 Long Sword -E 1 3042 100 11 Shield -E 1 3046 100 5 Breast Plate -M 0 12022 1 12055 Judge -E 1 3022 100 16 Long Sword -E 1 12012 1 2 Sapphire Ring -M 0 12023 1 12043 Master Scheduler -E 1 3022 100 16 Long Sword -E 1 12008 100 8 Leather Sandals -E 1 12013 1 4 Jade Necklace -G 1 12035 1 Key To Caesar's Office -G 1 12036 1 Key To The Senate Chambers -M 0 12024 6 12041 Slimeball -M 0 12024 6 12048 Slimeball -M 0 12024 6 12054 Slimeball -M 0 12024 6 12057 Slimeball -M 0 12024 6 12054 Slimeball -M 0 12024 6 12057 Slimeball -G 1 12030 500 Blaze Orange Potion -M 0 12025 1 12049 Froboz -E 1 3022 100 16 Long Sword -E 1 3042 100 11 Shield -E 1 12014 10 12 Froboz' Cloak -G 1 12025 10 Ornate Scroll -G 1 12026 10 Plain Scroll -G 1 12029 10 Prototype Wand -M 0 12026 1 12007 Titus Andronicus -E 1 12016 3 17 Quenched Sword -E 1 3022 100 16 Long Sword -E 1 3042 100 11 Shield -E 1 3046 100 5 Breast Plate -E 1 12008 100 8 Leather Sandals -M 0 12027 2 12037 Senator -E 1 3021 100 16 Small Sword -E 1 3044 100 5 Studded Leather Jacket -G 1 12037 1 Key To The Common Room -M 0 12027 2 12037 Senator -E 1 3021 100 16 Small Sword -E 1 3044 100 5 Studded Leather Jacket -G 1 3050 500 Scroll Of Identify -M 0 12028 1 12050 Bailiff -E 1 3022 100 16 Long Sword -E 1 3042 100 11 Shield -G 1 12039 1 Key To The Judge's Chambers -M 0 12029 1 12050 Defendant -E 1 3024 100 16 Warhammer -E 1 3043 100 5 Leather Jacket -* Gods -M 0 12030 1 12047 Jupiter -E 1 12020 1 16 Thunderbolt -M 0 12031 1 12052 Venus -E 1 12022 1 3 Crystal Necklace -M 0 12032 1 12056 Mars -E 1 12016 3 17 Quenched Sword -E 1 12021 1 13 Loincloth -M 0 12033 1 12059 Mercury -E 1 12023 1 8 Winged Sandals -M 0 12034 1 12042 Froboz' Shopkeeper -G 1 3050 500 Scroll Of Identify -G 1 3051 500 Yellow Potion -G 1 3052 500 Scroll Of Recall -G 1 3053 500 Grey Wand -G 1 3054 500 Gnarled Staff -G 1 12030 10 Blaze Orange Potion -E 1 3022 100 16 Long Sword -E 1 12008 100 8 Leather Sandals -G 1 12038 1 Key To Froboz' Workshop -M 0 12035 1 12061 Executioner -G 1 12031 10 Executioner's Mace -M 0 12036 1 12062 Baker -G 1 3000 100 Beer Barrel -G 1 3001 100 Beer Bottle -G 1 3009 100 Waybread -G 1 3010 100 Bread Loaf -G 1 3011 100 Danish Pastry -G 1 12006 100 Apple -G 1 12007 100 Apple -E 1 3022 100 16 Long Sword -M 0 12037 1 12063 Grocer -G 1 3030 100 Torch -G 1 3031 100 Lantern -G 1 3032 100 Bag -G 1 3033 100 Box -G 1 3036 100 Cashcard -G 1 12003 100 Coach's Whistle -E 1 3022 100 16 Long Sword -* Gates -D 0 12005 3 2 West Gate Of City -D 0 12029 0 2 North Gate Of City -D 0 12035 2 2 South Gate Of City -D 0 12051 1 1 East Gate Of City -D 0 12064 3 1 Outside Of East Gate -* Doors -D 0 12001 5 2 Caesar's Private Box -D 0 12002 4 2 -D 0 12006 2 2 Back Room Of Titus Andronicus' Store -D 0 12007 0 2 -D 0 12037 0 2 Emperor's Private Office -D 0 12036 2 2 -D 0 12037 2 2 House Of Commons -D 0 12038 0 2 -D 0 12042 1 2 Froboz' Workshop -D 0 12049 3 2 -D 0 12043 3 2 Emperor's Private Office -D 0 12036 1 2 -D 0 12044 3 2 Senate Chambers -D 0 12037 1 2 -D 0 12050 1 2 Judge's Chambers -D 0 12055 3 2 -* -S -$ diff --git a/lc-mud/circle/world/zon/15.zon b/lc-mud/circle/world/zon/15.zon deleted file mode 100644 index 7a44cf823e8574c4aef34f7593f77ed3e97610d0..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/15.zon +++ /dev/null @@ -1,54 +0,0 @@ -#15 -The Straight Path~ -1500 1599 10 2 -* -* By Steppin, Originally For ChicagoMUD 4-94 -* Hopefully Final Version For JediMUD 12-95 -* Conversion to CircleMUD by Furry -* -M 0 1500 1 1540 Allah -M 0 1501 1 1533 Michael -E 1 1500 2 17 Scales Of Justice -M 0 1502 1 1531 Gabriel -E 1 1501 3 17 Scroll Of The Messenger -M 0 1503 1 1530 Raphael -E 1 1503 2 11 Protector Of The Faithful -M 0 1504 1 1528 Uriel -E 1 1502 1 16 Blazing Sword -M 0 1505 1 1501 Cherubin -E 1 1508 5 17 Key To The Gates -M 0 1506 1 1505 Jester -E 1 1509 5 17 Burnt History -M 0 1507 5 1509 Jinn -M 0 1507 5 1516 Jinn -M 0 1507 5 1521 Jinn -M 0 1507 5 1524 Jinn -M 0 1507 5 1539 Jinn -M 0 1508 1 1512 Old Man -E 1 1504 1 10 Faded Armband -M 0 1509 1 1511 Al-Hakim -M 0 1510 1 1510 Judas -M 0 1511 1 1509 Pharoah -E 1 1512 3 3 Ankh -M 0 1512 1 1519 Abu Bakr -E 1 1505 4 16 Jeweled Scimiatr -M 0 1513 1 1520 Umar -M 0 1514 1 1521 Uthman -E 1 1510 3 0 A Surah Of The book -M 0 1515 1 1522 Ali -E 1 1511 1 9 Forge Of Unity -M 0 1516 1 1514 Angel -M 0 1517 1 1515 The Voice -E 1 1514 1 0 Graven Image -M 0 1518 1 1516 Dragon -E 1 1513 1 3 Amulet Of Ra -M 0 1519 1 1517 Demon -G 1 1506 1 Charred Ember -M 0 1520 1 1524 Baby -M 0 1521 1 1525 Teenager -M 0 1522 1 1526 Man -M 0 1523 1 1527 Soul -G 1 1507 1 Ethereal Flame -* -S -$ diff --git a/lc-mud/circle/world/zon/150.zon b/lc-mud/circle/world/zon/150.zon deleted file mode 100644 index 71d4a47d774f93d3765ed502f192207f1cd19f32..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/150.zon +++ /dev/null @@ -1,154 +0,0 @@ -#150 -King Welmar's Castle~ -15000 15099 120 2 -* -* Created by Pjotr and Sapowox of CircleMUD -* -* Heavily modifed, edited, and added to for CircleMUD by Furry -* -* Mobiles -M 0 15001 1 15017 King Welmar -E 1 15002 1 17 Golden Sceptre -E 1 15003 1 6 Golden Crown -E 1 15004 1 0 Golden Apple -G 1 15014 1 Key To King's Quarters -M 0 15003 1 15042 Jim The Royal Guard -E 1 3022 100 16 Long Sword -E 1 15015 50 5 Chain Mail Hauberk -M 0 15004 1 15023 Brian The Royal Guard -E 1 15006 100 16 Training Sword -E 1 15015 50 5 Chain Mail Hauberk -M 0 15005 1 15023 Mick The Royal Guard -E 1 15006 100 16 Training Sword -E 1 15015 50 5 Chain Mail Hauberk -M 0 15006 1 15035 Matt The Royal Guard -E 1 3022 100 16 Long Sword -E 1 15015 50 5 Chain Mail Hauberk -M 0 15007 1 15028 Jochem The Royal Guard -E 1 3022 100 16 Long Sword -E 1 15015 50 5 Chain Mail Hauberk -M 0 15008 1 15023 Anne The Royal Guard -E 1 3022 100 16 Long Sword -E 1 15015 50 5 Chain Mail Hauberk -M 0 15009 1 15008 Andrew The Royal Guard -E 1 3022 100 16 Long Sword -E 1 15015 50 5 Chain Mail Hauberk -M 0 15010 1 15032 Bertram The Royal Guard -E 1 3022 100 16 Long Sword -E 1 15015 50 5 Chain Mail Hauberk -M 0 15011 1 15019 Jeanette The Royal Guard -E 1 3022 100 16 Long Sword -E 1 15015 50 5 Chain Mail Hauberk -M 0 15012 1 15023 Peter -E 1 15015 50 5 Chain Mail Hauberk -E 1 15016 10 16 Broadsword -M 0 15013 1 15023 Training Master -E 1 3022 100 16 Long Sword -M 0 15014 1 15017 Herald -M 0 15016 1 15027 Butler -G 1 15009 1 Key To The Butler's Quarters -M 0 15017 5 15010 Cleaning Woman -M 0 15017 5 15010 Cleaning Woman -M 0 15017 5 15041 Cleaning Woman -M 0 15017 5 15041 Cleaning Woman -M 0 15017 5 15038 Cleaning Woman -M 0 15019 1 15052 Astrologer -G 1 3052 100 Scroll Of Recall -G 1 3050 100 Scroll Of Identify -G 1 15012 10 Brown Potion -M 0 15020 1 15017 Tim The King's Lifeguard -E 1 3022 100 16 Long Sword -E 1 15015 50 5 Chain Mail Hauberk -M 0 15021 1 15017 Tom The King's Lifeguard -E 1 3022 100 16 Long Sword -E 1 15015 50 5 Chain Mail Hauberk -M 0 15022 1 15005 Chef -G 1 15019 50 Lobster -G 1 15020 50 Some Russian Caviar -M 0 15023 2 15005 Cook -G 1 15010 1 Key To The Chest -M 0 15023 2 15005 Cook -M 0 15024 1 15036 David The Royal Guard -E 1 3022 100 16 Long Sword -E 1 15015 50 5 Chain Mail Hauberk -G 1 15007 1 Key To The Treasury -M 1 15025 1 15036 Dick The Royal Guard -E 1 3022 100 16 Long Sword -E 1 15015 50 5 Chain Mail Hauberk -M 0 15026 1 15008 Jerry The Royal Guard -E 1 3022 100 16 Long Sword -E 1 15015 50 5 Chain Mail Hauberk -M 0 15027 1 15008 Michael The Royal Guard -E 1 3022 100 16 Long Sword -E 1 15015 50 5 Chain Mail Hauberk -M 0 15028 1 15047 Hans The Royal Guard -E 1 3022 100 16 Long Sword -E 1 15015 50 5 Chain Mail Hauberk -M 0 15029 1 15009 Boris The Royal Guard -E 1 3022 100 16 Long Sword -E 1 15015 50 5 Chain Mail Hauberk -* Objects -R 0 15023 3020 -O 0 3020 100 15023 Dagger -R 0 15023 3021 -O 0 3021 100 15023 Small Sword -R 0 15023 3022 -O 0 3022 100 15023 Long Sword -O 1 15001 1 15037 Treasure -O 0 15005 1 15052 Telescope -O 0 15011 1 15026 Chest -* Doors -D 0 15004 0 1 Front Gate -D 0 15007 2 1 -D 0 15007 3 1 Small Passage -D 0 15006 1 1 -D 0 15020 1 1 Servants' Corridor -D 0 15021 3 1 -D 0 15021 0 1 Servants' Quarters -D 0 15026 2 1 -D 0 15022 0 2 Butler's Quarters -D 0 15027 2 2 -D 0 15023 0 1 Guard Barracks -D 0 15028 2 1 -D 0 15036 1 2 Treasure Room -D 0 15037 3 2 -D 0 15038 0 1 Guest Room -D 0 15043 2 1 -D 0 15038 1 1 Guest Suite -D 0 15039 3 1 -D 0 15049 1 2 King Welmar's Quarters -D 0 15050 3 2 -* -* Additions to King Welmar's Castle by Furry -* Mobiles -M 0 15000 1 15056 Gwydion The Royal Guard -E 1 3022 100 16 Long Sword -E 1 15015 50 5 Chain Mail Hauberk -G 1 15017 1 Cell Key -M 0 15002 1 15069 Horrible Ghost -M 0 15015 1 15059 Ergan The Murderer -M 0 15018 2 15058 Cockroach -M 0 15018 2 15058 Cockroach -M 0 15030 2 15067 Villager Zombie -M 0 15030 2 15067 Villager Zombie -M 0 15031 2 15067 Villager Skeleton -M 0 15031 2 15067 Villager Skeleton -M 0 15032 1 15074 Pit Fiend -E 1 15008 3 16 Verminator -* Objects -O 0 15013 1 15054 Royal Banner -O 0 15018 1 15070 Corpse -O 0 15021 1 15073 Glow -O 0 15022 1 15065 Sound -* Doors -D 0 15056 2 2 Prison Entrance -D 0 15057 0 2 -D 0 15057 1 2 Cell Door -D 0 15060 3 2 -D 0 15057 2 2 Ergan's Cell -D 0 15059 0 2 -D 0 15057 3 2 Cell Door -D 0 15058 1 2 -* -S -$ diff --git a/lc-mud/circle/world/zon/186.zon b/lc-mud/circle/world/zon/186.zon deleted file mode 100644 index 0beb75d653a1dfc8679b0f32c5cb6adfaab78c9f..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/186.zon +++ /dev/null @@ -1,65 +0,0 @@ -#186 -Newbie Zone~ -18600 18699 10 2 -* -* Created by Maynard of StrangeMUD -* -* Mobiles -M 0 18601 1 18605 Pit Beast -E 1 18604 50 12 Cloak -M 0 18602 3 18600 Newbie Monster -E 1 18602 99 5 Vest -M 0 18602 3 18607 Newbie Monster -E 1 18606 99 16 Dagger -M 0 18611 1 18646 Annoying Newbie -E 1 18606 99 16 Dagger -M 0 18612 1 18642 Clueless Newbie -M 0 18613 1 18640 Friendly Newbie -E 1 18602 99 5 Vest -M 0 18614 1 18604 Lost Newbie -M 0 18615 1 18645 Smart Newbie -E 1 18613 99 10 Sleeves -E 1 18612 99 7 Leggings -E 1 18602 99 5 Vest -E 1 18614 30 16 Mace -M 0 18603 1 18602 Dragon -E 1 18607 99 3 Collar -M 0 18604 1 18606 Newbie Guard -E 1 18605 60 1 Ring -G 1 18608 5 Key -E 1 18603 30 6 Helm -M 0 18605 1 18612 Alchemist -G 1 18609 50 Light -M 0 18606 4 18602 Crawler -M 0 18606 4 18606 Crawler -M 0 18606 4 18609 Crawler -M 0 18607 5 18620 Zombie -M 0 18607 5 18624 Zombie -M 0 18607 5 18637 Zombie -M 0 18607 5 18633 Zombie -M 0 18608 5 18627 Quasit -M 0 18608 5 18636 Quasit -M 0 18608 5 18638 Quasit -M 0 18608 5 18621 Quasit -M 0 18609 1 18629 Minotaur -E 1 18610 50 6 Horns -E 1 18611 50 5 Hide -M 0 18610 1 18639 Spectre -* Doors -D 0 18602 2 1 A Small Room -D 0 18606 0 1 -D 0 18603 0 1 Bright Hallway -D 0 18644 2 1 -D 0 18603 1 1 Bright Hallway -D 0 18646 3 1 -D 0 18604 2 1 Alchemist's Chamber -D 0 18612 0 1 -D 0 18606 5 2 Dark Pit -D 0 18605 4 2 -D 0 18607 3 1 A Small Room -D 0 18606 1 1 -D 0 18611 1 1 Alchemist's Chamber -D 0 18612 3 1 -* -S -$ diff --git a/lc-mud/circle/world/zon/25.zon b/lc-mud/circle/world/zon/25.zon deleted file mode 100644 index 566eb97f451025870c4d07f1ac1c2d4f539c0220..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/25.zon +++ /dev/null @@ -1,345 +0,0 @@ -#25 -The High Tower Of Magic~ -2500 2699 20 2 -* -* Created for SillyMUD by Skylar -* -* Edited and modified for CircleMUD by Furry -* -* Mobiles -M 0 2500 6 2502 Shadow Guardian -M 0 2500 6 2504 Shadow Guardian -M 0 2500 6 2506 Shadow Guardian -M 0 2500 6 2508 Shadow Guardian -M 0 2500 6 2511 Shadow Guardian -M 0 2501 1 2511 Adventurer -M 0 2502 1 2507 Edgar -M 0 2503 1 2512 Diamond Golem -E 1 2500 1 17 Diamond Key -M 0 2504 7 2513 Wandering Mage -M 0 2504 7 2514 Wandering Mage -M 0 2504 7 2514 Wandering Mage -M 0 2504 7 2515 Wandering Mage -M 0 2504 7 2516 Wandering Mage -M 0 2504 7 2518 Wandering Mage -M 0 2504 7 2519 Wandering Mage -M 0 2505 1 2518 Strick The Bartender -G 1 2504 100 Silce Of Traveller's Bread -G 1 2545 100 Herbal Brew -G 1 2546 100 Waybread -G 1 3010 100 Loaf Of Bread -G 1 3100 100 Tea Cup -G 1 3101 100 Coffee Cup -M 0 2506 1 2519 Tatorious The Wizard -G 1 3050 100 Scroll Of Identify -G 1 3051 100 Yellow Potion -G 1 3053 100 Grey Wand Of Invisibility -M 0 2507 1 2520 The Cook -E 1 2547 2 16 Meat Cleaver -M 0 2508 1 2520 Assistant Cook -M 0 2509 1 2527 Prisoner -E 1 2548 1 13 Chain Shackles -M 0 2510 1 2528 Jailor -E 1 2522 1 17 Old Key -M 0 2511 2 2533 Broom -M 0 2511 2 2533 Broom -M 0 2512 10 2535 Lesser Guardian -M 0 2512 10 2540 Lesser Guardian -M 0 2512 10 2630 Lesser Guardian -M 0 2512 10 2535 Lesser Guardian -M 0 2512 10 2535 Lesser Guardian -M 0 2512 10 2535 Lesser Guardian -M 0 2513 5 2535 Greater Guardian -M 0 2513 5 2575 Greater Guardian -M 0 2513 5 2600 Greater Guardian -M 0 2513 5 2633 Greater Guardian -M 0 2513 5 2649 Greater Guardian -M 0 2514 1 2537 Visiting Mage -M 0 2515 3 2542 Apprentice -M 0 2515 3 2544 Apprentice -M 0 2516 3 2544 Apprentice -M 0 2516 3 2542 Apprentice -M 0 2517 3 2542 Apprentice -M 0 2517 3 2544 Apprentice -M 0 2518 3 2545 Apprentice -M 0 2518 3 2545 Apprentice -M 0 2518 3 2545 Apprentice -M 0 2519 1 2545 Kitten -M 0 2520 4 2549 Student -M 0 2520 4 2549 Student -M 0 2520 4 2549 Student -M 0 2520 4 2549 Student -M 0 2521 1 2549 Teacher -M 0 2522 4 2554 Student -M 0 2522 4 2554 Student -M 0 2522 4 2554 Student -M 0 2522 4 2554 Student -M 0 2523 1 2554 Teacher -M 0 2524 3 2557 Listener -M 0 2524 3 2557 Listener -M 0 2524 3 2557 Listener -M 0 2525 1 2557 Speaker -M 0 2526 3 2559 Student -E 1 2549 6 16 Silvery Dagger -M 0 2526 3 2559 Student -E 1 2549 6 16 Silvery Dagger -M 0 2526 3 2559 Student -E 1 2549 6 16 Silvery Dagger -M 0 2527 1 2559 Battle Master -E 1 2549 6 17 Silvery Dagger -M 0 2528 2 2564 Teacher -M 0 2529 1 2565 Sleeping Mage -M 0 2530 1 2567 Scribe -M 0 2512 10 2568 Lesser Guardian -M 0 2531 2 2571 Scribe -M 0 2531 2 2571 Scribe -M 0 2532 1 2573 Master Scribe -G 1 2552 1 Cylindrical Tube -P 1 2550 2 2552 Scroll -P 1 2551 2 2552 Bound Scroll -M 0 2533 1 2573 Assistant Scribe -G 1 2553 3 Old Scroll -M 0 2534 1 2582 Enchanter -E 1 2515 1 17 Small Key -G 1 2554 1 Scroll Of Enchantment -M 0 2535 1 2582 Dancing Sword -M 0 2536 1 2588 The Mad Alchemist -E 1 2555 5 17 Leather Pouch -P 1 2556 2 2555 Silver Spoon -P 1 2558 2 2555 Red Potion -P 1 2559 2 2555 Green Potion -P 1 2560 2 2555 Effervescent Potion -P 1 2561 2 2555 Milky White Potion -M 0 2537 1 2590 The Summoner -E 1 2562 2 17 Teleport Staff -M 0 2538 1 2595 Master Of Charm -E 1 2563 1 17 Golden Flute -G 1 2564 1 Figurine -M 0 2539 5 2568 Golem Sentry -M 0 2539 5 2598 Golem Sentry -M 0 2539 5 2598 Golem Sentry -M 0 2539 5 2628 Golem Sentry -M 0 2539 5 2628 Golem Sentry -M 0 2540 1 2602 SpellBinder -E 1 2524 1 17 Silvery Key -G 1 2523 1 Silvery Key -E 1 2565 2 13 Holstered Belt -P 1 2566 2 2565 Blackened Wand -M 0 2541 1 2609 Golem Maker -E 1 2567 2 17 Runed Chisel -M 0 2542 1 2609 Granite Golem -M 0 2543 1 2611 Bronze Golem -M 0 2544 1 2611 Flesh Golem -M 0 2545 1 2609 Cloth Golem -M 0 2546 1 2611 Adamantite Golem -M 0 2547 1 2611 Clay Golem -M 0 2548 1 2617 Master Of Illusion -E 1 2568 3 13 Beltpouch -P 1 2569 3 2568 Sparkling Dust -M 0 2549 1 2625 The Necromancer -E 1 2570 2 3 Dark Cowl -E 1 2571 2 17 Ashen Wand -M 0 2550 4 2625 Skeleton -M 0 2550 4 2625 Skeleton -M 0 2551 1 2625 Undead Giant -E 1 2572 1 16 Spiked Club -M 0 2552 3 2635 Witch -M 0 2552 3 2635 Witch -M 0 2552 3 2635 Witch -M 0 2553 1 2637 Librarian -M 0 2554 1 2653 Neutral Apprentice -E 1 2573 1 12 Grey Robe -E 1 2574 1 14 Silver Bracelet -M 0 2555 1 2654 Grey Familiar -M 0 2556 1 2654 Neutral Guildmaster -G 1 2593 1 Grey Key -E 1 2575 1 3 Grey Cloak -E 1 2576 1 16 Iron Shod Staff -E 1 2577 3 17 Ward Minor -M 0 2557 1 2661 Evil Apprentice -E 1 2578 1 12 Black Robe -E 1 2579 1 14 Onyx Bracelet -M 0 2558 1 2664 Black Familiar -M 0 2559 1 2664 Evil Guildmaster -G 1 2594 1 Black Key -E 1 2580 1 3 Dark Black Cloak -E 1 2581 1 16 Shard Of Obsidian -E 1 2577 3 17 Ward Minor -M 0 2560 1 2667 Good Apprentice -E 1 2582 1 12 White Robe -E 1 2583 1 14 White Gold Bracelet -M 0 2561 1 2669 White Familiar -M 0 2562 1 2669 Good Guildmaster -G 1 2595 1 White Key -E 1 2584 1 3 White Cloak -E 1 2585 1 16 Ivory Hilted Dagger -E 1 2577 3 17 Ward Minor -M 0 2563 1 2677 Calico Cat -E 1 2586 1 3 Spiked Collar -M 0 2564 1 2677 Grand Master Of Magic -G 1 2538 1 Intricate Key -E 1 2587 1 3 Shimmering Cloak -E 1 2592 2 5 Green Dragon Scale Shirt -E 1 2588 1 1 Emerald Ring -E 1 2589 1 14 Emerald Bracelet -E 1 2590 1 17 Ward Major -E 1 2591 1 16 Ebony Kris -* Objects -O 0 2501 1 2520 Oven -P 1 2504 200 2501 Traveller's Bread -O 0 2502 1 2520 Meat Locker -P 1 2505 1 2502 Chunk Of Meat -P 1 2506 1 2502 Finger Sandwich -R 0 2520 2503 -O 0 2503 3 2520 Spice Rack -O 0 2507 2 2533 Broom -O 0 2507 2 2533 Broom -O 0 2508 1 2579 Cabinet -P 1 3020 100 2508 Dagger -P 1 3021 100 2508 Small Sword -P 1 3022 100 2508 Long Sword -O 0 2509 1 2579 Bar Of Silver -O 0 2510 1 2579 Bar Of Gold -O 0 2511 1 2579 Bar Of Mithral -O 0 2512 1 2579 Bar Of Adamantite -O 0 2513 1 2581 Mithral Hammer -O 0 2514 1 2582 Chest -P 1 2516 1 2514 Long Sword -P 1 2517 1 2514 Silver Dagger -P 1 2518 1 2514 Scimitar -O 0 2519 1 2601 Staff -O 0 2520 1 2603 Cabinet -P 1 2525 1 2520 Red And White Staff -P 1 2526 1 2520 Burnt Staff -O 0 2521 1 2603 Cabinet -P 1 2527 1 2521 Black Rod -P 1 2528 1 2521 Wooden Stick -P 1 2529 1 2521 Metal Wand -O 0 2530 1 2635 Cauldron -P 1 2531 1 2530 Bat Wings -P 1 2532 1 2530 Eyeball -O 0 2533 1 2645 The Book Of Magic -P 1 2534 1 2533 Spectacles Of True Seeing -O 0 2535 1 2680 Golden Altar -P 1 2536 1 2535 Heart Shaped Medallion -O 0 2537 1 2681 Chest -P 1 2539 1 2537 Coins -O 0 2540 1 2682 Brown Cloak -O 0 2541 1 2682 Chameleon Poncho -O 0 2542 1 2682 Old Boots -O 0 2544 1 2682 Leather Backpack -P 1 2543 1 2544 Seashell Ring -* Doors -D 0 2512 0 2 Tower Entrance -D 0 2513 2 2 -D 0 2516 3 1 Kitchen -D 0 2520 1 1 -D 0 2517 5 1 Trapdoor -D 0 2521 4 1 -D 0 2523 0 2 Dark Cell -D 0 2527 2 2 -D 0 2524 1 1 Jailor's Office -D 0 2528 3 1 -D 0 2530 0 1 Store Room -D 0 2532 2 1 -D 0 2530 2 1 Broom Closet -D 0 2533 0 1 -D 0 2531 0 1 A Hallway -D 0 2534 2 1 -D 0 2531 1 1 Guest Bedroom -D 0 2536 3 1 -D 0 2531 2 1 Guardian's Chamber -D 0 2535 0 1 -D 0 2534 1 1 Guest Bedroom -D 0 2537 3 1 -D 0 2538 1 1 Burnt Room -D 0 2539 3 1 -D 0 2540 0 1 Apprentices' Barracks -D 0 2542 2 1 -D 0 2543 0 1 Apprentices' Barracks -D 0 2544 2 1 -D 0 2545 0 1 Apprentices' Workshop -D 0 2546 2 1 -D 0 2548 3 1 Classroom -D 0 2549 1 1 -D 0 2550 3 1 Empty Classroom -D 0 2552 1 1 -D 0 2551 3 1 Empty Classroom -D 0 2554 1 1 -D 0 2555 2 1 Amphitheater -D 0 2557 0 1 -D 0 2556 2 1 Training Room -D 0 2559 0 1 -D 0 2558 2 1 Dueling Room -D 0 2561 0 1 -D 0 2562 1 1 Spellmasters' Lounge -D 0 2564 3 1 -D 0 2563 1 1 Bedroom -D 0 2565 3 1 -D 0 2566 1 1 Study -D 0 2567 3 1 -D 0 2570 0 1 Small Office -D 0 2571 2 1 -D 0 2571 3 1 Master Scribe's Workshop -D 0 2573 1 1 -D 0 2574 0 1 Store Room -D 0 2575 2 1 -D 0 2577 3 1 Store Room -D 0 2579 1 1 -D 0 2578 3 1 Very Hot Room -D 0 2581 1 1 -D 0 2581 2 1 Master Enchanter's Chamber -D 0 2582 0 1 -D 0 2581 4 1 Dark Room -D 0 2612 5 1 -D 0 2584 2 1 Laboratory -D 0 2586 0 1 -D 0 2587 2 1 Pentagram Chamber -D 0 2590 0 1 -D 0 2591 1 1 Empty Room -D 0 2594 3 1 -D 0 2593 1 1 Charm Master's Chamber -D 0 2595 3 1 -D 0 2595 0 1 Animal Pens -D 0 2597 2 1 -D 0 2600 0 1 Store Room -D 0 2601 2 1 -D 0 2601 3 1 Master Spellbinder's Chamber -D 0 2602 1 1 -D 0 2602 3 1 Master Spellbinder's Cache -D 0 2603 1 1 -D 0 2605 0 1 Master Spellbinder's Cache -D 0 2603 2 1 -D 0 2608 3 1 Golem Master's Workshop -D 0 2609 1 1 -D 0 2609 5 1 Dark Room -D 0 2612 4 1 -D 0 2616 2 1 Illusion Master's Chamber -D 0 2617 0 1 -D 0 2619 2 1 Meditation Chamber -D 0 2620 0 1 -D 0 2622 1 1 Necromancer's Room -D 0 2623 3 1 -D 0 2634 1 1 Scrying Chamber -D 0 2635 3 1 -D 0 2536 3 1 Library -D 0 2637 1 1 -D 0 2652 2 1 Grey Antechamber -D 0 2653 0 1 -D 0 2660 1 1 Black Antechamber -D 0 2661 3 1 -D 0 2666 3 1 White Antechamber -D 0 2667 1 1 -D 0 2673 0 2 Grey Door -D 0 2674 2 2 -D 0 2674 0 2 Black Door -D 0 2675 2 2 -D 0 2675 0 2 White Door -D 0 2676 2 2 -D 0 2680 1 1 Treasury -D 0 2681 3 1 -D 0 2680 3 1 Secret Excape Passage -D 0 2682 1 1 -* -S -$ diff --git a/lc-mud/circle/world/zon/30.zon b/lc-mud/circle/world/zon/30.zon deleted file mode 100644 index d51a4e44222f5d7429fff53f64928336d5834069..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/30.zon +++ /dev/null @@ -1,175 +0,0 @@ -#30 -Northern Midgaard Main City~ -3000 3099 15 2 -* -* Mobiles -M 0 3000 1 3033 Wizard Shop Keeper -G 1 3050 500 Scroll Of Identify -G 1 3051 500 Yellow Potion -G 1 3052 500 Scroll Of Recall -G 1 3053 500 Grey Wand -G 1 3054 500 Gnarled Staff -M 0 3001 1 3009 Baker -G 1 3009 100 Waybread -G 1 3010 100 Loaf Of Bread -G 1 3011 100 Danish Pastry -E 1 3022 100 16 Long Sword -M 0 3002 1 3010 Grocer -G 1 3030 100 Torch -G 1 3031 100 Lantern -G 1 3032 100 Bag -G 1 3033 100 Box -G 1 3036 100 Cashcard -E 1 3022 100 16 Long Sword -M 0 3003 1 3011 Weaponsmith -G 1 3020 100 Dagger -G 1 3021 100 Small Sword -G 1 3022 100 Long Sword -G 1 3023 100 Wooden Club -G 1 3024 100 Warhammer -G 1 3025 100 Flail -E 1 3022 100 16 Long Sword -M 0 3004 1 3020 Armourer -G 1 3040 100 Breast Plate -G 1 3041 100 Chain Mail Shirt -G 1 3042 100 Wooden Shield -G 1 3043 100 Leather Jacket -G 1 3044 100 Studded Leather Jacket -G 1 3045 100 Scale Mail Jacket -G 1 3046 100 Bronze Breast Plate -G 1 3070 100 Bronze Gauntlets -G 1 3071 100 Leather Gloves -G 1 3075 100 Bronze Helmet -G 1 3076 100 Leather Cap -G 1 3080 100 Bronze Leggings -G 1 3081 100 Leather Pants -G 1 3085 100 Bronze Sleeves -G 1 3086 100 Leather Sleeves -E 1 3022 100 16 Long Sword -M 0 3005 1 3008 Receptionist -E 1 3022 100 16 Long Sword -M 0 3006 1 3049 Captain -G 1 3060 20 Raft -G 1 3061 10 Canoe -M 0 3007 1 3050 Sailor -M 0 3009 1 3058 Wally The Watermaster -G 1 3102 100 Water Cup -G 1 3103 100 Water Bottle -G 1 3104 100 Water Canteen -G 1 6013 100 Water Barrel -M 0 3010 1 3062 Postmaster -M 0 3020 1 3019 Magic Users' Guildmaster -M 0 3021 1 3002 Clerics' Guildmaster -M 0 3022 1 3029 Thieves' Guildmaster -M 0 3023 1 3023 Warriors' Guildmaster -M 0 3024 1 3017 Mage Guard -E 1 3022 100 16 Long Sword -M 0 3025 1 3004 Priest Templar Guard -E 1 3022 100 16 Long Sword -M 0 3026 1 3027 Thief Guard -E 1 3022 100 16 Long Sword -M 0 3027 1 3021 Warrior Guard -E 1 3022 100 16 Long Sword -M 0 3040 1 3007 Bartender -G 1 3000 100 Beer Barrel -G 1 3001 100 Beer Bottle -G 1 3002 100 Dark Ale Bottle -G 1 3003 100 Firebreather -G 1 3004 100 Local Bottle -E 1 3022 100 16 Long Sword -M 0 3042 1 3018 Magic Users' Waiter -G 1 3002 100 Dark Ale Bottle -G 1 3003 100 Firebreather -E 1 3020 100 16 Dagger -M 0 3043 1 3003 Clerics' Waiter -G 1 3002 100 Dark Ale Bottle -G 1 3004 100 Local Bottle -E 1 3024 100 16 Warhammer -M 0 3044 1 3028 Thieves' Waiter -G 1 3003 100 Firebreather -G 1 3004 100 Local Bottle -E 1 3021 100 16 Small Sword -M 0 3045 1 3022 Fighters' Waiter -G 1 3002 100 Dark Ale Bottle -G 1 3003 100 Firebreather -G 1 3004 100 Local Bottle -E 1 3022 100 16 Long Sword -M 0 3046 1 3048 Filthy -G 1 3003 100 Firebreather -G 1 3004 100 Local Bottle -E 1 3022 100 16 Long Sword -M 0 3059 5 3004 Peacekeeper -M 0 3059 5 3014 Peacekeeper -M 0 3059 5 3017 Peacekeeper -M 0 3059 5 3021 Peacekeeper -M 0 3059 5 3027 Peacekeeper -M 0 3060 10 3004 Cityguard -E 1 3022 100 16 Long Sword -M 0 3060 10 3014 Cityguard -E 1 3022 100 16 Long Sword -M 0 3060 10 3017 Cityguard -E 1 3022 100 16 Long Sword -M 0 3060 10 3021 Cityguard -E 1 3022 100 16 Long Sword -M 0 3060 10 3027 Cityguard -E 1 3022 100 16 Long Sword -M 0 3061 5 3006 Janitor -M 0 3062 15 3024 Fido -G 1 3015 30 Mystery Meat -M 0 3062 15 3025 Fido -G 1 3015 30 Mystery Meat -M 0 3062 15 3016 Fido -G 1 3015 30 Mystery Meat -M 0 3062 15 3012 Fido -G 1 3015 30 Mystery Meat -M 0 3063 5 3026 Mercenary -E 1 3021 100 16 Small Sword -M 0 3064 3 3007 Happy Drunk -M 0 3065 2 3044 Beggar -G 1 3005 1 Sewer Key -M 0 3065 2 3048 Beggar -M 0 3066 1 3026 Odif -G 1 3015 30 Mystery Meat -M 0 3067 10 3041 Cityguard -E 1 3022 100 16 Long Sword -M 0 3067 10 3040 Cityguard -E 1 3022 100 16 Long Sword -M 0 3068 4 3008 Green Blob -M 0 3068 4 3014 Green Blob -M 0 3089 1 3031 Pet Shop Boy -M 0 3090 1 3032 Kitten -M 0 3091 1 3032 Puppy -M 0 3092 1 3032 Beagle -M 0 3093 1 3032 Rottweiler -M 0 3094 1 3032 Wolf -M 0 3095 1 3064 Cryogenicist -E 1 3022 100 16 Long Sword -* Important Objects -R 0 3005 3035 -O 0 3035 1 3005 Fountain -R 0 3001 3034 -O 0 3034 10 3001 ATM -R 0 3008 3034 -O 1 3034 10 3008 ATM -R 0 3004 3034 -O 1 3034 10 3004 ATM -R 0 3017 3034 -O 1 3034 10 3017 ATM -R 0 3021 3034 -O 1 3034 10 3021 ATM -R 0 3027 3034 -O 1 3034 10 3027 ATM -* Boards -R 0 3000 3099 -O 0 3099 2 3000 Mortal Bulletin Board -R 0 3003 3096 -O 1 3096 5 3003 Social Bulletin Board -R 0 3018 3096 -O 1 3096 5 3018 Social Bulletin Board -R 0 3022 3096 -O 1 3096 5 3022 Social Bulletin Board -R 0 3028 3096 -O 1 3096 5 3028 Social Bulletin Board -* -S -$ diff --git a/lc-mud/circle/world/zon/31.zon b/lc-mud/circle/world/zon/31.zon deleted file mode 100644 index 0605e4736209130f9aadcf2dceb1ff6705d32c29..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/31.zon +++ /dev/null @@ -1,63 +0,0 @@ -#31 -Southern part of Midgaard~ -3100 3299 40 2 -* -* Cityguards from zone 30 -M 0 3060 20 3111 Cityguard -E 1 3022 100 16 Long Sword -G 1 3105 2 Key To HQ -M 0 3060 20 3111 Cityguard -E 1 3022 100 16 Long Sword -M 0 3060 20 3111 Cityguard -E 1 3022 100 16 Long Sword -M 0 3060 20 3111 Cityguard -E 1 3022 100 16 Long Sword -M 0 3068 4 3106 Green Blob -* Mobiles -M 0 3100 1 3106 Maid -G 1 3100 500 Cup Of Tea -G 1 3101 500 Cup Of Coffee -G 1 3102 500 Cup Of Water -M 0 3101 1 3106 Sexton -G 1 3106 2 Key To Graveyard -M 0 3102 1 3110 Chief Guard -G 1 3107 2 Key To The Desk -M 0 3103 4 3110 Mad Guard -M 1 3103 4 3110 Mad Guard -M 1 3103 4 3110 Mad Guard -M 1 3103 4 3110 Mad Guard -M 0 3104 1 3137 Secretary -M 0 3105 1 3138 Mayor -E 1 3112 1 17 City Key -M 0 3106 1 3120 Town Crier -M 0 3120 1 3114 Swan -M 0 3121 1 3114 Duckling -M 0 3122 1 3109 Sparrow -M 0 3123 2 3113 Duck -M 0 3123 2 3115 Duck -* Objects -O 0 3109 1 3110 Desk -P 1 3108 1 3109 Key To Safe -O 0 3110 1 3110 Safe -P 1 3115 1 3110 Money -R 0 3101 3111 -O 0 3111 3 3101 Bench -R 0 3102 3111 -O 0 3111 3 3102 Bench -R 0 3103 3111 -O 0 3111 3 3103 Bench -R 0 3141 3113 -O 0 3113 1 3141 Fountain -O 0 3114 1 3141 20 Coins -O 0 3116 1 3155 Candlestick -O 0 3117 1 3124 Elm Tree -* Doors -D 0 3111 3 2 Cityguard HQ -D 0 3110 1 2 -D 0 3129 2 2 Graveyard -D 0 3150 0 2 -D 0 3154 2 1 Chapel -D 0 3155 0 1 -* -S -$ diff --git a/lc-mud/circle/world/zon/33.zon b/lc-mud/circle/world/zon/33.zon deleted file mode 100644 index de76f7476e120582ddb1f2aa57045493583d32a4..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/33.zon +++ /dev/null @@ -1,108 +0,0 @@ -#33 -The Three Of Swords~ -3300 3399 30 2 -* -* Created by Amanda Eterniale & Builder_5 of C.A.W. -* Official C.A.W. site: http://qsilver.queensu.ca/~fletchra/Caw/ -* Mail Address: fletchra@qsilver.queensu.ca -* -* Mobiles -M 0 3300 2 3346 Farmer -M 0 3300 2 3353 Farmer -M 0 3301 1 3345 Storekeeper -G 1 3032 1000 Bag -G 1 3037 1000 Candle -G 1 3038 1000 Nail -G 1 3039 1000 Pot -M 0 3302 1 3347 Cowgirl -M 0 3303 4 3347 Horse -M 0 3303 4 3347 Horse -M 0 3303 4 3347 Horse -M 0 3303 4 3347 Horse -M 0 3304 1 3350 Farmer's Wife -G 1 3300 1000 Orange -G 1 3301 1000 Bale Of Wheat -G 1 3308 1000 Apple -G 1 3309 1000 Loaf Of Bread -G 1 3310 1000 Melon -M 0 3305 1 3375 Aglandiir -G 1 3313 5 Short Sword -O 1 3302 5 3375 Zither -O 1 3303 5 3375 Barrel Of Perfume -O 1 3304 5 3375 Statue -O 1 3305 25 3375 Halberd -O 1 3306 25 3375 Potion Of Protection -O 1 3307 1 3375 Dragon's Crown -M 0 3306 3 3368 Cyclops -M 0 3306 3 3368 Cyclops -M 0 3306 3 3368 Cyclops -M 0 3307 1 3357 Salle -E 1 3318 25 5 Leather Vest -E 1 3312 20 16 Long Sword -M 0 3308 1 3330 Duwick -E 1 3311 10 16 Knife -M 0 3309 1 3358 Receptionist -M 0 3310 1 3356 Innkeeper -M 0 3311 2 3349 Hunter -E 1 3317 1000 16 Hunting Bow -M 0 3311 2 3355 Hunter -E 1 3317 1000 16 Hunting Bow -M 0 3312 1 3357 Waiter -M 0 3313 1 3357 Waitress -M 0 3314 1 3357 Bartender -G 1 3319 1000 Glass Of Beer -G 1 3320 1000 Glass Of Mead -G 1 3321 1000 Shot Of Whiskey -M 0 3315 9 3319 Bandit -E 1 3315 1000 16 Scimitar -M 0 3315 9 3323 Bandit -E 1 3315 1000 16 Scimitar -M 0 3315 9 3325 Bandit -E 1 3315 1000 16 Scimitar -M 0 3315 9 3327 Bandit -E 1 3315 1000 16 Scimitar -M 0 3315 9 3332 Bandit -E 1 3315 1000 16 Scimitar -M 0 3315 9 3336 Bandit -E 1 3315 1000 16 Scimitar -M 0 3315 9 3339 Bandit -E 1 3315 1000 16 Scimitar -M 0 3315 9 3321 Bandit -E 1 3315 1000 16 Scimitar -M 0 3315 9 3327 Bandit -E 1 3315 1000 16 Scimitar -M 0 3316 5 3329 Bandit Guard -E 1 3315 1000 16 Scimitar -M 0 3316 5 3329 Bandit Guard -E 1 3315 1000 16 Scimitar -M 0 3316 5 3340 Bandit Guard -E 1 3315 1000 16 Scimitar -M 0 3316 5 3340 Bandit Guard -E 1 3315 1000 16 Scimitar -M 0 3316 5 3317 Bandit Guard -E 1 3315 1000 16 Scimitar -M 0 3317 2 3340 Slave -M 0 3317 2 3340 Slave -M 0 3318 2 3357 Farmer -M 0 3318 2 3357 Farmer -M 0 3319 1 3357 Hunter -E 1 3317 1000 16 Hunting Bow -* Objects -O 0 3314 1 3304 Corpse -O 0 3315 2 3323 Scimitar -O 0 3315 2 3323 Scimitar -O 0 3316 3 3330 Crate -O 0 3316 3 3330 Crate -O 0 3316 3 3330 Crate -* Doors -D 0 3329 0 1 -D 0 3330 2 1 -D 0 3351 1 1 -D 0 3352 3 1 -D 0 3353 2 1 -D 0 3354 0 1 -D 0 3355 0 1 -D 0 3356 2 1 -S -$ - diff --git a/lc-mud/circle/world/zon/35.zon b/lc-mud/circle/world/zon/35.zon deleted file mode 100644 index 9a727cd2c20b0a1fc382ae659054a371c8c86e51..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/35.zon +++ /dev/null @@ -1,57 +0,0 @@ -#35 -Miden'Nir~ -3500 3599 60 2 -* -* Created by Copper II DikuMUD -* -* Rewritten for MercMUD by VampLestat -* -* Modified and edited for CircleMUD by Furry -* -* Mobiles -M 0 3500 3 3521 Wyvern -M 0 3500 3 3521 Wyvern -M 0 3500 3 3521 Wyvern -M 0 3501 10 3508 Goblin -E 1 3502 10 16 Club -M 0 3501 10 3509 Goblin -E 1 3502 10 16 Club -M 0 3501 10 3509 Goblin -E 1 3502 10 16 Club -M 0 3501 10 3512 Goblin -E 1 3502 10 16 Club -M 0 3501 10 3512 Goblin -E 1 3502 10 16 Club -M 0 3501 10 3512 Goblin -E 1 3502 10 16 Club -M 0 3501 10 3514 Goblin -E 1 3502 10 16 Club -M 0 3501 10 3516 Goblin -E 1 3502 10 16 Club -M 0 3501 10 3518 Goblin -E 1 3502 10 16 Club -M 0 3501 10 3556 Goblin -E 1 3502 10 16 Club -M 0 3502 4 3551 Lieutenant -E 1 3500 10 16 Small Sword -M 0 3502 4 3556 Lieutenant -E 1 3500 10 16 Small Sword -M 0 3503 1 3556 Leader -E 1 3504 10 16 Small Spear -M 0 3504 1 3575 Small Boy -E 1 3508 25 17 Gyroscope -M 0 3505 1 3576 Innkeeper -M 0 3506 1 3577 Bard -E 1 3502 2 16 Fine Long Sword -M 0 3507 4 3584 Horseman -E 1 3503 8 5 Leather Jacket -M 0 3507 4 3584 Horseman -E 1 3503 8 5 Leather Jacket -* Objects -O 0 3505 2 3521 Mutilated Corpse -O 0 3506 1 3521 Mutilated Corpse -P 1 3507 1 3506 Ornate Dagger -O 0 3505 2 3521 Mutilated Corpse -* -S -$ diff --git a/lc-mud/circle/world/zon/36.zon b/lc-mud/circle/world/zon/36.zon deleted file mode 100644 index ef66d855820e3b9863c525e60e16451abb58d09b..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/36.zon +++ /dev/null @@ -1,100 +0,0 @@ -#36 -The Chessboard of Midgaard~ -3600 3699 10 1 -* -* Created for SillyMud by Exxon -* -* Mobiles -M 0 3600 8 3609 Black Pawn -E 1 3600 8 5 Black Pawn Armour -E 1 3602 8 16 Black Pawn Sword -M 0 3600 8 3610 Black Pawn -E 1 3600 8 5 Black Pawn Armour -E 1 3602 8 16 Black Pawn Sword -M 0 3600 8 3611 Black Pawn -E 1 3600 8 5 Black Pawn Armour -E 1 3602 8 16 Black Pawn Sword -M 0 3600 8 3612 Black Pawn -E 1 3600 8 5 Black Pawn Armour -E 1 3602 8 16 Black Pawn Sword -M 0 3600 8 3613 Black Pawn -E 1 3600 8 5 Black Pawn Armour -E 1 3602 8 16 Black Pawn Sword -M 0 3600 8 3614 Black Pawn -E 1 3600 8 5 Black Pawn Armour -E 1 3602 8 16 Black Pawn Sword -M 0 3600 8 3615 Black Pawn -E 1 3600 8 5 Black Pawn Armour -E 1 3602 8 16 Black Pawn Sword -M 0 3600 8 3616 Black Pawn -E 1 3600 8 5 Black Pawn Armour -E 1 3602 8 16 Black Pawn Sword -M 0 3601 8 3649 White Pawn -E 1 3601 8 5 White Pawn Armour -E 1 3603 8 16 White Pawn Sword -M 0 3601 8 3650 White Pawn -E 1 3601 8 5 White Pawn Armour -E 1 3603 8 16 White Pawn Sword -M 0 3601 8 3651 White Pawn -E 1 3601 8 5 White Pawn Armour -E 1 3603 8 16 White Pawn Sword -M 0 3601 8 3652 White Pawn -E 1 3601 8 5 White Pawn Armour -E 1 3603 8 16 White Pawn Sword -M 0 3601 8 3653 White Pawn -E 1 3601 8 5 White Pawn Armour -E 1 3603 8 16 White Pawn Sword -M 0 3601 8 3654 White Pawn -E 1 3601 8 5 White Pawn Armour -E 1 3603 8 16 White Pawn Sword -M 0 3601 8 3655 White Pawn -E 1 3601 8 5 White Pawn Armour -E 1 3603 8 16 White Pawn Sword -M 0 3601 8 3656 White Pawn -E 1 3601 8 5 White Pawn Armour -E 1 3603 8 16 White Pawn Sword -M 0 3602 2 3601 Black Rook -E 1 3604 2 5 Black Rook Armour -M 0 3602 2 3608 Black Rook -E 1 3604 2 5 Black Rook Armour -M 0 3603 2 3657 White Rook -E 1 3605 2 5 White Rook Armour -M 0 3603 2 3664 White Rook -E 1 3605 2 5 White Rook Armour -M 0 3604 2 3602 Black Knight -E 1 3606 2 16 Black Knight Lance -M 0 3604 2 3607 Black Knight -E 1 3606 2 16 Black Knight Lance -M 0 3605 2 3658 White Knight -E 1 3607 2 16 White Knight Lance -M 0 3605 2 3663 White Knight -E 1 3607 2 16 White Knight Lance -M 0 3606 2 3603 Black Bishop -E 1 3608 2 17 Black Bishop Staff -M 0 3606 2 3606 Black Bishop -E 1 3608 2 17 Black Bishop Staff -M 0 3607 2 3659 White Bishop -E 1 3609 2 17 White Bishop Staff -M 0 3607 2 3662 White Bishop -E 1 3609 2 17 White Bishop Staff -M 0 3608 1 3604 Black Queen -E 1 3610 1 6 Black Queen Crown -M 0 3609 1 3660 White Queen -E 1 3611 1 6 White Queen Crown -M 0 3610 1 3605 Black King -E 1 3612 1 17 Black King Sceptre -G 1 3614 1 Black Treasury Key -M 0 3611 1 3661 White King -E 1 3613 1 17 White King Sceptre -G 1 3615 1 White Treasury Key -* Objects -O 0 3616 1 3665 Black Treasury Gold -O 0 3617 1 3666 White Treasury Gold -* Doors -D 0 3604 5 2 Black Treasury Door -D 0 3665 4 2 -D 0 3660 5 2 White Treasury Door -D 0 3666 4 2 -* -S -$ diff --git a/lc-mud/circle/world/zon/40.zon b/lc-mud/circle/world/zon/40.zon deleted file mode 100644 index 6443e42b1790880383b65ae8657dd46c0a97463c..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/40.zon +++ /dev/null @@ -1,93 +0,0 @@ -#40 -Mines of Moria~ -4000 4198 20 2 -* -* Created for DikuMud -* Heavily rewritten descriptions for CircleMud by Furry -* -* Level 1 -* -* Mobiles -M 0 4000 1 4030 Large Snake -G 1 4001 1 Goblin Corpse -P 1 4002 1 4001 500 Coins -M 0 4001 2 4025 Green Snake -M 0 4001 2 4015 Green Snake -M 0 4002 3 4023 Centipede -M 0 4002 3 4017 Centipede -M 0 4002 3 4020 Centipede -M 0 4003 6 4021 Kobold -M 0 4003 6 4021 Kobold -M 0 4003 6 4013 Kobold -M 0 4003 6 4013 Kobold -M 0 4003 6 4027 Kobold -M 0 4003 6 4027 Kobold -M 0 4004 3 4015 Orc -M 0 4004 3 4028 Orc -M 0 4004 3 4028 Orc -M 0 4005 1 4022 Large Orc -E 1 4000 5 1 Yellow Green Ring -* -* Level 2 -* -M 0 4050 1 4062 Warrior -G 1 4051 3 Helmet -M 0 4051 4 4070 Warrior -M 0 4051 4 4050 Warrior -M 0 4051 4 4073 Warrior -M 0 4051 4 4055 Warrior -M 0 4052 3 4056 Hobgoblin -M 0 4052 3 4065 Hobgoblin -M 0 4052 3 4059 Hobgoblin -M 0 4053 2 4058 Snake -M 0 4053 2 4068 Snake -M 0 4054 3 4060 Centipede -M 0 4054 3 4053 Centipede -M 0 4054 3 4052 Centipede -M 0 4055 2 4064 Hobgoblin -G 1 4050 20 Purple Potion -M 0 4055 2 4071 Hobgoblin -G 1 4050 20 Purple Potion -M 0 4056 2 4067 Orc -M 0 4056 2 4057 Orc -* Objects -R 0 4068 4052 -O 0 4052 8 4068 Mushroom -R 0 4069 4052 -O 0 4052 8 4069 Mushroom -R 0 4070 4052 -O 0 4052 8 4070 Mushroom -R 0 4071 4052 -O 0 4052 8 4071 Mushroom -* -* Level 3 -* -* Mobiles -M 0 4100 1 4114 Mage -G 1 4102 2 Scroll Of Identify -M 0 4101 1 4122 Troll -G 1 4100 2 Demon Blade -M 0 4102 3 4111 Snake -G 1 4103 10 Slime -M 0 4102 3 4111 Snake -G 1 4104 3 Poisoned slime -M 0 4103 6 4103 Thief -M 0 4103 2 4124 Thief -E 1 4053 3 16 Dirk -M 0 4105 3 4108 Centipede -M 0 4106 2 4113 Warrior -G 1 4101 1 Swordsman's Gloves -M 0 4107 1 4119 Kobold -G 1 4104 10 Slime -* Doors -D 0 4119 3 1 Secret Passage -D 0 4121 1 1 -* -* North Of Mountain -- Wilderness -* -M 0 4057 2 4038 Lion -M 0 4057 2 4041 Lion -M 0 4058 1 4044 Hill Giant -* -S -$ diff --git a/lc-mud/circle/world/zon/50.zon b/lc-mud/circle/world/zon/50.zon deleted file mode 100644 index 72a7a7552958fb00c192c00a8f5f030771790a34..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/50.zon +++ /dev/null @@ -1,72 +0,0 @@ -#50 -The Great Eastern Desert~ -5000 5099 30 2 -* -* Created by Rorschach of Alfa -* -* Mobiles -M 0 5015 3 5039 Dustdigger -M 0 5015 3 5033 Dustdigger -M 0 5015 3 5049 Dustdigger -M 0 5017 1 5058 Rabid Camel -M 0 5000 5 5047 Dervish -E 1 7211 25 16 Short Sword -M 0 5000 5 5033 Dervish -E 1 7211 25 16 Short Sword -M 0 5001 8 5040 Large Dervish -E 1 3022 25 16 Long Sword -M 0 5002 5 5031 Coral Snake -M 0 5003 5 5050 Small Scorpion -M 0 5004 1 5036 Purple Worm -G 1 5019 10 Pink Potion -G 1 5020 5 Platinum Wand -G 1 5021 1 Energy Bow -M 0 5005 1 5065 Brass Dragon -G 1 5024 1 Golden Key -G 1 5022 10 Encrypted Scroll -M 0 5006 1 5061 Nomad Leader -E 1 5016 10 16 Sabre -M 0 5007 1 5060 Nomad Commander -E 1 5017 15 16 Scimitar -M 0 5008 5 5059 Nomad Warrior -E 1 5018 25 16 Cutlass -M 0 5009 10 5057 Slave -M 0 5010 1 5011 Dracolich -E 1 5001 1 5 Banded Mail -E 1 5002 1 16 Halberd -M 0 5011 3 5009 Drider -E 1 3022 50 16 Long Sword -M 0 5012 3 5014 Duergar -E 1 5000 15 16 Mining Pick -M 0 5013 4 5021 Myconoid -M 0 5014 1 5021 Myconoid Shaman -E 1 5003 1 3 Mushroom Amulet -* Objects -O 0 5005 1 5011 Bone -R 0 5049 5006 -O 0 5006 6 5049 Cactus Cup -R 0 5031 5006 -O 0 5006 6 5031 Cactus Cup -R 0 5044 5006 -O 0 5006 6 5044 Cactus Cup -O 0 5007 1 5060 Basket -P 0 5012 1 5007 Stakes -P 0 5011 1 5007 Coil Of Rope -O 0 5008 1 5061 Basket -P 1 5014 5 5008 Turban -O 0 5009 1 5061 Basket -O 0 5010 1 5061 Basket -P 1 5013 50 5010 Tattered Map -O 0 5023 1 5070 Iron Chest -P 1 5025 3 5023 Bracelet -P 1 5026 3 5023 Ruby -P 1 5027 3 5023 Diamond -P 1 5028 3 5023 Sapphire -P 1 5029 3 5023 Lapis -P 1 5030 1 5023 Tiger Jewel -P 1 5031 1 5023 Red-Eyed Jewel -P 1 5032 3 5023 Emerald -P 1 5015 1 5023 Gold -* -S -$ diff --git a/lc-mud/circle/world/zon/51.zon b/lc-mud/circle/world/zon/51.zon deleted file mode 100644 index 1e5e44027d90cecbed7718725d25507a75a8fe17..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/51.zon +++ /dev/null @@ -1,114 +0,0 @@ -#51 -Drow City~ -5100 5199 30 1 -* -* Created by Rorschach of Alfa -* -* Mobiles -M 0 5100 15 5122 Goblin Slave -M 0 5100 15 5122 Goblin Slave -M 0 5100 15 5122 Goblin Slave -M 0 5100 15 5122 Goblin Slave -M 0 5100 15 5122 Goblin Slave -M 0 5100 15 5122 Goblin Slave -M 0 5100 15 5122 Goblin Slave -M 0 5100 15 5122 Goblin Slave -M 0 5101 10 5118 Drow Commoner -E 1 5100 50 16 Commoner's Longsword -M 0 5101 10 5133 Drow Commoner -E 1 5100 50 16 Commoner's Longsword -M 0 5102 4 5104 Drow Warrior -E 1 5101 12 16 Noble's Longsword -M 0 5102 4 5124 Drow Warrior -E 1 5101 12 16 Noble's Longsword -M 0 5102 4 5108 Drow Warrior -E 1 5101 12 16 Noble's Longsword -M 0 5102 4 5111 Drow Warrior -E 1 5101 12 16 Noble's Longsword -M 0 5103 4 5104 Drow Mage -E 1 5102 12 16 Two-Headed Snake Whip -M 0 5103 4 5124 Drow Mage -E 1 5102 12 16 Two-Headed Snake Whip -M 0 5103 4 5108 Drow Mage -E 1 5102 12 16 Two-Headed Snake Whip -M 0 5103 4 5111 Drow Mage -E 1 5102 12 16 Two-Headed Snake Whip -M 0 5104 4 5104 Drow Priestess -E 1 5103 12 16 Three-Headed Snake Whip -M 0 5104 4 5124 Drow Priestess -E 1 5103 12 16 Three-Headed Snake Whip -M 0 5104 4 5108 Drow Priestess -E 1 5103 12 16 Three-Headed Snake Whip -M 0 5104 4 5111 Drow Priestess -E 1 5103 12 16 Three-Headed Snake Whip -M 0 5105 3 5118 Drow Master -E 1 5105 3 16 Black Longsword -E 1 5110 5 17 Silvery Blue Wand -M 0 5105 3 5120 Drow Master -E 1 5104 2 16 Four-Headed Snake Whip -E 1 5110 5 17 Silvery Blue Wand -M 0 5105 3 5116 Drow Master -E 1 5104 2 16 Four-Headed Snake Whip -E 1 5110 5 17 Silvery Blue Wand -M 0 5106 2 5150 Drow Weapons Master -E 1 5105 2 16 Black Longsword -E 1 5109 1 9 Gauntlets -M 0 5106 2 5101 Drow Weapons Master -E 1 5105 2 16 Black Longsword -M 0 5107 3 5125 4th Matron Mother -E 1 5106 3 16 Five-Headed Snake Whip -G 1 5114 3 Green Hat -M 0 5107 3 5105 3rd Matron Mother -E 1 5106 3 16 Five-Headed Snake Whip -E 1 5111 2 6 Small Helmet -M 0 5107 3 5109 2nd Matron Mother -E 1 5106 3 16 Five-Headed Snake Whip -E 1 5108 2 10 Iron Bracers -M 0 5108 1 5113 1st Matron Mother -E 1 5107 1 16 Six-Headed Snake Whip -E 1 5112 1 1 Ruby Ring -M 0 5109 6 5101 Drider -M 0 5109 6 5106 Drider -M 0 5109 6 5115 Drider -M 0 5109 6 5121 Drider -M 0 5110 2 5110 Drider -M 0 5110 2 5110 Drider -M 0 5111 1 5148 Yochlol -E 1 5113 1 16 Spider Dagger -E 1 5115 1 17 Adamantite Key -* Objects -O 1 5116 1 5149 Treasure -* Doors -D 0 5100 3 0 City Gates -D 0 5101 1 0 -D 0 5104 2 1 3rd House Throne Room -D 0 5105 0 1 -D 0 5108 3 1 2nd House Throne Room -D 0 5109 1 1 -D 0 5110 3 1 1st House Main Gate -D 0 5111 1 1 -D 0 5112 0 1 1st House Main Chamber -D 0 5113 2 1 -D 0 5117 0 1 Temple Of Lloth -D 0 5119 2 1 -D 0 5123 0 1 4th House Entrance -D 0 5124 2 1 -D 0 5129 0 1 Weaponsmaster's Chamber -D 0 5150 2 1 -D 0 5132 2 1 Warriors' Barracks -D 0 5133 0 1 -D 0 5136 1 1 Mages' Barracks -D 0 5137 3 1 -D 0 5138 3 1 Clerics' Barracks -D 0 5139 1 1 -D 0 5140 0 1 Temple Main Chamber -D 0 5141 2 1 -D 0 5142 1 1 Slave Cells -D 0 5146 3 1 -D 0 5146 0 1 Slave Pen -D 0 5147 2 1 -D 0 5148 3 2 Treasure Chamber -D 0 5149 1 2 -* -S -$ diff --git a/lc-mud/circle/world/zon/52.zon b/lc-mud/circle/world/zon/52.zon deleted file mode 100644 index 6762af4579fc14ce055c06fe0c1e5184d9e8ed4e..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/52.zon +++ /dev/null @@ -1,105 +0,0 @@ -#52 -The City Of Thalos~ -5200 5299 15 2 -* -* Created by Rorschach of Alfa -* -* Mobiles -M 0 5200 1 5250 Beholder -E 1 5217 3 17 Silver Flute -E 1 5208 3 11 Iron Shield -E 1 5223 1 3 Green Cloak -* -* Lamia Note - #5201 Is AGGR_GOOD And Casts Spells, #5209 Is Just Plain AGGR -* -M 0 5201 25 5235 Lamia -M 0 5201 25 5232 Lamia -M 0 5201 25 5236 Lamia -M 0 5201 25 5237 Lamia -M 0 5201 25 5242 Lamia -M 0 5201 25 5218 Lamia -M 0 5201 25 5219 Lamia -M 0 5201 25 5220 Lamia -M 0 5201 25 5225 Lamia -M 0 5201 25 5226 Lamia -M 0 5201 25 5203 Lamia -M 0 5201 25 5204 Lamia -M 0 5201 25 5206 Lamia -M 0 5201 25 5208 Lamia -M 0 5209 25 5205 Lamia -M 0 5209 25 5209 Lamia -M 0 5209 25 5216 Lamia -M 0 5209 25 5221 Lamia -M 0 5209 25 5224 Lamia -M 0 5209 25 5229 Lamia -M 0 5209 25 5234 Lamia -M 0 5209 25 5240 Lamia -* Mobiles -M 0 5202 1 5229 Mimic - Chest -E 1 5214 4 17 Ball Of Light -M 0 5203 1 5226 Mimic - Boulder -G 1 5215 4 Tattered Scroll -M 0 5204 1 5219 Mimic - Floor -G 1 5218 4 Talisman -M 0 5205 1 5238 Mimic - Pottery -E 1 5214 4 17 Ball Of Light -M 0 5206 1 5236 Mimic - Planks -E 1 5222 4 12 Black Robe -M 0 5207 4 5232 Lizard -M 0 5207 4 5217 Lizard -M 0 5207 4 5227 Lizard -M 0 5207 4 5244 Lizard -M 0 5208 3 5247 Golem SW -E 1 5224 1 17 Ebony Seal -E 1 5200 5 5 Chainmail Vest -M 0 5208 3 5246 Golem NW -E 1 5226 1 17 Ivory Seal -M 0 5208 3 5248 Golem NE -E 1 5221 5 16 Two-Handed Sword -* Objects -O 0 5225 1 5231 Curved Desk -P 1 5215 1 5225 Scroll Of Enchantment -P 1 5216 2 5225 Scroll Of Detection -O 0 5227 1 5233 Glass Cabinet -P 1 5201 1 5227 Iron Helm -P 1 5202 1 5227 Iron Gauntlets -P 1 5203 1 5227 Iron Sleeves -P 1 5204 1 5227 Iron Boots -P 1 5205 1 5227 Iron Leggings -P 1 5206 1 5227 Iron Girth -R 0 5242 5228 -O 0 5228 10 5242 Rotten Arm -R 0 5217 5219 -O 0 5219 5 5217 Venison -R 0 5234 5220 -O 0 5220 1 5234 Cracked Fountain -R 0 5229 5207 -O 0 5207 5 5229 Battered Armor -R 0 5238 5210 -O 0 5210 2 5238 Black Potion -R 0 5238 5211 -O 0 5211 2 5238 Orange Potion -R 0 5238 5213 -O 0 5213 2 5238 Serpentine Staff -R 0 5230 5250 -O 0 5250 2 5230 Mandolin -R 0 5230 5251 -O 0 5251 2 5230 Harp -O 0 5230 1 5202 Pale Blue Stone -O 0 5231 1 5205 Scarlet And Blue Stone -O 0 5232 1 5208 Incandescent Blue Stone -O 0 5233 1 5211 Deep Red Stone -O 0 5234 1 5214 Pink Stone -O 0 5235 1 5217 White Stone -O 0 5236 1 5220 Pale Lavander Stone -O 0 5237 1 5224 Green And Lavander Stone -O 0 5238 1 5227 Dusty Rose Stone -O 0 5239 1 5230 Dull Grey Stone -O 0 5240 1 5234 Vivbant Purple Stone -O 0 5241 1 5238 Pink And Green Stone -O 0 5242 1 5241 Pale Green Stone -O 0 5243 1 5246 Clear Stone -O 0 5244 1 5250 Iridescent Stone -* -S -$ diff --git a/lc-mud/circle/world/zon/53.zon b/lc-mud/circle/world/zon/53.zon deleted file mode 100644 index 200db9966ad183a879e88d6045fb368e145f5244..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/53.zon +++ /dev/null @@ -1,127 +0,0 @@ -#53 -The Great Pyramid~ -5300 5399 20 2 -* -* Created by Andersen of HexOynx. -* -* Modifed and edited for CircleMUD by Furry -* -* Mobiles -M 0 5300 6 5302 Asp -M 0 5300 6 5305 Asp -M 0 5300 6 5313 Asp -M 0 5300 6 5340 Asp -M 0 5301 4 5303 Cobra -M 0 5301 4 5341 Cobra -M 0 5302 3 5306 Mongoose -M 0 5302 3 5316 Mongoose -M 0 5302 3 5326 Mongoose -M 0 5303 6 5309 Pyramid Watcher -E 1 5300 6 16 Egyptian Mace -M 0 5303 6 5309 Pyramid Watcher -E 1 5301 10 12 Sand-Coloured Robes -M 0 5303 6 5337 Pyramid Watcher -E 1 5300 6 16 Egyptian Mace -M 0 5303 6 5337 Pyramid Watcher -E 1 5301 10 12 Sand-Coloured Robes -M 0 5303 6 5340 Pyramid Watcher -E 1 5300 6 16 Egyptian Mace -M 0 5303 6 5340 Pyramid Watcher -E 1 5301 10 12 Sand-Coloured Robes -M 0 5304 6 5325 Tomb Thief -E 1 5302 7 16 Obsidian Dagger -M 0 5304 6 5326 Tomb Thief -E 1 5302 7 16 Obsidian Dagger -M 0 5304 6 5333 Tomb Thief -E 1 5302 7 16 Obsidian Dagger -M 0 5304 6 5334 Tomb Thief -E 1 5302 7 16 Obsidian Dagger -M 0 5304 6 5335 Tomb Thief -E 1 5302 7 16 Obsidian Dagger -M 0 5304 6 5342 Tomb Thief -E 1 5302 7 16 Obsidian Dagger -M 0 5305 1 5343 Ali Baba -E 1 5303 4 6 Cloth Turban -E 1 5302 7 16 Obsidian Dagger -M 0 5306 1 5323 Magic Carpet -M 0 5307 4 5325 Mummy -E 1 5304 5 5 Cloth Wrappings -G 1 5306 3 Jar Of Formaldehyde -M 0 5307 4 5325 Mummy -E 1 5304 5 5 Cloth Wrappings -G 1 5305 2 Bottle Of Embalming Fluid -M 0 5307 4 5337 Mummy -E 1 5304 5 5 Cloth Wrappings -M 0 5307 4 5341 Mummy -E 1 5304 5 5 Cloth Wrappings -M 0 5308 4 5354 Sandman -M 0 5308 4 5355 Sandman -M 0 5308 4 5356 Sandman -M 0 5308 4 5357 Sandman -M 0 5309 1 5311 Efreet -E 1 5307 4 17 Ball Of Flame -M 0 5310 2 5345 Caryatid -E 1 5308 3 16 Stone Scimitar -M 0 5310 2 5345 Caryatid -E 1 5308 3 16 Stone Scimitar -G 1 5309 1 Stone Key -* -* Note: The Second One Was Given The Key To Require That BOTH Be Killed -* At Some Time For The Key To Be Reloaded. This Way If Players Only Kill -* The Second One, The First One Will Be Loaded W/O Key On The Next Reset. -* Of Course, This Won't Really FORCE The Previous Players To Kill Both, -* But It Is More Balanced Than Always Fighting Only The First Caraytid. -* And Also The Treasure Of The Pharoahs -* -M 0 5311 1 5323 Djinn -E 1 5313 4 17 Lamp -M 0 5312 3 5348 Hieracosphinx -M 0 5312 3 5349 Hieracosphinx -M 0 5312 3 5351 Hieracosphinx -M 0 5313 2 5350 Gynosphinx -M 0 5313 2 5350 Gynosphinx -G 1 5314 2 Ankh -M 0 5314 2 5352 Criosphinx -M 0 5314 2 5352 Criosphinx -G 1 5315 2 Book Of Riddles -M 0 5315 1 5347 Androsphinx -G 1 5316 2 Lion's Paw -M 0 5316 1 5358 Great Sphinx -E 1 5317 1 17 Answer -M 0 5317 1 5332 Lord Ramses -G 1 5319 1 Pile Of Sand -G 1 5320 3 Curse Of The Mummy -G 1 5321 2 Small Elixir -G 1 5321 2 Small Elixir -E 1 5322 1 6 Golden Mask -* Objects -O 1 5318 1 5359 The Treasure Of The Sphinx -O 1 5324 1 5359 A Sun Wand -O 1 5325 1 5359 A Sandy Ring -O 1 5326 1 5359 A Small Golden Sphinx -O 1 5327 1 5359 Sphinxian Leggings -O 0 5323 1 5319 Key -O 0 5310 1 5345 The Stone Sarcophagus -P 1 5311 2 5310 Dust -P 1 5312 1 5310 The Scarab -* Doors -D 0 5306 5 1 Stone Atop The Pyramid -D 0 5308 4 1 -D 0 5309 3 1 Fire Pool -D 0 5310 1 1 -D 0 5322 2 2 Entrance To The Vault Of The Lamp -D 0 5323 0 2 -D 0 5326 3 2 Coffin Lid -D 0 5327 1 2 * Note That This Has No Key Number, Locking You In -D 0 5329 2 1 Stone Into The Ancient Hall -D 0 5330 0 1 -D 0 5331 5 1 The Stone Into The Tomb Of Ramses -D 0 5332 4 1 -D 0 5343 5 1 Floor Into The Tomb -D 0 5344 4 1 -D 0 5344 0 1 Tomb Of The Pharoahs -D 0 5345 2 1 -D 0 5358 2 2 Entrance To The Hole In The Sand -* -S -$ diff --git a/lc-mud/circle/world/zon/54.zon b/lc-mud/circle/world/zon/54.zon deleted file mode 100644 index bd82cb3d7e7b6873cc97102fb97431d27ed2b6de..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/54.zon +++ /dev/null @@ -1,414 +0,0 @@ -#54 -New Thalos~ -5400 5699 20 2 -* -* Created by Duke and Conner of SillyMud -* -* Edited and modified for CircleMUD by Furry -* -* Mobiles -M 0 5400 1 5548 Mage Guildmaster -M 0 5401 1 5503 Cleric Guildmaster -M 0 5402 1 5534 Warrior Guildmaster -M 0 5403 1 5546 Thief Guildmaster -M 0 5404 1 5401 Receptionist -M 0 5405 1 5402 Old Withered Mage/Bartender - Shopkeeper -G 1 5467 100 Glass Of Blue Oasis -G 1 5468 100 Glass Of Wine -G 1 5469 100 Bottle Of Grog -M 0 5406 1 5402 Brother John -M 0 5407 1 5403 Panhandler -M 0 5408 1 5404 Panhandler -M 0 5409 20 5410 Beggar -M 0 5410 1 5535 Baker - Shopkeeper -G 1 5440 100 Hunk Of Cheese -G 1 5441 100 Bread -G 1 5442 100 Some Dry Rations -G 1 5443 100 Some Iron Rations -G 1 5445 100 Some Nuts -G 1 5491 100 Sesame Seed -M 0 5411 1 5528 Shopkeeper - Shopkeeper -G 1 5434 100 Sack -G 1 5435 100 Oil Lamp -G 1 5436 100 Backpack -G 1 5437 100 Basket -G 1 5438 100 Belt Pouch -G 1 5439 100 Candle -M 0 5412 1 5521 Banker -M 0 5413 1 5514 Ahkeem The Tailor - Shopkeeper -G 1 5446 100 Belt -G 1 5447 100 Hiking Boots -G 1 5448 100 Fur Cloak -G 1 5449 100 Girdle -G 1 5450 100 Pair Of Hose -G 1 5451 100 Common Robe -G 1 5452 100 Embroidered Robe -G 1 5453 100 Sandals -G 1 5454 100 Sash -G 1 5455 100 Silk Jacket -E 1 5483 100 16 Sewing Shears -M 0 5414 1 5515 Vera The Veggie Lady - Shopkeeper -G 1 5456 100 Egg -G 1 5457 100 Carrot -G 1 5458 100 Tomatoe -G 1 5459 100 Fig -G 1 5460 100 Some Dates -M 0 5415 1 5522 Butch The Meatcutter - Shopkeeper -G 1 5461 100 Leg Of Lamb -G 1 5462 100 Side Of Beef -G 1 5463 100 Whole Chicken -E 1 5484 100 16 Meat Cleaver -M 0 5416 1 5529 Abdul The Armorer - Shopkeeper -G 1 5415 100 Suit Of Banded Mail -G 1 5416 100 Suit Of Brigandine -G 1 5417 100 Suit Of Field Plate -G 1 5418 100 Suit Of Ringmail -G 1 5419 100 Suit Of Splintmail -G 1 5420 100 Wooden Shield -G 1 5421 100 Splinted Shield -M 0 5417 1 5536 Igor The Weaponsmith - Shopkeeper -G 1 5403 100 Morningstar -G 1 5404 100 Awl-Pike -G 1 5405 100 Bardiche -G 1 5406 100 Bec De Corbine -G 1 5407 100 Bill-Guisarme -G 1 5408 100 Fauchard -G 1 5409 100 Glaive -G 1 5410 100 Guisarme -G 1 5411 100 Sickle -G 1 5412 100 Two-Handed Bastard Sword -G 1 5413 100 Scimitar -G 1 5414 100 Rapier -M 0 5418 1 5432 Cassandra - Shopkeeper -G 1 5464 20 Salted Herring -G 1 5465 20 Muscle -M 0 5419 1 5425 Foreman -E 1 5485 1 16 Fountain Pen -M 0 5420 2 5425 Construction Worker -E 1 5486 2 16 Sledge Hammer -M 0 5420 2 5425 Construction Worker -E 1 5486 2 16 Sledge Hammer -M 0 5421 1 5511 Statue Of Brahman -M 0 5422 1 5511 Statue Of Siva -M 0 5423 1 5511 Statue Of Indra -M 0 5424 1 5511 Statue Of Yama -M 0 5425 1 5516 Statue Of Surya -M 0 5426 1 5516 Statue Of Kali -M 0 5427 1 5516 Statue Of Brihaspati -M 0 5428 1 5516 Statue Of Puchan -M 0 5429 1 5466 Aziz -M 0 5430 1 5466 Mustafah -M 0 5431 1 5466 Fatima -M 0 5432 1 5466 Kareem -M 0 5433 12 5406 Nomad Merchant -M 0 5433 12 5509 Nomad Merchant -M 0 5433 12 5414 Nomad Merchant -M 0 5433 12 5426 Nomad Merchant -M 0 5433 12 5449 Nomad Merchant -M 0 5433 12 5462 Nomad Merchant -M 0 5434 4 5589 Sultan's Bodyguard -M 0 5434 4 5589 Sultan's Bodyguard -M 0 5434 4 5589 Sultan's Bodyguard -M 0 5434 4 5589 Sultan's Bodyguard -M 0 5435 3 5468 Skinny Kid -M 0 5435 3 5468 Skinny Kid -M 0 5435 3 5468 Skinny Kid -M 0 5436 8 5433 Dockworker -M 0 5436 8 5433 Dockworker -M 0 5436 8 5433 Dockworker -M 0 5436 8 5434 Dockworker -M 0 5436 8 5434 Dockworker -M 0 5436 8 5435 Dockworker -M 0 5436 8 5443 Dockworker -M 0 5436 8 5443 Dockworker -M 0 5437 2 5406 Taxcollector -G 1 5400 1 The Palace Key Of New Thalos -M 0 5438 1 5415 Gord -M 0 5439 1 5405 Chulainn -E 1 5492 1 16 Gae Bolg -E 1 5415 60 5 Banded Mail -M 0 5440 1 5406 Daghdha -M 0 5441 1 5415 Curley GreenLeaf -M 0 5442 21 5410 Wandering Prophet -M 0 5442 21 5424 Wandering Prophet -M 0 5442 21 5508 Wandering Prophet -M 0 5442 21 5509 Wandering Prophet -M 0 5442 21 5513 Wandering Prophet -M 0 5442 21 5513 Wandering Prophet -M 0 5442 21 5514 Wandering Prophet -M 0 5442 21 5631 Wandering Prophet -M 0 5442 21 5631 Wandering Prophet -M 0 5443 14 5465 Alley Cat -M 0 5443 14 5467 Alley Cat -M 0 5443 14 5469 Alley Cat -M 0 5443 14 5473 Alley Cat -M 0 5443 14 5514 Alley Cat -M 0 5443 14 5569 Alley Cat -M 0 5443 14 5617 Alley Cat -M 0 5444 24 5429 Vulture -M 0 5444 24 5430 Vulture -M 0 5444 24 5453 Vulture -M 0 5444 24 5463 Vulture -M 0 5444 24 5507 Vulture -M 0 5444 24 5522 Vulture -M 0 5444 24 5523 Vulture -M 0 5444 24 5524 Vulture -M 0 5444 24 5532 Vulture -M 0 5444 24 5549 Vulture -M 0 5444 24 5555 Vulture -M 0 5444 24 5567 Vulture -M 0 5444 24 5568 Vulture -M 0 5444 24 5692 Vulture -M 0 5445 2 5455 Old Man -E 1 5490 2 17 Chessboard -M 0 5445 2 5455 Old Man -E 1 5490 2 17 Chessboard -M 0 5446 1 5551 Lugh The Librarian -M 0 5447 1 5411 Dirt Devil -M 0 5448 1 5411 Lamia -M 0 5449 1 5411 Raggety Dervish -M 0 5450 1 5589 Sultan -M 0 5451 8 5587 Harem Girl -M 0 5451 8 5587 Harem Girl -M 0 5451 8 5587 Harem Girl -M 0 5451 8 5587 Harem Girl -M 0 5451 8 5587 Harem Girl -M 0 5451 8 5587 Harem Girl -M 0 5451 8 5587 Harem Girl -M 0 5451 8 5587 Harem Girl -M 0 5452 1 5591 Jailor -G 1 5493 1 Jail Key -M 0 5453 4 5587 Eunich -M 0 5453 4 5587 Eunich -M 0 5453 4 5587 Eunich -M 0 5453 4 5587 Eunich -M 0 5454 1 5587 Nichole, The Sultan's Favorite -M 0 5455 1 5566 Allah -E 1 5496 2 16 The Wrath Of Allah -M 0 5456 1 5525 Mage Guildguard -M 0 5457 1 5512 Cleric Guildguard -M 0 5458 1 5526 Warrior Guildguard -M 0 5459 1 5532 Thief Guildguard -M 0 5460 2 5561 Servant Boy -M 0 5460 2 5561 Servant Boy -M 0 5461 20 5412 Sultan's Guard -E 1 5413 100 16 Scimitar -E 1 5417 53 5 Suit Of Field Plate -E 1 5421 52 11 Splinted Shield -M 0 5461 20 5418 Sultan's Guard -E 1 5413 100 16 Scimitar -E 1 5417 43 5 Suit Of Field Plate -E 1 5421 42 11 Splinted Shield -M 0 5461 20 5419 Sultan's Guard -E 1 5413 100 16 Scimitar -E 1 5417 43 5 Suit Of Field Plate -E 1 5421 42 11 Splinted Shield -M 0 5461 20 5420 Sultan's Guard -E 1 5413 100 16 Scimitar -E 1 5417 43 5 Suit Of Field Plate -E 1 5421 42 11 Splinted Shield -M 0 5461 20 5444 Sultan's Guard -M 0 5461 20 5445 Sultan's Guard -M 0 5461 20 5446 Sultan's Guard -M 0 5461 20 5447 Sultan's Guard -M 0 5461 20 5572 Sultan's Guard -M 0 5461 20 5581 Sultan's Guard -M 0 5461 20 5582 Sultan's Guard -M 0 5461 20 5588 Sultan's Guard -M 0 5462 12 5413 Sultan's Guard -E 1 5413 100 16 Scimitar -E 1 5417 53 5 Suit Of Field Plate -E 1 5421 72 11 Splinted Shield -M 0 5462 12 5413 Sultan's Guard -E 1 5413 100 16 Scimitar -E 1 5417 53 5 Suit Of Field Plate -E 1 5421 42 11 Splinted Shield -M 0 5462 12 5422 Sultan's Guard -E 1 5413 100 16 Scimitar -E 1 5417 43 5 Suit Of Field Plate -E 1 5421 42 11 Splinted Shield -M 0 5462 12 5422 Sultan's Guard -E 1 5413 100 16 Scimitar -E 1 5417 43 5 Suit Of Field Plate -E 1 5421 42 11 Splinted Shield -M 0 5462 12 5423 Sultan's Guard -E 1 5413 100 16 Scimitar -E 1 5417 43 5 Suit Of Field Plate -E 1 5421 42 11 Splinted Shield -M 0 5462 12 5423 Sultan's Guard -E 1 5413 100 16 Scimitar -E 1 5417 43 5 Suit Of Field Plate -E 1 5421 42 11 Splinted Shield -M 0 5462 12 5431 Sultan's Guard -E 1 5413 100 16 Scimitar -E 1 5417 43 5 Suit Of Field Plate -E 1 5421 42 11 Splinted Shield -M 0 5462 12 5431 Sultan's Guard -E 1 5413 100 16 Scimitar -E 1 5417 43 5 Suit Of Field Plate -E 1 5421 42 11 Splinted Shield -M 0 5463 1 5406 Chief Sultan's Guard -M 0 5464 1 5531 Mercenary -M 0 5465 1 5542 Shipwright - Shopkeeper -G 1 3060 100 Raft -G 1 3061 100 Canoe -M 0 5466 1 5544 Blacksmith - Shopkeeper -G 1 5487 100 Horse Shoe -G 1 5488 100 Saddle -G 1 5489 100 Riding Crop -M 0 5467 6 5545 Horse -M 0 5467 6 5545 Horse -M 0 5467 6 5545 Horse -M 0 5467 6 5545 Horse -M 0 5467 6 5545 Horse -M 0 5467 6 5545 Horse -M 0 5468 8 5427 Tourist -M 0 5468 8 5428 Tourist -M 0 5469 1 5699 Ixitxachitl -M 0 5470 1 5600 Cryohydra -M 0 5471 1 5604 Minotaur Lizard -M 0 5472 5 5599 Death Dog -M 0 5472 5 5599 Death Dog -M 0 5472 5 5599 Death Dog -M 0 5472 5 5599 Death Dog -M 0 5472 5 5599 Death Dog -M 0 5473 1 5603 Spotted Lion -M 0 5474 1 5598 Behir -M 0 5475 1 5597 Chimera -M 0 5476 1 5602 Couatl -M 0 5477 1 5601 Giant Hornet -M 0 5478 1 5583 Pegasus -M 0 5479 1 5523 Elvria - Shopkeeper -G 1 5470 100 Glowing Blue Vial -G 1 5471 100 Deep-Green Potion -G 1 5472 100 Crystal Clear Potion -G 1 5473 100 Off White Potion -G 1 5474 100 Dark Blue Potion -M 0 5480 1 5524 Braheem - Shopkeeper -G 1 5478 100 Scroll Of Recall -G 1 5479 100 Grey-Silver Wand -G 1 5480 100 Wand Of Glinting Yellow -G 1 5481 100 Wand Of Oak -G 1 5482 100 Pink Wand -M 0 5481 1 5504 High Priest -M 0 5482 15 5407 Royal Guard -M 0 5482 15 5408 Royal Guard -M 0 5482 15 5414 Royal Guard -M 0 5482 15 5416 Royal Guard -M 0 5482 15 5444 Royal Guard -M 0 5482 15 5445 Royal Guard -M 0 5482 15 5450 Royal Guard -M 0 5482 15 5452 Royal Guard -M 0 5483 1 5538 Patch The Bartender - Shopkeeper -G 1 5475 100 Flaming Scorpion -G 1 5476 100 Barrel Of Beer -G 1 5477 100 Shot Of Whisky -M 0 5484 1 5537 Stitch, The Leather Dude - Shopkeeper -G 1 5422 100 Buckler -G 1 5423 100 Leather Jacket -G 1 5424 100 Leather Sleeves -G 1 5425 100 Leather Cap -G 1 5426 100 Leather Pants -G 1 5427 100 Leather Gloves -G 1 5428 100 Padded Leather Boots -G 1 5429 100 Studded Leather Jacket -G 1 5430 100 Studded Leather Sleeves -G 1 5431 100 Studded Leather Pants -G 1 5432 100 Studded Leather Gloves -G 1 5433 100 Leather Shield -M 0 5485 1 5578 Gardener -M 0 5486 1 5583 Nightmare -M 0 5487 1 5596 Wolverine -E 1 5495 1 16 Wolverine Claw -M 0 5488 1 5580 Mimic -M 0 5489 1 5554 Mayor -G 1 5401 1 Key To The City Of New Thalos -M 0 5490 1 5561 Chef -* Objects -R 0 5521 3034 -O 0 3034 10 5521 ATM -R 0 5406 5402 -O 0 5402 1 5406 Large Central Fountain -* Doors -D 0 5413 2 2 The South Gate -D 0 5411 0 2 -D 0 5422 0 2 The North Gate -D 0 5567 2 2 -D 0 5423 3 2 The West Gate -D 0 5569 1 2 -D 0 5431 1 2 The East Gate -D 0 5568 3 2 -D 0 5444 2 2 Jail -D 0 5553 0 2 -D 0 5459 5 1 Underground -D 0 5475 4 1 -D 0 5470 5 1 Underground -D 0 5478 4 1 -D 0 5474 5 1 Underground -D 0 5481 4 1 -D 0 5483 3 1 Grating On River Ishtar -D 0 5484 1 1 -D 0 5487 3 1 Grating On River Ishtar -D 0 5623 1 1 -D 0 5491 4 1 Outside The Wall -D 0 5503 1 1 Alley -D 0 5517 2 1 Braheem's Magic Shop -D 0 5530 1 1 The Thieves' Guild -D 0 5532 3 1 -D 0 5534 1 1 Alley -D 0 5546 2 1 Alley -D 0 5558 3 2 The Palace Gate -D 0 5550 1 2 -D 0 5563 2 1 The Kitchen -D 0 5561 0 1 -D 0 5565 0 1 The Shrine Of Allah -D 0 5566 2 1 -D 0 5572 2 1 Dining Hall -D 0 5571 0 1 -D 0 5574 0 1 Entrance To The Dungeon -D 0 5575 2 1 -D 0 5575 5 1 Jailer's Room -D 0 5591 4 1 -D 0 5577 2 1 Guest Room -D 0 5576 0 1 -D 0 5579 0 1 Art Exhibit -D 0 5580 2 1 -D 0 5582 2 1 Guest Room -D 0 5581 0 1 -D 0 5582 3 2 Harem -D 0 5587 1 2 -D 0 5584 0 1 Guard Room -D 0 5585 2 1 -D 0 5584 3 1 Throne Room -D 0 5589 1 1 -D 0 5588 0 1 Throne Room -D 0 5589 2 1 -D 0 5588 2 1 Harem -D 0 5587 0 1 -D 0 5589 0 2 Treasury -D 0 5590 2 2 -D 0 5591 1 1 Tunnel In The Dungeon -D 0 5592 3 1 -D 0 5592 0 2 Cell -D 0 5597 2 2 -D 0 5592 2 2 Cell -D 0 5601 0 2 -D 0 5593 0 2 Cell -D 0 5598 2 2 -D 0 5593 2 2 Cell -D 0 5602 0 2 -D 0 5594 0 2 Cell -D 0 5599 2 2 -D 0 5594 2 2 Cell -D 0 5603 0 2 -D 0 5595 0 2 Cell -D 0 5600 2 2 -D 0 5595 1 2 Secret Cell -D 0 5596 3 2 -D 0 5595 2 2 Cell -D 0 5604 0 2 -D 0 5653 1 1 Boulder To River -D 0 5698 3 1 Lair Of The Ixitxachitl -D 0 5699 1 1 -S -$ diff --git a/lc-mud/circle/world/zon/60.zon b/lc-mud/circle/world/zon/60.zon deleted file mode 100644 index a0f9c110170acfce11dade0e0be574a9d54712f3..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/60.zon +++ /dev/null @@ -1,132 +0,0 @@ -#60 -Haon-Dor, Light Forest~ -6000 6099 13 2 -* -* Mobiles -M 0 6000 1 6009 John The Lumberjack -E 1 6000 2 16 Lumber Axe -E 1 6001 10 5 Chequered Shirt -E 1 6002 20 8 Leather Boots -M 0 6001 6 6012 Rabbit -G 1 6023 10 Meat -M 0 6001 6 6015 Rabbit -G 1 6023 10 Meat -M 0 6001 6 6017 Rabbit -G 1 6023 10 Meat -M 0 6001 6 6019 Rabbit -G 1 6023 10 Meat -M 0 6002 1 6022 Brown Bear -M 0 6004 1 6023 Fallow Deer -G 1 6024 4 Venison -M 0 6005 4 6014 Brown Fox -* Objects -O 0 6003 1 6010 Fireplace -P 1 6006 1 6003 Key To Wooden Chest -R 0 6010 6004 -O 0 6004 50 6010 Lantern -O 0 6005 1 6010 Wooden Chest -P 1 6007 1 6005 Coins -R 0 6010 6013 -O 0 6013 100 6010 Water Barrel -O 0 6010 1 6023 Blackberries -R 0 6006 6011 -O 0 6011 10 6006 Mushroom -R 0 6013 6011 -O 0 6011 10 6013 Mushroom -R 0 6016 6011 -O 0 6011 10 6016 Mushroom -R 0 6019 6011 -O 0 6011 10 6019 Mushroom -R 0 6065 6011 -O 0 6011 10 6065 Mushroom -R 0 6062 6011 -O 0 6011 10 6062 Mushroom -R 0 6069 6011 -O 0 6011 10 6069 Mushroom -R 0 6078 6011 -O 0 6011 10 6078 Mushroom -O 0 6012 1 6000 The News Sign -* -* Haon-Dor Addition, By Derkhil -* -* Mobiles -M 0 6006 1 6033 Bird With Broken Wing -M 0 6007 1 6033 Bobcat -M 0 6008 4 6005 Sparrow -M 0 6008 4 6013 Sparrow -M 0 6008 4 6062 Sparrow -M 0 6009 3 6032 Robin -M 0 6009 4 6066 Robin -M 0 6009 4 6013 Robin -M 0 6009 4 6016 Robin -M 0 6010 2 6030 Nested (Hidden) Squirrel -M 0 6010 2 6030 Nested (Hidden) Squirrel -M 0 6011 1 6067 (Hidden) Badger -M 0 6012 7 6003 Grey Squirrel -M 0 6012 7 6007 Grey Squirrel -M 0 6012 7 6028 Grey Squirrel -M 0 6012 7 6032 Grey Squirrel -M 0 6012 7 6030 Grey Squirrel -M 0 6012 7 6064 Grey Squirrel -M 0 6012 7 6075 Grey Squirrel -M 0 6013 4 6030 Chipmunk -M 0 6013 4 6021 Chipmunk -M 0 6013 4 6067 Chipmunk -M 0 6013 4 6061 Chipmunk -M 0 6014 4 6026 Crow -M 0 6014 4 6026 Crow -M 0 6014 4 6026 Crow -M 0 6014 4 6027 Crow -M 0 6015 1 6026 Vulture -M 0 6016 1 6025 Small 5-Pt Buck -G 1 6024 4 Venison -M 0 6017 3 6027 Fish -M 0 6017 3 6027 Fish -M 0 6017 3 6027 Fish -M 0 6018 2 6027 Duckling -M 0 6018 2 6027 Duckling -M 0 6019 2 6027 Duck -M 0 6019 2 6027 Duck -M 0 6001 11 6068 Rabbit -G 1 6023 16 Meat -M 0 6001 11 6062 Rabbit -G 1 6023 16 Meat -M 0 6001 11 6071 Rabbit -G 1 6023 16 Meat -M 0 6001 11 6070 Rabbit -G 1 6023 16 Meat -M 0 6001 11 6060 Rabbit -G 1 6023 16 Meat -M 0 6005 8 6069 Brown Fox -M 0 6005 8 6074 Brown Fox -M 0 6005 8 6060 Brown Fox -* Objects -R 0 6006 6014 -R 0 6007 6014 -R 0 6008 6014 -R 0 6013 6014 -R 0 6014 6014 -O 0 6014 5 6006 Brook -O 0 6014 5 6007 Brook -O 0 6014 5 6008 Brook -O 0 6014 5 6013 Brook -O 0 6014 5 6014 Brook -R 0 6025 6015 -O 0 6015 2 6025 Lake -R 0 6025 6015 -O 0 6015 2 6027 Lake -O 0 6016 1 6033 Oaken Cudgel -O 0 6017 1 6026 Corpse Of The Boar -P 1 6018 1 6017 Meat -P 1 6019 1 6017 Tusks -O 0 6020 1 6067 Invis Floating Log -O 0 6021 1 6032 Invis Bird's Nest -P 1 6022 3 6021 Robin's Egg -P 1 6022 3 6021 Robin's Egg -P 1 6022 3 6021 Robin's Egg -* Doors -D 0 6009 0 1 Cabin -D 0 6010 2 1 -* -S -$ diff --git a/lc-mud/circle/world/zon/61.zon b/lc-mud/circle/world/zon/61.zon deleted file mode 100644 index 9905cbe6e4e74d82c62443da6adcbeabf9287da1..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/61.zon +++ /dev/null @@ -1,62 +0,0 @@ -#61 -Haon-Dor, Dark Forest~ -6100 6199 30 2 -* Mobiles -M 0 6100 2 6116 Vicious Warg -M 0 6100 2 6116 Vicious Warg -M 0 6101 2 6127 Ferocious Warg -M 0 6101 2 6127 Ferocious Warg -M 0 6102 4 6108 Grey Wolf -M 0 6102 4 6108 Grey Wolf -M 0 6102 4 6104 Grey Wolf -M 0 6102 4 6104 Grey Wolf -M 0 6103 4 6112 Black Wolf -M 0 6103 4 6112 Black Wolf -M 0 6103 4 6118 Black Wolf -M 0 6103 4 6118 Black Wolf -M 0 6110 4 6120 Tree -M 0 6110 4 6123 Tree -M 0 6111 4 6109 Tree -M 0 6111 4 6105 Tree -M 0 6112 1 6143 Green Dragon -G 1 6108 10 10,000 Gold -G 1 6110 10 Strength Potion -G 1 6112 1 Iron Crown -O 1 6111 10 6143 Shield -M 0 6113 3 6133 Poisonous Spider -M 0 6113 3 6133 Poisonous Spider -M 0 6113 3 6133 Poisonous Spider -M 0 6114 1 6134 Queen Spider -G 1 6108 10 10,000 Gold -G 1 6109 3 Healing Potion -G 1 6113 2 Iron Sceptre -M 0 6115 1 6100 Shargugh The Forest Brownie -E 1 6114 1 1 Iron Ring -M 0 6116 1 6155 Druid -E 1 6115 1 16 Morning Star -G 1 3055 3 17 Metal Staff -M 0 6117 1 6134 Isha The Dark Elf -E 1 6116 1 5 Dragon Scale Shirt -E 1 6117 1 7 Dragon Scale Skirt -E 1 6118 1 12 Black Cloak -E 1 6119 1 13 Silver Belt -E 1 6120 1 16 Long, Slender Sword -* Objects -O 0 6102 1 6103 Hollow Tree -O 0 6103 1 6113 Branch, Light -O 0 6104 1 6125 Branch, Weapon -O 0 6105 1 6105 Branch, Unusable -R 0 6104 6106 -O 0 6106 4 6104 Toadstool -R 0 6111 6106 -O 0 6106 4 6111 Toadstool -R 0 6122 6106 -O 0 6106 4 6122 Toadstool -R 0 6119 6107 -O 0 6107 4 6119 Poisonous Toadstool -* Doors -D 1 6152 1 1 Tree -D 1 6153 3 1 -* -S -$ diff --git a/lc-mud/circle/world/zon/62.zon b/lc-mud/circle/world/zon/62.zon deleted file mode 100644 index 979d88f68ca4a7d729e9789a8f1030a00153707b..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/62.zon +++ /dev/null @@ -1,78 +0,0 @@ -#62 -The Orc Enclave~ -6200 6299 20 2 -* -* Created by Builder_5 & Serene of C.A.W. -* Official C.A.W. site: http://qsilver.queensu.ca/~fletchra/Caw/ -* Mail Address: fletchra@qsilver.queensu.ca -* -* Mobiles -M 0 6200 3 6219 Deer -M 0 6200 3 6224 Deer -M 0 6200 3 6218 Deer -M 0 6201 2 6219 Rabbit -M 0 6201 2 6224 Rabbit -M 0 6202 3 6227 Squirrel -M 0 6202 3 6224 Squirrel -M 0 6202 3 6238 Squirrel -M 0 6203 10 6234 Orc Hunter -E 1 6204 1 16 Club -M 0 6203 10 6240 Orc Hunter -E 1 6204 1 16 Club -M 0 6203 10 6236 Orc Hunter -E 1 6204 1 16 Club -M 0 6203 10 6229 Orc Hunter -E 1 6204 1 16 Club -M 0 6203 10 6212 Orc Hunter -E 1 6204 1 16 Club -M 0 6203 10 6221 Orc Hunter -E 1 6204 1 16 Club -M 0 6203 10 6223 Orc Hunter -E 1 6204 1 16 Club -M 0 6203 10 6225 Orc Hunter -E 1 6204 1 16 Club -M 0 6203 10 6214 Orc Hunter -E 1 6204 1 16 Club -M 0 6203 10 6230 Orc Hunter -E 1 6204 1 16 Club -M 0 6204 1 6252 Orc Chief -E 1 6204 1 16 Club -M 0 6205 3 6253 Orc Woman -M 0 6205 3 6250 Orc Woman -M 0 6205 3 6249 Orc Woman -M 0 6206 2 6246 Orc Child -M 0 6206 2 6251 Orc Child -M 0 6207 1 6253 Pregnant Orc Woman -M 0 6208 2 6254 Mutant Orc -M 0 6208 2 6254 Mutant Orc -M 0 6209 3 6251 Mutant Orc -E 1 6204 1 16 Club -M 0 6209 3 6250 Mutant Orc -E 1 6204 1 16 Club -M 0 6209 3 6244 Mutant Orc -E 1 6204 1 16 Club -M 0 6210 1 6259 Elstar -E 1 6205 1 16 Starkblade -E 1 6203 1 17 Runestone -M 0 6211 1 6216 Elven Child -G 1 6200 1 Key -M 0 6212 4 6267 Mutant Thing -M 0 6212 4 6264 Mutant Thing -M 0 6212 4 6261 Mutant Thing -M 0 6213 1 6265 Mutant Thing -E 1 6201 1 9 Manacles -E 1 6202 1 8 Shackles -* Doors -D 0 6255 3 2 -D 0 6256 1 2 -D 0 6256 3 1 -D 0 6257 1 1 -D 0 6266 1 1 -D 0 6267 3 1 -D 0 6263 1 1 -D 0 6264 3 1 -D 0 6260 1 1 -D 0 6261 3 1 -S -$ - diff --git a/lc-mud/circle/world/zon/63.zon b/lc-mud/circle/world/zon/63.zon deleted file mode 100644 index 519f6b641818a903c5204fc4f472b3757fe85aa6..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/63.zon +++ /dev/null @@ -1,54 +0,0 @@ -#63 -Arachnos~ -6300 6399 34 2 -* -* Created by Mahatma of HexOynx -* -* Mobiles -M 0 6301 10 6301 Young Spider -M 0 6301 10 6306 Young Spider -M 0 6301 10 6306 Young Spider -M 0 6301 10 6304 Young Spider -M 0 6305 1 6303 Wasp -M 0 6310 1 6342 Bird Spider -M 0 6303 1 6313 Wolf Spider -M 0 6308 5 6308 Slave -M 0 6308 5 6308 Slave -M 0 6308 5 6308 Slave -M 0 6308 5 6308 Slave -M 0 6308 5 6308 Slave -M 0 6309 2 6327 Quasit -M 0 6307 5 6335 Ethereal Spider -M 0 6307 5 6333 Ethereal Spider -M 0 6304 1 6332 Stuck Orc -G 1 6300 1 Key To Arachnos' Chambers -M 0 6306 3 6321 Drone Spider -G 1 6305 10 Black Potion -M 0 6306 3 6331 Drone Spider -G 1 6305 10 Black Potion -M 0 6311 1 6373 Hermit -G 1 6302 2 Wizard's Hat -M 0 6315 1 6350 Ki-Rin -G 1 6109 10 Blue Potion -G 1 6109 10 Blue Potion -M 0 6314 1 6399 Arachnos -G 1 6301 5 Thief's Knife -G 1 6302 2 Wizard's Hat -G 1 6303 2 Pontiff's Headdress -G 1 6304 2 Black Knight's Visor -M 0 6312 1 6370 Donjonkeeper -G 1 6301 5 Thief's Knife -G 1 6109 10 Blue Potion -M 0 6313 1 6367 Guardian -M 0 6306 3 6330 Drone Spider -M 0 6302 1 6360 Yevaud -G 1 6304 2 Black Knight's Visor -G 1 7203 1 Purple Cloak -M 0 6316 1 6330 Baby Dragon -M 0 6317 1 6340 Elder Wormkin -* Doors -D 0 6392 0 2 Arachnos' Lair -D 0 6399 2 2 -* -S -$ diff --git a/lc-mud/circle/world/zon/64.zon b/lc-mud/circle/world/zon/64.zon deleted file mode 100644 index 62939c0adb0de51501fc498f27c542f2e995b124..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/64.zon +++ /dev/null @@ -1,82 +0,0 @@ -#64 -Rand's Tower~ -6400 6499 20 1 -* -* Created by Amanda Eterniale of C.A.W. -* Official C.A.W. site: http://qsilver.queensu.ca/~fletchra/Caw/ -* Mail Address: fletchra@qsilver.queensu.ca -* -* Mobiles -M 0 6400 3 6400 Goats -M 0 6400 3 6402 Goats -M 0 6400 3 6404 Goats -M 0 6401 2 6407 Demons -M 0 6401 2 6407 Demons -M 0 6402 1 6412 Book Monster -G 1 6410 20 Chaos Book -G 1 6411 20 Elder Book -M 0 6403 1 6411 Bad Feeling -M 0 6405 1 6437 Door Guardian -O 0 6416 1 6416 Chest -M 0 6404 3 6416 Worst Nightmare -P 1 6401 50 6416 Glowing Platemail -O 0 6417 1 6416 Chest -M 0 6404 3 6416 Worst Nightmare -P 1 6405 100 6417 Dragon's Blood -P 1 6407 50 6417 Tent Pole -O 0 6418 1 6416 Chest -M 0 6404 1 6416 Worst Nightmare -P 1 6406 100 6418 Amulet -P 1 6408 1 6418 Powder Of Wealth -P 1 6412 10 6418 Occluded Lens -* Objects -R 0 6411 6404 -O 0 6404 5 6411 Sculpture -O 0 6409 1 6411 Desk -P 0 6402 50 6409 Agate -P 0 6403 50 6409 Jade -P 0 6400 50 6409 Glowing Dagger -R 0 6441 6413 -O 0 6413 100 6441 Mevais -R 0 6441 6414 -O 0 6414 100 6441 Peska -R 0 6436 6415 -O 0 6415 10 6436 Rand's Staff -R 0 6410 6419 -O 0 6419 1 6410 Water Basin -R 0 6424 6420 -O 0 6420 10 6424 Food -R 0 6424 6420 -O 0 6420 10 6424 Food -* Doors -D 0 6406 5 1 -D 0 6407 4 1 -D 0 6407 2 1 -D 0 6408 0 1 -D 0 6409 0 1 -D 0 6409 2 1 -D 0 6410 0 1 -D 0 6411 2 1 -D 0 6412 1 1 -D 0 6412 3 1 -D 0 6413 3 1 -D 0 6414 1 1 -D 0 6414 5 1 -D 0 6415 3 1 -D 0 6416 4 1 -D 0 6417 0 1 -D 0 6417 1 1 -D 0 6417 2 1 -D 0 6418 0 1 -D 0 6419 2 1 -D 0 6420 0 1 -D 0 6421 2 1 -D 0 6423 0 1 -D 0 6424 2 1 -D 0 6435 3 2 -D 0 6436 1 2 -D 0 6437 3 1 -D 0 6438 1 1 -S -$ - diff --git a/lc-mud/circle/world/zon/65.zon b/lc-mud/circle/world/zon/65.zon deleted file mode 100644 index 3d8dfd0bcbaef11e6fa1ef5280fa5936927fdd3e..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/65.zon +++ /dev/null @@ -1,132 +0,0 @@ -#65 -The Dwarven Kingdom~ -6500 6599 40 2 -* -* Mobiles -M 0 6500 11 6505 Dwarf Guard -E 1 6504 100 16 Dwarven Hammer -E 1 6505 100 5 Dwarven Plate -E 1 6515 3 17 Key To Entrance Of Mountain -M 0 6500 11 6540 Dwarf Guard -E 1 6504 100 16 Dwarven Hammer -E 1 6505 100 5 Dwarven Plate -E 1 6502 100 17 Key To The Mines -M 0 6500 11 6505 Dwarf Guard -E 1 6504 100 16 Dwarven Hammer -E 1 6505 100 5 Dwarven Plate -M 0 6500 11 6540 Dwarf Guard -E 1 6504 100 16 Dwarven Hammer -E 1 6505 100 5 Dwarven Plate -M 0 6500 11 6509 Dwarf Guard -E 1 6512 100 9 Dwarven Gloves -E 1 6509 100 16 Two-Handed Dwarven Axe -M 0 6500 11 6521 Dwarf Guard -M 1 6500 11 6521 Dwarf Guard -M 1 6500 11 6521 Dwarf Guard -M 0 6500 11 6512 Dwarf Guard -E 1 6508 100 16 Dwarven Club -M 0 6500 11 6512 Dwarf Guard -E 1 6508 100 16 Dwarven Club -M 0 6500 11 6509 Dwarf Guard -E 1 6509 100 16 Two-Handed Dwarven Axe -E 1 6510 100 6 Dwarven Helmet -E 1 6511 100 1 Golden Dwarf Ring -M 0 6501 9 6503 Dwarven Worker -M 0 6501 9 6502 Dwarven Worker -M 0 6501 9 6501 Dwarven Worker -M 0 6502 1 6527 Wraith -E 1 6503 100 17 Key To The Castle -* Shopkeepers -M 0 6503 1 6516 Hide & Tooth Storekeeper -G 1 3022 100 Long Sword -G 1 6504 100 Dwarven Hammer -G 1 6505 100 Dwarven Plate -G 1 6510 100 Dwarven Helmet -G 1 6512 100 Dwarven Gloves -E 1 6504 100 16 Dwarven Hammer -M 0 6504 1 6535 Granite Head The Baker -G 1 3000 100 Beer Barrel -G 1 3003 100 Firebreather -G 1 3010 100 Loaf Of Bread -G 1 3011 100 Danish Pastry -G 1 3031 100 Lantern -G 1 6013 100 Water Barrel -E 1 6504 100 16 Dwarven Hammer -* Mobiles -M 0 6505 2 6515 Lizard -M 0 6505 2 6520 Lizard -M 0 6506 2 6508 Giant -E 1 6505 100 5 Dwarven Plate -M 0 6507 4 6543 Dwarven Mineworker -E 1 6508 100 16 Dwarven Club -M 0 6507 4 6543 Dwarven Mineworker -E 1 6508 100 16 Dwarven Club -M 0 6507 4 6542 Dwarven Mineworker -E 1 6508 100 16 Dwarven Club -M 0 6507 4 6542 Dwarven Mineworker -E 1 6508 100 16 Dwarven Club -M 0 6508 1 6543 Dwarven Mineleader -E 1 6512 100 9 Dwarven Gloves -E 1 6508 100 16 Dwarven Club -M 0 6509 1 6534 Dwarf Doctor -E 1 6506 100 17 Long Black Heal Stick -M 0 6510 4 6534 Dwarf Peon -E 1 7211 100 16 Short Sword -M 0 6510 4 6534 Dwarf Peon -E 1 7211 100 16 Short Sword -M 0 6511 8 6523 Barrack Dwarf -E 1 7211 100 16 Short Sword -M 0 6511 8 6523 Barrack Dwarf -E 1 7211 100 16 Short Sword -M 0 6511 8 6523 Barrack Dwarf -E 1 7211 100 16 Short Sword -M 0 6511 8 6524 Barrack Dwarf -E 1 6504 100 16 Dwarven Hammer -M 0 6511 8 6524 Barrack Dwarf -E 1 7211 100 16 Short Sword -M 0 6511 8 6524 Barrack Dwarf -E 1 7211 100 16 Short Sword -M 0 6514 4 6521 Barrack Guard -E 1 6509 100 16 Two-Handed Dwarven Axe -M 0 6514 4 6521 Barrack Guard -E 1 6509 100 16 Two-Handed Dwarven Axe -M 0 6516 1 6553 Mazekeeper -E 1 6500 1 17 Key To The Treasury -O 1 6501 1 6554 Treasure -M 0 6517 2 6548 Giant Snake -M 0 6517 2 6549 Giant Snake -* Objects -R 0 6513 6507 -O 0 6507 4 6513 Long Black Light Stick -R 0 6505 6507 -O 0 6507 4 6505 Long Black Light Stick -R 0 6503 6507 -O 0 6507 4 6503 Long Black Light Stick -R 0 6540 6507 -O 0 6507 4 6540 Long Black Light Stick -O 0 6513 6 6545 Chunk Of Coal -R 0 6551 6514 -O 0 6514 3 6551 Mining Pick -O 0 6516 1 6532 Key To The Mine Maze -* Doors -D 0 6505 3 2 Mountain Entrance -D 0 6513 1 2 -D 0 6509 0 2 Kingdom Door -D 0 6510 2 2 -D 0 6512 1 2 Castle Door -D 0 6525 3 2 -D 0 6521 2 1 Barracks Entrance -D 0 6523 0 1 -D 0 6526 5 1 Wine Cellar -D 0 6527 4 1 -D 0 6531 0 1 Queen's Bedroom -D 0 6532 2 1 -D 0 6532 3 2 Treasury Door -D 0 6554 1 2 -D 0 6540 1 2 Mine Entrance -D 0 6541 3 2 -D 0 6544 0 2 Maze Entrance -D 0 6546 2 2 -* -S -$ diff --git a/lc-mud/circle/world/zon/70.zon b/lc-mud/circle/world/zon/70.zon deleted file mode 100644 index a7730ce4199a7ae5a955d724c0d1f1079c793ee1..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/70.zon +++ /dev/null @@ -1,23 +0,0 @@ -#70 -The Sewer, First Level~ -7000 7099 15 2 -* -* Mobiles -M 0 7001 9 7041 The Mean Bat -M 0 7001 9 7025 The Mean Bat -M 0 7001 9 7004 The Mean Bat -M 0 7001 9 7004 The Mean Bat -M 0 7002 3 7049 The Sewer Rat -M 0 7002 3 7031 The Sewer Rat -M 0 7003 8 7039 The Small Hairy Spider -M 0 7003 8 7039 The Small Hairy Spider -M 0 7003 8 7039 The Small Hairy Spider -M 0 7003 8 7037 The Small Hairy Spider -M 0 7003 8 7037 The Small Hairy Spider -M 0 7003 8 7050 The Small Hairy Spider -* Doors -D 0 7047 1 1 South End Of The Grand Sewer -D 0 7053 3 1 -* -S -$ diff --git a/lc-mud/circle/world/zon/71.zon b/lc-mud/circle/world/zon/71.zon deleted file mode 100644 index d733ec5f8988cf609941625607eaee3cc056d5d9..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/71.zon +++ /dev/null @@ -1,25 +0,0 @@ -#71 -The Second Sewer~ -7100 7199 20 2 -* -* Mobiles -M 0 7004 3 7102 The Earth Beetle -M 0 7005 7 7112 The Giant Maggot -M 0 7005 7 7112 The Giant Maggot -M 0 7005 7 7122 The Giant Maggot -M 0 7002 7 7104 The Sewer Rat -M 0 7000 3 7103 The Horrifying Mudmonster -M 0 7000 3 7103 The Horrifying Mudmonster -M 0 7006 7 7113 The Slithering Snake -M 0 7006 7 7122 The Slithering Snake -M 0 7006 7 7122 The Slithering Snake -* Doors -D 0 7106 5 1 The Abyss -D 0 7111 5 1 The Abyss -D 0 7121 5 1 The Abyss -D 0 7279 4 1 -D 0 7116 5 1 Secret Way Down -D 0 7280 4 1 -* -S -$ diff --git a/lc-mud/circle/world/zon/72.zon b/lc-mud/circle/world/zon/72.zon deleted file mode 100644 index abc084602283eab43c6ebd20a0d6490d9dc5a532..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/72.zon +++ /dev/null @@ -1,62 +0,0 @@ -#72 -The Sewer Maze~ -7200 7299 25 2 -* -* Mobiles -M 0 7200 1 7201 Master Mindflayer -E 1 7200 1 16 Devil Rod -E 1 7203 1 3 Cloak -G 1 7205 1 Key -O 1 7204 6 7200 Neon Blue Potion -O 1 7210 1 7200 Treasure -M 0 7201 1 7203 Senior Mindflayer -E 1 7201 4 16 Large Mace -M 0 7202 2 7205 Junior Mindflayer -E 1 7202 8 16 Small Mace -M 0 7202 2 7207 Junior Mindflayer -E 1 7202 8 16 Small Mace -M 0 7203 10 7214 Wererat -E 1 7211 16 16 Short Sword -M 0 7203 10 7213 Wererat -E 1 7211 16 16 Short Sword -M 0 7203 10 7215 Wererat -E 1 7211 16 16 Short Sword -M 0 7203 10 7217 Wererat -E 1 7211 16 16 Short Sword -M 0 7203 10 7219 Wererat -M 0 7203 10 7221 Wererat -M 0 7203 10 7223 Wererat -M 0 7203 10 7225 Wererat -M 0 7203 10 7233 Wererat -M 0 7203 10 7233 Wererat -M 0 7204 1 7234 Gigantic Rat -M 0 7002 5 7285 The Sewer Rat -M 0 7002 5 7285 The Sewer Rat -E 1 7190 2 2 Silver Ring -E 1 7209 4 8 Muddy Boots -G 1 7208 20 Light Stick -M 0 7002 5 7285 The Sewer Rat -M 0 7000 8 7286 The Horrifying Mudmonster -M 0 7000 8 7286 The Horrifying Mudmonster -M 0 7000 8 7281 The Horrifying Mudmonster -M 0 7000 8 7281 The Horrifying Mudmonster -M 0 7000 8 7280 The Horrifying Mudmonster -* Objects -R 0 7206 7206 -O 0 7206 4 7206 Skull -R 0 7211 7208 -O 0 7208 20 7211 Light Stick -* Doors -D 0 7201 3 2 Treasury Door -D 0 7200 1 2 -D 0 7202 0 1 Inner Lair Door -D 0 7201 2 1 -D 0 7208 0 1 Lair Door -D 0 7204 2 1 -D 0 7281 2 1 Entrance Door -D 0 7280 0 1 -D 0 7286 0 1 Torture Room Door -D 0 7285 2 1 -* -S -$ diff --git a/lc-mud/circle/world/zon/73.zon b/lc-mud/circle/world/zon/73.zon deleted file mode 100644 index 1139b8293d16aedd04cfce28af6c84006e4c9cca..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/73.zon +++ /dev/null @@ -1,30 +0,0 @@ -#73 -The Tunnels In The Sewer~ -7300 7399 25 2 -* -* Mobiles -M 0 7040 1 7328 The Red Dragon -M 0 7041 2 7344 The Sea Hag -M 0 7042 2 7335 The Good Guardian Naga -M 0 7043 3 7339 The Basilisk -M 0 7044 6 7306 The Lemure Blob -M 0 7045 1 7319 Jones The Ettin -M 0 7046 1 7324 Herald The Ettin -M 0 7010 2 7329 Chr-eff'n -* Doors -D 0 7304 2 1 The Secret Room Door -D 0 7305 0 1 -D 0 7305 2 1 The Mudhole Entrance -D 0 7306 0 1 -D 0 7315 0 1 The Treasure Room Door -D 0 7316 2 1 -D 0 7321 3 1 The Square Lair -D 0 7318 1 1 -D 0 7324 0 2 False Door -D 0 7324 2 2 False Door -D 0 7324 1 1 Secret Tunnel Entrance -D 0 7325 3 1 -D 0 7333 3 1 Stair-Room Entrance -* -S -$ diff --git a/lc-mud/circle/world/zon/79.zon b/lc-mud/circle/world/zon/79.zon deleted file mode 100644 index 0037dcadd339e702d74f44ffe11e78fcb39518cf..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/79.zon +++ /dev/null @@ -1,63 +0,0 @@ -#79 -Redferne's Residence~ -7900 7999 50 2 -* -* Created for DikuMud -* -* Modified by Cyron of VieMud -* -* Mobiles -M 0 7900 1 7900 Grand Knight of Paladins -E 1 7901 4 17 Copper Key -E 1 7910 2 16 Bastard Sword -E 1 7914 2 5 Silvery Breast-Plate -E 1 7915 2 7 Silvery Leg Plates -E 1 7916 2 9 Silvery Gloves -E 1 7917 2 6 Silvery Helmet -E 1 7918 2 11 Shield of the Rose -E 1 7919 2 8 Heavy Boots -E 1 7920 2 10 Silvery Arm Plates -M 0 7901 2 7907 Rat -G 1 7900 1 Brass Key -M 0 7901 2 7907 Rat -M 0 7902 1 7913 The Cleaver -E 1 7907 6 14 Spiked Bracelet -E 1 7907 6 15 Spiked Bracelet -E 1 7911 2 6 Large Helmet -G 1 7902 1 Steel Key -* Objects -R 0 7907 7908 -O 0 7908 40 7907 Waybread -R 0 7908 7921 -O 0 7921 10 7908 Water Barrel -R 0 7903 7904 -O 0 7904 1 7903 Chest -P 1 7903 1 7904 Money -P 1 7909 4 7904 Golden Ring -R 0 7913 7905 -O 1 7905 1 7913 Chest -P 1 7906 5 7905 -P 1 7912 3 7905 Chaos Helmet -P 1 7913 2 7905 Two-Handed Sword -* Doors -D 0 7900 0 2 Residence Door -D 0 7901 2 2 -D 0 7901 1 1 Treasure Room Door -D 0 7910 3 1 -D 0 7901 3 1 Library Door -D 0 7902 1 1 -D 0 7910 1 2 Safe Entrance -D 0 7903 3 2 -D 0 7904 1 1 Monster Pen Door -D 0 7913 3 1 -D 0 7904 3 1 Sitting Room Door -D 0 7905 1 1 -D 0 7906 0 1 Larder Door -D 0 7907 2 1 -D 0 7906 1 1 Fridge Door -D 0 7908 3 1 -D 0 7911 2 1 Balcony Doors -D 0 7912 0 1 -* -S -$ diff --git a/lc-mud/circle/world/zon/9.zon b/lc-mud/circle/world/zon/9.zon deleted file mode 100644 index e436632ff842f86d7cbc4bc872a33f20726db4c5..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/9.zon +++ /dev/null @@ -1,50 +0,0 @@ -#9 -River Island Of Minos~ -900 999 39 1 -* -* Created by Mahatma of HexOynx -* -* Mobiles -* First Test -M 0 900 3 915 Homba -M 0 900 3 915 Homba -M 0 900 3 915 Homba -* Second Test -M 0 901 2 916 Swordsman -E 1 901 15 17 Speckled Potion -M 0 901 2 916 Swordsman -* Third Test -M 0 902 1 917 Mummy -* Fourth Test -M 0 903 1 918 Giant Lizard -* Fifth Test -M 0 904 1 919 General Woundwart -E 1 903 10 9 Troll Gauntlets -E 1 902 25 17 Speckled Potion -* Sixth Test -M 0 905 1 920 Franz -E 1 905 10 16 Flail -M 0 906 1 920 Hanz -E 1 907 5 16 Heavy Spear -* Final Test And Treasure -M 0 907 1 921 Minos -E 1 901 8 11 Minotaur Shield -E 1 900 1 17 Golden Key -O 1 904 10 922 Platinum Ring -O 1 906 1 922 Gold -M 0 909 2 908 Sea Hag -M 0 909 2 908 Sea Hag -M 0 910 2 909 Merman -E 1 908 30 16 Trident -M 0 910 2 909 Merman -E 1 908 30 16 Trident -M 0 911 3 910 Crab -M 0 911 3 910 Crab -* Objects -R 0 910 909 -O 0 909 12 910 Boots Of Water Walking -* Doors -D 0 921 1 2 Treasure Room Door -* -S -$ diff --git a/lc-mud/circle/world/zon/index b/lc-mud/circle/world/zon/index deleted file mode 100644 index f94aac398d5f9bbf182f3a52342d7f68fae13c16..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/index +++ /dev/null @@ -1,32 +0,0 @@ -0.zon -9.zon -12.zon -15.zon -25.zon -30.zon -31.zon -33.zon -35.zon -36.zon -40.zon -50.zon -51.zon -52.zon -53.zon -54.zon -60.zon -61.zon -62.zon -63.zon -64.zon -65.zon -70.zon -71.zon -72.zon -73.zon -79.zon -120.zon -150.zon -186.zon -$ - diff --git a/lc-mud/circle/world/zon/index.mini b/lc-mud/circle/world/zon/index.mini deleted file mode 100644 index 9e3447fac52908bc7739a42097d4e02f13cb5b3b..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zon/index.mini +++ /dev/null @@ -1,4 +0,0 @@ -0.zon -12.zon -30.zon -$ diff --git a/lc-mud/circle/world/zone.lst b/lc-mud/circle/world/zone.lst deleted file mode 100644 index e19d05a7a803641a1119471788c230efb7d8bc83..0000000000000000000000000000000000000000 --- a/lc-mud/circle/world/zone.lst +++ /dev/null @@ -1,22 +0,0 @@ -Zone Vnum List -************** - -0 - Limbo - Internal 54 - New Thalos -9 - The River Island 55 - New Thalos (Cont) -12 - God Simplex 56 - New Thalos (Cont) -15 - The Straight Path 60 - Haon-Dor-Light Forest -25 - High Tower Of Sorcery 61 - Haon-Dor-Dark Forest -26 - High Tower Of Sorcery (Cont) 62 - Orc Enclave -30 - Midgaard City 63 - Arachnos -31 - Midgaard City 64 - Rand's Tower -32 - Midgaard River 65 - Dwarven Kingdom -33 - Three Of Swords 70 - Sewers -35 - Miden'nir 71 - Sewers -36 - Chessboard 72 - Sewers -40 - Moria 73 - Sewers -41 - Moria (Cont) 79 - Redferne's Residence -50 - Great Eastern Desert 120 - Rome -51 - Drow City 150 - King Welmar's Castle -52 - Old Thalos 186 - Newbie Zone -53 - Great Pyramid - diff --git a/lc-mud/src/main/java/lc/mud/engine/Direction.java b/lc-mud/src/main/java/lc/mud/engine/Direction.java deleted file mode 100644 index 0fd0553f59a1e00654bf752c9829ed3c37d0a494..0000000000000000000000000000000000000000 --- a/lc-mud/src/main/java/lc/mud/engine/Direction.java +++ /dev/null @@ -1,40 +0,0 @@ -package lc.mud.engine; - -public enum Direction { - NORTH, EAST, SOUTH, WEST, UP, DOWN; - - public static Direction getDirection(String dir) { - dir = dir.toUpperCase(); - - try { - return valueOf(dir); - } catch (IllegalArgumentException e) { - // Do nothing - } - - return switch (dir) { - case "N" -> NORTH; - case "E" -> EAST; - case "S" -> SOUTH; - case "W" -> WEST; - case "U" -> UP; - case "D" -> DOWN; - default -> null; - }; - } - - /** - * Return the opposite direction for the one provided. - */ - public static Direction opposite(Direction d) { - return switch (d) { - case NORTH -> SOUTH; - case EAST -> WEST; - case SOUTH -> NORTH; - case WEST -> EAST; - case UP -> DOWN; - case DOWN -> UP; - default -> null; - }; - } -} diff --git a/lc-mud/src/main/java/lc/mud/engine/Exit.java b/lc-mud/src/main/java/lc/mud/engine/Exit.java deleted file mode 100644 index 2327fe4c5165f7316fb3a3255fca871b02832c8f..0000000000000000000000000000000000000000 --- a/lc-mud/src/main/java/lc/mud/engine/Exit.java +++ /dev/null @@ -1,39 +0,0 @@ -package lc.mud.engine; - -/** - * This class contains the data for an exit to a {@link Room}. - * - * @author Alex Leigh - */ -public class Exit { - private final int destinationId; - private final String desc; - - public Exit(int destinationId, String desc) { - this.destinationId = destinationId; - this.desc = desc; - } - - /** - * Return the destination for this exit at this time. Callers should not cache this information, as it may - * change dynamically. - */ - public int getDestinationId() { - return destinationId; - } - - /** - * Return a description string for this exit. - */ - public String getDesc() { - return desc; - } - - @Override - public String toString() { - return "Exit{" + - "destinationId=" + destinationId + - ", desc='" + desc + '\'' + - '}'; - } -} diff --git a/lc-mud/src/main/java/lc/mud/engine/Extra.java b/lc-mud/src/main/java/lc/mud/engine/Extra.java deleted file mode 100644 index 7a91ba543cd66840a71f9300c7d6c19f8a08278f..0000000000000000000000000000000000000000 --- a/lc-mud/src/main/java/lc/mud/engine/Extra.java +++ /dev/null @@ -1,13 +0,0 @@ -package lc.mud.engine; - -public class Extra { - private final String desc; - - public Extra(String desc) { - this.desc = desc; - } - - public String getDesc() { - return desc; - } -} diff --git a/lc-mud/src/main/java/lc/mud/engine/Mob.java b/lc-mud/src/main/java/lc/mud/engine/Mob.java deleted file mode 100644 index 588209b70c2e2c4763ca2d95c6a906174a088ab7..0000000000000000000000000000000000000000 --- a/lc-mud/src/main/java/lc/mud/engine/Mob.java +++ /dev/null @@ -1,13 +0,0 @@ -package lc.mud.engine; - -public class Mob { - private final String shortDesc; - - public Mob(String shortDesc) { - this.shortDesc = shortDesc; - } - - public String getShortDesc() { - return shortDesc; - } -} diff --git a/lc-mud/src/main/java/lc/mud/engine/MudEngine.java b/lc-mud/src/main/java/lc/mud/engine/MudEngine.java deleted file mode 100644 index 19cfd86cdf13c5797ed24733506fddfb4a4afb4e..0000000000000000000000000000000000000000 --- a/lc-mud/src/main/java/lc/mud/engine/MudEngine.java +++ /dev/null @@ -1,118 +0,0 @@ -package lc.mud.engine; - -import lc.continuity.line.BasicLineHandlerFactory; -import lc.continuity.net.TcpListener; -import lc.mecha.lang.DangerousRunnable; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mud.engine.io.CircleDataImporter; -import lc.mud.engine.io.DataImporter; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.HashMap; -import java.util.stream.Stream; - -/** - * The central class for the MUD engine. - * - * @author Alex Leigh - */ -public class MudEngine implements DangerousRunnable { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(MudEngine.class); - - private TcpListener listener = new TcpListener( - new BasicLineHandlerFactory(new MudSessionFactory(this)), 4000); - private HashMap<Integer, Room> rooms = new HashMap<>(); - private int startRoom; - - public static void main(String args[]) throws IOException { - MudEngine engine = new MudEngine(); - engine.run(); - } - - public HashMap<Integer, Room> getRooms() { - return rooms; - } - - public Room getRoom(int id) { - return rooms.get(id); - } - - public MudEngine() throws IOException { - //initRooms(); - initCircleRooms(); - logger.info("Loaded rooms. [cnt: {}]", rooms.size()); - } - - /** - * Return the room that new players are placed into. Existing players should be returned to the room - * they were in when their session was last closed. - */ - public Room getNewPlayerRoom() { - return rooms.get(startRoom); - } - - /** - * Load the world from CSV files. - */ - public void initCsvRooms() throws IOException { - DataImporter di = new DataImporter(); - di.readRooms(Path.of("leigh-mud/world/rooms.csv")); - di.readExits(Path.of("leigh-mud/world/exits.csv")); - di.readExtras(Path.of("leigh-mud/world/extras.csv")); - - for (Room r : di.getRooms()) { - rooms.put(r.getId(), r); - } - - startRoom = 5; - } - - /** - * Load the CircleMUD test files. This is intended to be used for dev/test purposes rather than suggested - * as a production game. - */ - public void initCircleRooms() throws IOException { - try (Stream<Path> paths = Files.walk(Paths.get("leigh-mud/circle/world/wld/"))) { - paths.filter(path -> !path.endsWith(".wld")).filter(path -> !Files.isDirectory(path)).forEach(path -> { - CircleDataImporter loader = new CircleDataImporter(path.toFile()); - loader.run(); - for (Room r : loader.getRooms()) { - rooms.put(r.getId(), r); - } - }); - } - - startRoom = 3000; - } - - @Override - public void runDangerously() throws Exception { - listener.runDangerously(); - } - - public synchronized Room createVoidRoom() { - int x = 0; - for (Room r : rooms.values()) { - if (r.getId() > x) x = r.getId(); - } - - x++; - - Room v = new Room(x, "A void pocket.", "You are in a featureless void space."); - rooms.put(x, v); - return v; - } - - @Override - public void run() { - try { - runDangerously(); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/lc-mud/src/main/java/lc/mud/engine/MudSession.java b/lc-mud/src/main/java/lc/mud/engine/MudSession.java deleted file mode 100644 index d9070d75a0e460e6542c70fb269fe738559b7efc..0000000000000000000000000000000000000000 --- a/lc-mud/src/main/java/lc/mud/engine/MudSession.java +++ /dev/null @@ -1,155 +0,0 @@ -package lc.mud.engine; - -import lc.continuity.cmd.BasicCommandProcessor; -import lc.continuity.cmd.CommandHandler; -import lc.continuity.line.BasicLineHandler; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.term.ConsoleColors; -import lc.mecha.util.StringAccumulator; -import lc.mud.engine.cmd.WorldEditCommand; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Random; -import java.util.TreeSet; - -/** - * This class represents a player session. Each session is associated with a player object and a room object. - * The primary command processing for player input, as well as routing for output messages, happens in this class. - * - * @author Alex Leigh - */ -public class MudSession extends BasicCommandProcessor { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(MudSession.class); - private Player player; - private Room location; - private MudEngine engine; - - public MudSession(MudEngine engine, BasicLineHandler lineHandler) throws IOException { - // TODO: Have this rotate out with different messages each time it is used. - super(lineHandler); - this.engine = engine; - setUnknownResponse("What? I didn't understand you."); - - // TODO: Get this from telnet session via IAC interaction - setConsoleWidth(80); - - logger.info("Session created."); - // TODO: Actually load a player from somewhere based on un/pw - player = new Player("A stranger"); - location = engine.getNewPlayerRoom(); - location.addPlayer(this); - logger.info("New session. [loc: {}] [pc: {}]", location, player); - - addCommandHandler("LOOK", cmd -> location.look(cmd, this)); - addCommandHandler("COMMANDS", cmd -> { - StringAccumulator sa = new StringAccumulator(", "); - TreeSet<String> sortedKeys = new TreeSet<>(getHandlers().keySet()); - for (String cmdName : sortedKeys) { - sa.append(cmdName); - } - - // TODO: Color replacement support for optional color - return ConsoleColors.BLUE + sa.toString() + ConsoleColors.RESET; - }); - - CommandHandler move = cmd -> { - Direction d = Direction.getDirection(clean(cmd[0])); - - logger.debug("Desired direction: {}", d); - - Exit exit = location.getExits().get(d); - - if (exit == null) { - return "Sorry, you can't go that way."; - } - - // We allow for the concept the room is missing, although this should NEVER happen. - Room dst = engine.getRoom(exit.getDestinationId()); - if (dst == null) { - logger.warn("Missing room. [dst: {}] [src: {}]", exit.getDestinationId(), location.getId()); - return "Doesn't seem like anywhere to you..."; - } - - location.removePlayer(this); - location = dst; - dst.addPlayer(this); - - return dst.look(new String[]{"look"}, this); - }; - - addCommandHandler("NORTH", move); - addCommandHandler("EAST", move); - addCommandHandler("WEST", move); - addCommandHandler("SOUTH", move); - addCommandHandler("UP", move); - addCommandHandler("DOWN", move); - - // TODO: This should be handled better, with some kind of alias / short command processing - addCommandHandler("N", move); - addCommandHandler("E", move); - addCommandHandler("W", move); - addCommandHandler("S", move); - addCommandHandler("U", move); - addCommandHandler("D", move); - - addCommandHandler("SAY", cmd -> location.say(cmd, this)); - addCommandHandler("HELP", cmd -> "Until there is HELP, try COMMANDS."); - - addCommandHandler("QUIT", cmd -> { - - close(); - // They are gone, so we have nothing to say. - return null; - }); - - addCommandHandler("WE", new WorldEditCommand(this)); - } - - public Player getPlayer() { - return player; - } - - public void close() { - logger.info("Session closing. {}", this); - try { - location.removePlayer(this); - } catch (IOException e) { - // Intentionally blank - } - super.close(); - } - - /** - * Write an asynchronous message to the client. This custom implementation consumes any exceptions which occur. - * If an exception does occur, <code>close()</code> is called on this session. - */ - public void write(String str) { - try { - super.write(str); - } catch (Exception e) { - close(); - } - } - - public MudEngine getEngine() { - return engine; - } - - public Room getLocation() { - return location; - } - - @Override - public String getUnknownResponse() { - ArrayList<String> responses = new ArrayList<>(); - responses.add("What? I didn't understand you."); - responses.add("I'm sorry, I don't understand."); - responses.add("I'm not sure I understand."); - responses.add("Not sure what you are asking."); - - Random rand = new Random(); - return (responses.get(rand.nextInt(responses.size()))); - } -} diff --git a/lc-mud/src/main/java/lc/mud/engine/MudSessionFactory.java b/lc-mud/src/main/java/lc/mud/engine/MudSessionFactory.java deleted file mode 100644 index b71cd130a865c3712bfc27e155909f39ec22428c..0000000000000000000000000000000000000000 --- a/lc-mud/src/main/java/lc/mud/engine/MudSessionFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -package lc.mud.engine; - -import lc.continuity.line.BasicLineHandler; -import lc.continuity.line.CommandLineProcessor; -import lc.continuity.line.LineProcessor; -import lc.continuity.line.LineProcessorFactory; - -import java.io.IOException; - -/** - * Factory to create {@link MudSession} objects. - * - * @author Alex Leigh - */ -public class MudSessionFactory implements LineProcessorFactory { - private final MudEngine engine; - - public MudSessionFactory(MudEngine engine) { - this.engine = engine; - } - - @Override - public LineProcessor build(BasicLineHandler lineHandler) throws IOException { - return new CommandLineProcessor(new MudSession(engine, lineHandler)); - } -} diff --git a/lc-mud/src/main/java/lc/mud/engine/Player.java b/lc-mud/src/main/java/lc/mud/engine/Player.java deleted file mode 100644 index c66b73127e4e0ac4d788d6e5365926f993ac903b..0000000000000000000000000000000000000000 --- a/lc-mud/src/main/java/lc/mud/engine/Player.java +++ /dev/null @@ -1,12 +0,0 @@ -package lc.mud.engine; - -/** - * Class containing all the non-session specific information about a player character. - * - * @author Alex Leigh - */ -public class Player extends Mob { - public Player(String shortDesc) { - super(shortDesc); - } -} diff --git a/lc-mud/src/main/java/lc/mud/engine/Room.java b/lc-mud/src/main/java/lc/mud/engine/Room.java deleted file mode 100644 index 53da4a2dd91aa290a85d832a8af72aa6abb5e438..0000000000000000000000000000000000000000 --- a/lc-mud/src/main/java/lc/mud/engine/Room.java +++ /dev/null @@ -1,174 +0,0 @@ -package lc.mud.engine; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.StringAccumulator; - -import java.io.IOException; -import java.util.HashMap; -import java.util.HashSet; - -/** - * This class implements the book-keeping for a room in the mud. - * - * @author Alex Leigh - */ -public class Room { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(Room.class); - private final int id; - private String title; - private String desc; - private final HashMap<Direction, Exit> exits = new HashMap<>(); - private final HashMap<String, Extra> extras = new HashMap<>(); - private final HashSet<MudSession> players = new HashSet<>(); - - public Room(int id, String title, String desc) { - this.id = id; - this.title = title; - this.desc = desc; - } - - public int getId() { - return id; - } - - public String getTitle() { - return title; - } - - public HashMap<String, Extra> getExtras() { - return extras; - } - - public String getDesc() { - return desc; - } - - /** - * Add a player to this room. The arrival of the player will be announced to any other players in the room. - */ - public synchronized void addPlayer(MudSession p) throws IOException { - for (MudSession player : players) { - String nm = p.getPlayer().getShortDesc(); - player.write(nm + " arrives."); - } - players.add(p); - } - - public void setTitle(String title) { - this.title = title; - } - - /** - * Remove a player from this room. The departure of the player will be announced to any other players in the room. - */ - public synchronized void removePlayer(MudSession p) throws IOException { - players.remove(p); - for (MudSession player : players) { - String nm = p.getPlayer().getShortDesc(); - player.write(nm + " departs."); - } - } - - public void setDesc(String desc) { - this.desc = desc; - } - - /** - * Process the look command for this room. This will provide the general room description, or, the description - * of an extra. - */ - public String look(String[] cmd, MudSession session) { - logger.info("Look called: {}", cmd); - if (cmd.length == 1) { - StringBuffer buf = new StringBuffer(); - buf.append(title); - buf.append("\r\n "); - buf.append(desc); - - if (players.size() > 1) { - for (MudSession p : players) { - if (p.equals(session)) continue; - buf.append("\r\n" + p.getPlayer().getShortDesc() + " is here."); - } - } - - return buf.toString(); - } else { - String noun = null; - if (cmd.length == 2) { - noun = cmd[1]; - } else if (cmd.length >= 3) { - // TODO: Don't take it on faith that the command says LOOK AT - noun = cmd[2]; - } - - noun = noun.trim().toLowerCase(); - - // Maybe we are looking at a direction... - Direction dir = Direction.getDirection(noun); - if (dir != null) { - return lookDirection(dir); - } - - // Maybe we are looking at a thing... - Extra extra = extras.get(noun.trim().toLowerCase()); - - if (extra == null) { - return "I don't see that here."; - } else { - return extra.getDesc(); - } - } - } - - /** - * Process the player looking in the given direction. This typically returns the description for the exit - * in that direction, if one exists. - */ - public String lookDirection(Direction dir) { - Exit ex = exits.get(dir); - if (ex == null) { - return "I don't see exit that way."; - } - - String str = ex.getDesc(); - if (str == null) { - return "You see an exit, but it doesn't look like anything to you"; - } - - return ex.getDesc(); - } - - public HashMap<Direction, Exit> getExits() { - return exits; - } - - @Override - public String toString() { - return "Room{" + - "id=" + id + - ", title='" + title + '\'' + - ", desc='" + desc + '\'' + - ", exits=" + exits + - '}'; - } - - public String say(String[] cmd, MudSession session) throws IOException { - StringAccumulator msg = new StringAccumulator(" "); - for (int i = 1; i < cmd.length; i++) { - msg.append(cmd[i]); - } - - String nm = session.getPlayer().getShortDesc(); - - for (MudSession player : players) { - if (!player.equals(session)) { - player.write(nm + " says '" + msg.toString() + "'."); - } else { - player.write("You say, '" + msg.toString() + "'."); - } - } - return null; - } -} diff --git a/lc-mud/src/main/java/lc/mud/engine/cmd/CommandFrame.java b/lc-mud/src/main/java/lc/mud/engine/cmd/CommandFrame.java deleted file mode 100644 index e118bb8cae568448ced0241550db60f8205910c7..0000000000000000000000000000000000000000 --- a/lc-mud/src/main/java/lc/mud/engine/cmd/CommandFrame.java +++ /dev/null @@ -1,60 +0,0 @@ -package lc.mud.engine.cmd; - -import lc.continuity.cmd.CommandHandler; -import lc.mecha.cli.CommandRoute; -import lc.mecha.cli.CommandRouter; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; - -import java.util.Arrays; -import java.util.Map; - -/** - * CommandFrame is a base command implementation that in turn offers subcommands. CommandFrames may be nested - * to provide complex command structures. - * - * @author Alex Leigh - */ -public class CommandFrame implements CommandHandler { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(CommandFrame.class); - private final CommandRouter<CommandHandler> subcommands = new CommandRouter<>(); - - @Override - /** - * Attempt to route a subcommand from this command invocation. - */ - public String handle(String[] cmd) throws Exception { - // cmd[0] == this - // cmd[1] == wanted - // cmd[2...] == args - - // TODO: Check for null - - logger.info("Called: {} {}", cmd.length, Arrays.toString(cmd)); - - if (cmd.length < 2) { - return "Incomplete command."; - } - - CommandRoute<CommandHandler> handler = subcommands.route(cmd[1]); - - // TODO Get the unknown response from the session - - if (handler == null) return "Unknown command."; - - Map<String, CommandHandler> cmds = handler.getCommands(); - if (cmds.size() == 0) return "Unknown command."; - // Which ones? - if (cmds.size() > 1) return "Ambiguous commands."; - - CommandHandler h = (CommandHandler) cmds.values().toArray()[0]; - String[] subCmd = Arrays.copyOfRange(cmd, 1, cmd.length); - logger.info("Built subcmd: {}", Arrays.toString(subCmd)); - - return h.handle(subCmd); - } - - public void putCommand(String name, CommandHandler handler) { - subcommands.putCommand(name, handler); - } -} diff --git a/lc-mud/src/main/java/lc/mud/engine/cmd/WorldEditCommand.java b/lc-mud/src/main/java/lc/mud/engine/cmd/WorldEditCommand.java deleted file mode 100644 index 88ef8ecdc897417affb03210dbc975358852513f..0000000000000000000000000000000000000000 --- a/lc-mud/src/main/java/lc/mud/engine/cmd/WorldEditCommand.java +++ /dev/null @@ -1,20 +0,0 @@ -package lc.mud.engine.cmd; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mud.engine.MudSession; - -/** - * Implementation of the WE command. This allows for editing the world. - * - * @author Alex Leigh - */ -public class WorldEditCommand extends CommandFrame { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(WorldEditCommand.class); - private final MudSession session; - - public WorldEditCommand(MudSession session) { - this.session = session; - putCommand("room", new WorldEditRoomCommand(session)); - } -} diff --git a/lc-mud/src/main/java/lc/mud/engine/cmd/WorldEditRoomCommand.java b/lc-mud/src/main/java/lc/mud/engine/cmd/WorldEditRoomCommand.java deleted file mode 100644 index 55fa8331626a993a3d459abd9606fb2ccc59e1db..0000000000000000000000000000000000000000 --- a/lc-mud/src/main/java/lc/mud/engine/cmd/WorldEditRoomCommand.java +++ /dev/null @@ -1,51 +0,0 @@ -package lc.mud.engine.cmd; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.StringAccumulator; -import lc.mud.engine.MudSession; - -import java.util.Arrays; - -/** - * Implementation of the WE ROOM command. This allows for manipulation of a room. - * - * @author Alex Leigh - */ -public class WorldEditRoomCommand extends CommandFrame { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(WorldEditRoomCommand.class); - private final MudSession session; - - public WorldEditRoomCommand(MudSession session) { - this.session = session; - putCommand("title", cmd -> { - logger.info("Called: {}", cmd); - - if (cmd.length == 1) { - return "[title: " + session.getLocation().getTitle() + "]"; - } else { - String[] args = Arrays.copyOfRange(cmd, 1, cmd.length); - StringAccumulator sa = new StringAccumulator(" "); - sa.appendAll(args); - session.getLocation().setTitle(sa.toString()); - return "OK"; - } - }); - - putCommand("desc", cmd -> { - logger.info("Called: {}", cmd); - - if (cmd.length == 1) { - return "[desc: " + session.getLocation().getDesc() + "]"; - } else { - String[] args = Arrays.copyOfRange(cmd, 1, cmd.length); - StringAccumulator sa = new StringAccumulator(" "); - sa.appendAll(args); - session.getLocation().setDesc(sa.toString()); - return "OK"; - } - }); - - putCommand("exit", new WorldEditRoomExitCommand(session)); - } -} \ No newline at end of file diff --git a/lc-mud/src/main/java/lc/mud/engine/cmd/WorldEditRoomExitCommand.java b/lc-mud/src/main/java/lc/mud/engine/cmd/WorldEditRoomExitCommand.java deleted file mode 100644 index 816731a4923f562bc3741b703b5f54ea9b1d12f8..0000000000000000000000000000000000000000 --- a/lc-mud/src/main/java/lc/mud/engine/cmd/WorldEditRoomExitCommand.java +++ /dev/null @@ -1,62 +0,0 @@ -package lc.mud.engine.cmd; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mud.engine.Direction; -import lc.mud.engine.Exit; -import lc.mud.engine.MudSession; -import lc.mud.engine.Room; - -import java.util.Arrays; -import java.util.Map; - -/** - * Implementation of the WE ROOM EXIT command. This allows for manipulating the exits of a room. - * - * @author Alex Leigh - */ -public class WorldEditRoomExitCommand extends CommandFrame { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(WorldEditRoomExitCommand.class); - - public WorldEditRoomExitCommand(MudSession session) { - putCommand("create", cmd -> { - logger.info("exit create called: {}", Arrays.toString(cmd)); - - if (cmd.length == 2) { - Direction srcDir = Direction.getDirection(cmd[1]); - Direction dstDir = Direction.opposite(srcDir); - - Room src = session.getLocation(); - Room dst = session.getEngine().createVoidRoom(); - - // TODO: Implement setting exit description - Exit srcExit = new Exit(dst.getId(), null); - Exit dstExit = new Exit(src.getId(), null); - - src.getExits().put(srcDir, srcExit); - dst.getExits().put(dstDir, dstExit); - - return "OK"; - } - - return session.getUnknownResponse(); - }); - - putCommand("list", cmd -> { - if (cmd.length == 1) { - StringBuilder sb = new StringBuilder(); - sb.append("=====\r\n"); - for (Map.Entry<Direction, Exit> entry : session.getLocation().getExits().entrySet()) { - sb.append(entry.getKey()); - sb.append(" "); - sb.append(entry.getValue()); - sb.append("\r\n"); - } - sb.append("=====\r\n"); - return sb.toString(); - } - - return session.getUnknownResponse(); - }); - } -} diff --git a/lc-mud/src/main/java/lc/mud/engine/io/CircleDataImporter.java b/lc-mud/src/main/java/lc/mud/engine/io/CircleDataImporter.java deleted file mode 100644 index 23387264afad73e61b1e4acfa8b49e8b63f3e082..0000000000000000000000000000000000000000 --- a/lc-mud/src/main/java/lc/mud/engine/io/CircleDataImporter.java +++ /dev/null @@ -1,156 +0,0 @@ -package lc.mud.engine.io; - -import lc.mecha.lang.DangerousRunnable; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mud.engine.Direction; -import lc.mud.engine.Exit; -import lc.mud.engine.Extra; -import lc.mud.engine.Room; - -import java.io.*; -import java.util.ArrayList; - -/** - * Processor to load CircleMUD format room files. - * <p> - * Note that this class is not intended to be production quality, and is simply to be used for testing purposes. - * - * @author Alex Leigh - */ -public class CircleDataImporter implements DangerousRunnable { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(CircleDataImporter.class); - private final File f; - private final ArrayList<Room> rooms = new ArrayList<>(); - - public CircleDataImporter(File f) { - this.f = f; - } - - public ArrayList<Room> getRooms() { - return rooms; - } - - @Override - public void runDangerously() throws Exception { - logger.info("Parsing Circle world file. [file: {}]", f); - - try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(f)))) { - Room room; - while ((room = readRoom(in)) != null) { - rooms.add(room); - } - } - } - - public String readDesc(BufferedReader in) throws IOException { - StringBuffer buf = new StringBuffer(); - String line; - while ((line = in.readLine()) != null) { - if (line.equals("~")) break; - line = line.trim(); - line = line.replace(" ", " "); - logger.debug("line: [{}]", line); - if (buf.length() > 0) buf.append(' '); - buf.append(line); - } - return buf.toString().trim(); - } - - public void readExtra(BufferedReader in, String first, Room room) throws IOException { - String nouns = in.readLine(); - String desc = readDesc(in); - - nouns = nouns.replace("~", ""); - String n[] = nouns.split(" "); - - Extra ex = new Extra(desc); - - for (String noun : n) { - room.getExtras().put(noun, ex); - } - - logger.debug("Extra found. [nouns: {}] [desc: {}]", nouns, desc); - } - - public void readDirection(BufferedReader in, String first, Room room) throws IOException { - String desc = readDesc(in); - String keyword = in.readLine(); - String door = in.readLine(); - String dArr[] = door.split(" "); - - logger.debug("Door argument: {}", door); - - Exit e = new Exit(Integer.parseInt(dArr[2]), desc); - - Direction d; - switch (first.trim()) { - case "D0": - d = Direction.NORTH; - break; - case "D1": - d = Direction.EAST; - break; - case "D2": - d = Direction.SOUTH; - break; - case "D3": - d = Direction.WEST; - break; - case "D4": - d = Direction.UP; - break; - case "D5": - d = Direction.DOWN; - break; - default: - logger.warn("Unknown direction found in world file: {}", first); - throw new IllegalStateException(); - } - - room.getExits().put(d, e); - - logger.debug("Read exit: [direction: {}] [desc: {}] [door: {}]", d, desc, door); - } - - public Room readRoom(BufferedReader in) throws IOException { - // Not meant to be production quality - just needs to work enough to load rooms for testing the engine - String id = in.readLine(); - if (id == null) return null; - String title = in.readLine(); - if (title == null) return null; - title = title.replace("~", ""); - String desc = readDesc(in); - if (desc == null) return null; - String status = in.readLine(); - if (status == null) return null; - - Room room = new Room(Integer.parseInt(id.substring(1)), title, desc); - - // At this point, we have sets of either D or E items. Ironically, D is exit, and E is description. S ends. - String line; - while ((line = in.readLine()) != null) { - if (line.equals("S")) { - return room; - } - if (line.startsWith("D")) { - readDirection(in, line, room); - } - if (line.startsWith("E")) { - readExtra(in, line, room); - } - - } - - return null; - } - - @Override - public void run() { - try { - runDangerously(); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/lc-mud/src/main/java/lc/mud/engine/io/DataExporter.java b/lc-mud/src/main/java/lc/mud/engine/io/DataExporter.java deleted file mode 100644 index 5a0ac5f90d83b4ffbc35da1d05aca5838c87424f..0000000000000000000000000000000000000000 --- a/lc-mud/src/main/java/lc/mud/engine/io/DataExporter.java +++ /dev/null @@ -1,43 +0,0 @@ -package lc.mud.engine.io; - -import lc.mud.engine.MudEngine; -import lc.mud.engine.Room; -import org.apache.commons.csv.CSVFormat; -import org.apache.commons.csv.CSVPrinter; - -import java.io.BufferedWriter; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Collection; - -/** - * Incomplete implementation of a world exporter. This implementation is just enough to output the rooms without - * any extended information. - * - * @author Alex Leigh - */ -public class DataExporter { - private final Collection<Room> rooms; - - public DataExporter(Collection<Room> rooms) { - this.rooms = rooms; - } - - public void exportRooms(Path dst) throws IOException { - BufferedWriter writer = Files.newBufferedWriter(dst); - try (CSVPrinter csvPrinter = new CSVPrinter(writer, CSVFormat.DEFAULT - .withHeader("ROOM_ID", "TITLE", "DESC"))) { - for (Room r : rooms) { - csvPrinter.printRecord(r.getId(), r.getTitle(), r.getDesc()); - } - } - } - - public static void main(String args[]) throws IOException { - MudEngine engine = new MudEngine(); - DataExporter exp = new DataExporter(engine.getRooms().values()); - exp.exportRooms(Paths.get("world_rooms.csv")); - } -} diff --git a/lc-mud/src/main/java/lc/mud/engine/io/DataImporter.java b/lc-mud/src/main/java/lc/mud/engine/io/DataImporter.java deleted file mode 100644 index 2c1041867b94e26d8a5c71dd2fbc27cd1de8519c..0000000000000000000000000000000000000000 --- a/lc-mud/src/main/java/lc/mud/engine/io/DataImporter.java +++ /dev/null @@ -1,105 +0,0 @@ -package lc.mud.engine.io; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mud.engine.Direction; -import lc.mud.engine.Exit; -import lc.mud.engine.Extra; -import lc.mud.engine.Room; -import org.apache.commons.csv.CSVFormat; -import org.apache.commons.csv.CSVParser; -import org.apache.commons.csv.CSVRecord; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.Reader; -import java.nio.file.Path; -import java.util.Collection; -import java.util.HashMap; - -/** - * Class to import CSV-format worldfiles. This is a homegrown creation that is intended to bootstrap the mud - * world prior to having a proper database. - * - * @author Alex Leigh - */ -public class DataImporter { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(DataImporter.class); - - private final HashMap<Integer, Room> rooms = new HashMap<>(); - - public void readExits(Path exitsCsv) throws IOException { - try (final Reader reader = new InputStreamReader(new FileInputStream(exitsCsv.toFile()))) { - try (CSVParser parser = new CSVParser(reader, CSVFormat.EXCEL.withHeader());) { - for (CSVRecord record : parser) { - String roomId = record.get("SRC"); - String dst = record.get("DST"); - String title = record.get("DIR"); - String desc = record.get("DESC"); - - Integer srcId = Integer.parseInt(roomId.trim()); - Room src = rooms.get(srcId); - - if (src == null) { - logger.warn("Missing room for exit! [src: {}] [dst: {}]", roomId, dst); - continue; - } - - Direction dir = Direction.getDirection(title); - - src.getExits().put(dir, new Exit(Integer.parseInt(dst.trim()), desc)); - } - } - } - } - - public void readRooms(Path roomsCsv) throws IOException { - try (final Reader reader = new InputStreamReader(new FileInputStream(roomsCsv.toFile()))) { - try (CSVParser parser = new CSVParser(reader, CSVFormat.EXCEL.withHeader());) { - for (CSVRecord record : parser) { - String roomId = record.get("ROOM_ID"); - String title = record.get("TITLE"); - String desc = record.get("DESC"); - Room r = new Room(Integer.parseInt(roomId.trim()), title, desc); - rooms.put(r.getId(), r); - } - } - } - } - - - public void readExtras(Path extrasCsv) throws IOException { - try (final Reader reader = new InputStreamReader(new FileInputStream(extrasCsv.toFile()))) { - try (CSVParser parser = new CSVParser(reader, CSVFormat.EXCEL.withHeader());) { - for (CSVRecord record : parser) { - String roomId = record.get("ROOM_ID"); - String nouns = record.get("NOUN"); - String desc = record.get("DESC"); - - Integer srcId = Integer.parseInt(roomId.trim()); - Room src = rooms.get(srcId); - - if (src == null) { - logger.warn("Missing room for extra! [room_id: {}]", roomId); - continue; - } - - nouns = nouns.replace("~", ""); - String n[] = nouns.split(" "); - - Extra ex = new Extra(desc); - - for (String noun : n) { - src.getExtras().put(noun, ex); - } - } - } - } - } - - - public Collection<Room> getRooms() { - return rooms.values(); - } -} \ No newline at end of file diff --git a/lc-mud/src/test/java/lc/mud/engine/RoomLoaderTest.java b/lc-mud/src/test/java/lc/mud/engine/RoomLoaderTest.java deleted file mode 100644 index 14ddfc1294f90078c97a5c46cb38d5787d0614da..0000000000000000000000000000000000000000 --- a/lc-mud/src/test/java/lc/mud/engine/RoomLoaderTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package lc.mud.engine; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mud.engine.io.CircleDataImporter; -import org.junit.jupiter.api.Test; - -import java.io.File; - -public class RoomLoaderTest { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(RoomLoaderTest.class); - - @Test - public void testLoader() throws Exception { - CircleDataImporter loader = new CircleDataImporter(new File("circle/world/wld/9.wld")); - loader.runDangerously(); - - for (Room r : loader.getRooms()) { - logger.info("Room: {}", r); - } - } -} diff --git a/lc-mud/world/exits.csv b/lc-mud/world/exits.csv deleted file mode 100644 index 5b493aac6ca01adce5c32f7089c8ae24fa718966..0000000000000000000000000000000000000000 --- a/lc-mud/world/exits.csv +++ /dev/null @@ -1,29 +0,0 @@ -SRC,DST,DIR,DESC -0,1,U,An imposing metal door blocks your way -1,0,D,An imposing metal door blocks your way -1,2,U,Worn stone steps leading up the tower -1,5,N,A bustling marketplace can be seen through these open doors -1,6,E,A bustling marketplace can be seen through these open doors -1,7,S,A bustling marketplace can be seen through these open doors -1,8,W,A bustling marketplace can be seen through these open doors -2,1,D,Worn stone steps leading down the tower -2,3,U,Worn stone steps leading up the tower -3,2,D,Stone steps leading down the tower -3,4,U,Stone steps leading to a bolted metal door -4,3,D,A bolted metal door blocks the way into the Keep -5,1,S,A pair of heavy metal doors lead into a large stone tower -5,9,N,An avenue stretches out before you -5,10,E,Old timers lean against the porch railing of the General Store while the shopkeeper makes smalltalk -5,11,W,A pair of guards survey the people streaming in and out of the Bank -6,1,W,A pair of heavy metal doors lead into a large stone tower -6,12,N,You can hear the rhythmic chop of the butcher's cleaver emminating from the open window -6,13,S,The smell of freshly baked bread wafts towards you -6,14,E,A street stretches out before you -7,1,N,A pair of heavy metal doors lead into a large stone tower -8,1,E,A pair of heavy metal doors lead into a large stone tower -9,5,S,The Northern Square opens up before you -10,5,W,You catch a glimpse of the square outside as the door swings in -11,5,E,You catch a glimpse of the square outside as the door swings in -12,6,,You catch a glimpse of the square outside as the door swings in -13,6,,You catch a glimpse of the square outside as the door swings in -14,6,,The Eastern Square opens up before you \ No newline at end of file diff --git a/lc-mud/world/extras.csv b/lc-mud/world/extras.csv deleted file mode 100644 index 32d12557da5e9151f53c95c5ceee2d6954d8aebd..0000000000000000000000000000000000000000 --- a/lc-mud/world/extras.csv +++ /dev/null @@ -1,6 +0,0 @@ -ROOM_ID,NOUN,DESC -0,cell,A tatterd looking beggar lays moaning on a stone bench. -0,wall,A lone torch gutters in its sconce -1,ceiling,Large wooden timbers creak with each step from above -2,floor,Softly creaks as you shift your weight -2,locker,A cheap looking padlock secures a metal cabinet. An illegibly scribbled name adorns the top \ No newline at end of file diff --git a/lc-mud/world/rooms.csv b/lc-mud/world/rooms.csv deleted file mode 100644 index c47bd4e62b27b63284a3483a23479803da2488b8..0000000000000000000000000000000000000000 --- a/lc-mud/world/rooms.csv +++ /dev/null @@ -1,8 +0,0 @@ -ROOM_ID,TITLE,DESC -0,Keep Dungeon,"Musty air fills your nose as soft moans emminate from a cell along the far wall. The inevitable march of eternity is punctuated only by a slow drip of water in ths poorly lit excuse for a dungeon. You could have sworn you saw a note on the bulletin board flutter, but there couldn't possibly be any wind down here... right?" -1,Keep Entrance,"Your steps echo dully off the stone walls surrounding you. A pair of large metal doors adorn all 4 walls. Through them you hear the dull roar of a bustling marketplace spilling in, while the clomping of heavy boots drifts down from the ceiling." -2,Keep Armoury,"An unheard joke causes an explosion of laughter from a group of guards at the far end of the room. Rows of metal lockers secured by cheap looking padlocks fill the majority of the room. Recruitment posters adorn the walls, often with lewd phrases scribbled over the official propaganda. You notice a bulletin board nearly hidden behind a miriad of notices" -3,Town Lord's Quarters,"A lavishly furnished apartment for the town Lord, well removed from the chaos of the town below. The most comfortable looking couch you've ever seen faces into the room, matched by an antique desk occupying the adjacent wall. Portaits of previous Lords adorn the walls" -4,Keep Parapets,"From here you are afforded an unparalleled view of the town and surrounding countryside. Barges from the eastern forest drift along the river to unload at the southern docks. To the north you can see what looks to be some kind of quarry dug into hillside. Mountains dominate the skyline at the extents of your vision. Farmland butts up against the western gate, hemmed in by barely visible treetops" -5,Northern Square,"People mill around the marketplace as peddlers hawk their wares. A general store stands to the East, the town bank on the West side of the square, the Keep looms over you to the South, while an avenue extends to the North. " -6,Eastern Square,"People mill around the marketplace as peddlers hawk their wares. The Butcher's repetitive chopping can be heard from his shop to the north. The smell of fresh pastries drifts up from the south. To the East, a street continues through some nice looking houses." \ No newline at end of file diff --git a/lc-perfect/.gitignore b/lc-perfect/.gitignore deleted file mode 100644 index ede7310f5aa22a8bb16f7393dedac5d9b0cba2c9..0000000000000000000000000000000000000000 --- a/lc-perfect/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -kabe.log -velocity.log -.DS_Store -statistic.xml -.gradle -/*/build/ -/build/ -gradle-app.setting -!gradle-wrapper.jar -.gradletasknamecache -.idea/ -*.iml -out/ -.cache -node_modules -/*/.idea -.vi -/*/graph.eo -.vai -graph.bak -.idea -tests.vai -vds.log -hosts.json -tests.vai.old \ No newline at end of file diff --git a/lc-perfect/LICENSE.md b/lc-perfect/LICENSE.md deleted file mode 100644 index 226d1f25b12e58e21c29a6c1869d1ec05095d443..0000000000000000000000000000000000000000 --- a/lc-perfect/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-perfect/build.gradle b/lc-perfect/build.gradle deleted file mode 100644 index 7b5f46e6f91df02eae2f95a19fa828e84d3615dd..0000000000000000000000000000000000000000 --- a/lc-perfect/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -plugins { - id 'java' - id 'java-library' -} - -group 'leigh' -version '15.0' - -repositories { - mavenCentral() -} -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -dependencies { - api group: 'c3p0', name: 'c3p0', version: '0.9.1.2' - api group: 'mysql', name: 'mysql-connector-java', version: '8.0.22' - api project(':lc-mecha-audio') - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/lc-perfect/sql/perfect-1.sql b/lc-perfect/sql/perfect-1.sql deleted file mode 100644 index 580a2aaf0c74f334035a6e19b370c305e492ff8c..0000000000000000000000000000000000000000 --- a/lc-perfect/sql/perfect-1.sql +++ /dev/null @@ -1,12 +0,0 @@ -create table load_t -( - id int not null auto_increment, - artist varchar(64), - album varchar(64), - title varchar(64), - length int, - samplerate int, - kind varchar(8), - orig_fn varchar(512), - orig_path varchar(512) -) kabe = innodb; \ No newline at end of file diff --git a/lc-perfect/src/main/java/lc/perfect/PerfectDatasource.java b/lc-perfect/src/main/java/lc/perfect/PerfectDatasource.java deleted file mode 100644 index f485c88f2c1cd2a276bf51d4c0a1c1f24cd4f109..0000000000000000000000000000000000000000 --- a/lc-perfect/src/main/java/lc/perfect/PerfectDatasource.java +++ /dev/null @@ -1,16 +0,0 @@ -package lc.perfect; - -import com.mchange.v2.c3p0.ComboPooledDataSource; - -import java.beans.PropertyVetoException; - -public class PerfectDatasource { - public static ComboPooledDataSource getDataSource() throws PropertyVetoException { - ComboPooledDataSource cpds = new ComboPooledDataSource(); - cpds.setDriverClass("com.mysql.cj.jdbc.Driver"); - cpds.setJdbcUrl("jdbc:mysql://db1.leigh-co.com/music"); - cpds.setUser("music"); - cpds.setPassword(System.getenv("MUSIC_PW")); - return cpds; - } -} diff --git a/lc-perfect/src/main/java/lc/perfect/PerfectLoader.java b/lc-perfect/src/main/java/lc/perfect/PerfectLoader.java deleted file mode 100644 index ae79134b4ba10ae8bec32a5d87d7211d6051a27b..0000000000000000000000000000000000000000 --- a/lc-perfect/src/main/java/lc/perfect/PerfectLoader.java +++ /dev/null @@ -1,33 +0,0 @@ -package lc.perfect; - -import lc.mecha.audio.AudioFileProcessor; -import lc.mecha.audio.AudioScanner; - -import java.nio.file.Path; -import java.nio.file.Paths; -import java.sql.Connection; - -/** - * Load raw files into the audio database. - * - * @author Alex Leigh - */ -public class PerfectLoader { - public static void main(String args[]) throws Exception { - try(Connection con = PerfectDatasource.getDataSource().getConnection()) { - AudioScanner scanner = new AudioScanner(); - scanner.defaultSupported(); - - // try(PreparedStatement ps = con.prepareStatement(""INSERT INTO load_t ())) - - scanner.scan(Paths.get(args[0]), new AudioFileProcessor() { - @Override - public void process(Path file, String artist, String album, String title, int length, long bitrate) { - - } - }); - } - } - - -} diff --git a/lc-reactor/.gitignore b/lc-reactor/.gitignore deleted file mode 100644 index ede7310f5aa22a8bb16f7393dedac5d9b0cba2c9..0000000000000000000000000000000000000000 --- a/lc-reactor/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -kabe.log -velocity.log -.DS_Store -statistic.xml -.gradle -/*/build/ -/build/ -gradle-app.setting -!gradle-wrapper.jar -.gradletasknamecache -.idea/ -*.iml -out/ -.cache -node_modules -/*/.idea -.vi -/*/graph.eo -.vai -graph.bak -.idea -tests.vai -vds.log -hosts.json -tests.vai.old \ No newline at end of file diff --git a/lc-reactor/LICENSE.md b/lc-reactor/LICENSE.md deleted file mode 100644 index 226d1f25b12e58e21c29a6c1869d1ec05095d443..0000000000000000000000000000000000000000 --- a/lc-reactor/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-reactor/build.gradle b/lc-reactor/build.gradle deleted file mode 100644 index ff37cedb1152b17eb2604d6966e44ec3cebd50b2..0000000000000000000000000000000000000000 --- a/lc-reactor/build.gradle +++ /dev/null @@ -1,22 +0,0 @@ -plugins { - id 'java' - id 'java-library' -} - -group 'leigh' -version '16.0' -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -repositories { - mavenCentral() -} - -dependencies { - api project(':lc-mecha') - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/lc-reactor/src/main/java/lc/reactor/Reactor.java b/lc-reactor/src/main/java/lc/reactor/Reactor.java deleted file mode 100644 index 5e4154aafdc88e0939e62ccd1f400ba16f73d6f6..0000000000000000000000000000000000000000 --- a/lc-reactor/src/main/java/lc/reactor/Reactor.java +++ /dev/null @@ -1,32 +0,0 @@ -package lc.reactor; - -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; - -import java.io.Serializable; -import java.time.Instant; -import java.util.HashMap; - -/** - * Implementation of a tree-based data manifestation. - */ -public class Reactor { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(Reactor.class); - private final HashMap<String, SymbolValue> symbols = new HashMap<>(); - - /** - * Set a new value into the reactor. - */ - public void putSymbol(String key, Serializable value) { - SymbolValue sv = new SymbolValue(value, Instant.now()); - logger.info("Symbol update. [key: {}] [symbol: {}]", key, sv); - symbols.put(key, sv); - } - - /** - * Return the {@link SymbolValue} associated with the given key, if one exists. - */ - public SymbolValue getValue(String key) { - return symbols.get(key); - } -} diff --git a/lc-reactor/src/main/java/lc/reactor/SymbolValue.java b/lc-reactor/src/main/java/lc/reactor/SymbolValue.java deleted file mode 100644 index b306701ddaed4da88ec4eb4742c5f2f024496a9b..0000000000000000000000000000000000000000 --- a/lc-reactor/src/main/java/lc/reactor/SymbolValue.java +++ /dev/null @@ -1,25 +0,0 @@ -package lc.reactor; - -import java.io.Serializable; -import java.time.Instant; - -/** - * This idempotent class represents a symbol value at a particular instant. - */ -public class SymbolValue { - private final Serializable value; - private final Instant time; - - public SymbolValue(Serializable value, Instant time) { - this.value = value; - this.time = time; - } - - @Override - public String toString() { - return "SymbolValue{" + - "value=" + value + - ", time=" + time + - '}'; - } -} diff --git a/lc-tansu-sdk/LICENSE.md b/lc-tansu-sdk/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/lc-tansu-sdk/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-tansu-sdk/build.gradle b/lc-tansu-sdk/build.gradle deleted file mode 100644 index 01228b8650ae7105657dfb132ca9a29f9cb6c50b..0000000000000000000000000000000000000000 --- a/lc-tansu-sdk/build.gradle +++ /dev/null @@ -1,23 +0,0 @@ -plugins { - id 'java' - id 'java-library' -} - -group 'leigh' -version '16.0' - -repositories { - mavenCentral() -} -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -dependencies { - api project(':lc-eo-schema') - api project(':lc-esp-sdk') - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/SchemaGeneratorApp.java b/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/SchemaGeneratorApp.java deleted file mode 100644 index 1e4c316be1b15aa8450ab03e68b0aa2487c431e3..0000000000000000000000000000000000000000 --- a/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/SchemaGeneratorApp.java +++ /dev/null @@ -1,66 +0,0 @@ -package lc.tansu.sdk.v1; - -import lc.eo.EO; -import lc.eo.EODataType; -import lc.eo.schema.DAOGenerator; -import lc.eo.schema.dao.ElementElementDAO; -import lc.eo.schema.dao.FieldUtil; -import lc.eo.schema.dao.SchemaElementDAO; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.UniversalJob; - -import java.io.File; -import java.io.FileNotFoundException; - -import static lc.eo.schema.dao.SchemaUtil.API_KEY; -import static lc.eo.schema.dao.SchemaUtil.create; - -public class SchemaGeneratorApp { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(SchemaGeneratorApp.class); - - public static EO generate() { - final EO schema = create(API_KEY); - - final EO objectGetRequest = ElementElementDAO.create(); - SchemaElementDAO.getElements(schema).add(objectGetRequest); - ElementElementDAO.setApiName(objectGetRequest, "leigh.tansu.sdk.v1.ObjectGetRequest"); - ElementElementDAO.getFields(objectGetRequest).add( - FieldUtil.createNotNull("bucketId", "Bucket ID", EODataType.string)); - ElementElementDAO.getFields(objectGetRequest).add( - FieldUtil.createNotNull("id", "Object ID", EODataType.string)); - - final EO objectPutResponse = ElementElementDAO.create(); - SchemaElementDAO.getElements(schema).add(objectPutResponse); - ElementElementDAO.setApiName(objectPutResponse, "leigh.tansu.sdk.v1.ObjectPutResponse"); - - final EO objectPutRequest = ElementElementDAO.create(); - SchemaElementDAO.getElements(schema).add(objectPutRequest); - ElementElementDAO.setApiName(objectPutRequest, "leigh.tansu.sdk.v1.ObjectPutRequest"); - ElementElementDAO.getFields(objectPutRequest).add( - FieldUtil.createNotNull("bucketId", "Bucket ID", EODataType.string)); - ElementElementDAO.getFields(objectPutRequest).add( - FieldUtil.createNotNull("id", "Object ID", EODataType.string)); - - final EO bucketCreateResponse = ElementElementDAO.create(); - SchemaElementDAO.getElements(schema).add(bucketCreateResponse); - ElementElementDAO.setApiName(bucketCreateResponse, "leigh.tansu.sdk.v1.BucketCreateResponse"); - - final EO bucketCreateRequest = ElementElementDAO.create(); - SchemaElementDAO.getElements(schema).add(bucketCreateRequest); - ElementElementDAO.setApiName(bucketCreateRequest, "leigh.tansu.sdk.v1.BucketCreateRequest"); - ElementElementDAO.getFields(bucketCreateRequest).add( - FieldUtil.createNotNull("id", "Bucket ID", EODataType.string)); - - return schema; - } - - public static void main(final String... args) throws FileNotFoundException { - UniversalJob.banner(logger, "Apotheosis mk3", "2021 Alex Leigh"); - final EO schema = generate(); - final DAOGenerator gen = new DAOGenerator(new File("leigh-tansu-sdk/src/main/java")); - gen.generateJava("leigh.tansu.sdk.v1.schema", schema); - - logger.info("Generated schema: {}", schema); - } -} diff --git a/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/TansuClient.java b/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/TansuClient.java deleted file mode 100644 index db0bce24b626337f76906b90962c80a8d6597672..0000000000000000000000000000000000000000 --- a/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/TansuClient.java +++ /dev/null @@ -1,49 +0,0 @@ -package lc.tansu.sdk.v1; - -import lc.eo.EO; -import lc.esp.sdk.ContentPart; -import lc.esp.sdk.ESPClient; -import lc.esp.sdk.link23.Link23Response; -import lc.mecha.lang.FutureResult; -import lc.tansu.sdk.v1.schema.BucketCreateRequestElementDAO; -import lc.tansu.sdk.v1.schema.ObjectGetRequestElementDAO; -import lc.tansu.sdk.v1.schema.ObjectPutRequestElementDAO; - -import java.io.InputStream; -import java.util.ArrayList; - -public class TansuClient { - private final ESPClient ctx; - public final static String API_BASE = "/tansu/v1"; - public final static String API_BUCKET_CREATE = "/bucket/create"; - public final static String API_OBJECT_GET = "/obj/get"; - public final static String API_OBJECT_PUT = "/obj/put"; - public final static String MULTIPART_BLOB = "leigh.tansu.blob"; - - public TansuClient(ESPClient ctx) { - this.ctx = ctx; - } - - public FutureResult<Link23Response> bucketCreate(String bucketId) { - EO request = BucketCreateRequestElementDAO.create(); - BucketCreateRequestElementDAO.setId(request, bucketId); - return ctx.apiRequest(API_BASE + API_BUCKET_CREATE, request); - } - - public FutureResult<Link23Response> objectPut(String bucketId, String objId, InputStream data, String contentType) { - EO request = ObjectPutRequestElementDAO.create(); - ObjectPutRequestElementDAO.setBucketId(request, bucketId); - ObjectPutRequestElementDAO.setId(request, objId); - - ArrayList<ContentPart> parts = new ArrayList<>(); - parts.add(new ContentPart(data, MULTIPART_BLOB, contentType, false)); - return ctx.apiRequest(API_BASE + API_OBJECT_PUT, request, parts); - } - - public FutureResult<Link23Response> objectGet(String bucketId, String objId) { - EO request = ObjectGetRequestElementDAO.create(); - ObjectGetRequestElementDAO.setBucketId(request, bucketId); - ObjectGetRequestElementDAO.setId(request, objId); - return ctx.apiRequest(API_BASE + API_OBJECT_GET, request); - } -} diff --git a/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/TansuObject.java b/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/TansuObject.java deleted file mode 100644 index 3f9efccc134f5e5a6db1a75bce97f2eb018ee2dc..0000000000000000000000000000000000000000 --- a/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/TansuObject.java +++ /dev/null @@ -1,21 +0,0 @@ -package lc.tansu.sdk.v1; - -import java.io.InputStream; - -public class TansuObject { - private final InputStream inputStream; - private final String contentType; - - public TansuObject(InputStream inputStream, String contentType) { - this.inputStream = inputStream; - this.contentType = contentType; - } - - public InputStream getInputStream() { - return inputStream; - } - - public String getContentType() { - return contentType; - } -} diff --git a/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/schema/BucketCreateRequestElementDAO.java b/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/schema/BucketCreateRequestElementDAO.java deleted file mode 100644 index d7f72e7e92a36a2ec0f5a1e2185a3670cb0bcf9f..0000000000000000000000000000000000000000 --- a/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/schema/BucketCreateRequestElementDAO.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2014-2021, by Alex Leigh. - * All rights reserved. - * - * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE - * The copyright notice above does not evidence any - * actual or intended publication of such source code. - */ - -package lc.tansu.sdk.v1.schema; - -import lc.eo.EO; - -/** - * This is a dynamically generated DAO class for accessing objects within an ESP graph. This class - * has been generated by <code>DAOGenerator</code> and should not be modified. - * - * @author DAOGenerator (synthetically generated class) - */ -public final class BucketCreateRequestElementDAO { - public static final String API_TYPE = "leigh.tansu.sdk.v1.BucketCreateRequest"; - - public static EO create() { - EO eo = new EO(API_TYPE); - return eo; - } - - public static boolean assertType(final EO eo) { - return eo.getApiType().equals(API_TYPE); - } - - public static final String KEY_ID = "id"; - - public static String apiType(final EO eo) { - return eo.getApiType(); - } - - - /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=id, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}, meta=null}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Bucket ID, locale=en}, meta=null}]} , type=string}, meta=null} */ - - - public static java.lang.String getId(EO eo) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_ID); - } - - public static void setId(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_ID, value); - } - - public static void setIdLabel(final EO eo, final String label) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setLabel(KEY_ID, label); - } - - public static void getLabelOrValueId(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.getLabelOrValue(KEY_ID); - } - - public static void setIfUnsetId(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValueIfUnset(KEY_ID, value); - } - - -} \ No newline at end of file diff --git a/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/schema/BucketCreateResponseElementDAO.java b/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/schema/BucketCreateResponseElementDAO.java deleted file mode 100644 index b4393240c49dcd2ae0f883977a594b913c27bed8..0000000000000000000000000000000000000000 --- a/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/schema/BucketCreateResponseElementDAO.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2014-2021, by Alex Leigh. - * All rights reserved. - * - * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE - * The copyright notice above does not evidence any - * actual or intended publication of such source code. - */ - -package lc.tansu.sdk.v1.schema; - -import lc.eo.EO; - -/** - * This is a dynamically generated DAO class for accessing objects within an ESP graph. This class - * has been generated by <code>DAOGenerator</code> and should not be modified. - * - * @author DAOGenerator (synthetically generated class) - */ -public final class BucketCreateResponseElementDAO { - public static final String API_TYPE = "leigh.tansu.sdk.v1.BucketCreateResponse"; - - public static EO create() { - EO eo = new EO(API_TYPE); - return eo; - } - - public static boolean assertType(final EO eo) { - return eo.getApiType().equals(API_TYPE); - } - - - public static String apiType(final EO eo) { - return eo.getApiType(); -} - - -} \ No newline at end of file diff --git a/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/schema/ObjectGetRequestElementDAO.java b/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/schema/ObjectGetRequestElementDAO.java deleted file mode 100644 index 8d9f195cd5334fab74ee1b30f3d980324fbea431..0000000000000000000000000000000000000000 --- a/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/schema/ObjectGetRequestElementDAO.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2014-2021, by Alex Leigh. - * All rights reserved. - * - * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE - * The copyright notice above does not evidence any - * actual or intended publication of such source code. - */ - -package lc.tansu.sdk.v1.schema; - -import lc.eo.EO; - -/** - * This is a dynamically generated DAO class for accessing objects within an ESP graph. This class - * has been generated by <code>DAOGenerator</code> and should not be modified. - * - * @author DAOGenerator (synthetically generated class) - */ -public final class ObjectGetRequestElementDAO { - public static final String API_TYPE = "leigh.tansu.sdk.v1.ObjectGetRequest"; - - public static EO create() { - EO eo = new EO(API_TYPE); - return eo; - } - - public static boolean assertType(final EO eo) { - return eo.getApiType().equals(API_TYPE); - } - - public static final String KEY_BUCKETID = "bucketId"; - public static final String KEY_ID = "id"; - - public static String apiType(final EO eo) { - return eo.getApiType(); - } - - - /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=bucketId, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}, meta=null}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Bucket ID, locale=en}, meta=null}]} , type=string}, meta=null} */ - - - public static java.lang.String getBucketId(EO eo) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_BUCKETID); - } - - public static void setBucketId(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_BUCKETID, value); - } - - public static void setBucketIdLabel(final EO eo, final String label) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setLabel(KEY_BUCKETID, label); - } - - public static void getLabelOrValueBucketId(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.getLabelOrValue(KEY_BUCKETID); - } - - public static void setIfUnsetBucketId(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValueIfUnset(KEY_BUCKETID, value); - } - - - /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=id, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}, meta=null}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Object ID, locale=en}, meta=null}]} , type=string}, meta=null} */ - - - public static java.lang.String getId(EO eo) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_ID); - } - - public static void setId(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_ID, value); - } - - public static void setIdLabel(final EO eo, final String label) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setLabel(KEY_ID, label); - } - - public static void getLabelOrValueId(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.getLabelOrValue(KEY_ID); - } - - public static void setIfUnsetId(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValueIfUnset(KEY_ID, value); -} - - -} \ No newline at end of file diff --git a/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/schema/ObjectPutRequestElementDAO.java b/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/schema/ObjectPutRequestElementDAO.java deleted file mode 100644 index b8f95b5f2c033aca56453389e875ec39ab7b4325..0000000000000000000000000000000000000000 --- a/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/schema/ObjectPutRequestElementDAO.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2014-2021, by Alex Leigh. - * All rights reserved. - * - * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE - * The copyright notice above does not evidence any - * actual or intended publication of such source code. - */ - -package lc.tansu.sdk.v1.schema; - -import lc.eo.EO; - -/** - * This is a dynamically generated DAO class for accessing objects within an ESP graph. This class - * has been generated by <code>DAOGenerator</code> and should not be modified. - * - * @author DAOGenerator (synthetically generated class) - */ -public final class ObjectPutRequestElementDAO { - public static final String API_TYPE = "leigh.tansu.sdk.v1.ObjectPutRequest"; - - public static EO create() { - EO eo = new EO(API_TYPE); - return eo; - } - - public static boolean assertType(final EO eo) { - return eo.getApiType().equals(API_TYPE); - } - - public static final String KEY_BUCKETID = "bucketId"; - public static final String KEY_ID = "id"; - - public static String apiType(final EO eo) { - return eo.getApiType(); - } - - - /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=bucketId, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}, meta=null}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Bucket ID, locale=en}, meta=null}]} , type=string}, meta=null} */ - - - public static java.lang.String getBucketId(EO eo) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_BUCKETID); - } - - public static void setBucketId(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_BUCKETID, value); - } - - public static void setBucketIdLabel(final EO eo, final String label) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setLabel(KEY_BUCKETID, label); - } - - public static void getLabelOrValueBucketId(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.getLabelOrValue(KEY_BUCKETID); - } - - public static void setIfUnsetBucketId(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValueIfUnset(KEY_BUCKETID, value); - } - - - /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=id, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}, meta=null}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Object ID, locale=en}, meta=null}]} , type=string}, meta=null} */ - - - public static java.lang.String getId(EO eo) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueString(KEY_ID); - } - - public static void setId(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_ID, value); - } - - public static void setIdLabel(final EO eo, final String label) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setLabel(KEY_ID, label); - } - - public static void getLabelOrValueId(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.getLabelOrValue(KEY_ID); - } - - public static void setIfUnsetId(final EO eo, java.lang.String value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValueIfUnset(KEY_ID, value); -} - - -} \ No newline at end of file diff --git a/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/schema/ObjectPutResponseElementDAO.java b/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/schema/ObjectPutResponseElementDAO.java deleted file mode 100644 index 27043b54a3216a53b7488c2755bb3d03cdd9e74d..0000000000000000000000000000000000000000 --- a/lc-tansu-sdk/src/main/java/lc/tansu/sdk/v1/schema/ObjectPutResponseElementDAO.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2014-2021, by Alex Leigh. - * All rights reserved. - * - * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE - * The copyright notice above does not evidence any - * actual or intended publication of such source code. - */ - -package lc.tansu.sdk.v1.schema; - -import lc.eo.EO; - -/** - * This is a dynamically generated DAO class for accessing objects within an ESP graph. This class - * has been generated by <code>DAOGenerator</code> and should not be modified. - * - * @author DAOGenerator (synthetically generated class) - */ -public final class ObjectPutResponseElementDAO { - public static final String API_TYPE = "leigh.tansu.sdk.v1.ObjectPutResponse"; - - public static EO create() { - EO eo = new EO(API_TYPE); - return eo; - } - - public static boolean assertType(final EO eo) { - return eo.getApiType().equals(API_TYPE); - } - - - public static String apiType(final EO eo) { - return eo.getApiType(); -} - - -} \ No newline at end of file diff --git a/lc-tansu-service/LICENSE.md b/lc-tansu-service/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/lc-tansu-service/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-tansu-service/build.gradle b/lc-tansu-service/build.gradle deleted file mode 100644 index dabac16e4144ca0977b9f5081b7f6a3c1a532beb..0000000000000000000000000000000000000000 --- a/lc-tansu-service/build.gradle +++ /dev/null @@ -1,28 +0,0 @@ -plugins { - id 'java' - id 'java-library' - id 'application' -} -application { - mainClass = 'leigh.tansu.service.TansuService' -} - -group 'leigh' -version '16.0' - -repositories { - mavenCentral() -} -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -dependencies { - api project(':lc-esp-service-sdk') - api project(':lc-tansu-sdk') - implementation 'org.apache.commons:commons-compress:1.21' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/lc-tansu-service/src/main/java/lc/tansu/service/TansuFileObject.java b/lc-tansu-service/src/main/java/lc/tansu/service/TansuFileObject.java deleted file mode 100644 index e53e4f9d62da31c1080e53c5f9a3df98e4e1ed36..0000000000000000000000000000000000000000 --- a/lc-tansu-service/src/main/java/lc/tansu/service/TansuFileObject.java +++ /dev/null @@ -1,54 +0,0 @@ -package lc.tansu.service; - -import lc.eo.EO; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; - -import java.io.BufferedInputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.nio.file.Path; -import java.util.zip.ZipFile; - -/** - * Implementation of a Tansu filesystem file for the purposes of reading. - * - * @author Alex Leigh - */ -// TODO Extract a generic interface here -public class TansuFileObject implements AutoCloseable { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(TansuFileObject.class); - private final ZipFile zip; - - public TansuFileObject(Path path) throws IOException { - zip = new ZipFile(path.toFile()); - } - - /** - * Return an input stream for the main content of this object. This method may be called multiple times, - * which will result in multiple input streams being returned. The caller should close the stream, but if - * the caller does not, it will be closed when <code>close()</code> is called on this object. - */ - public BufferedInputStream getMainInputStream() throws IOException { - return new BufferedInputStream(zip.getInputStream(zip.getEntry(TansuFileStore.MAIN_FILENAME))); - } - - /** - * Return a {@link EO} representing the meta contents. This method may be called multiple times, but it will - * read and process the meta multiple times, returning a new object each time, so that usage is discouraged. - */ - public EO readMeta() throws IOException, ClassNotFoundException { - ObjectInputStream ois = new ObjectInputStream( - new BufferedInputStream(zip.getInputStream(zip.getEntry(TansuFileStore.META_FILENAME)))); - return (EO) ois.readObject(); - } - - @Override - /** - * Close the object. This will side-effect closing all associated streams that were previously returned - * with <code>getMainInputStream()</code>. - */ - public void close() throws IOException { - zip.close(); - } -} diff --git a/lc-tansu-service/src/main/java/lc/tansu/service/TansuFileStore.java b/lc-tansu-service/src/main/java/lc/tansu/service/TansuFileStore.java deleted file mode 100644 index e624489cc646a94abf2dac316963091340eea7fc..0000000000000000000000000000000000000000 --- a/lc-tansu-service/src/main/java/lc/tansu/service/TansuFileStore.java +++ /dev/null @@ -1,92 +0,0 @@ -package lc.tansu.service; - -import lc.eo.EO; -import lc.mecha.io.OutputFile; -import lc.mecha.io.Persister; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.IOUtil; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.ObjectOutputStream; -import java.nio.charset.StandardCharsets; -import java.nio.file.Path; -import java.util.Base64; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -/** - * A simple implementation of a storage store using the local filesystem. This is great for dev/test environments - * and very simple single-server production deployments. Files are stored on disk as zip files which contain both - * the meta parts and data parts of the object. This allows the files to be read/written/moved/deleted atomically, - * while providing compression, but maintains an industry standard approach. - * <p> - * This implementation takes a bath path and stores everything within that path. In the basepath directory - * are n subdirectories, name after the UUID of the bucket they represent. Within each subdirectory is a folder - * containing zip files, each of which represents a single object. - * - * @author Alex Leigh - */ -public class TansuFileStore { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(TansuFileStore.class); - protected static final String MAIN_FILENAME = "main.dat"; - protected static final String META_FILENAME = "meta.eo"; - public static final String META_CONTENT_TYPE_KEY = "contentType"; - - private final Persister persister = new Persister(Path.of("tansu")); - - public TansuFileStore() throws IOException, ClassNotFoundException { - String objId = ".. e /// evil hello"; - String bucketId = "test"; - - createBucket(bucketId); - - write(bucketId, objId, - new ByteArrayInputStream("Hello World!\n".getBytes(StandardCharsets.UTF_8)), "text/plain" - ); - - try (TansuFileObject obj = read(bucketId, objId)) { - EO meta = obj.readMeta(); - logger.info("OBJ: [meta: {}] [obj: {}]", meta, obj); - } - } - - private String makeSafe(String s) { - return Base64.getEncoder().encodeToString(s.getBytes(StandardCharsets.UTF_8)); - } - - public void createBucket(String bucketId) { - logger.info("Creating bucket. [bucketId: {}]", bucketId); - persister.getBasePath().resolve(makeSafe(bucketId)).toFile().mkdirs(); - } - - private Path objectPath(String bucketId, String objId) { - return Path.of(makeSafe(bucketId), - makeSafe(objId)); - } - - public void write(String bucketId, String objId, InputStream data, String contentType) throws IOException { - OutputFile outFile = persister.output(objectPath(bucketId, objId)); - logger.info("write() called. [outFile: {}]", outFile); - ZipOutputStream zos = new ZipOutputStream(outFile.getOutputStream()); - // The order matters here: must match TansuFileObject - zos.putNextEntry(new ZipEntry(MAIN_FILENAME)); - IOUtil.copy(data, zos); - zos.closeEntry(); - zos.putNextEntry(new ZipEntry(META_FILENAME)); - ObjectOutputStream oos = new ObjectOutputStream(zos); - oos.writeObject(new EO().setValue(META_CONTENT_TYPE_KEY, contentType)); - oos.close(); - // We don't close the entry, oos did that. It is poorly behaved and will throw if we close it twice. - zos.close(); - outFile.commit(); - } - - public TansuFileObject read(String bucketId, String objId) throws IOException { - Path fullpath = persister.getBasePath().resolve(objectPath(bucketId, objId)); - logger.info("read(). [path: {}] [len: {}]", fullpath, fullpath.toFile().length()); - return new TansuFileObject(fullpath); - } -} diff --git a/lc-tansu-service/src/main/java/lc/tansu/service/TansuService.java b/lc-tansu-service/src/main/java/lc/tansu/service/TansuService.java deleted file mode 100644 index 54b1c3a77199ff53ce6e9e470e3adfebe27770d6..0000000000000000000000000000000000000000 --- a/lc-tansu-service/src/main/java/lc/tansu/service/TansuService.java +++ /dev/null @@ -1,98 +0,0 @@ -package lc.tansu.service; - -import jakarta.servlet.http.Part; -import lc.eo.EO; -import lc.esp.sdk.service.MicroService; -import lc.esp.sdk.service.schema.v1.MicroServiceCfgElementDAO; -import lc.mecha.http.server.WebTransaction; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.UniversalJob; -import lc.tansu.sdk.v1.TansuClient; -import lc.tansu.sdk.v1.schema.*; -import org.apache.commons.io.IOUtils; -import org.apache.commons.io.output.CountingOutputStream; - -import java.io.IOException; - -/** - * Tansu implements a simple object store which can be used to store a wide variety of binary objects (BLOB)s. - * - * @author Alex Leigh - */ -public class TansuService extends MicroService { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(TansuService.class); - private final TansuFileStore store = new TansuFileStore(); - - public TansuService(EO cfg) throws IOException, ClassNotFoundException { - super(cfg); - } - - public static void main(String args[]) throws IOException, ClassNotFoundException { - UniversalJob.banner(logger, "Tansu Service mk1"); - EO cfg = MicroServiceCfgElementDAO.create(); - MicroServiceCfgElementDAO.setSrcUri(cfg, "/tansu/v1"); - MicroServiceCfgElementDAO.setKabeUrl(cfg, "http://localhost:8123"); - TansuService svc = new TansuService(cfg); - svc.run(); - } - - @Override - public void serviceRequest(WebTransaction request) throws Throwable { - logger.info("Processing request. {}", request); - - try { - switch (request.getPathInfo()) { - case TansuClient.API_BUCKET_CREATE -> bucketCreate(request); - case TansuClient.API_OBJECT_GET -> objectGet(request); - case TansuClient.API_OBJECT_PUT -> objectPut(request); - default -> { - logger.info("Could not find handler. [path: {}]", request.getPathInfo()); - sendError(request, 404); - } - } - - } catch (Throwable t) { - t.printStackTrace(); - throw t; - } - } - - /** - * Perform an object put operation. - * <p> - * Note that we get the content-type here from the multi-part part, not from the request. Therefore it is - * essential that the client has set that properly. - */ - private void objectPut(WebTransaction txn) throws Exception { - // It is strongly implied this is a multi-part message, but if it is not, we'll sure find out later. - EO obj = getInputObject(txn); - Part part = txn.httpServletRequest.getPart(TansuClient.MULTIPART_BLOB); - store.write(ObjectPutRequestElementDAO.getBucketId(obj), - ObjectPutRequestElementDAO.getId(obj), - part.getInputStream(), part.getContentType()); - sendResponse(txn, ObjectPutResponseElementDAO.create()); - } - - private void objectGet(WebTransaction txn) throws Exception { - EO obj = getInputObject(txn); - // TODO: Error check for missing - try (TansuFileObject blob = store.read(ObjectGetRequestElementDAO.getBucketId(obj), - ObjectGetRequestElementDAO.getId(obj))) { - EO meta = blob.readMeta(); - String contentType = meta.getValueString(TansuFileStore.META_CONTENT_TYPE_KEY); - txn.httpServletResponse.setContentType(contentType); - CountingOutputStream cos = new CountingOutputStream(txn.httpServletResponse.getOutputStream()); - IOUtils.copy(blob.getMainInputStream(), cos); - logger.info("Write {} bytes.", cos.getByteCount()); - cos.close(); - } - } - - private void bucketCreate(WebTransaction txn) throws Exception { - EO obj = getInputObject(txn); - String bucketId = BucketCreateRequestElementDAO.getId(obj); - store.createBucket(bucketId); - sendResponse(txn, BucketCreateResponseElementDAO.create()); - } -} diff --git a/lc-tansu-service/src/test/java/lc/tansu/test/TansuTest.java b/lc-tansu-service/src/test/java/lc/tansu/test/TansuTest.java deleted file mode 100644 index 8de38749dd5fe76099cc4787a4ff64abe5914269..0000000000000000000000000000000000000000 --- a/lc-tansu-service/src/test/java/lc/tansu/test/TansuTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package lc.tansu.test; - -import lc.esp.sdk.ESPClient; -import lc.esp.sdk.link23.Link23Response; -import lc.mecha.lang.FutureResult; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.tansu.sdk.v1.TansuClient; -import org.apache.commons.io.IOUtils; - -import java.io.FileInputStream; - -public class TansuTest { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(TansuTest.class); - - public static void main(String args[]) throws Exception { - String id = "/etc/passwd"; - - TansuClient client = new TansuClient(new ESPClient("http://localhost:8123/")); - logger.info("Sending request..."); - FutureResult<Link23Response> result = client.objectPut("test", id, - new FileInputStream("/etc/passwd"), "text/plain"); - - try (Link23Response putResult = (Link23Response) result.get()) { - logger.info("Got result from API: {}", putResult.getResponse()); - } - - FutureResult<Link23Response> getFuture = client.objectGet("test", id); - try (Link23Response getResult = (Link23Response) getFuture.get()) { - logger.info("GET response: {} {}", getResult, IOUtils.toString(getResult.getInputStream())); - } - } -} diff --git a/lc-teremetori-sdk/LICENSE.md b/lc-teremetori-sdk/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/lc-teremetori-sdk/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-teremetori-sdk/README.md b/lc-teremetori-sdk/README.md deleted file mode 100644 index 1ad800b1a24f15568e2ff44924120c8cbbae3039..0000000000000000000000000000000000000000 --- a/lc-teremetori-sdk/README.md +++ /dev/null @@ -1,7 +0,0 @@ -Teremetori is a telemetry transport & processing system -for the Enhanced Services Platform (ESP). Telremetori is not a particular -application (like a monitoring system), although it is the -foundation by which one could be created. - -This package contains the producer & consumer implementations -for the Teremetory system. \ No newline at end of file diff --git a/lc-teremetori-sdk/build.gradle b/lc-teremetori-sdk/build.gradle deleted file mode 100644 index e2424cb68adb9e2cc955b0e5497f7f2d8bc77fe4..0000000000000000000000000000000000000000 --- a/lc-teremetori-sdk/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -plugins { - id 'java' - id 'java-library' -} - -group 'leigh' -version '1.0' - -repositories { - mavenCentral() -} -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -dependencies { - api project (':lc-eo-schema') - api project (':lc-esp-sdk') - api 'javax.measure:unit-api:2.1.3' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/lc-teremetori-sdk/src/main/java/lc/teremetori/sdk/SchemaGenerator.java b/lc-teremetori-sdk/src/main/java/lc/teremetori/sdk/SchemaGenerator.java deleted file mode 100644 index 1549aef823f609ccb8173a71fb21e43284918fda..0000000000000000000000000000000000000000 --- a/lc-teremetori-sdk/src/main/java/lc/teremetori/sdk/SchemaGenerator.java +++ /dev/null @@ -1,45 +0,0 @@ -package lc.teremetori.sdk; - -import lc.eo.EO; -import lc.eo.EODataType; -import lc.eo.schema.DAOGenerator; -import lc.eo.schema.dao.ElementElementDAO; -import lc.eo.schema.dao.FieldUtil; -import lc.eo.schema.dao.SchemaElementDAO; -import lc.eo.schema.dao.SchemaUtil; -import lc.esp.sdk.SchemaGeneratorApp; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import lc.mecha.util.UniversalJob; - -import java.io.File; -import java.io.FileNotFoundException; - -public class SchemaGenerator { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(SchemaGeneratorApp.class); - - public static EO generate() { - final EO schema = SchemaUtil.create(SchemaUtil.API_KEY); - final EO updateFrame = ElementElementDAO.create(); - SchemaElementDAO.getElements(schema).add(updateFrame); - ElementElementDAO.setApiName(updateFrame, "leigh.teremetori.sdk.v1.TelemetryFrame"); - ElementElementDAO.getFields(updateFrame).add(FieldUtil.createNotNull( - "channel", "Events", EODataType.loop)); - ElementElementDAO.getFields(updateFrame).add(FieldUtil.createNotNull( - "metrics", "Metrics", EODataType.loop)); - ElementElementDAO.getFields(updateFrame).add(FieldUtil.createNotNull( - "events", "Events", EODataType.loop)); - ElementElementDAO.getFields(updateFrame).add(FieldUtil.createNotNull( - "time", "Time", EODataType.instant)); - return schema; - } - - public static void main(final String... args) throws FileNotFoundException { - UniversalJob.banner(logger, "Apotheosis mk3", "2014 Alex Leigh"); - final EO schema = generate(); - final DAOGenerator gen = new DAOGenerator(new File("leigh-teremetori-sdk/src/main/java")); - gen.generateJava("leigh.teremetori.sdk.schema.v1", schema); - - logger.info("Generated schema: {}", schema); - } -} diff --git a/lc-teremetori-sdk/src/main/java/lc/teremetori/sdk/producer/TelemetrySource.java b/lc-teremetori-sdk/src/main/java/lc/teremetori/sdk/producer/TelemetrySource.java deleted file mode 100644 index 545069d983fd531a75c8a90e0381d48b2ada07bb..0000000000000000000000000000000000000000 --- a/lc-teremetori-sdk/src/main/java/lc/teremetori/sdk/producer/TelemetrySource.java +++ /dev/null @@ -1,32 +0,0 @@ -package lc.teremetori.sdk.producer; - -import lc.eo.EO; -import lc.eo.EOLoop; -import lc.esp.sdk.ESPClient; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; - -/** - * A source of telemetry to the Teremetori system. - * - * @author Alex Leigh - */ - -public class TelemetrySource { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(TelemetrySource.class); - private final ESPClient esp; - private final String publishUri; - private final EO currentValues = new EO(); - - public TelemetrySource(ESPClient esp, String publishUri) { - this.esp = esp; - this.publishUri = publishUri; - } - - public void update(EO channel, EO values, EOLoop events) { - logger.info("Received updates: {}", values); - currentValues.setAll(values); - - // TODO: Remove values that have not changed since last time - } -} diff --git a/lc-teremetori-sdk/src/main/java/lc/teremetori/sdk/schema/v1/TelemetryFrameElementDAO.java b/lc-teremetori-sdk/src/main/java/lc/teremetori/sdk/schema/v1/TelemetryFrameElementDAO.java deleted file mode 100644 index 8408dd4cec4815fab4a0a33360a665076621c630..0000000000000000000000000000000000000000 --- a/lc-teremetori-sdk/src/main/java/lc/teremetori/sdk/schema/v1/TelemetryFrameElementDAO.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (c) 2014-2021, by Alex Leigh. - * All rights reserved. - * - * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE - * The copyright notice above does not evidence any - * actual or intended publication of such source code. - */ - -package lc.teremetori.sdk.schema.v1; - -import lc.eo.EO; - -/** - * This is a dynamically generated DAO class for accessing objects within an ESP graph. This class - * has been generated by <code>DAOGenerator</code> and should not be modified. - * - * @author DAOGenerator (synthetically generated class) - */ -public final class TelemetryFrameElementDAO { - public static final String API_TYPE = "leigh.teremetori.sdk.v1.TelemetryFrame"; - - public static EO create() { - EO eo = new EO(API_TYPE); - return eo; - } - - public static boolean assertType(final EO eo) { - return eo.getApiType().equals(API_TYPE); - } - - public static final String KEY_CHANNEL = "channel"; - public static final String KEY_METRICS = "metrics"; - public static final String KEY_EVENTS = "events"; - public static final String KEY_TIME = "time"; - - public static String apiType(final EO eo) { - return eo.getApiType(); - } - - - /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=channel, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}, meta=null}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Events, locale=en}, meta=null}]} , type=loop}, meta=null} */ - - - public static lc.eo.EOLoop getChannel(EO eo) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueLoop(KEY_CHANNEL); - } - - public static void setChannel(final EO eo, lc.eo.EOLoop value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_CHANNEL, value); - } - - public static void setChannelLabel(final EO eo, final String label) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setLabel(KEY_CHANNEL, label); - } - - public static void getLabelOrValueChannel(final EO eo, lc.eo.EOLoop value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.getLabelOrValue(KEY_CHANNEL); - } - - public static void setIfUnsetChannel(final EO eo, lc.eo.EOLoop value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValueIfUnset(KEY_CHANNEL, value); - } - - - /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=metrics, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}, meta=null}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Metrics, locale=en}, meta=null}]} , type=loop}, meta=null} */ - - - public static lc.eo.EOLoop getMetrics(EO eo) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueLoop(KEY_METRICS); - } - - public static void setMetrics(final EO eo, lc.eo.EOLoop value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_METRICS, value); - } - - public static void setMetricsLabel(final EO eo, final String label) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setLabel(KEY_METRICS, label); - } - - public static void getLabelOrValueMetrics(final EO eo, lc.eo.EOLoop value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.getLabelOrValue(KEY_METRICS); - } - - public static void setIfUnsetMetrics(final EO eo, lc.eo.EOLoop value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValueIfUnset(KEY_METRICS, value); - } - - - /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=events, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}, meta=null}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Events, locale=en}, meta=null}]} , type=loop}, meta=null} */ - - - public static lc.eo.EOLoop getEvents(EO eo) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueLoop(KEY_EVENTS); - } - - public static void setEvents(final EO eo, lc.eo.EOLoop value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_EVENTS, value); - } - - public static void setEventsLabel(final EO eo, final String label) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setLabel(KEY_EVENTS, label); - } - - public static void getLabelOrValueEvents(final EO eo, lc.eo.EOLoop value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.getLabelOrValue(KEY_EVENTS); - } - - public static void setIfUnsetEvents(final EO eo, lc.eo.EOLoop value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValueIfUnset(KEY_EVENTS, value); - } - - - /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=time, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}, meta=null}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Time, locale=en}, meta=null}]} , type=instant}, meta=null} */ - - - public static java.time.Instant getTime(EO eo) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - return eo.getValueInstant(KEY_TIME); - } - - public static void setTime(final EO eo, java.time.Instant value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValue(KEY_TIME, value); - } - - public static void setTimeLabel(final EO eo, final String label) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setLabel(KEY_TIME, label); - } - - public static void getLabelOrValueTime(final EO eo, java.time.Instant value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.getLabelOrValue(KEY_TIME); - } - - public static void setIfUnsetTime(final EO eo, java.time.Instant value) { - if (!assertType(eo)) - throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]"); - eo.setValueIfUnset(KEY_TIME, value); - } - - -} \ No newline at end of file diff --git a/lc-teremetori-service/LICENSE.md b/lc-teremetori-service/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/lc-teremetori-service/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/lc-teremetori-service/README.md b/lc-teremetori-service/README.md deleted file mode 100644 index d6fb879a0bf30e6da675e0b403937dca862246e0..0000000000000000000000000000000000000000 --- a/lc-teremetori-service/README.md +++ /dev/null @@ -1,9 +0,0 @@ -Teremetori is a telemetry transport & processing system -for the Enhanced Services Platform (ESP). Telremetori is not a particular -application (like a monitoring system), although it is the -foundation by which one could be created. - -This package contains the central service and telemetry processor -to which both producers and consumers connect. For the SDK that -implementes the producer or the consumer, see the -leigh-teremetori-sdk module. \ No newline at end of file diff --git a/lc-teremetori-service/build.gradle b/lc-teremetori-service/build.gradle deleted file mode 100644 index 68d7b762ada1d629344e3b4eac6727af1c6938fa..0000000000000000000000000000000000000000 --- a/lc-teremetori-service/build.gradle +++ /dev/null @@ -1,22 +0,0 @@ -plugins { - id 'java' - id 'java-library' -} - -group 'leigh' -version '1.0' - -repositories { - mavenCentral() -} -sourceCompatibility = JavaVersion.VERSION_17 -targetCompatibility = JavaVersion.VERSION_17 -dependencies { - api project (':lc-mecha') - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/lc-teremetori-service/template-library/build.gradle b/lc-teremetori-service/template-library/build.gradle deleted file mode 100644 index f2ec39f47b417fd61c924e6c10f7a4643c836b71..0000000000000000000000000000000000000000 --- a/lc-teremetori-service/template-library/build.gradle +++ /dev/null @@ -1,21 +0,0 @@ -plugins { - id 'java' - id 'java-library' -} - -group 'leigh' -version '1.0' - -repositories { - mavenCentral() -} - -dependencies { - api project (':leigh-mecha') - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' -} - -test { - useJUnitPlatform() -} \ No newline at end of file diff --git a/leigh-minecraft-worldguard/LICENSE.md b/leigh-minecraft-worldguard/LICENSE.md deleted file mode 100644 index 2291a532567b727a6b296185e8be279898504bd3..0000000000000000000000000000000000000000 --- a/leigh-minecraft-worldguard/LICENSE.md +++ /dev/null @@ -1,636 +0,0 @@ -# GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](http://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies of this license -document, but changing it is not allowed. - -## Preamble - -The GNU General Public License is a free, copyleft license for software and -other kinds of works. - -The licenses for most software and other practical works are designed to take -away your freedom to share and change the works. By contrast, the GNU General -Public License is intended to guarantee your freedom to share and change all -versions of a program--to make sure it remains free software for all its users. -We, the Free Software Foundation, use the GNU General Public License for most -of our software; it applies also to any other work released this way by its -authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our -General Public Licenses are designed to make sure that you have the freedom to -distribute copies of free software (and charge for them if you wish), that you -receive source code or can get it if you want it, that you can change the -software or use pieces of it in new free programs, and that you know you can do -these things. - -To protect your rights, we need to prevent others from denying you these rights -or asking you to surrender the rights. Therefore, you have certain -responsibilities if you distribute copies of the software, or if you modify it: -responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for -a fee, you must pass on to the recipients the same freedoms that you received. -You must make sure that they, too, receive or can get the source code. And you -must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: - -1. assert copyright on the software, and -2. offer you this License giving you legal permission to copy, distribute - and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that -there is no warranty for this free software. For both users' and authors' sake, -the GPL requires that modified versions be marked as changed, so that their -problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified -versions of the software inside them, although the manufacturer can do so. This -is fundamentally incompatible with the aim of protecting users' freedom to -change the software. The systematic pattern of such abuse occurs in the area of -products for individuals to use, which is precisely where it is most -unacceptable. Therefore, we have designed this version of the GPL to prohibit -the practice for those products. If such problems arise substantially in other -domains, we stand ready to extend this provision to those domains in future -versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States -should not allow patents to restrict development and use of software on -general-purpose computers, but in those that do, we wish to avoid the special -danger that patents applied to a free program could make it effectively -proprietary. To prevent this, the GPL assures that patents cannot be used to -render the program non-free. - -The precise terms and conditions for copying, distribution and modification -follow. - -## TERMS AND CONDITIONS - -### 0. Definitions. - -*This License* refers to version 3 of the GNU General Public License. - -*Copyright* also means copyright-like laws that apply to other kinds of works, -such as semiconductor masks. - -*The Program* refers to any copyrightable work licensed under this License. -Each licensee is addressed as *you*. *Licensees* and *recipients* may be -individuals or organizations. - -To *modify* a work means to copy from or adapt all or part of the work in a -fashion requiring copyright permission, other than the making of an exact copy. -The resulting work is called a *modified version* of the earlier work or a work -*based on* the earlier work. - -A *covered work* means either the unmodified Program or a work based on the -Program. - -To *propagate* a work means to do anything with it that, without permission, -would make you directly or secondarily liable for infringement under applicable -copyright law, except executing it on a computer or modifying a private copy. -Propagation includes copying, distribution (with or without modification), -making available to the public, and in some countries other activities as well. - -To *convey* a work means any kind of propagation that enables other parties to -make or receive copies. Mere interaction with a user through a computer -network, with no transfer of a copy, is not conveying. - -An interactive user interface displays *Appropriate Legal Notices* to the -extent that it includes a convenient and prominently visible feature that - -1. displays an appropriate copyright notice, and -2. tells the user that there is no warranty for the work (except to the - extent that warranties are provided), that licensees may convey the work - under this License, and how to view a copy of this License. - -If the interface presents a list of user commands or options, such as a menu, a -prominent item in the list meets this criterion. - -### 1. Source Code. - -The *source code* for a work means the preferred form of the work for making -modifications to it. *Object code* means any non-source form of a work. - -A *Standard Interface* means an interface that either is an official standard -defined by a recognized standards body, or, in the case of interfaces specified -for a particular programming language, one that is widely used among developers -working in that language. - -The *System Libraries* of an executable work include anything, other than the -work as a whole, that (a) is included in the normal form of packaging a Major -Component, but which is not part of that Major Component, and (b) serves only -to enable use of the work with that Major Component, or to implement a Standard -Interface for which an implementation is available to the public in source code -form. A *Major Component*, in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system (if any) on -which the executable work runs, or a compiler used to produce the work, or an -object code interpreter used to run it. - -The *Corresponding Source* for a work in object code form means all the source -code needed to generate, install, and (for an executable work) run the object -code and to modify the work, including scripts to control those activities. -However, it does not include the work's System Libraries, or general-purpose -tools or generally available free programs which are used unmodified in -performing those activities but which are not part of the work. For example, -Corresponding Source includes interface definition files associated with source -files for the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, such as -by intimate data communication or control flow between those subprograms and -other parts of the work. - -The Corresponding Source need not include anything that users can regenerate -automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -### 2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on -the Program, and are irrevocable provided the stated conditions are met. This -License explicitly affirms your unlimited permission to run the unmodified -Program. The output from running a covered work is covered by this License only -if the output, given its content, constitutes a covered work. This License -acknowledges your rights of fair use or other equivalent, as provided by -copyright law. - -You may make, run and propagate covered works that you do not convey, without -conditions so long as your license otherwise remains in force. You may convey -covered works to others for the sole purpose of having them make modifications -exclusively for you, or provide you with facilities for running those works, -provided that you comply with the terms of this License in conveying all -material for which you do not control copyright. Those thus making or running -the covered works for you must do so exclusively on your behalf, under your -direction and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the -conditions stated below. Sublicensing is not allowed; section 10 makes it -unnecessary. - -### 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure -under any applicable law fulfilling obligations under article 11 of the WIPO -copyright treaty adopted on 20 December 1996, or similar laws prohibiting or -restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention is -effected by exercising rights under this License with respect to the covered -work, and you disclaim any intention to limit operation or modification of the -work as a means of enforcing, against the work's users, your or third parties' -legal rights to forbid circumvention of technological measures. - -### 4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, -in any medium, provided that you conspicuously and appropriately publish on -each copy an appropriate copyright notice; keep intact all notices stating that -this License and any non-permissive terms added in accord with section 7 apply -to the code; keep intact all notices of the absence of any warranty; and give -all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may -offer support or warranty protection for a fee. - -### 5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it -from the Program, in the form of source code under the terms of section 4, -provided that you also meet all of these conditions: - -- a) The work must carry prominent notices stating that you modified it, and - giving a relevant date. -- b) The work must carry prominent notices stating that it is released under - this License and any conditions added under section 7. This requirement - modifies the requirement in section 4 to *keep intact all notices*. -- c) You must license the entire work, as a whole, under this License to - anyone who comes into possession of a copy. This License will therefore - apply, along with any applicable section 7 additional terms, to the whole - of the work, and all its parts, regardless of how they are packaged. This - License gives no permission to license the work in any other way, but it - does not invalidate such permission if you have separately received it. -- d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your work need - not make them do so. - -A compilation of a covered work with other separate and independent works, -which are not by their nature extensions of the covered work, and which are not -combined with it such as to form a larger program, in or on a volume of a -storage or distribution medium, is called an *aggregate* if the compilation and -its resulting copyright are not used to limit the access or legal rights of the -compilation's users beyond what the individual works permit. Inclusion of a -covered work in an aggregate does not cause this License to apply to the other -parts of the aggregate. - -### 6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 -and 5, provided that you also convey the machine-readable Corresponding Source -under the terms of this License, in one of these ways: - -- a) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by the Corresponding Source - fixed on a durable physical medium customarily used for software - interchange. -- b) Convey the object code in, or embodied in, a physical product (including - a physical distribution medium), accompanied by a written offer, valid for - at least three years and valid for as long as you offer spare parts or - customer support for that product model, to give anyone who possesses the - object code either - 1. a copy of the Corresponding Source for all the software in the product - that is covered by this License, on a durable physical medium - customarily used for software interchange, for a price no more than your - reasonable cost of physically performing this conveying of source, or - 2. access to copy the Corresponding Source from a network server at no - charge. -- c) Convey individual copies of the object code with a copy of the written - offer to provide the Corresponding Source. This alternative is allowed only - occasionally and noncommercially, and only if you received the object code - with such an offer, in accord with subsection 6b. -- d) Convey the object code by offering access from a designated place - (gratis or for a charge), and offer equivalent access to the Corresponding - Source in the same way through the same place at no further charge. You - need not require recipients to copy the Corresponding Source along with the - object code. If the place to copy the object code is a network server, the - Corresponding Source may be on a different server operated by you or a - third party) that supports equivalent copying facilities, provided you - maintain clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the Corresponding - Source, you remain obligated to ensure that it is available for as long as - needed to satisfy these requirements. -- e) Convey the object code using peer-to-peer transmission, provided you - inform other peers where the object code and Corresponding Source of the - work are being offered to the general public at no charge under subsection - 6d. - -A separable portion of the object code, whose source code is excluded from the -Corresponding Source as a System Library, need not be included in conveying the -object code work. - -A *User Product* is either - -1. a *consumer product*, which means any tangible personal property which is - normally used for personal, family, or household purposes, or -2. anything designed or sold for incorporation into a dwelling. - -In determining whether a product is a consumer product, doubtful cases shall be -resolved in favor of coverage. For a particular product received by a -particular user, *normally used* refers to a typical or common use of that -class of product, regardless of the status of the particular user or of the way -in which the particular user actually uses, or expects or is expected to use, -the product. A product is a consumer product regardless of whether the product -has substantial commercial, industrial or non-consumer uses, unless such uses -represent the only significant mode of use of the product. - -*Installation Information* for a User Product means any methods, procedures, -authorization keys, or other information required to install and execute -modified versions of a covered work in that User Product from a modified -version of its Corresponding Source. The information must suffice to ensure -that the continued functioning of the modified object code is in no case -prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as part of a -transaction in which the right of possession and use of the User Product is -transferred to the recipient in perpetuity or for a fixed term (regardless of -how the transaction is characterized), the Corresponding Source conveyed under -this section must be accompanied by the Installation Information. But this -requirement does not apply if neither you nor any third party retains the -ability to install modified object code on the User Product (for example, the -work has been installed in ROM). - -The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates for a -work that has been modified or installed by the recipient, or for the User -Product in which it has been modified or installed. Access to a network may be -denied when the modification itself materially and adversely affects the -operation of the network or violates the rules and protocols for communication -across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord -with this section must be in a format that is publicly documented (and with an -implementation available to the public in source code form), and must require -no special password or key for unpacking, reading or copying. - -### 7. Additional Terms. - -*Additional permissions* are terms that supplement the terms of this License by -making exceptions from one or more of its conditions. Additional permissions -that are applicable to the entire Program shall be treated as though they were -included in this License, to the extent that they are valid under applicable -law. If additional permissions apply only to part of the Program, that part may -be used separately under those permissions, but the entire Program remains -governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any -additional permissions from that copy, or from any part of it. (Additional -permissions may be written to require their own removal in certain cases when -you modify the work.) You may place additional permissions on material, added -by you to a covered work, for which you have or can give appropriate copyright -permission. - -Notwithstanding any other provision of this License, for material you add to a -covered work, you may (if authorized by the copyright holders of that material) -supplement the terms of this License with terms: - -- a) Disclaiming warranty or limiting liability differently from the terms of - sections 15 and 16 of this License; or -- b) Requiring preservation of specified reasonable legal notices or author - attributions in that material or in the Appropriate Legal Notices displayed - by works containing it; or -- c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in reasonable - ways as different from the original version; or -- d) Limiting the use for publicity purposes of names of licensors or authors - of the material; or -- e) Declining to grant rights under trademark law for use of some trade - names, trademarks, or service marks; or -- f) Requiring indemnification of licensors and authors of that material by - anyone who conveys the material (or modified versions of it) with - contractual assumptions of liability to the recipient, for any liability - that these contractual assumptions directly impose on those licensors and - authors. - -All other non-permissive additional terms are considered *further restrictions* -within the meaning of section 10. If the Program as you received it, or any -part of it, contains a notice stating that it is governed by this License along -with a term that is a further restriction, you may remove that term. If a -license document contains a further restriction but permits relicensing or -conveying under this License, you may add to a covered work material governed -by the terms of that license document, provided that the further restriction -does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, -in the relevant source files, a statement of the additional terms that apply to -those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a -separately written license, or stated as exceptions; the above requirements -apply either way. - -### 8. Termination. - -You may not propagate or modify a covered work except as expressly provided -under this License. Any attempt otherwise to propagate or modify it is void, -and will automatically terminate your rights under this License (including any -patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a -particular copyright holder is reinstated - -- a) provisionally, unless and until the copyright holder explicitly and - finally terminates your license, and -- b) permanently, if the copyright holder fails to notify you of the - violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated -permanently if the copyright holder notifies you of the violation by some -reasonable means, this is the first time you have received notice of violation -of this License (for any work) from that copyright holder, and you cure the -violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses -of parties who have received copies or rights from you under this License. If -your rights have been terminated and not permanently reinstated, you do not -qualify to receive new licenses for the same material under section 10. - -### 9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy -of the Program. Ancillary propagation of a covered work occurring solely as a -consequence of using peer-to-peer transmission to receive a copy likewise does -not require acceptance. However, nothing other than this License grants you -permission to propagate or modify any covered work. These actions infringe -copyright if you do not accept this License. Therefore, by modifying or -propagating a covered work, you indicate your acceptance of this License to do -so. - -### 10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a -license from the original licensors, to run, modify and propagate that work, -subject to this License. You are not responsible for enforcing compliance by -third parties with this License. - -An *entity transaction* is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered work -results from an entity transaction, each party to that transaction who receives -a copy of the work also receives whatever licenses to the work the party's -predecessor in interest had or could give under the previous paragraph, plus a -right to possession of the Corresponding Source of the work from the -predecessor in interest, if the predecessor has it or can get it with -reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights -granted or affirmed under this License. For example, you may not impose a -license fee, royalty, or other charge for exercise of rights granted under this -License, and you may not initiate litigation (including a cross-claim or -counterclaim in a lawsuit) alleging that any patent claim is infringed by -making, using, selling, offering for sale, or importing the Program or any -portion of it. - -### 11. Patents. - -A *contributor* is a copyright holder who authorizes use under this License of -the Program or a work on which the Program is based. The work thus licensed is -called the contributor's *contributor version*. - -A contributor's *essential patent claims* are all patent claims owned or -controlled by the contributor, whether already acquired or hereafter acquired, -that would be infringed by some manner, permitted by this License, of making, -using, or selling its contributor version, but do not include claims that would -be infringed only as a consequence of further modification of the contributor -version. For purposes of this definition, *control* includes the right to grant -patent sublicenses in a manner consistent with the requirements of this -License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent -license under the contributor's essential patent claims, to make, use, sell, -offer for sale, import and otherwise run, modify and propagate the contents of -its contributor version. - -In the following three paragraphs, a *patent license* is any express agreement -or commitment, however denominated, not to enforce a patent (such as an express -permission to practice a patent or covenant not to sue for patent -infringement). To *grant* such a patent license to a party means to make such -an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the -Corresponding Source of the work is not available for anyone to copy, free of -charge and under the terms of this License, through a publicly available -network server or other readily accessible means, then you must either - -1. cause the Corresponding Source to be so available, or -2. arrange to deprive yourself of the benefit of the patent license for this - particular work, or -3. arrange, in a manner consistent with the requirements of this License, to - extend the patent license to downstream recipients. - -*Knowingly relying* means you have actual knowledge that, but for the patent -license, your conveying the covered work in a country, or your recipient's use -of the covered work in a country, would infringe one or more identifiable -patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you -convey, or propagate by procuring conveyance of, a covered work, and grant a -patent license to some of the parties receiving the covered work authorizing -them to use, propagate, modify or convey a specific copy of the covered work, -then the patent license you grant is automatically extended to all recipients -of the covered work and works based on it. - -A patent license is *discriminatory* if it does not include within the scope of -its coverage, prohibits the exercise of, or is conditioned on the non-exercise -of one or more of the rights that are specifically granted under this License. -You may not convey a covered work if you are a party to an arrangement with a -third party that is in the business of distributing software, under which you -make payment to the third party based on the extent of your activity of -conveying the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory patent -license - -- a) in connection with copies of the covered work conveyed by you (or copies - made from those copies), or -- b) primarily for and in connection with specific products or compilations - that contain the covered work, unless you entered into that arrangement, or - that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied -license or other defenses to infringement that may otherwise be available to -you under applicable patent law. - -### 12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not excuse -you from the conditions of this License. If you cannot convey a covered work so -as to satisfy simultaneously your obligations under this License and any other -pertinent obligations, then as a consequence you may not convey it at all. For -example, if you agree to terms that obligate you to collect a royalty for -further conveying from those to whom you convey the Program, the only way you -could satisfy both those terms and this License would be to refrain entirely -from conveying the Program. - -### 13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to -link or combine any covered work with a work licensed under version 3 of the -GNU Affero General Public License into a single combined work, and to convey -the resulting work. The terms of this License will continue to apply to the -part which is the covered work, but the special requirements of the GNU Affero -General Public License, section 13, concerning interaction through a network -will apply to the combination as such. - -### 14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU -General Public License from time to time. Such new versions will be similar in -spirit to the present version, but may differ in detail to address new problems -or concerns. - -Each version is given a distinguishing version number. If the Program specifies -that a certain numbered version of the GNU General Public License *or any later -version* applies to it, you have the option of following the terms and -conditions either of that numbered version or of any later version published by -the Free Software Foundation. If the Program does not specify a version number -of the GNU General Public License, you may choose any version ever published by -the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the -GNU General Public License can be used, that proxy's public statement of -acceptance of a version permanently authorizes you to choose that version for -the Program. - -Later license versions may give you additional or different permissions. -However, no additional obligations are imposed on any author or copyright -holder as a result of your choosing to follow a later version. - -### 15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE -LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER -PARTIES PROVIDE THE PROGRAM *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER -EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE -QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE -DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR -CORRECTION. - -### 16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY -COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS -PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, -INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE -THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED -INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE -PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY -HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -### 17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot -be given local legal effect according to their terms, reviewing courts shall -apply local law that most closely approximates an absolute waiver of all civil -liability in connection with the Program, unless a warranty or assumption of -liability accompanies a copy of the Program in return for a fee. - -## END OF TERMS AND CONDITIONS ### - -### How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible -use to the public, the best way to achieve this is to make it free software -which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach -them to the start of each source file to most effectively state the exclusion -of warranty; and each file should have at least the *copyright* line and a -pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like -this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w` and `show c` should show the appropriate -parts of the General Public License. Of course, your program's commands might -be different; for a GUI interface, you would use an *about box*. - -You should also get your employer (if you work as a programmer) or school, if -any, to sign a *copyright disclaimer* for the program, if necessary. For more -information on this, and how to apply and follow the GNU GPL, see -[http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). - -The GNU General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may consider -it more useful to permit linking proprietary applications with the library. If -this is what you want to do, use the GNU Lesser General Public License instead -of this License. But first, please read -[http://www.gnu.org/philosophy/why-not-lgpl.html](http://www.gnu.org/philosophy/why-not-lgpl.html). diff --git a/leigh-minecraft-worldguard/src/main/java/leigh/minecraft/worldguard/LotRepairApp.java b/leigh-minecraft-worldguard/src/main/java/leigh/minecraft/worldguard/LotRepairApp.java deleted file mode 100644 index 1038128155cd3ab462f0cfd8b368ec5a44d5e5fc..0000000000000000000000000000000000000000 --- a/leigh-minecraft-worldguard/src/main/java/leigh/minecraft/worldguard/LotRepairApp.java +++ /dev/null @@ -1,57 +0,0 @@ -package lc.minecraft.worldguard; - -import lc.mecha.json.JSONObject; -import lc.mecha.log.MechaLogger; -import lc.mecha.log.MechaLoggerFactory; -import org.apache.commons.io.IOUtils; - -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; - -public class LotRepairApp { - private static final MechaLogger logger = MechaLoggerFactory.getLogger(LotRepairApp.class); - - public static void main(String[] args) throws IOException { - InputStream is = new FileInputStream("regions.json"); - String json = IOUtils.toString(is); - - JSONObject obj = new JSONObject(json); - - // logger.info("Read keys: {}", obj.keySet()); - - int i = 400; - - JSONObject regions = obj.getJSONObject("regions"); - for (String regionId : regions.keySet()) { - // logger.info("Reading: {}", regionId); - if (regionId.equals("__global__") || regionId.startsWith("ctl-")) continue; - JSONObject region = regions.getJSONObject(regionId); - - /* - JSONObject region = regions.getJSONObject(regionId); - JSONObject min = region.getJSONObject("min"); - JSONObject max = region.getJSONObject("max"); - - int minx = min.getInt("x"); - int maxx = max.getInt("x"); - int minz = min.getInt("z"); - int maxz = max.getInt("z"); - - if (minx < 0 || maxx < 0) { - min.put("x", minx - 1); - max.put("x", maxx - 1); - } - - if (minz < 0 || maxz < 0) { - min.put("z", minz - 1); - max.put("z", maxz - 1); - } - - */ - } - - System.out.println(obj.toString()); - } - -} diff --git a/mineacademy-corearena/.github/ISSUE_TEMPLATE/bug_report.md b/mineacademy-corearena/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index e9149ddee3c92436dcc991d0e70e016ff02d17bb..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -name: Bug report -about: Report a problem, issue or a bug. -title: 'Minecraft Version: Issue Title' -labels: issue -assignees: '' - ---- - -<!--- -To report a problem or a bug with this plugin, please follow the three steps below: - -1) Put your Minecraft version in the title. -Example: 1.16.1: Getting NullPointerException error - -2) Be clear: What is your current situation, the desired situation, and your problem? -Example: I want my chat to be formatted in vanilla but not the creative world. My current situation is it is being formatted everywhere. I made sure not to use reload and haven't found any console errors. What I am doing wrong? - -3) If needed - upload your plugin's folder here and any errors using pastebin.com. -How to upload your folder? -a) Right-click the folder and follow the instructions below. For macOS right-click and select "Compress": https://i.imgur.com/4YhCSjD.gif -b) Then simply drag and drop the ZIP file into the issue field: https://i.imgur.com/DG1OAGh.gif - -Thank you. Please remove this text and write your actual issue below. ---> diff --git a/mineacademy-corearena/.github/ISSUE_TEMPLATE/question.md b/mineacademy-corearena/.github/ISSUE_TEMPLATE/question.md deleted file mode 100644 index 9cbe09ba0c4390deaad75c0223ef547a614c0f83..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/.github/ISSUE_TEMPLATE/question.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: Question -about: Ask a question about the plugin. -title: 'Minecraft Version: Your Question Title' -labels: question -assignees: '' - ---- - -<!--- -To ask us anything, please follow these directions: - -1) Please include your Minecraft version in your title: -Example: 1.16.1: How to setup the menus? - -2) Try to keep it simple and clear, providing us all information necessary to answer your question. You can use imgur.com to upload images or pastebin.com to upload large text or error traces. - -Thank you. Please remove this text and write your actual question below. ---> diff --git a/mineacademy-corearena/.github/ISSUE_TEMPLATE/suggestion.md b/mineacademy-corearena/.github/ISSUE_TEMPLATE/suggestion.md deleted file mode 100644 index 8ca16426031c7d672441a0f90ae9ee7ae50a08f0..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/.github/ISSUE_TEMPLATE/suggestion.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: Improvement -about: Suggest a new idea or a feature. -title: 'Your Suggestion Title' -labels: improvement -assignees: '' - ---- - -<!--- -Notice: Some of the best ideas and features we added were thanks to your suggestions. However, as an extremely small team we're focusing on stability and performance of our software first before adding new features. As such, we're currently very limited to taking in new features. - -If you still believe your feature should be added, you're welcome to suggest it and answer those questions in your description: - -1) How it would benefit others? (Not just you, but 1,000s of others people using the same plugin.) - -2) What would happen if we won't implement this feature? How's your server being affected? - -3) If suggesting something new - Can the old system be modified/improved instead? - -Thank you. Please remove this text and write your actual suggestion below. ---> \ No newline at end of file diff --git a/mineacademy-corearena/.gitignore b/mineacademy-corearena/.gitignore deleted file mode 100644 index bf5c2bce45ee36e6d84e0cbd98c6fa43bd0ba26e..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/.gitignore +++ /dev/null @@ -1,72 +0,0 @@ -################# -## IDEA -################# - -# User-specific stuff -.idea/ -.idea_modules/ -*.iml - -# IntelliJ -out/ - -target/ - -################# -## Eclipse -################# - -*.pydevproject -.project -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.classpath -.settings/ -.loadpath -.apt_generated/ -.apt_generated_tests/ - -# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored) -!/.mvn/wrapper/maven-wrapper.jar - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# CDT-specific -.cproject - -# PDT-specific -.buildpath - -# Builder -builder.xml -build.xml - -############# -## Windows detritus -############# - -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Mac crap -.DS_Store -REBASE.bat - -library/ \ No newline at end of file diff --git a/mineacademy-corearena/LICENSE.md b/mineacademy-corearena/LICENSE.md deleted file mode 100644 index 8122d7e1e89eed2c0a33b30742ea77bc809ee87c..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/LICENSE.md +++ /dev/null @@ -1,46 +0,0 @@ -_In short, you can use CoreArena and modify its sources to your likings as long as these are private changes made for your network or server or public contributions to CoreArena's repository. You cannot copy and paste CoreArena its parts and republish it, such as as a premium plugin._ - -This End-User License Agreement ("EULA") is a legal agreement between you and MineAcademy to use CoreArena. - -This EULA agreement governs your acquisition and use of our CoreArena software ("Software") directly from MineAcademy. - -Please read this EULA agreement carefully before completing the installation process and using the CoreArena software. It provides a license to use the CoreArena software and contains warranty information and liability disclaimers. - -By installing and/or using the CoreArena software, you are confirming your acceptance of the Software and agreeing to become bound by the terms of this EULA agreement. - -If you are entering into this EULA agreement on behalf of a company or other legal entity, you represent that you have the authority to bind such entity and its affiliates to these terms and conditions. If you do not have such authority or if you do not agree with the terms and conditions of this EULA agreement, do not install or use the Software, and you must not accept this EULA agreement. - -This EULA agreement shall apply only to the Software supplied by MineAcademy herewith regardless of whether other software is referred to or described herein. The terms also apply to any MineAcademy updates, supplements, Internet-based services, and support services for the Software, unless other terms accompany those items on delivery. If so, those terms apply. - -## License Grant - -MineAcademy hereby grants you a personal, non-transferable, non-exclusive licence to use the CoreArena software on your devices in accordance with the terms of this EULA agreement. - -You are permitted to load the CoreArena software on a device, for example on a Minecraft server, that you own. You are responsible for ensuring your device meets the minimum requirements of the CoreArena software. - -You are not permitted to: - -- Edit, alter, modify, adapt, translate or otherwise change the whole or any part of the Software nor permit the whole or any part of the Software to be combined with or become incorporated in any other software, nor decompile, disassemble or reverse engineer the Software with the exception of private, unpublished changes for your own server or network or changes contributed to the source code. That means that, you can modify the source code and use a modified CoreArena version for your own server or network, but cannot distribute it publicly elsewhere. -- Reproduce, copy, distribute, resell or otherwise use the Software for any non-commercial or commercial purpose. You can however, distribute CoreArena on all servers that are part of a single BungeeCord, Redis or a similar network that you own. -- Use the Software in any way which breaches any applicable local, national or international law. -- Use the Software for any purpose that MineAcademy considers is a breach of this EULA agreement. - -## Use of Data - -You acknowledge that MineAcademy will be able to access and adjust your downloaded licensed Software content and Your personal information, and that MineAcademy's use of such material and information is subject to Your legal agreements with MineAcademy's privacy policy: https://mineacademy.org/privacy - -## Intellectual Property and Ownership - -MineAcademy shall at all times retain ownership of the Software as originally downloaded by you and all subsequent downloads of the Software by you. The Software (and the copyright, and other intellectual property rights of whatever nature in the Software, including any modifications made thereto) are and shall remain the property of MineAcademy. - -MineAcademy reserves the right to grant licences to use the Software to third parties. - -## Termination - -This EULA agreement is effective from the date you first use the Software and shall continue until terminated. You may terminate it at any time upon written notice to MineAcademy. - -It will also terminate immediately if you fail to comply with any term of this EULA agreement. Upon such termination, the licenses granted by this EULA agreement will immediately terminate and you agree to stop all access and use of the Software. The provisions that by their nature continue and survive will survive any termination of this EULA agreement. - -## Governing Law - -This EULA agreement, and any dispute arising out of or in connection with this EULA agreement, shall be governed by and construed in accordance with the laws of Slovakia. \ No newline at end of file diff --git a/mineacademy-corearena/README.md b/mineacademy-corearena/README.md deleted file mode 100644 index b2f6df20fa6b35862afdaa61be27a17910bb17a2..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/README.md +++ /dev/null @@ -1,40 +0,0 @@ -<p align="center"> - Do you want to code your own CoreArena?<br> - <a href="https://mineacademy.org/gh-join"> - <img src="https://i.imgur.com/HGc2VG3.png" /> - </a> -</p> - -## Announcement: This plugin is now free of charge, you can download it in the "Releases" tab. See https://mineacademy.org/plugins for a list of all plugins we've open sourced. - -# CoreArena -CoreArena is a premium quality Bukkit plugin that brings a whole new experience to your Minecraft server in the form of a monster fight arena. Its unique approach is determined by - -New: Get your CoreArena maps package here: -https://mega.nz/#F!FzRBQJDb!eDg6i4NYGt7zl30NPQ3aIQ - -* Realistic physical engine making arenas fully destroyable. -* Class upgrades and reward system. Can by synchronized over MySQL (and across BungeeCord). -* Well-made menus and a powerful user interface in-game. -* Unique monster spawner options (clickable using a GUI). -* 5 minutes setup with visual creation without complicated config files. -* Fully automated, no admin required to manage games. - -Check out https://mineacademy.org/plugins for more information. - -You are welcome to read the **[CoreArena Wikipedia](https://github.com/kangarko/CoreArena/wiki)**, where you fill find tons of information about the installation, configuring and using this plugin. - -If you have any **questions or bugs to report**, try seeing if [those can be resolved quickly](https://github.com/kangarko/CoreArena/wiki/Common-Issues) by yourself. If that does not help, you are welcome to **fill an issue**. Please read the [Getting Help the Best Way](https://github.com/kangarko/CoreArena/wiki/Getting-Help-the-Right-Way) to obtain help as quickly as possible. - -# Compiling - -1. Obtain Foundation from github.com/kangarko/Foundation -2. Create library/ folder in CoreArena/ and obtain binaries described in pom.xml. You have to obtain them yourself. Regarding Boss, you can just remove the very few references to it in the source code and remove the dependency from pom.xml. -3. Compile Foundation and CoreArena using Maven with the "clean install" goal. - -<hr> - -Dave Thomas, founder of OTI, godfather of the Eclipse strategy: - -<i>Clean code can be read, and enhanced by a developer other than its original author. It has unit and acceptance tests. It has meaningful names. It provides one way rather than many ways for doing one thing. It has minimal dependencies, which are explicitly defined, and provides a clear and minimal API. Code should be literate since depending on the language, not all necessary information can be expressed clearly in code alone.</i> - diff --git a/mineacademy-corearena/build.gradle b/mineacademy-corearena/build.gradle deleted file mode 100644 index 8453fafb25242ce3c0b9b695950c474f591750ee..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/build.gradle +++ /dev/null @@ -1,118 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - */ - -plugins { - id 'java' - id 'maven-publish' -} - -repositories { - mavenLocal() - - maven { - url = uri("https://mvn.intellectualsites.com/content/groups/public/") - } - - maven { - url = uri('https://bitbucket.org/kangarko/libraries/raw/master') - } - - maven { - url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots') - } - - maven { - url = uri('https://repo.maven.apache.org/maven2/') - } - - maven { - url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots/') - } - - maven { - url = uri('https://repo.onarandombox.com/content/groups/public') - } - - maven { - url = uri('https://hub.spigotmc.org/nexus/content/groups/public/') - } - - maven { - url = uri('https://jitpack.io') - } - - maven { - url = uri('https://repo.minebench.de/') - } - - maven { - url = uri('https://repo.maven.apache.org/maven2/') - } - maven { - url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots') - } - - maven { - url = uri('http://massive.leigh-co.com/dist') - allowInsecureProtocol true - } - -} - -dependencies { - implementation 'org.projectlombok:lombok:1.18.20' - annotationProcessor 'org.projectlombok:lombok:1.18.20' - implementation 'leigh:mineacademy-foundation:5.11.0' - compileOnly("com.fastasyncworldedit:FAWE-Core:1.17-93") - compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT' - compileOnly 'org.mineacademy.plugin:AuthMe:5.6.0-SNAPSHOT-2459' - compileOnly 'org.mineacademy.plugin:CitizensAPI:2.0.28-b784' - compileOnly 'org.mineacademy.plugin:CMI-API:7.6.2.0' - compileOnly 'org.mineacademy.plugin:DiscordSRV:1.22.0' - compileOnly 'org.mineacademy.plugin:EssentialsX:2.19.0-SNAPSHOT-1148' - compileOnly 'org.mineacademy.plugin:Factions:3.3.2' - compileOnly 'org.mineacademy.plugin:FactionsUUID:1.6.9.5-U0.5.17-b237' - compileOnly 'org.mineacademy.plugin:Jobs:4.17.1' - compileOnly 'org.mineacademy.plugin:LandsAPI:5.4.12' - compileOnly 'org.mineacademy.plugin:LWC:2.2.7' - compileOnly 'org.mineacademy.plugin:MassiveCore:3.3.0' - compileOnly 'org.mineacademy.plugin:mcMMO:2.1.157' - compileOnly 'leigh:onarandombox-multiverse-core:4.3.1-SNAPSHOT' - compileOnly 'org.mineacademy.plugin:NuVotifier:2.7.2' - compileOnly 'org.mineacademy.plugin:PlaceholderAPI:2.10.9' - compileOnly 'org.mineacademy.plugin:ProtocolLib:4.6.1-SNAPSHOT-b499' - compileOnly 'org.mineacademy.plugin:Residence:4.9.3.4' - compileOnly 'org.mineacademy.plugin:SimpleClans:2.15.1' - compileOnly 'org.mineacademy.plugin:StackMob:5.5.3' - compileOnly 'org.mineacademy.plugin:Towny:0.97.0.0' - compileOnly 'org.mineacademy.plugin:TownyChat:0.88' - compileOnly 'org.mineacademy.plugin:Vault:1.7.3' - compileOnly 'org.mineacademy.plugin:WorldEdit:7.3.0-SNAPSHOT-5758' - compileOnly 'org.mineacademy.plugin:WorldGuard:7.0.5-SNAPSHOT-2109' -} - -group = 'org.mineacademy' -version = '2.9.4' -description = 'leigh-mineacademy-corearena' -java.sourceCompatibility = JavaVersion.VERSION_1_8 - -publishing { - publications { - maven(MavenPublication) { - from(components.java) - } - } -} - -tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' -} - -jar { - duplicatesStrategy = DuplicatesStrategy.INCLUDE - from { - configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } - } -} - diff --git a/mineacademy-corearena/dist.sh b/mineacademy-corearena/dist.sh deleted file mode 100755 index e3a07fedbfaa45c62dfb67dacf530e073d83cf8b..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/dist.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -gradle clean build -cp build/libs/CoreArena-2.9.4.jar ../leigh-minecraft-link/leigh-bin-minecraft-plugin/leigh-mineacademy-corearena-2.9.4.jar - diff --git a/mineacademy-corearena/gradle/wrapper/gradle-wrapper.jar b/mineacademy-corearena/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index e708b1c023ec8b20f512888fe07c5bd3ff77bb8f..0000000000000000000000000000000000000000 Binary files a/mineacademy-corearena/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/mineacademy-corearena/gradle/wrapper/gradle-wrapper.properties b/mineacademy-corearena/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 0f80bbf516ce01e19ca7d329ef8997f131030a91..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/mineacademy-corearena/gradlew b/mineacademy-corearena/gradlew deleted file mode 100755 index 4f906e0c811fc9e230eb44819f509cd0627f2600..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/gradlew +++ /dev/null @@ -1,185 +0,0 @@ -#!/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=`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/mineacademy-corearena/gradlew.bat b/mineacademy-corearena/gradlew.bat deleted file mode 100644 index 107acd32c4e687021ef32db511e8a206129b88ec..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@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/mineacademy-corearena/settings.gradle b/mineacademy-corearena/settings.gradle deleted file mode 100644 index 10309ccec1877d07caee63b956e4ff73ea27c2e4..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/settings.gradle +++ /dev/null @@ -1,5 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - */ - -rootProject.name = 'CoreArena' diff --git a/mineacademy-corearena/src/main/java/leigh/minecraft/murderarium/Murderarium.java b/mineacademy-corearena/src/main/java/leigh/minecraft/murderarium/Murderarium.java deleted file mode 100644 index 30924904b17b9a811e09bf7072f67244eccb6d30..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/leigh/minecraft/murderarium/Murderarium.java +++ /dev/null @@ -1,114 +0,0 @@ -package lc.minecraft.murderarium; - -import net.milkbowl.vault.economy.Economy; -import net.milkbowl.vault.economy.EconomyResponse; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Item; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByBlockEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.plugin.RegisteredServiceProvider; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.remain.CompSound; -import org.mineacademy.game.exception.EventHandledException; -import org.mineacademy.game.impl.ArenaPlayer; -import org.mineacademy.game.impl.arena.FeatureArena; -import org.mineacademy.game.model.ExpItem; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.type.DeathCause; -import org.mineacademy.game.type.LeaveCause; -import org.mineacademy.game.type.StopCause; - -import static org.bukkit.Bukkit.getServer; - -/** - * This class implements the LEIGH&CO Murderarium. It works substantially like the regular CoreArena with the - * exception that players are paid directly for picking up XP orbs that drop from kills. - * - * @author Alex Leigh - */ -public class Murderarium extends FeatureArena { - private final RegisteredServiceProvider<Economy> economyProvider; - - public Murderarium(String name) { - super(name); - economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class); - } - - @Override - /** - * This custom modification directly pays the player marbles. It continues to perform the regular mechanic, - * so the original functionality is maintained. - */ - public void onPlayerPickupTag(PlayerPickupItemEvent e, ExpItem tag) throws EventHandledException { - super.checkRunning(); - - final Player pl = e.getPlayer(); - final Item item = e.getItem(); - final ArenaPlayer.InArenaCache cache = CoreArenaPlugin.getDataFor(e.getPlayer()).getArenaCache(); - - // Pay the player - { - cache.giveAndShowExp(pl, tag.getExpGiven()); - economyProvider.getProvider().depositPlayer(pl, tag.getExpGiven()); - Common.tell(pl, "Got paid! Collected M"+tag.getExpGiven()); - CompSound.ORB_PICKUP.play(pl, 1, 1); - Common.tell(pl, Localization.Experience.PICKUP.replace("{level}", - Localization.Cases.LEVEL.formatWithCount(cache.getLevel())).replace("{exp}", - Localization.Cases.EXP.formatWithCount(tag.getExpGiven()))); - } - - // Take care of the item - { - e.setCancelled(true); - item.remove(); - } - } - - - @Override - public void onPlayerDeath(Player pl, Player killer) throws EventHandledException { - super.onPlayerDeath(pl, killer); - - kickPlayer(pl, LeaveCause.KILLED); - - getMessenger().broadcastExcept(pl, pl, Localization.Arena.Game.KICK_KILL_BROADCAST.replace("{killer}", killer.getName())); - getMessenger().tell(pl, Localization.Arena.Game.KICK_KILL_TO_VICTIM.replace("{killer}", killer.getName())); - } - - @Override - public void onPlayerDeath(Player pl, DeathCause cause) throws EventHandledException { - super.onPlayerDeath(pl, cause); - - kickPlayer(pl, LeaveCause.KILLED); - } - - @Override - protected void handleArenaPostStop(StopCause cause) { - - } - - @Override - public void onPlayerDamage(EntityDamageByEntityEvent event, Player player, Entity source, double damage) { - - } - - @Override - public void onPlayerBlockDamage(EntityDamageByBlockEvent event, Player player, double damage) { - - } - - @Override - public void onProjectileLaunch(ProjectileLaunchEvent event) { - - } - - @Override - public void onProjectileHit(ProjectileHitEvent event) { - - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/corearena/CoreArenaPlugin.java b/mineacademy-corearena/src/main/java/org/mineacademy/corearena/CoreArenaPlugin.java deleted file mode 100644 index de5c0145d9608c6fa960b5331a444bb402d2fe3c..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/corearena/CoreArenaPlugin.java +++ /dev/null @@ -1,317 +0,0 @@ -package org.mineacademy.corearena; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.bukkit.OfflinePlayer; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; -import org.bukkit.scheduler.BukkitTask; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.model.HookManager; -import org.mineacademy.fo.model.Variables; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompMonsterEgg; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.fo.settings.YamlStaticConfig; -import org.mineacademy.game.data.GeneralDataSection; -import org.mineacademy.game.hook.ArenaPAPIPlaceholder; -import org.mineacademy.game.hook.JobsListener; -import org.mineacademy.game.hook.McMMOListener; -import org.mineacademy.game.hook.StackMobListener; -import org.mineacademy.game.impl.ArenaPlayer; -import org.mineacademy.game.impl.SimpleGameCommandGroup; -import org.mineacademy.game.impl.arena.SimpleArena; -import org.mineacademy.game.listener.AutoRepairListener; -import org.mineacademy.game.listener.InArenaListener; -import org.mineacademy.game.listener.PlayerListener; -import org.mineacademy.game.listener.SignsListener; -import org.mineacademy.game.manager.ClassManager; -import org.mineacademy.game.manager.RewardsManager; -import org.mineacademy.game.manager.SetupManager; -import org.mineacademy.game.manager.SimpleArenaManager; -import org.mineacademy.game.manager.UpgradesManager; -import org.mineacademy.game.menu.MenuGameTools; -import org.mineacademy.game.menu.MenuItems; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaManager; -import org.mineacademy.game.model.ArenaPlugin; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.settings.Settings; -import org.mineacademy.game.type.StopCause; -import org.mineacademy.game.util.FallingLimitter; -import org.mineacademy.game.util.InventoryStorageUtil; -import org.mineacademy.game.visualize.VisualizerListener; - -import lombok.Getter; -import lombok.NonNull; - -public final class CoreArenaPlugin extends SimplePlugin implements ArenaPlugin { - - /** - * Unlocks: - * <ul> - * <li>No longer 10 seconds limit on lobby/arena waiting</li> - * <li>Disable player auto teleport to spawn on join</li> - * <li>Allow toggle flight when in arena</li> - * </ul> - */ - public static boolean DEBUG_EDITING_MODE; - - // Player Name, Player Cache - private static Map<String, ArenaPlayer> playerCache = new HashMap<>(); - - private SimpleArenaManager arenaManager; - - @Getter - private final SimpleGameCommandGroup mainCommand = new SimpleGameCommandGroup(); - private final SetupManager setupManager = new SetupManager(); - private final ClassManager classManager = new ClassManager(); - private final UpgradesManager upgradesManager = new UpgradesManager(); - - private RewardsManager rewardsManager; - private BukkitTask fallingLimitter; - - @Override - public V getMinimumVersion() { - return V.v1_8; - } - - @Override - protected String[] getStartupLogo() { - return new String[] { - "&e ___ _ ", - "&e / __\\___ _ __ ___ /_\\ _ __ ___ _ __ __ _ ", - "&e / / / _ \\| '__/ _ \\//_\\\\| '__/ _ \\ '_ \\ / _` |", - "&6 / /__| (_) | | | __/ _ \\ | | __/ | | | (_| |", - "&6 \\____/\\___/|_| \\___\\_/ \\_/_| \\___|_| |_|\\__,_|", - "&8 " + getVersion() - }; - } - - @Override - protected void onPluginPreStart() { - if (Common.doesPluginExistSilently("GameAPI")) { - Common.logFramed(true, - "**PLEASE REMOVE GAMEAPI**", - "", - "Dear user! " + getName() + " no longer requires GameAPI.", - "Please remove it from your disk and restart the server."); - - isEnabled = false; - } - - if (isEnabled) - arenaManager = new SimpleArenaManager(); - } - - @Override - protected void onPluginStart() { - DEBUG_EDITING_MODE = Debugger.isDebugModeEnabled(); - - // Setup listeners - registerEvents(new InArenaListener()); - registerEvents(new SignsListener()); - registerEvents(new PlayerListener()); - registerEvents(new VisualizerListener()); - - registerEventsIf(new AutoRepairListener(), Settings.Arena.AUTO_REPAIR_ITEMS); - registerEventsIf(new McMMOListener(), Common.doesPluginExistSilently("mcMMO") && Settings.Arena.Integration.MCMMO_BLOCK_EXP); - registerEventsIf(new JobsListener(), Common.doesPluginExistSilently("Jobs") && Settings.Arena.Integration.JOBS_BLOCK_LEVELUP); - registerEventsIf(new StackMobListener(), Common.doesPluginExistSilently("StackMob")); - - // Load tools - MenuItems.getInstance(); - MenuGameTools.getInstance(); - - Settings.MySQL.dummyCall(); - - if (!HookManager.isWorldEditLoaded() && MinecraftVersion.atLeast(V.v1_13)) - Common.warning("No WorldEdit detected. It is required for procedural damage and arena snapshots."); - - rewardsManager = new RewardsManager(); - - // Register variables - { - Variables.addVariable("nuggets", player -> { - final ArenaPlayer arenaPlayer = getDataFor(player); - - return arenaPlayer.getNuggets() + ""; - }); - - Variables.addVariable("is_playing", player -> { - final ArenaPlayer arenaPlayer = getDataFor(player); - - return arenaPlayer.hasArenaCache() ? "true" : "false"; - }); - - Variables.addVariable("class", player -> { - final ArenaPlayer.ClassCache arenaClass = getDataFor(player).getClassCache(); - - return arenaClass.assignedClass != null ? arenaClass.assignedClass.getName() : ""; - }); - } - - // Start the rest - startReloadable(); - } - - @Override - protected void onPluginPreReload() { - clearData(); - - playerCache.clear(); - } - - @Override - public void onPluginReload() { - startReloadable(); - } - - public void startReloadable() { - GeneralDataSection.getInstance(); // Load up - - getArenaManager().loadSavedArenas(); - - classManager.loadClasses(); - upgradesManager.loadUpgrades(); - rewardsManager.loadRewards(); - - if (fallingLimitter != null) - fallingLimitter.cancel(); - - fallingLimitter = new FallingLimitter().runTaskTimer(this, 10, 10); - - getArenaManager().onPostLoad(); - - if (Common.doesPluginExistSilently("PlaceholderAPI")) - new ArenaPAPIPlaceholder().register(); - - Common.ADD_TELL_PREFIX = true; - } - - @Override - protected void onPluginStop() { - try { - clearData(); - - } catch (final Throwable t) { - Common.error(t, "Plugin shutdown malfunction: " + t.getClass().getSimpleName()); - } - } - - private void clearData() { - SimpleArena.clearRegisteredArenas(); - - if (getArenaManager() != null) - getArenaManager().stopArenas(StopCause.INTERRUPTED_RELOAD); - - for (final Arena arena : setupManager.getEditedArenas()) - setupManager.removeEditedArena(arena); - - final InventoryStorageUtil i = InventoryStorageUtil.$(); - - for (final Player pl : Remain.getOnlinePlayers()) { - final ArenaPlayer data = getDataFor(pl); - - if (Settings.Arena.STORE_INVENTORIES && i.hasStored(pl)) - i.restore(pl); - - data.removeCurrentArena(); - data.removeCurrentSetup(); - - if (Menu.getMenu(pl) != null) - pl.closeInventory(); - } - } - - @Override - public ArenaManager getArenas() { - return getArenaManager(); - } - - @Override - public Plugin getPlugin() { - return this; - } - - @Override - public List<Class<? extends YamlStaticConfig>> getSettings() { - return Arrays.asList(Settings.class, Localization.class); - } - - /*@Override - public SpigotUpdater getUpdateCheck() { - return new SpigotUpdater(42404); - }*/ - - @Override - public int getFoundedYear() { - return 2017; - } - - public static ArenaPlayer getDataFor(OfflinePlayer offlinePlayer) { - return getDataFor(offlinePlayer.getUniqueId(), offlinePlayer.getName()); - } - - public static ArenaPlayer getDataFor(@NonNull CommandSender sender) { - return sender instanceof Player ? getDataFor((Player) sender) : getDataFor(null, sender.getName()); - } - - public static ArenaPlayer getDataFor(@NonNull Player player) { - return getDataFor(player.getUniqueId(), player.getName()); - } - - private static ArenaPlayer getDataFor(UUID uuid, String name) { - synchronized (playerCache) { - if (uuid == null || name == null) - return null; - - ArenaPlayer cache = playerCache.get(name); - - if (cache == null) - playerCache.put(name, cache = new ArenaPlayer(uuid, name)); - - return cache; - } - } - - public static void trashDataFor(Player player) { - Valid.checkBoolean(playerCache.containsKey(player.getName()), "Cannot trash non existing cached player " + player.getName()); - - playerCache.remove(player.getName()); - } - - public static SimpleArenaManager getArenaManager() { - return getInstance().arenaManager; - } - - public static ClassManager getClassManager() { - return getInstance().classManager; - } - - public static SetupManager getSetupManager() { - return getInstance().setupManager; - } - - public static UpgradesManager getUpgradesManager() { - return getInstance().upgradesManager; - } - - public static RewardsManager getRewadsManager() { - return getInstance().rewardsManager; - } - - public static CoreArenaPlugin getInstance() { - return (CoreArenaPlugin) SimplePlugin.getInstance(); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/AbstractCoreSubcommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/AbstractCoreSubcommand.java deleted file mode 100644 index 9b5ab4d10253dec78ff16147c0bef9c4238fe0f6..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/AbstractCoreSubcommand.java +++ /dev/null @@ -1,122 +0,0 @@ -package org.mineacademy.game.command; - -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.command.SimpleSubCommand; -import org.mineacademy.fo.exception.CommandException; -import org.mineacademy.game.command.placeholder.Placeholder; -import org.mineacademy.game.command.placeholder.PositionPlaceholder; -import org.mineacademy.game.command.placeholder.StaticPlaceholder; -import org.mineacademy.game.manager.ClassManager; -import org.mineacademy.game.manager.SetupManager; -import org.mineacademy.game.manager.UpgradesManager; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaClass; -import org.mineacademy.game.model.ArenaManager; -import org.mineacademy.game.model.ArenaRegistry; -import org.mineacademy.game.model.Upgrade; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.type.ArenaState; - -abstract class AbstractCoreSubcommand extends SimpleSubCommand { - - /** - * A list of placeholders to replace in this command, see {@link Placeholder} - * - * These are used when sending player messages - */ - private final StrictList<Placeholder> placeholders = new StrictList<>(); - - protected AbstractCoreSubcommand(String aliases) { - super(aliases); - - addPlaceholder(new StaticPlaceholder("currency_name", Localization.Currency.rawPluralName())); - } - - /** - * Registers a new placeholder to be used when sending messages to the player - * - * @param placeholder - */ - protected final void addPlaceholder(final Placeholder placeholder) { - placeholders.add(placeholder); - } - - @Override - protected String replacePlaceholders(String message) { - // Replace previous - message = super.replacePlaceholders(message); - - // Replace saved placeholders - for (final Placeholder placeholder : placeholders) { - String toReplace = message; - - if (placeholder instanceof PositionPlaceholder) { - final PositionPlaceholder arguedPlaceholder = (PositionPlaceholder) placeholder; - - if (args.length > arguedPlaceholder.getPosition()) - toReplace = args[arguedPlaceholder.getPosition()]; - else - continue; - } - - message = message.replace("{" + placeholder.getIdentifier() + "}", placeholder.replace(toReplace)); - } - - return message; - } - - protected final boolean canEditArena(Arena arena) throws CommandException { - if (arena.getState() != ArenaState.STOPPED) - returnTell(Localization.Commands.Edit.ARENA_RUNNING); - - final ArenaManager commonManager = ArenaRegistry.getCommonManager(); - - { // Play - if (commonManager.isPlaying(getPlayer())) - returnTell(Localization.Commands.DISALLOWED_WHILE_PLAYING); - } - - // Already editing - { - final Arena editedArena = commonManager.findEditedArena(getPlayer()); - - if (editedArena != null && !editedArena.getName().equalsIgnoreCase(arena.getName())) - returnTell(Localization.Commands.Edit.ALREADY_EDITING.replace("{arena}", editedArena.getName())); - } - - return true; - } - - protected final Arena getArena(String name) { - return getArenas().findArena(name); - } - - protected final ArenaManager getArenas() { - return CoreArenaPlugin.getArenaManager(); - } - - protected final Upgrade getUpgrade(String name) { - return getUpgrades().findUpgrade(name); - } - - protected final UpgradesManager getUpgrades() { - return CoreArenaPlugin.getUpgradesManager(); - } - - protected final ArenaClass getClass(String name) { - return getClasses().findClass(name); - } - - protected final ClassManager getClasses() { - return CoreArenaPlugin.getClassManager(); - } - - protected final SetupManager getSetup() { - return CoreArenaPlugin.getSetupManager(); - } - - protected final CoreArenaPlugin getCore() { - return CoreArenaPlugin.getInstance(); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ClassCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ClassCommand.java deleted file mode 100644 index 6c0c5476a71525d3ca3159760e193ebcffc8dbbc..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ClassCommand.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.mineacademy.game.command; - -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.exception.CommandException; -import org.mineacademy.game.impl.ArenaPlayer.InArenaCache; -import org.mineacademy.game.menu.MenuInArenaClasses; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.util.CoreUtil; - -public class ClassCommand extends AbstractCoreSubcommand { - - public ClassCommand() { - super("class|cl"); - - setDescription("Select your class in an arena."); - } - - @Override - protected final void onCommand() { - checkConsole(); - - tryOpenMenu(getPlayer()); - } - - public static final void tryOpenMenu(Player player) { - try { - if (!CoreUtil.checkMenuAccessInArena(player)) - return; - - } catch (final CommandException ex) { - return; - } - - final InArenaCache cache = CoreArenaPlugin.getDataFor(player).getArenaCache(); - final Arena arena = cache.getArena(player); - - if (arena.getSettings().allowOwnEquipment()) { - Common.tell(player, Localization.Class.NOT_AVAILABLE.replace("{arena}", arena.getName())); - - return; - } - - new MenuInArenaClasses(arena, player).displayTo(player); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ConvoCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ConvoCommand.java deleted file mode 100644 index cf01d90a5531b4ef4f9d5c8e304272ef4da28bac..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ConvoCommand.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.mineacademy.game.command; - -import org.mineacademy.fo.Common; - -public class ConvoCommand extends AbstractCoreSubcommand { - - public ConvoCommand() { - super("conversation|c"); - - setDescription("Reply to server's conversation manually."); - setUsage("<message ...>"); - setMinArguments(1); - } - - @Override - protected final void onCommand() { - checkBoolean(getPlayer().isConversing(), "&cYou must be conversing with the server!"); - - getPlayer().acceptConversationInput(Common.joinRange(0, args)); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/EditCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/EditCommand.java deleted file mode 100644 index 46b7e9483cdf2b2a2fca152884a6e387975c6133..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/EditCommand.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.mineacademy.game.command; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.settings.Localization; - -public class EditCommand extends AbstractCoreSubcommand { - - public EditCommand() { - super("edit|e"); - - setDescription("Begin or stop editing an arena."); - setUsage("[arena]"); - - addPlaceholder(new PlaceholderArena(0)); - } - - @Override - protected final void onCommand() { - final Player player = getPlayer(); - final String arenaName = args.length == 1 ? args[0] : ""; - - Arena arena; - - if (arenaName.isEmpty()) { - arena = getArenas().findArena(player.getLocation()); - - if (arena == null) - arena = getSetup().getEditedArena(player); - - checkNotNull(arena, Localization.Arena.Error.NO_ARENA_AT_LOCATION); - - } else { - arena = getArena(arenaName); - checkNotNull(arena, Localization.Arena.Error.NOT_FOUND); - } - - setArg(0, arena.getName()); - - if (!canEditArena(arena)) - return; - - if (getSetup().isArenaEdited(arena)) { - getSetup().removeEditedArena(arena); - - tell(Localization.Commands.Edit.DISABLED); - - } else { - getSetup().addEditedArena(player, arena); - - tell(Localization.Commands.Edit.ENABLED); - } - } - - @Override - public final List<String> tabComplete() { - final List<String> tab = new ArrayList<>(); - - if (args.length == 1) - if (sender instanceof Player && getSetup().getEditedArena((Player) sender) != null) - tab.add(getSetup().getEditedArena((Player) sender).getName()); - else - for (final String key : CoreArenaPlugin.getArenaManager().getAvailable()) - if (key.toLowerCase().startsWith(args[0].toLowerCase())) - tab.add(key); - - return tab; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/EggCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/EggCommand.java deleted file mode 100644 index 173070c6ae8fe6d4c3e96d4b52cafd6b78e9de6b..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/EggCommand.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.mineacademy.game.command; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Common.TypeConverter; -import org.mineacademy.fo.ItemUtil; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.ReflectionUtil.MissingEnumException; -import org.mineacademy.fo.TabUtil; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.CompMonsterEgg; - -public class EggCommand extends AbstractCoreSubcommand { - - public EggCommand() { - super("egg"); - - setDescription("Get eggs to use in mob spawners."); - setUsage("<monster>"); - setMinArguments(1); - } - - @Override - protected final void onCommand() { - final String mobName = Common.joinRange(0, args); - - EntityType type = null; - - try { - type = ReflectionUtil.lookupEnum(EntityType.class, mobName); - - } catch (final MissingEnumException ex) { - returnTell("&cUnknown entity '" + mobName + "'. Available: " + String.join(", ", Common.convert(getValidEntities(), (TypeConverter<String, String>) ItemUtil::bountifyCapitalized))); - } - - final String fancyEntity = ItemUtil.bountifyCapitalized(type); - checkBoolean(canBeSpawned(type), "The entity " + fancyEntity + " cannot be spawned or is unstable and has been disabled."); - - ItemStack egg = ItemCreator.of( - CompMaterial.SHEEP_SPAWN_EGG, - "Spawn " + fancyEntity, - "", - "Place this item in your", - "monster spawner to", - "summon " + fancyEntity) - .glow(true) - .build().make(); - - egg = CompMonsterEgg.setEntity(egg, type); - - getPlayer().getInventory().addItem(egg); - tell("You've got an egg for " + fancyEntity + ". Place this into an arena mob spawner to have some fun!"); - } - - private final List<String> getValidEntities() { - final List<String> list = new ArrayList<>(); - - for (final EntityType entity : EntityType.values()) - if (canBeSpawned(entity)) - list.add(entity.toString()); - - return list; - } - - private final boolean canBeSpawned(EntityType entity) { - return entity.isSpawnable() && entity.isAlive() && !"ARMOR_STAND".equals(entity.toString()) && !"ENDER_DRAGON".equals(entity.toString()); - } - - @Override - public List<String> tabComplete() { - if (args.length == 1) - return TabUtil.complete(args[0], getValidEntities()); - - return new ArrayList<>(); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/FindCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/FindCommand.java deleted file mode 100644 index b28c8910b0981888c51b73ce3152a835a9771879..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/FindCommand.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.mineacademy.game.command; - -import static org.mineacademy.game.settings.Localization.Commands.Find.FOUND; -import static org.mineacademy.game.settings.Localization.Commands.Find.FOUND_LOCATION; -import static org.mineacademy.game.settings.Localization.Commands.Find.FOUND_OTHER; -import static org.mineacademy.game.settings.Localization.Commands.Find.NOT_FOUND; -import static org.mineacademy.game.settings.Localization.Commands.Find.NOT_FOUND_LOCATION; -import static org.mineacademy.game.settings.Localization.Commands.Find.WRONG_SYNTAX; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.entity.Player; -import org.mineacademy.fo.Common; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaManager; -import org.mineacademy.game.settings.Localization; - -public class FindCommand extends AbstractCoreSubcommand { - - public FindCommand() { - super("find|f"); - - setDescription("Find arena at a location."); - setUsage("[player] or [x y z] or [world x y z]"); - } - - @Override - protected final void onCommand() { - final ArenaManager m = getArenas(); - Arena arena; - - if (args.length == 0) { - arena = m.findArena(getPlayer().getLocation()); - checkNotNull(arena, NOT_FOUND); - - returnTell(FOUND.replace("{arena}", arena.getName())); - } - - if (args.length == 1) { - final String other = args[0]; - final Player other_player = Bukkit.getPlayer(other); - checkNotNull(other_player, Localization.Player.NOT_ONLINE.replace("{player}", other)); - - arena = m.findArena(other_player); - checkNotNull(arena, Localization.Player.NOT_PLAYING.replace("{player}", other_player.getName())); - - returnTell(FOUND_OTHER.replace("{player}", other_player.getName()).replace("{arena}", arena.getName())); - } - - world: - if (args.length == 3 || args.length == 4) { - int arg = 0; - - final String wRaw = args.length == 3 ? getPlayer().getWorld().getName() : args[arg++]; - final World w = Bukkit.getWorld(wRaw); - checkNotNull(w, Localization.World.NOT_FOUND.replace("{world}", wRaw)); - - final Integer x = getNumber(arg++); - final Integer y = getNumber(arg++); - final Integer z = getNumber(arg++); - - if (x == null || y == null || z == null) - break world; - - final Location loc = new Location(w, x, y, z); - - arena = m.findArena(loc); - checkNotNull(arena, NOT_FOUND_LOCATION.replace("{location}", Common.shortLocation(loc))); - - returnTell(FOUND_LOCATION.replace("{arena}", arena.getName()).replace("{location}", Common.shortLocation(loc))); - } - - returnTell(WRONG_SYNTAX); - } - - private final Integer getNumber(int arg) { - try { - return Integer.parseInt(args[arg]); - } catch (final NumberFormatException ex) { - return null; - } - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ItemMenuSubCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ItemMenuSubCommand.java deleted file mode 100644 index 718c8d111a715bc271f0debd467967653eedcdcf..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ItemMenuSubCommand.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.mineacademy.game.command; - -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.util.Permissions; - -abstract class ItemMenuSubCommand extends AbstractCoreSubcommand { - - public ItemMenuSubCommand(String aliases) { - super(aliases); - } - - @Override - protected final void onCommand() { - checkConsole(); - - if (!CoreArenaPlugin.DEBUG_EDITING_MODE && !hasPerm(Permissions.Bypass.ARENA_COMMANDS) && CoreArenaPlugin.getDataFor(getPlayer()).hasArenaCache()) - returnTell(Localization.Commands.DISALLOWED_WHILE_PLAYING); - - final Menu menu = getMenu(); - - if (menu != null) - menu.displayTo(getPlayer()); - } - - protected abstract Menu getMenu(); -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ItemsCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ItemsCommand.java deleted file mode 100644 index 10e27f0d0af4931e652a3c3c9fd0adbdba935e54..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ItemsCommand.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.mineacademy.game.command; - -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.game.menu.MenuItems; - -public final class ItemsCommand extends ItemMenuSubCommand { - - public ItemsCommand() { - super("items|i"); - - setDescription("Get items with special features while in game."); - } - - @Override - protected Menu getMenu() { - return MenuItems.getInstance(); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/JoinCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/JoinCommand.java deleted file mode 100644 index 2668a507c7c8e73151d753843d2a31468eb061db..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/JoinCommand.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.mineacademy.game.command; - -import java.util.List; - -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.type.JoinCause; -import org.mineacademy.game.util.CoreUtil; - -public class JoinCommand extends AbstractCoreSubcommand { - - public JoinCommand() { - super("join|j"); - - setDescription("Join an existing arena."); - setUsage("[arena]"); - - addPlaceholder(new PlaceholderArena(0)); - } - - @Override - protected final void onCommand() { - final String arenaName = args.length > 0 ? args[0] : null; - Arena arena = arenaName != null ? getArena(arenaName) : getArenas().findArena(getPlayer().getLocation()); - - if (arena == null && getArenas().getArenas().size() == 1) - arena = getArenas().getArenas().iterator().next(); - - if (arena == null) { - - if (args.length > 0) - tell(Localization.Arena.Error.NOT_FOUND); - - CoreArenaPlugin.getArenaManager().tellAvailableArenas(sender); - return; - } - - arena.joinPlayer(getPlayer(), JoinCause.COMMAND); - } - - @Override - public List<String> tabComplete() { - return CoreUtil.tabCompleteArenaNames(args); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/LeaveCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/LeaveCommand.java deleted file mode 100644 index 5e8db05c13424ab77af385b210aa4eeffe7649b8..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/LeaveCommand.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.mineacademy.game.command; - -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.type.LeaveCause; - -public class LeaveCommand extends AbstractCoreSubcommand { - - public LeaveCommand() { - super("leave|l"); - - setDescription("Leave arena while playing."); - } - - @Override - protected final void onCommand() { - final Arena arena = getArenas().findArena(getPlayer()); - checkNotNull(arena, Localization.Commands.Leave.NOT_PLAYING); - - final boolean left = arena.kickPlayer(getPlayer(), LeaveCause.COMMAND); - - if (left) - tell(Localization.Commands.Leave.SUCCESS.replace("{arena}", arena.getName())); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ListCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ListCommand.java deleted file mode 100644 index 92c67359f7fd91bbef410ebdd0082ad738be312c..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ListCommand.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.mineacademy.game.command; - -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.game.settings.Localization; - -public class ListCommand extends AbstractCoreSubcommand { - - public ListCommand() { - super("list"); - - setDescription("Browse available arenas."); - } - - @Override - protected final void onCommand() { - CoreArenaPlugin.getArenaManager().tellAvailableArenas(sender); - - if (sender instanceof Player) - tell(Localization.Commands.Join.SUGGEST); - } - - @Override - protected String[] getMultilineUsageMessage() { - return new String[] { - "&fjoin &6<arena> &e- Join an arena.", - }; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/MenuCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/MenuCommand.java deleted file mode 100644 index e2a7631791dadb60cf362f872db1b54aeea86661..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/MenuCommand.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.mineacademy.game.command; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.exception.CommandException; -import org.mineacademy.game.command.placeholder.ForwardingPlaceholder; -import org.mineacademy.game.impl.ArenaPlayer; -import org.mineacademy.game.menu.CoreMenu; -import org.mineacademy.game.menu.IndividualArenaMenu; -import org.mineacademy.game.menu.IndividualClassMenu; -import org.mineacademy.game.menu.IndividualUpgradeMenu; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaClass; -import org.mineacademy.game.model.Upgrade; -import org.mineacademy.game.settings.Localization; - -public class MenuCommand extends AbstractCoreSubcommand { - - public MenuCommand() { - super("menu|m"); - - setDescription("The main menu of this plugin."); - setUsage("[object]"); - - addPlaceholder(new ForwardingPlaceholder("object", 0)); - } - - @Override - protected final void onCommand() { - if (!canAccessMenu()) - return; - - if (args.length == 0) { - new CoreMenu().displayTo(getPlayer()); - - return; - } - - checkBoolean(args.length == 1, Localization.Parts.USAGE + "/" + getLabel() + " " + getSublabel() + " [object]"); - - final String object = args[0]; - - // Check arena - final Arena arena = getArena(object); - - if (arena != null) { - new IndividualArenaMenu(object).displayTo(getPlayer()); - return; - } - - // Check class - final ArenaClass cl = getClass(object); - - if (cl != null) { - new IndividualClassMenu(cl, true).displayTo(getPlayer()); - return; - } - - // Check upgrade - final Upgrade u = getUpgrade(object); - - if (u != null) { - new IndividualUpgradeMenu(u, true).displayTo(getPlayer()); - - return; - } - - tell(Localization.Commands.Menu.LOOKUP_FAILED.replace("{object}", object)); - } - - private final boolean canAccessMenu() throws CommandException { - final ArenaPlayer data = CoreArenaPlugin.getDataFor(sender); - - if (data.hasArenaCache()) - returnTell(Localization.Menu.CANNOT_OPEN_IN_ARENA); - - if (sender instanceof Player) { - final Arena editedArena = getSetup().getEditedArena(getPlayer()); - - if (editedArena != null) - returnTell(Localization.Arena.CANNOT_DO_WHILE_EDITING.replace("{arena}", editedArena.getName())); - } - - return true; - } - - @Override - public final List<String> tabComplete() { - final List<String> tab = new ArrayList<>(); - - if (args.length == 1) { - final List<String> all = new ArrayList<>(); - - all.addAll(getArenas().getAvailable()); - all.addAll(getClasses().getAvailable().getSource()); - all.addAll(getUpgrades().getAvailable().getSource()); - - for (final String key : all) - if (key.toLowerCase().startsWith(args[0].toLowerCase())) - tab.add(key); - } - - return tab; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/NewCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/NewCommand.java deleted file mode 100644 index 408e51c22f04684a94e4178afa120b6070e305b7..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/NewCommand.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.mineacademy.game.command; - -import org.bukkit.command.CommandSender; -import org.bukkit.conversations.Conversable; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.game.model.Arena; - -public class NewCommand extends AbstractCoreSubcommand { - - public NewCommand() { - super("new"); - - setDescription("Create a new arena."); - setUsage("<name>"); - setMinArguments(1); - } - - @Override - protected final void onCommand() { - final String name = args[0]; - - if (!mayCreate(getPlayer(), name)) - return; - - final Arena arena = CoreArenaPlugin.getArenaManager().createArena(name); - getSetup().addEditedArena(getPlayer(), arena); - - tell("&7A new Arena " + arena.getName() + " has been &2created&7 and put into edit mode automatically."); - } - - public static boolean mayCreate(Conversable player, String input) { - - @Deprecated - class $ { - private void say(Object obj, String message) { - if (obj instanceof Conversable) - Common.tellLaterConversing(1, (Conversable) obj, message); - else - Common.tell((CommandSender) obj, message); - } - } - - final $ $ = new $(); - - if (input.length() < 3 || input.length() > 50) { - $.say(player, "&cName may be between 3 and 50 letters long."); - - return false; - } - - if (input.contains(" ")) { - $.say(player, "&cName may not contains spaces."); - - return false; - } - - if (input.contains("&")) { - $.say(player, "&cName may not contains colors."); - - return false; - } - - if (CoreArenaPlugin.getArenaManager().findArena(input) != null) { - $.say(player, "&cArena named '" + input + "' already exists."); - - return false; - } - - return true; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/NuggetCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/NuggetCommand.java deleted file mode 100644 index 123162cae19d18258f70397386f24d1170558afb..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/NuggetCommand.java +++ /dev/null @@ -1,124 +0,0 @@ -package org.mineacademy.game.command; - -import java.util.List; - -import org.apache.commons.lang.StringUtils; -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.MathUtil; -import org.mineacademy.fo.exception.CommandException; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.game.command.placeholder.ForwardingPlaceholder; -import org.mineacademy.game.impl.ArenaPlayer; -import org.mineacademy.game.settings.Localization; - -public class NuggetCommand extends AbstractCoreSubcommand { - - public NuggetCommand() { - super("nugget|n"); - - setDescription("Manage the Nugget currency."); - setUsage("<player> [set/give/take] [amount]"); - setMinArguments(1); - - addPlaceholder(new ForwardingPlaceholder("player", 0)); - } - - @Override - protected final void onCommand() { - final OfflinePlayer other = Bukkit.getOfflinePlayer(args[0]); - checkBoolean(other != null && other.hasPlayedBefore(), Localization.Player.NEVER_PLAYED); - - final ArenaPlayer data = other != null ? CoreArenaPlugin.getDataFor(other) : CoreArenaPlugin.getDataFor(getPlayer()); - - setArg(0, data.getPlayerName()); - - if (args.length < 2) - returnTell(formatCurrencyMessage(other == null ? Localization.Commands.Nuggets.BALANCE : Localization.Commands.Nuggets.BALANCE_OTHER, data.getNuggets())); - - checkArgs(3, Localization.Parts.USAGE + "/" + getLabel() + " " + getSublabel() + " " + args[0] + " <set/give/take> <" + Localization.Parts.AMOUNT + ">"); - - if (!canAccessMenu()) - return; - - final String param = args[1].toLowerCase(); - - Integer amount = null; - - try { - amount = Integer.parseInt(args[2]); - - } catch (final NumberFormatException ex) { - returnTell(Localization.Commands.Nuggets.INVALID_AMOUNT); - } - - Mode mode = null; - - try { - mode = Mode.valueOf(param.toUpperCase()); - - } catch (final Throwable t) { - returnTell(Localization.Commands.Nuggets.INVALID_PARAM.replace("{available}", StringUtils.join(Mode.values(), ", ").toLowerCase())); - } - - if (mode == Mode.SET) { - data.setNuggets(amount); - - returnTell(formatManipulationMessage(Localization.Commands.Nuggets.SET, amount, data.getNuggets())); - - } else if (mode == Mode.GIVE) { - data.setNuggets(data.getNuggets() + amount); - - returnTell(formatManipulationMessage(Localization.Commands.Nuggets.GAVE, amount, data.getNuggets())); - - } else if (mode == Mode.TAKE) { - data.setNuggets(MathUtil.range(data.getNuggets() - amount, 0, Integer.MAX_VALUE)); - - returnTell(formatManipulationMessage(Localization.Commands.Nuggets.TOOK, amount, data.getNuggets())); - } - - throw new FoException("Mode " + mode + " not yet implemented! Please notify plugins developers."); - } - - enum Mode { - SET, - TAKE, - GIVE - } - - private String formatManipulationMessage(String key, int manipulated, int balance) { - return formatCurrencyMessage(key, balance).replace("{amount}", Localization.Currency.format(manipulated)); - } - - private String formatCurrencyMessage(String key, int nuggets) { - return key.replace("{balance}", Localization.Currency.format(nuggets)); - } - - private boolean canAccessMenu() throws CommandException { - if (sender instanceof Player) { - final ArenaPlayer data = CoreArenaPlugin.getDataFor(sender); - - if (data.hasArenaCache()) - returnTell(Localization.Commands.DISALLOWED_WHILE_PLAYING); - } - - return true; - } - - @Override - public List<String> tabComplete() { - - if (args.length == 1) - return completeLastWordPlayerNames(); - - if (args.length == 2) - return completeLastWord("set", "give", "take"); - - if (args.length == 3) - return completeLastWord("0", "1", "30"); - - return null; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/PlaceholderArena.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/PlaceholderArena.java deleted file mode 100644 index 312b2f4dbb35a85fadfa81b7a5d93a65dad2ccd8..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/PlaceholderArena.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.mineacademy.game.command; - -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.game.command.placeholder.PositionPlaceholder; -import org.mineacademy.game.model.Arena; - -final class PlaceholderArena extends PositionPlaceholder { - - public PlaceholderArena(int position) { - super("arena", position); - } - - @Override - public String replace(String raw) { - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(raw); - - return arena != null ? arena.getName() : raw; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/RewardsCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/RewardsCommand.java deleted file mode 100644 index 6295cdf55be45263ceae6679410bb66c1f71037d..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/RewardsCommand.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.mineacademy.game.command; - -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.exception.CommandException; -import org.mineacademy.game.impl.ArenaPlayer; -import org.mineacademy.game.menu.MenuRewards; -import org.mineacademy.game.menu.MenuRewards.MenuMode; -import org.mineacademy.game.settings.Localization; - -public class RewardsCommand extends AbstractCoreSubcommand { - - public RewardsCommand() { - super("rewards|r"); - - setDescription("Open the rewards menu."); - } - - @Override - protected final void onCommand() { - if (args.length != 0) - returnTell(Localization.Parts.USAGE + "/" + getLabel() + " " + getSublabel()); - - if (!canAccessMenu(getPlayer())) - return; - - MenuRewards.showRewardsMenu(getPlayer(), MenuMode.PURCHASE); - } - - public static final boolean canAccessMenu(Player player) throws CommandException { - final ArenaPlayer data = CoreArenaPlugin.getDataFor(player); - - if (data.hasArenaCache()) - Common.tell(player, Localization.Menu.CANNOT_OPEN_IN_ARENA); - - return true; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/StartCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/StartCommand.java deleted file mode 100644 index 83d5b78f7123e3fa142533ff9958fc8c20abfa35..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/StartCommand.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.mineacademy.game.command; - -import java.util.List; - -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.exception.CommandException; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.type.ArenaState; -import org.mineacademy.game.util.CoreUtil; - -public class StartCommand extends AbstractCoreSubcommand { - - public StartCommand() { - super("start"); - - setDescription("Start a pending arena."); - setUsage("[arena] [-f]"); - - addPlaceholder(new PlaceholderArena(0)); - } - - @Override - protected final void onCommand() { - final String arenaName = args.length > 0 ? args[0] : ""; - Arena arena = null; - - if (arenaName.isEmpty()) { - if (sender instanceof Player) - arena = findArenaWhenUnspecified(getPlayer()); - - if (arena == null) { - tell(Localization.Arena.Error.NO_ARENA_AT_LOCATION); - - returnTellAvailable(sender); - } - - } else - arena = getArena(arenaName); - - if (arena == null) { - tell(Localization.Arena.Error.NOT_FOUND); - - returnTellAvailable(sender); - } - - setArg(0, arena.getName()); - - if (arena.getState() == ArenaState.STOPPED) { - arena.startLobby(); - tell(Localization.Commands.Start.SUCCESS); - - } else if (arena.getState() == ArenaState.LOBBY) - tell(arena.startArena(true) ? Localization.Commands.Start.SUCCESS : Localization.Commands.Start.FAIL); - - else - tell(Localization.Arena.Error.ALREADY_RUNNING); - } - - final static Arena findArenaWhenUnspecified(Player player) { - Arena arena = CoreArenaPlugin.getArenaManager().findArena(player); - - if (arena == null) - arena = CoreArenaPlugin.getArenaManager().findArena(player.getLocation()); - - return arena; - } - - final static void returnTellAvailable(CommandSender sender) throws CommandException { - CoreArenaPlugin.getArenaManager().tellAvailableArenas(sender); - - throw new CommandException(); - } - - @Override - public List<String> tabComplete() { - return CoreUtil.tabCompleteArenaNames(args); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/StopCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/StopCommand.java deleted file mode 100644 index b9f81b283380424ae88a9df1d4a72393ef5cc517..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/StopCommand.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.mineacademy.game.command; - -import static org.mineacademy.game.command.StartCommand.findArenaWhenUnspecified; -import static org.mineacademy.game.command.StartCommand.returnTellAvailable; - -import java.util.List; - -import org.bukkit.entity.Player; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.type.ArenaState; -import org.mineacademy.game.type.StopCause; -import org.mineacademy.game.util.CoreUtil; - -public class StopCommand extends AbstractCoreSubcommand { - - public StopCommand() { - super("stop"); - - setDescription("Stop a running arena."); - setUsage("[arena]"); - - addPlaceholder(new PlaceholderArena(0)); - } - - @Override - protected final void onCommand() { - final String arenaName = args.length > 0 ? args[0] : ""; - Arena arena = null; - - if (arenaName.isEmpty()) { - if (sender instanceof Player) - arena = findArenaWhenUnspecified(getPlayer()); - - if (arena == null) { - tell(Localization.Arena.Error.NO_ARENA_AT_LOCATION); - - returnTellAvailable(sender); - } - - } else - arena = getArena(arenaName); - - if (arena == null) { - tell(Localization.Arena.Error.NOT_FOUND); - returnTellAvailable(sender); - } - - setArg(0, arena.getName()); - - checkBoolean(arena.getState() != ArenaState.STOPPED, Localization.Commands.Stop.ALREADY_STOPPED); - arena.stopArena(StopCause.INTERRUPTED_COMMAND); - tell(Localization.Commands.Stop.SUCCESS); - } - - @Override - public List<String> tabComplete() { - return CoreUtil.tabCompleteArenaNames(args); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ToggleCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ToggleCommand.java deleted file mode 100644 index 64a84ea3b5bc1fd96d7a437484f52d7c90445216..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ToggleCommand.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.mineacademy.game.command; - -import org.bukkit.entity.Player; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.settings.Localization; - -public class ToggleCommand extends AbstractCoreSubcommand { - - public ToggleCommand() { - super("toggle|tg"); - - setDescription("Enable or disable an arena"); - setUsage("[arena]"); - } - - @Override - protected void onCommand() { - final Player player = getPlayer(); - final String arenaName = args.length == 1 ? args[0] : ""; - - Arena arena; - - if (arenaName.isEmpty()) { - arena = getArenas().findArena(player.getLocation()); - - if (arena == null) - arena = getSetup().getEditedArena(player); - - checkNotNull(arena, Localization.Arena.Error.NO_ARENA_AT_LOCATION); - - } else { - arena = getArena(arenaName); - checkNotNull(arena, Localization.Arena.Error.NOT_FOUND); - } - - setArg(0, getLabel()); - - if (!canEditArena(arena)) - return; - - arena.setEnabled(!arena.isEnabled()); - - tell((arena.isEnabled() ? Localization.Commands.Change_State.ENABLED : Localization.Commands.Change_State.DISABLED) - .find("{name}") - .replace(arena.getName()) - .getReplacedMessageJoined()); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ToolsCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ToolsCommand.java deleted file mode 100644 index a25ba4fa39687f696d6a4a8d85198a80e8e1eefe..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/ToolsCommand.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.mineacademy.game.command; - -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.game.menu.MenuGameTools; - -public final class ToolsCommand extends ItemMenuSubCommand { - - public ToolsCommand() { - super("tools|t"); - - setDescription("Get tools to edit the arena with."); - } - - @Override - protected Menu getMenu() { - return MenuGameTools.getInstance(); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/TpCommand.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/TpCommand.java deleted file mode 100644 index 6ae4a3bf7cb970e9e9408447ccd10ccb2e65184d..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/TpCommand.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.mineacademy.game.command; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.TabUtil; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.settings.Localization; - -public class TpCommand extends AbstractCoreSubcommand { - - public TpCommand() { - super("tp"); - - setDescription("Teleport to an arena's lobby."); - setUsage("<arena>"); - setMinArguments(1); - - addPlaceholder(new PlaceholderArena(0)); - } - - @Override - protected final void onCommand() { - checkConsole(); - - final Player player = getPlayer(); - final String arenaName = args[0]; - - final Arena arena = getArenas().findArena(arenaName); - checkNotNull(arena, Localization.Arena.Error.NOT_FOUND); - checkNotNull(arena.getData().getLobby(), "&cThis arena lacks a lobby point. Use /" + getLabel() + " tools to set it."); - - player.teleport(arena.getData().getLobby().getLocation().clone().add(0, 1.1, 0)); - tell("Teleported to the lobby of " + arena.getName() + "."); - } - - @Override - public final List<String> tabComplete() { - final List<String> tab = new ArrayList<>(); - - if (args.length == 1) - return TabUtil.complete(args[0], CoreArenaPlugin.getArenaManager().getAvailable()); - - return tab; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/placeholder/ForwardingPlaceholder.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/placeholder/ForwardingPlaceholder.java deleted file mode 100644 index 532a1da6c6e4f48e3fbac4ed7ce286fcc977e83e..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/placeholder/ForwardingPlaceholder.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.mineacademy.game.command.placeholder; - -/** - * An argument that, when parsed, only returns the raw argument without any change. - */ -public final class ForwardingPlaceholder extends PositionPlaceholder { - - public ForwardingPlaceholder(String identifier, int position) { - super(identifier, position); - } - - @Override - public String replace(String raw) { - return raw; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/placeholder/Placeholder.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/placeholder/Placeholder.java deleted file mode 100644 index ff7bd5bec4e68fe35f5deb9d4a191a6b8b0f5b3a..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/placeholder/Placeholder.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.mineacademy.game.command.placeholder; - -import lombok.Getter; -import lombok.NonNull; -import lombok.RequiredArgsConstructor; - -/** - * A simple placeholder used in commands to replace {placeholder} with an actual value - * - * This is used to remove boilerplace code when sending messages - */ -@RequiredArgsConstructor -public abstract class Placeholder { - - /** - * The name of the variable, example "player" would replace {player} - */ - @Getter - @NonNull - private final String identifier; - - /** - * Replace the message with this placeholder - * - * @param message, the entire message or a part of it - * @return - */ - public abstract String replace(String message); - - @Override - public final boolean equals(Object obj) { - return obj instanceof Placeholder ? ((Placeholder) obj).identifier.equals(this.identifier) : false; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/placeholder/PlayerPlaceholder.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/placeholder/PlayerPlaceholder.java deleted file mode 100644 index dbbaf1a40a5eca72f9651ae9e0cc05b54981bac5..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/placeholder/PlayerPlaceholder.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.mineacademy.game.command.placeholder; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; - -/** - * Fixed placeholder replacing {player} with the player name - */ -public final class PlayerPlaceholder extends PositionPlaceholder { - - /** - * Create a new player placeholder getting player name - * at a certain args position, eg. args[1] - * - * @param position - */ - public PlayerPlaceholder(int position) { - super("player", position); - } - - @Override - public String replace(String raw) { - final Player player = Bukkit.getPlayer(raw); - - return player != null && player.isOnline() ? player.getName() : raw; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/placeholder/PositionPlaceholder.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/placeholder/PositionPlaceholder.java deleted file mode 100644 index 985caa556518dd7518e13641336e787a31b76f89..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/placeholder/PositionPlaceholder.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.mineacademy.game.command.placeholder; - -import lombok.Getter; - -/** - * A position placeholder simply replaces {0} with args[0], - * {1} with args[1] and so on. - */ -public abstract class PositionPlaceholder extends Placeholder { - - /** - * What argument number is replacing? - */ - @Getter - private final int position; - - /** - * Create a new position placeholder - * - * @param identifier - * @param position - */ - protected PositionPlaceholder(String identifier, int position) { - super(identifier); - - this.position = position; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/placeholder/StaticPlaceholder.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/command/placeholder/StaticPlaceholder.java deleted file mode 100644 index ef62b3b77e388922956bad421ee7438cd2016923..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/command/placeholder/StaticPlaceholder.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.mineacademy.game.command.placeholder; - -/** - * An argument that, when parsed, only returns the raw argument without any change. - */ -public class StaticPlaceholder extends Placeholder { - - /** - * The fixed replacement for this placeholder, for example - * {color} can always return RED as set here - */ - private final String replacement; - - /** - * Create a new static placeholder - * - * @param identifier - * @param replacement - */ - public StaticPlaceholder(String identifier, String replacement) { - super(identifier); - - this.replacement = replacement; - } - - @Override - public final String replace(String raw) { - return replacement; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/AddNewConvo.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/AddNewConvo.java deleted file mode 100644 index bbe8bd2473014e921732e4116385761270d53102..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/AddNewConvo.java +++ /dev/null @@ -1,155 +0,0 @@ -package org.mineacademy.game.conversation; - -import org.bukkit.conversations.ConversationContext; -import org.bukkit.conversations.Prompt; -import org.bukkit.conversations.ValidatingPrompt; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.game.menu.IndividualClassMenu; -import org.mineacademy.game.menu.IndividualUpgradeMenu; -import org.mineacademy.game.menu.MenuGameTools; -import org.mineacademy.game.settings.Localization; - -public final class AddNewConvo extends MenuQuestion { - - private final Created created; - - public AddNewConvo(Created created, Menu menu) { - super(menu); - - this.created = created; - } - - public enum Created { - ARENA { - @Override - public void create(String name) { - CoreArenaPlugin.getArenaManager().createArena(name); - } - - @Override - protected boolean exists(String name) { - return CoreArenaPlugin.getArenaManager().findArena(name) != null; - } - }, - - UPGRADE { - @Override - public void create(String name) { - CoreArenaPlugin.getUpgradesManager().createUpgrade(name); - } - - @Override - protected boolean exists(String name) { - return CoreArenaPlugin.getUpgradesManager().findUpgrade(name) != null; - } - }, - - CLASS { - @Override - public void create(String name) { - CoreArenaPlugin.getClassManager().createClass(name); - } - - @Override - protected boolean exists(String name) { - return CoreArenaPlugin.getClassManager().findClass(name) != null; - } - }, - - ; - - protected abstract void create(String name); - - protected abstract boolean exists(String name); - - @Override - public String toString() { - return name().toLowerCase(); - } - } - - @Override - protected Prompt getFirstPrompt() { - return new ValidatingPrompt() { - - @Override - public String getPromptText(ConversationContext context) { - return Common.colorize(Localization.Conversation.New.HELP.replace("{type}", created.toString())); - } - - @Override - protected boolean isInputValid(ConversationContext context, String input) { - if (input.contains(" ")) { - tellLater(1, context.getForWhom(), Localization.Conversation.New.NO_SPACES); - - return false; - } - - if (created.exists(input)) { - tellLater(1, context.getForWhom(), Localization.Conversation.New.ALREADY_EXISTS.replace("{type}", created.toString())); - - return false; - } - - return true; - } - - @Override - protected String getFailedValidationText(ConversationContext context, String invalidInput) { - return null; - } - - @Override - protected Prompt acceptValidatedInput(ConversationContext context, String input) { - final Player player = (Player) context.getForWhom(); - - try { - created.create(input); - } catch (final Throwable t) { - Common.error(t, "Error creating " + created + " " + input); - tell(context.getForWhom(), Localization.Conversation.New.ERROR); - - return Prompt.END_OF_CONVERSATION; - } - - if (created == Created.ARENA) { - CoreArenaPlugin.getSetupManager().addEditedArena(player, CoreArenaPlugin.getArenaManager().findArena(input)); - tell(context.getForWhom(), Localization.Conversation.New.SUCCESS_ARENA.replace("{name}", input)); - - Common.runLater(2, new BukkitRunnable() { - - @Override - public void run() { - MenuGameTools.getInstance().displayTo(player); - } - }); - - } else { - tell(context.getForWhom(), Localization.Conversation.New.SUCCESS.replace("{type}", created.toString()).replace("{name}", input)); - - Common.runLater(2, new BukkitRunnable() { - - @Override - public void run() { - if (created == Created.CLASS) - new IndividualClassMenu(input, true).displayTo(player); - - else if (created == Created.UPGRADE) - new IndividualUpgradeMenu(input, true).displayTo(player); - - else - throw new FoException("Menu after creating " + created + " not implemented"); - } - }); - } - - return Prompt.END_OF_CONVERSATION; - } - }; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/MenuNumberQuestion.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/MenuNumberQuestion.java deleted file mode 100644 index f69aee6953d65706ab0a77a925e516c334a3311d..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/MenuNumberQuestion.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.mineacademy.game.conversation; - -import org.bukkit.conversations.ConversationContext; -import org.bukkit.conversations.NumericPrompt; -import org.bukkit.conversations.Prompt; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.game.settings.Localization; - -public abstract class MenuNumberQuestion extends MenuQuestion { - - public MenuNumberQuestion(Menu menu) { - super(menu); - } - - @Override - protected final Prompt getFirstPrompt() { - return new NumericPrompt() { - - @Override - protected boolean isNumberValid(ConversationContext context, Number input) { - return input instanceof Integer && input.intValue() > 0 && MenuNumberQuestion.this.isNumberValid(input); - } - - @Override - public String getPromptText(ConversationContext context) { - return Common.colorize(getQuestion()); - } - - @Override - protected String getFailedValidationText(ConversationContext context, String invalidInput) { - return Common.colorize(Common.getTellPrefix() + Localization.Conversation.NUMBER_HELP); - } - - @Override - protected Prompt acceptValidatedInput(ConversationContext context, Number input) { - onSuccess(context, input); - - return Prompt.END_OF_CONVERSATION; - } - }; - } - - protected boolean isNumberValid(Number input) { - return true; - } - - protected abstract String getQuestion(); - - protected abstract void onSuccess(ConversationContext context, Number input); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/MenuQuestion.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/MenuQuestion.java deleted file mode 100644 index 9215ab247b54eaebade767a060bdef5d1b3b450a..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/MenuQuestion.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.mineacademy.game.conversation; - -import org.bukkit.conversations.Conversable; -import org.bukkit.conversations.ConversationAbandonedEvent; -import org.bukkit.entity.Player; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.conversation.SimpleConversation; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.game.settings.Localization; - -import lombok.AccessLevel; -import lombok.RequiredArgsConstructor; - -@RequiredArgsConstructor(access = AccessLevel.PROTECTED) -public abstract class MenuQuestion extends SimpleConversation { - - private final Menu menu; - - @Override - protected void onConversationEnd(ConversationAbandonedEvent e) { - final Conversable c = e.getContext().getForWhom(); - Valid.checkBoolean(c instanceof Player, "KaConversation was ended by a non player: " + c); - - if (!e.gracefulExit()) - tell(c, Localization.Conversation.CANCELLED); - - else if (menu != null) - menu.newInstance().displayTo((Player) c); - } - - protected final Menu getMenu() { - Valid.checkNotNull(menu, "Menu not set"); - - return menu; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/RewardCostConvo.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/RewardCostConvo.java deleted file mode 100644 index 55a19dedf9e56ac5fca6b2ad5cabfee3cdd513d6..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/RewardCostConvo.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.mineacademy.game.conversation; - -import org.bukkit.conversations.ConversationContext; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.ItemUtil; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.game.model.Reward; -import org.mineacademy.game.settings.Localization; - -public final class RewardCostConvo extends MenuNumberQuestion { - - private final Reward reward; - - public RewardCostConvo(Menu menu, Reward reward) { - super(menu); - - this.reward = reward; - } - - @Override - protected void onSuccess(ConversationContext context, Number input) { - reward.setCost(input.intValue()); - - CoreArenaPlugin.getRewadsManager().updateReward(reward); - tell(context.getForWhom(), Localization.Conversation.Reward.PRICE_SET.replace("{amount}", Localization.Currency.format(input.intValue()))); - - Common.runLater(1, new BukkitRunnable() { - - @Override - public void run() { - getMenu().displayTo((Player) context.getForWhom()); - } - }); - } - - @Override - protected String getQuestion() { - return Localization.Conversation.Reward.HELP.replace("{material}", ItemUtil.bountifyCapitalized(reward.getItem().getType())); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/SpawnerChanceConvo.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/SpawnerChanceConvo.java deleted file mode 100644 index ef242984eb432ba2659b82fc67f8cb302aafdff7..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/SpawnerChanceConvo.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.mineacademy.game.conversation; - -import org.bukkit.conversations.ConversationContext; -import org.mineacademy.game.menu.MenuMonsterSpawn; -import org.mineacademy.game.settings.Localization; - -public final class SpawnerChanceConvo extends MenuNumberQuestion { - - public SpawnerChanceConvo(MenuMonsterSpawn menu) { - super(menu); - } - - @Override - protected void onSuccess(ConversationContext context, Number input) { - final MenuMonsterSpawn menu = (MenuMonsterSpawn) getMenu(); - - menu.getSpawnPoint().setChance(input.intValue()); - menu.saveSpawnerChanges(); - - tell(context.getForWhom(), Localization.Conversation.SpawnerChance.SET.replace("{chance}", input.intValue() + "")); - } - - @Override - protected boolean isNumberValid(Number input) { - return input.intValue() <= 100; - } - - @Override - protected String getQuestion() { - return Localization.Conversation.SpawnerChance.HELP; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/SpawnerMinPlayerConvo.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/SpawnerMinPlayerConvo.java deleted file mode 100644 index 2c29ec0fd1e3e896b381ea2226963a537622242c..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/SpawnerMinPlayerConvo.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.mineacademy.game.conversation; - -import org.bukkit.conversations.ConversationContext; -import org.mineacademy.game.menu.MenuMonsterSpawn; -import org.mineacademy.game.settings.Localization; - -public final class SpawnerMinPlayerConvo extends MenuNumberQuestion { - - public SpawnerMinPlayerConvo(MenuMonsterSpawn menu) { - super(menu); - } - - @Override - protected void onSuccess(ConversationContext context, Number input) { - final MenuMonsterSpawn menu = (MenuMonsterSpawn) getMenu(); - - menu.getSpawnPoint().setMinimumPlayers(input.intValue()); - menu.saveSpawnerChanges(); - - tell(context.getForWhom(), Localization.Conversation.SpawnerMinPlayers.SET.replace("{amount_players}", Localization.Cases.PLAYER.formatWithCount(input.intValue()))); - } - - @Override - protected String getQuestion() { - return Localization.Conversation.SpawnerMinPlayers.HELP; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/SpawnerPhaseConvo.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/SpawnerPhaseConvo.java deleted file mode 100644 index 8f6ec3ff849fff6cf9bd0cf65b3f189154a8eb67..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/SpawnerPhaseConvo.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.mineacademy.game.conversation; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.bukkit.conversations.ConversationContext; -import org.bukkit.conversations.Prompt; -import org.bukkit.conversations.ValidatingPrompt; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.game.menu.MenuMonsterSpawn; -import org.mineacademy.game.model.ActivePeriod; -import org.mineacademy.game.model.ActivePeriod.ActiveMode; -import org.mineacademy.game.settings.Localization; - -public final class SpawnerPhaseConvo extends MenuQuestion { - - private static final Pattern INPUT_MATCHER = Pattern.compile(Localization.Conversation.Phase.MATCHER); - - public SpawnerPhaseConvo(MenuMonsterSpawn menu) { - super(menu); - } - - @Override - protected Prompt getFirstPrompt() { - return new ValidatingPrompt() { - - @Override - public String getPromptText(ConversationContext context) { - return Common.colorize(Localization.Conversation.Phase.HELP); - } - - @Override - protected boolean isInputValid(ConversationContext context, String input) { - return INPUT_MATCHER.matcher(input).matches(); - } - - @Override - protected String getFailedValidationText(ConversationContext context, String invalidInput) { - tellLater(1, context.getForWhom(), Localization.Conversation.INVALID_INPUT); - return null; - } - - @Override - protected Prompt acceptValidatedInput(ConversationContext context, String input) { - final MenuMonsterSpawn menu = (MenuMonsterSpawn) getMenu(); - - final Matcher m = INPUT_MATCHER.matcher(input); - m.find(); - - final ActiveMode mode = ActiveMode.fromName(m.group(1)); - final int limit = Integer.parseInt(m.group(2)); - final int limit2 = m.groupCount() > 3 && m.group(4) != null && input.contains("-") ? Integer.parseInt(m.group(4).replace("-", "")) : limit; - - final ActivePeriod period = new ActivePeriod(mode, limit, limit2); - - menu.getSpawnPoint().setActivePeriod(period); - menu.saveSpawnerChanges(); - - tell(context.getForWhom(), $(period)); - - return Prompt.END_OF_CONVERSATION; - } - - private String $(ActivePeriod period) { - return formatPeriod(period).replace("{period}", period.formatLimits()); - } - - private String formatPeriod(ActivePeriod period) { - switch (period.getMode()) { - case FROM: - return Localization.Conversation.Phase.SET_FROM; - - case ON: - return Localization.Conversation.Phase.SET_ON; - - case TILL: - return Localization.Conversation.Phase.SET_TILL; - - case BETWEEN: - return Localization.Conversation.Phase.SET_BETWEEN; - - default: - throw new FoException("Unhandled period: " + period.formatPeriod()); - } - } - }; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/TierCostConvo.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/TierCostConvo.java deleted file mode 100644 index d5d154e7761bd36b4d35c3c505446a3247cf5a9e..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/conversation/TierCostConvo.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.mineacademy.game.conversation; - -import org.bukkit.conversations.ConversationContext; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.game.model.ArenaClass; -import org.mineacademy.game.model.ClassTier; -import org.mineacademy.game.settings.Localization; - -public final class TierCostConvo extends MenuNumberQuestion { - - private final ArenaClass clazz; - private final ClassTier tier; - - public TierCostConvo(Menu menu, ArenaClass clazz, ClassTier tier) { - super(menu); - - this.clazz = clazz; - this.tier = tier; - } - - @Override - protected void onSuccess(ConversationContext context, Number input) { - tier.setLevelCost(input.intValue()); - clazz.addOrUpdateTier(tier); - - tell(context.getForWhom(), Localization.Conversation.Tier.PRICE_SET.replace("{amount}", Localization.Currency.format(input.intValue()))); - - Common.runLater(1, new BukkitRunnable() { - - @Override - public void run() { - getMenu().displayTo((Player) context.getForWhom()); - } - }); - } - - @Override - protected String getQuestion() { - return Localization.Conversation.Tier.HELP.replace("{class}", clazz.getName()).replace("{tier}", tier.getTier() + ""); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/countdown/ArenaCountdown.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/countdown/ArenaCountdown.java deleted file mode 100644 index c8779328a329236aabeb6b2291f6eacc0049fd0c..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/countdown/ArenaCountdown.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.mineacademy.game.countdown; - -import org.mineacademy.fo.model.Countdown; -import org.mineacademy.fo.remain.CompSound; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaMessenger; -import org.mineacademy.game.settings.Localization; - -import lombok.AccessLevel; -import lombok.Getter; - -@Getter(AccessLevel.PROTECTED) -public abstract class ArenaCountdown extends Countdown { - - private final Arena arena; - - protected ArenaCountdown(Arena arena, int seconds) { - super(seconds); - - this.arena = arena; - } - - protected void playSoundTimeLeft() { - final ArenaMessenger messenger = arena.getMessenger(); - - messenger.playSound(getTimeLeft() < 11 ? CompSound.NOTE_PIANO : CompSound.NOTE_STICKS, getTimeLeft() < 6 ? 2 : 1); - } - - protected final void broadcastLeft(String message) { - arena.getMessenger().broadcast(message.replace("{seconds}", Localization.Cases.SECOND.formatWithCount(getTimeLeft()))); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/countdown/EndCountdown.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/countdown/EndCountdown.java deleted file mode 100644 index afa8998701f99308d1e6ae5f76b4c113ddf3ddd0..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/countdown/EndCountdown.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.mineacademy.game.countdown; - -import org.mineacademy.fo.Valid; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.type.ArenaState; -import org.mineacademy.game.type.StopCause; - -public final class EndCountdown extends MomentedCountdown { - - public EndCountdown(Arena arena) { - super(arena, arena.getSettings().getArenaDurationSeconds()); - } - - @Override - protected void onInMomentTick() { - check(); - - broadcastLeft(Localization.Arena.Game.END_WARNING); - playSoundTimeLeft(); - } - - @Override - protected void onOutMomentTick() { - check(); - } - - private void check() { - Valid.checkBoolean(getArena().getState() == ArenaState.RUNNING, "Illegal state of " + getArena().getName() + " = " + getArena().getState()); - } - - @Override - protected void onEnd() { - getArena().stopArena(StopCause.NATURAL_COUNTDOWN); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/countdown/LaunchCountdown.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/countdown/LaunchCountdown.java deleted file mode 100644 index 5ef967fd8e11c811f70ad380a9612704a02d9756..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/countdown/LaunchCountdown.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.mineacademy.game.countdown; - -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.settings.Localization; - -public final class LaunchCountdown extends MomentedCountdown { - - public LaunchCountdown(Arena arena) { - super(arena, arena.getSettings().getLobbyDurationSeconds()); - } - - @Override - protected void onInMomentTick() { - broadcastLeft(Localization.Arena.Lobby.START_COUNTDOWN); - - playSoundTimeLeft(); - } - - @Override - protected void onOutMomentTick() { - } - - @Override - protected void onEnd() { - getArena().startArena(false); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/countdown/MomentedCountdown.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/countdown/MomentedCountdown.java deleted file mode 100644 index 57436f0bed4e2d1be82980b343ee4bc0eba48370..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/countdown/MomentedCountdown.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.mineacademy.game.countdown; - -import java.util.Set; - -import org.mineacademy.game.model.Arena; - -import com.google.common.collect.Sets; - -public abstract class MomentedCountdown extends ArenaCountdown { - - private final Set<Integer> moments = Sets.newHashSet(getCountdownSeconds() / 2, 720, 360, 180, 60, 30, 20, 10, 8, 6, 5, 4, 3, 2, 1); - - protected MomentedCountdown(Arena arena, int seconds) { - super(arena, seconds); - } - - @Override - protected final void onTick() { - if (moments.contains(getTimeLeft())) - onInMomentTick(); - else - onOutMomentTick(); - } - - protected abstract void onInMomentTick(); - - protected abstract void onOutMomentTick(); - -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/countdown/PhaseCountdown.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/countdown/PhaseCountdown.java deleted file mode 100644 index 6527cebe4180d87c92253d5bb4175ebf7d416418..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/countdown/PhaseCountdown.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.mineacademy.game.countdown; - -import org.mineacademy.fo.Common; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.type.StopCause; - -import lombok.Getter; - -public final class PhaseCountdown extends ArenaCountdown { - - @Getter - private final int durationSeconds; - - public PhaseCountdown(Arena arena, int durationSeconds) { - super(arena, arena.getSettings().getArenaDurationSeconds()); - - this.durationSeconds = durationSeconds; - } - - @Override - protected void onTick() { - if (getTimeLeft() == 1) - try { - getArena().getPhase().onNextPhase(); - - } catch (final Throwable t) { - Common.error(t, - "Arena " + getArena().getName() + " has failed entering phase: " + getArena().getPhase().getCurrent(), - "Stopping arena for safety.", - "%error"); - - getArena().stopArena(StopCause.INTERRUPTED_ERROR); - } - else - getArena().getPhase().onTimerTick(); - } - - @Override - protected void onEnd() { - } - - @Override - public int getTimeLeft() { - return durationSeconds - getSecondsSinceStart() % durationSeconds; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/data/ClassDataSection.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/data/ClassDataSection.java deleted file mode 100644 index 9082db999a83237e308ac603ecaacd94b9954f59..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/data/ClassDataSection.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.mineacademy.game.data; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.TreeSet; - -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.TimeUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.constants.FoConstants; -import org.mineacademy.fo.settings.YamlSectionConfig; -import org.mineacademy.game.impl.SimpleTier; -import org.mineacademy.game.model.ClassTier; - -import lombok.Getter; - -public final class ClassDataSection extends YamlSectionConfig { - - @Getter - private ItemStack icon; - - private StrictList<ClassTier> tiers = new StrictList<>(); - - public ClassDataSection(String className) { - super("Classes." + className); - - loadConfiguration(NO_DEFAULT, FoConstants.File.DATA); - } - - @Override - protected void onLoadFinish() { - if (!isSetAbsolute("Created")) - save("Created", TimeUtil.currentTimeSeconds()); - - loadIcon(); - loadTiers(); - } - - private void loadIcon() { - final Object obj = getObject("Icon"); - - this.icon = obj != null && obj instanceof ItemStack ? (ItemStack) obj : null; - } - - private void loadTiers() { - final TreeSet<ClassTier> sorted = new TreeSet<>(Comparator.comparingInt(ClassTier::getTier)); - - final List<?> tiersRaw = getList("Tiers"); - - if (tiersRaw != null) { - - final ArrayList<HashMap<String, Object>> maps = (ArrayList<HashMap<String, Object>>) tiersRaw; - - for (final HashMap<String, Object> map : maps) - if (!map.isEmpty()) { - final SimpleTier tier = SimpleTier.deserialize(SerializedMap.of(map), getClassName()); - - sorted.add(tier); - } - } - - { // Fix order - int startingTier = 1; - - for (final ClassTier tier : sorted) - tier.setTier(startingTier++); - } - - tiers = new StrictList<>(sorted); - } - - public void setIcon(ItemStack is) { - save("Icon", is); - - loadIcon(); - } - - public int getTiers() { - return tiers.size(); - } - - public ClassTier getTier(int tier) { - Valid.checkBoolean(tier > 0, "Cannot get the zero tier"); - - return tier > tiers.size() ? null : tiers.get(tier - 1); - } - - public void setTierNoSave(ClassTier tier) { - if (getTiers() >= tier.getTier()) - tiers.set(tier.getTier() - 1, tier); - else - tiers.add(tier); - } - - public void removeTier(ClassTier tier) { - tiers.remove(tier); - - saveAndReload(); - } - - public void saveUpdatedTier(ClassTier tier) { - setTierNoSave(tier); - - saveAndReload(); - } - - private void saveAndReload() { - save("Tiers", tiers); - loadTiers(); - } - - public String getClassName() { - return getSection().replace("Classes.", ""); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/data/GeneralDataSection.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/data/GeneralDataSection.java deleted file mode 100644 index 50303caf6dd11703f3ac2533c3b1838dfff1e2a6..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/data/GeneralDataSection.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.mineacademy.game.data; - -import java.util.UUID; - -import org.bukkit.Location; -import org.mineacademy.fo.constants.FoConstants; -import org.mineacademy.fo.settings.YamlSectionConfig; - -import lombok.Getter; - -public final class GeneralDataSection extends YamlSectionConfig { - - @Getter - private static final GeneralDataSection instance = new GeneralDataSection(); - - @Getter - private boolean snapshotNotified = false; - - public GeneralDataSection() { - super("Misc"); - - loadConfiguration(NO_DEFAULT, FoConstants.File.DATA); - } - - @Override - protected void onLoadFinish() { - snapshotNotified = getBoolean("Notified_Snapshot", false); - } - - public void setSnapshotNotified() { - save("Notified_Snapshot", true); - - onLoadFinish(); - } - - public void setPendingLocation(UUID id, Location loc) { - save("Locations." + id.toString(), loc); - } - - public Location getPendingLocation(UUID id) { - return getLocation("Locations." + id.toString()); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/data/RewardsDataSection.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/data/RewardsDataSection.java deleted file mode 100644 index b9436462b9fe0b4c79f82c8ee29ce2880a7c3dc3..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/data/RewardsDataSection.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.mineacademy.game.data; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.constants.FoConstants; -import org.mineacademy.fo.settings.YamlSectionConfig; -import org.mineacademy.game.impl.SimpleReward; -import org.mineacademy.game.model.Reward; -import org.mineacademy.game.type.RewardType; - -public final class RewardsDataSection extends YamlSectionConfig { - - private final StrictMap<RewardType, List<Reward>> rewards = new StrictMap<>(); - - public RewardsDataSection() { - super("Rewards"); - - loadConfiguration(NO_DEFAULT, FoConstants.File.DATA); - } - - @Override - protected void onLoadFinish() { - loadRewards(); - } - - private void loadRewards() { - rewards.clear(); - - for (final RewardType type : RewardType.values()) - loadReward(type); - } - - private void loadReward(RewardType type) { - final List<Reward> loaded = new ArrayList<>(); - final List<?> rewardsRaw = getList(type.toString()); - - if (rewardsRaw != null) { - - final ArrayList<HashMap<String, Object>> maps = (ArrayList<HashMap<String, Object>>) rewardsRaw; - - for (final HashMap<String, Object> map : maps) - if (map != null && !map.isEmpty()) { - final Reward reward = SimpleReward.deserialize(map); - - loaded.add(reward); - } else - loaded.add(null); - } - - rewards.put(type, loaded); - } - - public void setRewards(RewardType type, List<Reward> items) { - Valid.checkNotNull(items, "Report / Rewards cannot be null!"); - - rewards.override(type, items); - save(type.toString(), getRewards(type)); - - loadRewards(); - } - - public void updateReward(Reward reward) { - save(reward.getType().toString(), getRewards(reward.getType())); - loadRewards(); - } - - public List<Reward> getRewards(RewardType type) { - return rewards.getOrPut(type, new ArrayList<>()); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/data/UpgradeDataSection.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/data/UpgradeDataSection.java deleted file mode 100644 index dc20db6302f5b4e91fe3ed9572c10116a175d2ab..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/data/UpgradeDataSection.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.mineacademy.game.data; - -import java.util.List; - -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.TimeUtil; -import org.mineacademy.fo.constants.FoConstants; -import org.mineacademy.fo.settings.YamlSectionConfig; -import org.mineacademy.game.model.ArenaClass; - -import lombok.Getter; - -@Getter -public final class UpgradeDataSection extends YamlSectionConfig { - - private ArenaClass arenaClass; - private ItemStack[] items; - - public UpgradeDataSection(String upgradeName) { - super("Upgrades." + upgradeName); - - loadConfiguration(NO_DEFAULT, FoConstants.File.DATA); - } - - @Override - protected void onLoadFinish() { - if (!isSetAbsolute("Created")) - save("Created", TimeUtil.currentTimeSeconds()); - - loadArenaClass(); - loadItems(); - } - - private void loadArenaClass() { - final String className = getString("Class"); - - if (className != null) { - arenaClass = CoreArenaPlugin.getClassManager().findClass(className); - - if (arenaClass == null) { - Common.log("&cThe upgrade " + getUpgradeName() + " has assigned non-existing class " + className + ", removing.."); - - save("Class", null); - } - } else - arenaClass = null; - } - - private void loadItems() { - final Object items = getObject("Items"); - - if (items != null) - this.items = items instanceof List ? ((List<ItemStack>) items).toArray(new ItemStack[((List<ItemStack>) items).size()]) : (ItemStack[]) items; - } - - public void setArenaClass(ArenaClass clazz) { - save("Class", clazz != null ? clazz.getName() : null); - - onLoadFinish(); - } - - public void setItems(ItemStack[] items) { - save("Items", items); - - onLoadFinish(); - } - - public String getUpgradeName() { - return getSection().replace("Upgrades.", ""); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaJoinEvent.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaJoinEvent.java deleted file mode 100644 index 7a3f41d3cb0fd426c3669b2bfe19ff1c7430878f..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaJoinEvent.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.mineacademy.game.event; - -import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.type.JoinCause; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; - -/** - * Triggered when after the player has joined an arena. - */ -@RequiredArgsConstructor -@Getter -public final class ArenaJoinEvent extends Event { - - private static final HandlerList handlers = new HandlerList(); - - /** - * The arena - */ - private final Arena arena; - - /** - * Why the player has joined - */ - private final JoinCause cause; - - /** - * The player - */ - private final Player player; - - /** - * Shall other players in the lobby be informed about this player joining? - */ - @Setter - private boolean silent = false; - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaLeaveEvent.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaLeaveEvent.java deleted file mode 100644 index 579ed8145423421c7f07c92dd3dca7e89c526e83..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaLeaveEvent.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.mineacademy.game.event; - -import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.type.LeaveCause; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; - -/** - * Triggered when a player has left the arena. - */ -@Getter -@Setter -@RequiredArgsConstructor -public final class ArenaLeaveEvent extends Event { - - private static final HandlerList handlers = new HandlerList(); - - /** - * The arena - */ - private final Arena arena; - - /** - * The cause - */ - private final LeaveCause cause; - - /** - * The player - */ - private final Player player; - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaLobbyTeleportEvent.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaLobbyTeleportEvent.java deleted file mode 100644 index cd736cbd779cb5e778313848077706ea93de6893..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaLobbyTeleportEvent.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.mineacademy.game.event; - -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -import org.mineacademy.game.model.Arena; - -import lombok.Getter; -import lombok.Setter; - -/** - * Triggered when the player is teleported to the arena lobby. - */ -@Getter -@Setter -public final class ArenaLobbyTeleportEvent extends Event implements Cancellable { - - private static final HandlerList handlers = new HandlerList(); - - /** - * The player - */ - private final Player player; - - /** - * The arena - */ - private final Arena arena; - - /** - * The location where to teleport the player, can be changed - */ - private Location location; - - /** - * Should we do not teleport? - */ - private boolean cancelled; - - public ArenaLobbyTeleportEvent(Player player, Arena arena, Location location) { - this.player = player; - this.arena = arena; - this.location = location; - } - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaPostStartEvent.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaPostStartEvent.java deleted file mode 100644 index b71c27639b26360b608754f4c9ea116b4928d10c..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaPostStartEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.mineacademy.game.event; - -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -import org.mineacademy.game.model.Arena; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * Triggered when the arena starts after the lobby wait time has finished. - */ -@Getter -@RequiredArgsConstructor -public final class ArenaPostStartEvent extends Event { - - private static final HandlerList handlers = new HandlerList(); - - /** - * The arena - */ - private final Arena arena; - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaPostStopEvent.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaPostStopEvent.java deleted file mode 100644 index 4d50075c0fcd2fbd0eb3f9fb5d8b1e120458b064..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaPostStopEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.mineacademy.game.event; - -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.type.StopCause; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * Triggered after the arena stopped for any reason (stop command, reload, error, or naturally) - */ -@Getter -@RequiredArgsConstructor -public final class ArenaPostStopEvent extends Event { - - private static final HandlerList handlers = new HandlerList(); - - /** - * The arena - */ - private final Arena arena; - - /** - * Why is the arena stopping - */ - private final StopCause cause; - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaPreJoinEvent.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaPreJoinEvent.java deleted file mode 100644 index 831cd6e7869cac48f78054c9a4e0841727f79415..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaPreJoinEvent.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.mineacademy.game.event; - -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.type.JoinCause; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; - -/** - * Triggered when the a player attempts to join an arena. - */ -@Getter -@Setter -@RequiredArgsConstructor -public final class ArenaPreJoinEvent extends Event implements Cancellable { - - private static final HandlerList handlers = new HandlerList(); - - /** - * The arena - */ - private final Arena arena; - - /** - * The cause - */ - private final JoinCause cause; - - /** - * The player - */ - private final Player player; - - /** - * Cancel joining? - */ - private boolean cancelled; - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaPreLeaveEvent.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaPreLeaveEvent.java deleted file mode 100644 index 615733062fd25c237c9974e5520c1917cc730245..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ArenaPreLeaveEvent.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.mineacademy.game.event; - -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.type.LeaveCause; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; - -/** - * Triggered when a player attempts to leave the arena. - */ -@Getter -@Setter -@RequiredArgsConstructor -public final class ArenaPreLeaveEvent extends Event implements Cancellable { - - private static final HandlerList handlers = new HandlerList(); - - /** - * The arena - */ - private final Arena arena; - - /** - * Why is he leaving - */ - private final LeaveCause cause; - - /** - * The player - */ - private final Player player; - - /** - * Prevent that he leaves the arena? - */ - private boolean cancelled = false; - - /** - * Do not broadcast that he left? - */ - private boolean silent = false; - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ClassObtainEvent.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ClassObtainEvent.java deleted file mode 100644 index b60fffbe8793a5efcde6462c8418acf4f72a154e..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/ClassObtainEvent.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.mineacademy.game.event; - -import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -import org.mineacademy.game.model.ArenaClass; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * Triggered before the a player attempts to receive a class. - */ -@Getter -@RequiredArgsConstructor -public final class ClassObtainEvent extends Event { - - private static final HandlerList handlers = new HandlerList(); - - /** - * The player - */ - private final Player player; - - /** - * The class - */ - private final ArenaClass arenaClass; - - /** - * The tier - */ - private final int tier; - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/LobbyStartEvent.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/event/LobbyStartEvent.java deleted file mode 100644 index 0c23a85abca01f3086f6c26800d2774e0d5f812c..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/LobbyStartEvent.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.mineacademy.game.event; - -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -import org.mineacademy.game.model.Arena; - -import lombok.Getter; -import lombok.Setter; - -/** - * Triggered when the lobby starts when the first player joins. - */ -@Getter -@Setter -public final class LobbyStartEvent extends Event { - - private static final HandlerList handlers = new HandlerList(); - - /** - * The arena - */ - private final Arena arena; - - /** - * How many seconds should the lobby vary? - */ - private int countdown; - - public LobbyStartEvent(Arena arena) { - this.arena = arena; - this.countdown = arena.getSettings().getLobbyDurationSeconds(); - } - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/PluginShouldFireMenuEvent.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/event/PluginShouldFireMenuEvent.java deleted file mode 100644 index b145e2b4375c5fc1d0a50c81fc13418cf8b82bee..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/PluginShouldFireMenuEvent.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.mineacademy.game.event; - -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -import org.mineacademy.game.model.ArenaPlugin; -import org.mineacademy.game.type.MenuType; - -import lombok.Getter; -import lombok.Setter; - -/** - * An event indicating to a third party plugin that they should - * open a class menu. - */ -@Getter -public final class PluginShouldFireMenuEvent extends Event implements Cancellable { - - private static final HandlerList handlers = new HandlerList(); - - /** - * What plugin - */ - private final ArenaPlugin plugin; - - /** - * What menu to open - */ - private final MenuType type; - - /** - * The player to whom to open - */ - private final Player player; - - /** - * The data to be put into the menu class when initializing - */ - private final Object[] data; - - public PluginShouldFireMenuEvent(ArenaPlugin plugin, MenuType type, Player player, Object... data) { - this.plugin = plugin; - this.type = type; - this.player = player; - this.data = data; - } - - /** - * Should we prevent to display this menu? - */ - @Setter - private boolean cancelled; - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/SpawnTeleportEvent.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/event/SpawnTeleportEvent.java deleted file mode 100644 index d0045e736ebf08c2d3955c42343673929315cacc..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/event/SpawnTeleportEvent.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.mineacademy.game.event; - -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; - -import lombok.Getter; -import lombok.Setter; - -/** - * Triggered when the player is teleported back to spawn. - */ -@Getter -@Setter -public final class SpawnTeleportEvent extends Event implements Cancellable { - - private static final HandlerList handlers = new HandlerList(); - - /** - * The player - */ - private final Player player; - - /** - * The location - */ - private Location location; - - /** - * Should we cancel the teleport? - */ - private boolean cancelled; - - public SpawnTeleportEvent(Player player, Location location) { - this.player = player; - this.location = location; - } - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/exception/CancelledException.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/exception/CancelledException.java deleted file mode 100644 index dfa4520a0c95f4856872d1b88b9c62ec2c7d5842..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/exception/CancelledException.java +++ /dev/null @@ -1,6 +0,0 @@ -package org.mineacademy.game.exception; - -public final class CancelledException extends RuntimeException { - - private static final long serialVersionUID = 1L; -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/exception/EventHandledException.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/exception/EventHandledException.java deleted file mode 100644 index 957e5e90ed022e13418a523795546478c62edd01..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/exception/EventHandledException.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.mineacademy.game.exception; - -/** - * - * Methods that throw this are usually handled so: - * - * SimpleImpl --> FeatureImpl --> SpecificImpl - * - * Represents that a method in the pipeline does not - * need to be handled further with "super." or similar. - */ -public final class EventHandledException extends RuntimeException { - private static final long serialVersionUID = 1L; -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/exception/IllegalSignException.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/exception/IllegalSignException.java deleted file mode 100644 index 596e179ecb401d9e303cb7f373d8e7aa903631b9..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/exception/IllegalSignException.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.mineacademy.game.exception; - -import lombok.Getter; - -public class IllegalSignException extends RuntimeException { - - private static final long serialVersionUID = 1L; - - @Getter - private final String problem; - - public IllegalSignException(String message) { - this.problem = message; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/exp/ExpFormula.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/exp/ExpFormula.java deleted file mode 100644 index f13cf1bda24a800c4effc742fbb4e290e2f219c9..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/exp/ExpFormula.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.mineacademy.game.exp; - -import org.mineacademy.fo.MathUtil; -import org.mineacademy.game.model.Arena; - -import lombok.RequiredArgsConstructor; - -@RequiredArgsConstructor -public final class ExpFormula { - - private final String formula; - - public int calculate(final int phase) { - return (int) MathUtil.calculate(formula.replace("{phase}", phase + "")); - } - - public int calculate(final int phase, final int reward, final int players, final int maxPlayers) { - return (int) MathUtil.ceiling(MathUtil.calculate(formula - .replace("{reward}", reward + "") - .replace("{phase}", phase + "") - .replace("{players}", players + "") - .replace("{maxPlayers}", maxPlayers + ""))); - } - - public int calculate(final int reward, final Arena arena) { - return (int) MathUtil.ceiling(MathUtil.calculate(formula - .replace("{reward}", reward + "") - .replace("{phase}", arena.getPhase().getCurrent() + "") - .replace("{players}", arena.getPlayers().size() + "") - .replace("{maxPlayers}", arena.getSettings().getMaximumPlayers() + ""))); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/exp/ExpItemHandler.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/exp/ExpItemHandler.java deleted file mode 100644 index 94fe6f3b6c4a63f8ea21761ed8867d7633120ef3..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/exp/ExpItemHandler.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.mineacademy.game.exp; - -import java.util.function.Consumer; - -import org.bukkit.Location; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Item; -import org.bukkit.inventory.ItemStack; -import org.bukkit.metadata.FixedMetadataValue; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.EntityUtil; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.model.SimpleEnchant; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.game.model.ExpItem; -import org.mineacademy.game.settings.Settings; -import org.mineacademy.game.util.Constants; - -public final class ExpItemHandler { - - public static void spawn(Location location, int exp) { - if (Settings.Experience.ITEM == CompMaterial.AIR) - return; - - final ItemStack item = createItem(exp); - final Item spawned; - - final Consumer<Item> decorator = i -> { - Remain.setCustomName(i, item.getItemMeta().getDisplayName()); - - i.setPickupDelay(10); - addDroppedTag(i, new ExpItem(exp)); - }; - - if (MinecraftVersion.olderThan(V.v1_8)) { - spawned = location.getWorld().dropItem(location, item); - decorator.accept(spawned); - - } else - spawned = EntityUtil.dropItem(location, item, decorator); - - Valid.checkNotNull(spawned, "Report / Unable to spawn experience item"); - } - - private static ItemStack createItem(int exp) { - return ItemCreator - .of(Settings.Experience.ITEM) - .name(Settings.Experience.ITEM_LABEL.replace("{amount}", exp + "")) - .enchant(new SimpleEnchant(Enchantment.DURABILITY)) - .build().make(); - } - - public static ExpItem getExpItem(Item item) { - Valid.checkBoolean(isExpItem(item), "Item " + item.getItemStack().getType() + " does not have dropped tag"); - - return (ExpItem) item.getMetadata(Constants.Items.EXP_ITEM_TAG).get(0).value(); - } - - public static boolean isExpItem(Entity item) { - return item.hasMetadata(Constants.Items.EXP_ITEM_TAG); - } - - static void addDroppedTag(Item item, ExpItem tag) { - Valid.checkBoolean(!isExpItem(item), "Item " + item.getItemStack().getType() + " has already tag"); - - item.setMetadata(Constants.Items.EXP_ITEM_TAG, new FixedMetadataValue(CoreArenaPlugin.getInstance(), tag)); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/hook/ArenaPAPIPlaceholder.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/hook/ArenaPAPIPlaceholder.java deleted file mode 100644 index 0df46a0d612d7891742b7c959085c78446f4152e..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/hook/ArenaPAPIPlaceholder.java +++ /dev/null @@ -1,192 +0,0 @@ -package org.mineacademy.game.hook; - -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.Nullable; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.EntityUtil; -import org.mineacademy.fo.MathUtil; -import org.mineacademy.fo.TimeUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.game.impl.ArenaPlayer; -import org.mineacademy.game.model.Arena; - -import me.clip.placeholderapi.expansion.PlaceholderExpansion; - -public final class ArenaPAPIPlaceholder extends PlaceholderExpansion { - - @Override - public String getIdentifier() { - return SimplePlugin.getNamed(); - } - - @Override - public String getAuthor() { - return SimplePlugin.getInstance().getDescription().getAuthors().get(0); - } - - @Override - public String getVersion() { - return SimplePlugin.getVersion(); - } - - @Override - public boolean persist() { - return true; - } - - @Override - public boolean canRegister() { - return true; - } - - @Override - @Nullable - public String onPlaceholderRequest(Player player, String identifier) { - final String[] args = identifier.split("\\_"); - final ArenaPlayer cache = player != null ? CoreArenaPlugin.getDataFor(player) : null; - - if (player != null) { - if (identifier.equalsIgnoreCase("is_playing")) - return cache.hasArenaCache() ? "yes" : "no"; - - else if (identifier.equalsIgnoreCase("nuggets")) - return String.valueOf(cache.getNuggets()); - - else if (identifier.equalsIgnoreCase("class")) - return cache.getClassCache().assignedClass != null ? cache.getClassCache().assignedClass.getName() : "none"; - - // arena_name - if (args.length == 1) { - if ("arena".equals(identifier)) - return cache.hasArenaCache() ? cache.getArenaCache().getArena(player).getName() : "dead"; - - return null; - } - } - - final String arenaName = args[0]; - Arena arena = CoreArenaPlugin.getArenaManager().findArena(arenaName); - - if (arena == null && cache != null && cache.hasArenaCache() && "player".equals(arenaName)) - arena = cache.getArenaCache().getArena(player); - - if (arena == null) - return "no arena " + arenaName; - - // arenaname_player_{X}_{variable} - if (args.length == 4 && "player".equals(args[1]) && Valid.isInteger(args[2])) { - final List<Player> players = new ArrayList<>(arena.getPlayers()); - final int playerNumber = Integer.parseInt(args[2]) - 1; - final Player selected = playerNumber < players.size() && playerNumber >= 0 ? players.get(playerNumber) : null; - - return parseVariables(arena, args[3], selected, args); - } - - // arenaname_{player}_{variable} - else if (args.length == 3) { - Player selected = Bukkit.getPlayer(args[1]); - - if (selected == null && player != null && "current".equals(args[1])) - selected = player; - - return parseVariables(arena, args[2], selected, args); - } - - // arenaname_variable - else if (args.length == 2) { - final String param = args[1]; - - if ("mobcount".equals(param)) - return String.valueOf(arena.getAliveMonsters()); - - else if ("maxphase".equals(param)) - return String.valueOf(arena.getSettings().getMaxPhase() == -1 ? "infinite" : arena.getSettings().getMaxPhase()); - - else if ("phase".equals(param)) - return String.valueOf(arena.getPhase().getCurrent()); - - else if ("remaining".equals(param)) - return arena.getRemainingSeconds() > 7200 ? "never" : TimeUtil.formatTimeShort(arena.getRemainingSeconds()); - - else if ("alive".equals(param)) - return String.valueOf(arena.getPlayers().size()); - - else if ("lives".equals(param)) - return String.valueOf(arena.getSettings().getLifes()); - - } - - return null; - } - - private String parseVariables(Arena arena, String param, Player selected, String[] args) { - if (selected == null) - return "dead"; - - if ("name".equals(param)) - return selected.getName(); - - final ArenaPlayer cache = CoreArenaPlugin.getDataFor(selected); - - if (!cache.hasArenaCache()) - return "dead"; - - if ("health".equals(param)) - return selected.isDead() ? "dead" : MathUtil.formatTwoDigits(selected.getHealth()); - - else if ("location".contains(param)) { - final Location loc = selected.getLocation(); - - return selected.isDead() ? "dead" : "x:" + loc.getBlockX() + " y:" + loc.getBlockY() + " z:" + loc.getBlockZ(); - } - - else if ("exp".equals(param)) - return String.valueOf(cache.getArenaCache().getExp()); - - else if ("level".equals(param)) - return String.valueOf(cache.getArenaCache().getLevel()); - - else if ("livesleft".equals(param)) - return String.valueOf(cache.getArenaCache().lifesLeft); - - else if ("nearestmob".equals(param)) { - final Location playerLocation = selected.getLocation(); - Location closest = null; - - for (final Entity entity : arena.getData().getRegion().getEntities()) - if (EntityUtil.isAggressive(entity)) { - final Location entityLocation = entity.getLocation(); - - if (closest == null || entityLocation.distance(playerLocation) < closest.distance(playerLocation)) - closest = entityLocation; - } - - return closest == null ? "no mobs" : closest.getBlockX() + " " + closest.getBlockY() + " " + closest.getBlockZ(); - } - - else if ("nearestmobmeters".equals(param)) { - final Location playerLocation = selected.getLocation(); - Location closest = null; - - for (final Entity entity : arena.getData().getRegion().getEntities()) - if (EntityUtil.isAggressive(entity)) { - final Location entityLocation = entity.getLocation(); - - if (closest == null || entityLocation.distance(playerLocation) < closest.distance(playerLocation)) - closest = entityLocation; - } - - return closest == null ? "no mobs" : MathUtil.formatTwoDigits(closest.distance(playerLocation)) + "m"; - } - - return null; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/hook/JobsListener.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/hook/JobsListener.java deleted file mode 100644 index ce52f1fef26b75a62c0a2e116d86e58305223f55..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/hook/JobsListener.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.mineacademy.game.hook; - -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.mineacademy.corearena.CoreArenaPlugin; - -import com.gamingmesh.jobs.api.JobsLevelUpEvent; -import com.gamingmesh.jobs.container.JobsPlayer; - -public class JobsListener implements Listener { - - @EventHandler - public final void onLevelUp(JobsLevelUpEvent e) { - final JobsPlayer player = e.getPlayer(); - - if (player != null && CoreArenaPlugin.getArenaManager().isPlaying(player.getPlayer())) - e.setCancelled(true); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/hook/McMMOListener.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/hook/McMMOListener.java deleted file mode 100644 index c5ad6cac65d52770ce41fd876a3daf0c2310d3bf..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/hook/McMMOListener.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.mineacademy.game.hook; - -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.mineacademy.corearena.CoreArenaPlugin; - -import com.gmail.nossr50.events.experience.McMMOPlayerLevelDownEvent; -import com.gmail.nossr50.events.experience.McMMOPlayerLevelUpEvent; -import com.gmail.nossr50.events.experience.McMMOPlayerXpGainEvent; -import com.gmail.nossr50.events.hardcore.McMMOPlayerDeathPenaltyEvent; -import com.gmail.nossr50.events.items.McMMOItemSpawnEvent; -import com.gmail.nossr50.events.skills.abilities.McMMOPlayerAbilityActivateEvent; -import com.gmail.nossr50.events.skills.alchemy.McMMOPlayerBrewEvent; - -public class McMMOListener implements Listener { - - @EventHandler - public final void mcmmo(McMMOPlayerAbilityActivateEvent e) { - cancelIfPlaying(e.getPlayer(), e); - } - - @EventHandler - public final void mcmmo(McMMOPlayerDeathPenaltyEvent e) { - cancelIfPlaying(e.getPlayer(), e); - } - - @EventHandler - public final void mcmmo(McMMOPlayerXpGainEvent e) { - cancelIfPlaying(e.getPlayer(), e); - } - - @EventHandler - public final void mcmmo(McMMOPlayerLevelUpEvent e) { - cancelIfPlaying(e.getPlayer(), e); - } - - @EventHandler - public final void mcmmo(McMMOPlayerLevelDownEvent e) { - cancelIfPlaying(e.getPlayer(), e); - } - - @EventHandler - public final void mcmmo(McMMOItemSpawnEvent e) { - if (CoreArenaPlugin.getArenaManager().findArena(e.getLocation()) != null) - e.setCancelled(true); - } - - @EventHandler - public final void mcmmo(McMMOPlayerBrewEvent e) { - cancelIfPlaying(e.getPlayer(), e); - } - - private final boolean cancelIfPlaying(Player pl, Cancellable e) { - if (CoreArenaPlugin.getArenaManager().isPlaying(pl)) { - e.setCancelled(true); - - return true; - } - - return false; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/hook/StackMobListener.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/hook/StackMobListener.java deleted file mode 100644 index a0ea4f5583fdeb4ab64e30a15180a693ced88d4b..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/hook/StackMobListener.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.mineacademy.game.hook; - -import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaManager; - -import uk.antiperson.stackmob.entity.StackEntity; -import uk.antiperson.stackmob.events.StackMergeEvent; - -public class StackMobListener implements Listener { - - @EventHandler - public final void onEntityStack(StackMergeEvent event) { - final StackEntity stacked = event.getStackEntity(); - final StackEntity nearby = event.getNearbyStackEntity(); - - if (stacked != null) { - final ArenaManager manager = CoreArenaPlugin.getArenaManager(); - - final Arena arena = manager.findArena(stacked.getEntity().getLocation()); - final Arena arenaSecond = manager.findArena(nearby.getEntity().getLocation()); - - if (arena != null || arenaSecond != null) - event.setCancelled(true); - } - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/ArenaPlayer.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/ArenaPlayer.java deleted file mode 100644 index f90cf6b157f214c9f5c20bbf53246e4708205b1c..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/ArenaPlayer.java +++ /dev/null @@ -1,301 +0,0 @@ -package org.mineacademy.game.impl; - -import java.util.HashMap; -import java.util.UUID; - -import org.bukkit.Location; -import org.bukkit.configuration.MemorySection; -import org.bukkit.entity.Player; -import org.bukkit.permissions.PermissionAttachment; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.MathUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.constants.FoConstants; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.settings.YamlSectionConfig; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaClass; -import org.mineacademy.game.model.SpawnPoint; -import org.mineacademy.game.settings.Settings; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; - -public final class ArenaPlayer extends YamlSectionConfig { - - // -------------------------------------------------------------------------------- - // Data saved to data.db - // -------------------------------------------------------------------------------- - - @Getter - private final UUID uuid; - - @Getter - private final String playerName; - - @Getter - private int nuggets; - - private StrictMap<String, Integer> purchasedTiers = new StrictMap<>(); - - // -------------------------------------------------------------------------------- - // Internal data - // -------------------------------------------------------------------------------- - - private InArenaCache arenaCache; - private SetupCache setupCache; - private ClassCache classCache; - - public final class ClassCache { - /** - * The player's class, if any - */ - public ArenaClass assignedClass; - - /** - * Tier of his class. - */ - public int classTier; - } - - @RequiredArgsConstructor(access = AccessLevel.PRIVATE) - public final class InArenaCache { - - /** - * Name of the location from which the player escaped boredom. - */ - public final Location prevLocation; - - /** - * Whether the kicking process has been initiated - */ - public boolean pendingRemoval = false; - - /** - * Whether the joining process has been initiated - */ - public boolean pendingJoining = false; - - /** - * The player's spawn point, if any - */ - public SpawnPoint spawnPoint; - - /** - * How many lifes left, if configured - */ - public int lifesLeft = -1; - - /** - * Temporary permissions - */ - public StrictList<PermissionAttachment> givenPermissions = new StrictList<>(); - - /** - * The experience points - */ - @Getter - private int exp; - - /** - * The experience levels - */ - @Getter - private int level; - - public Arena getArena(Player player) { - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(player); - Valid.checkNotNull(arena, "Player " + player.getName() + " has arena cache but lacks an arena!"); - - return arena; - } - - public void giveAndShowExp(Player pl, int expToGive) { - final double totalExp = exp + expToGive; - - // Calculate levels to give - final double levelsToGive = level + totalExp / Settings.Experience.EXP_PER_LEVEL; - - final int newLevel = (int) MathUtil.floor(levelsToGive); - - // Calculate rest experience - final String[] split = Double.toString(levelsToGive).split("\\."); - Valid.checkBoolean(split.length == 2, "Malformed level calculation length " + split.length); - - final double rest = Double.parseDouble("0." + split[1]); - final int newExp = (int) Math.round(rest * Settings.Experience.EXP_PER_LEVEL); - - level = newLevel; - exp = newExp; - - updateExpBar(pl); - } - - public void takeAndShowLevels(Player pl, int levels) { - Valid.checkBoolean(level >= levels, "Cannot take more levels than player have (" + level + " < " + levels + ")!"); - level = level - levels; - - updateExpBar(pl); - } - - private void updateExpBar(Player pl) { - pl.setExp((float) ((double) exp / Settings.Experience.EXP_PER_LEVEL)); - pl.setLevel(level); - } - } - - @Setter - public final class SetupCache { - - /** - * The arena player is editing - */ - public final Arena arena; - - /** - * His scoreboard when editing - */ - private SimpleSidebarEdit sidebar; - - public SetupCache(Arena arena) { - this.arena = arena; - this.sidebar = new SimpleSidebarEdit(arena); - } - - public void showSidebar(Player player) { - if (sidebar != null && !sidebar.isViewing(player)) - sidebar.show(player); - } - - public void hideSidebar(Player player) { - if (sidebar != null && sidebar.isViewing(player)) - sidebar.hide(player); - } - } - - // -------------------------------------------------------------------------------- - // Loading - // -------------------------------------------------------------------------------- - - public ArenaPlayer(UUID uuid, String name) { - super("Players." + uuid.toString()); - - this.uuid = uuid; - this.playerName = name; - - loadConfiguration(NO_DEFAULT, FoConstants.File.DATA); - } - - @Override - protected void onLoadFinish() { - this.nuggets = getInteger("Nuggets", 0); - - loadPurchasedTiers(); - } - - private void loadPurchasedTiers() { - final Object tiersRaw = getObject("Tiers"); - - if (tiersRaw != null) - if (tiersRaw instanceof MemorySection) { - final MemorySection section = (MemorySection) tiersRaw; - - for (final String tier : section.getKeys(false)) { - final int level = section.getInt(tier); - - purchasedTiers.override(tier, level); - } - - } else if (tiersRaw instanceof HashMap) { - final HashMap<String, Integer> map = (HashMap<String, Integer>) tiersRaw; - - purchasedTiers = new StrictMap<>(map); - } - } - - // -------------------------------------------------------------------------------- - // Gettings for data.db - // -------------------------------------------------------------------------------- - - public void setNuggets(int nuggets) { - this.nuggets = nuggets; - - save("Nuggets", nuggets); - - if (Settings.MySQL.AGGRESIVE) - MySQLDatabase.save(this, true); - } - - public int getTierOf(ArenaClass clazz) { - return purchasedTiers.getOrDefault(clazz.getName(), 1); - } - - public void setHigherTier(ArenaClass clazz) { - final int currentTier = purchasedTiers.getOrDefault(clazz.getName(), 1); - final int newTier = currentTier + 1; - - Valid.checkBoolean(newTier <= clazz.getTiers(), "Report / Cannot upgrade to a higher tier then class supports! " + newTier + " vs " + clazz.getTiers()); - - purchasedTiers.override(clazz.getName(), newTier); - save("Tiers", purchasedTiers); - - loadPurchasedTiers(); - } - - // -------------------------------------------------------------------------------- - // Other getters - // -------------------------------------------------------------------------------- - - public ClassCache getClassCache() { - if (classCache == null) - classCache = new ClassCache(); - - return classCache; - } - - public void setCurrentSetup(Arena arena) { - Valid.checkBoolean(setupCache == null, "Setup cache already set for arena " + (setupCache != null ? setupCache.arena.getName() : "null") + "!"); - - this.setupCache = new SetupCache(arena); - } - - public void removeCurrentSetup() { - setupCache = null; - } - - public SetupCache getSetupCache() { - Valid.checkNotNull(setupCache, "Player cache has not any setup!"); - - return setupCache; - } - - public boolean hasSetupCache() { - return setupCache != null; - } - - public void setCurrentArena(Player player, Arena arena) { - if (arenaCache != null) - throw new FoException("Arena cache already set! " + player.getName() + " plays " + CoreArenaPlugin.getArenaManager().findArena(player)); - - this.arenaCache = new InArenaCache(player.getLocation()); - } - - public void removeCurrentArena() { - arenaCache = null; - classCache = null; - } - - public InArenaCache getArenaCache() { - Valid.checkNotNull(arenaCache, "Player cache has not any arena!"); - - return arenaCache; - } - - public boolean hasArenaCache() { - return arenaCache != null; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/MySQLDatabase.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/MySQLDatabase.java deleted file mode 100644 index 02066af561414781ce81b9021e90c21f16e10675..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/MySQLDatabase.java +++ /dev/null @@ -1,142 +0,0 @@ -package org.mineacademy.game.impl; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.UUID; - -import org.mineacademy.fo.Common; -import org.mineacademy.fo.TimeUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.database.SimpleDatabase; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.game.settings.Settings; - -public abstract class MySQLDatabase extends SimpleDatabase { - - // ------------------------------------------------------------------------ - - private static MySQLDatabase instance; - - public static final void setInstance(String table, String line, String user, String password) { - instance = new SimpleMySQLDatabase(table, line, user, password); - } - - public static final void load(ArenaPlayer cache) { - if (instance != null && Settings.MySQL.ENABLED) - instance.loadIfStored(cache); - } - - public static final void save(ArenaPlayer cache, boolean createIfNoData) { - if (instance != null && Settings.MySQL.ENABLED) - instance.saveOrUpdate(cache, createIfNoData); - } - - // ------------------------------------------------------------------------ - - /** - * A flag indicating we should save to MySQL immediatelly after load. - */ - protected boolean saveAfterLoad = false; - - private boolean doingUpdates = true; - - public MySQLDatabase(String table, String line, String user, String password) { - connect(line, user, password, table); - } - - @Override - protected void onConnected() { - update("CREATE TABLE IF NOT EXISTS " + getTable() + "(UUID varchar(64), Data text)"); - } - - private final void loadIfStored(ArenaPlayer cache) { - saveAfterLoad = false; - - if (!isLoaded() || cache.getUuid() == null || !doingUpdates) - return; - - try { - final long now = System.currentTimeMillis(); - - final ResultSet rs = query("SELECT * FROM " + getTable() + " WHERE UUID= '" + cache.getUuid() + "'"); - final String data = rs.next() ? rs.getString("Data") : "{}"; - final SerializedMap parsed = SerializedMap.fromJson(data); - - // Always load even if not stored (due to saveAfterLoad flag) - doingUpdates = false; - loadData(parsed, cache); - doingUpdates = true; - - if (saveAfterLoad) { - saveAfterLoad = false; - - saveOrUpdate(cache, true); - } - - rs.close(); - Debugger.debug("mysql", "Loaded MySQL data for " + cache.getName() + " took " + (System.currentTimeMillis() - now) + " ms"); - - } catch (final Throwable e) { - Common.error(e, "Error while loading MySQL data!", "Player: " + cache.getName(), "Error: %error"); - } - } - - protected abstract void loadData(SerializedMap map, ArenaPlayer data); - - private final void saveOrUpdate(ArenaPlayer cache, boolean createIfNoData) { - if (!isLoaded() || !doingUpdates || cache.getUuid() == null) - return; - - doingUpdates = false; - - try { - final long now = System.currentTimeMillis(); - final UUID uuid = cache.getUuid(); - final SerializedMap data = saveData(cache); - - if (!data.isEmpty()) { - data.put("last-update", TimeUtil.currentTimeSeconds()); - - if (!isPlayerStored(uuid)) { - if (createIfNoData) { - update("INSERT INTO " + getTable() + "(UUID, Data) VALUES ('" + uuid.toString() + "', '" + data.toJson() + "');"); - Debugger.debug("mysql", "&bMaking new MySQL data for " + cache.getName()); - - } else - Debugger.debug("mysql", "&cSkipping saving MySQL for " + cache.getName() + " due to no data"); - - } else { - Debugger.debug("mysql", "&aUpdating MySQL data for " + cache.getName() + " took " + (System.currentTimeMillis() - now) + " ms"); - update("UPDATE " + getTable() + " SET Data= '" + data.toJson() + "' WHERE UUID= '" + uuid.toString() + "';"); - } - - } else - Debugger.debug("mysql", "&cSkipping save/update MySQL for " + cache.getName() + " as it's empty!"); - - } finally { - doingUpdates = true; - } - } - - protected abstract SerializedMap saveData(ArenaPlayer data); - - private final boolean isPlayerStored(UUID uuid) { - Valid.checkNotNull(uuid, "UUID cannot be null"); - - try { - try (ResultSet rs = query("SELECT * FROM " + getTable() + " WHERE UUID= '" + uuid.toString() + "'")) { - if (rs == null) - return false; - - if (rs.next()) - return rs.getString("UUID") != null; - } - - } catch (final SQLException e) { - e.printStackTrace(); - } - - return false; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleArmorContent.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleArmorContent.java deleted file mode 100644 index 7eec7a51650e4d11476bd31081ab23e6d56b66d7..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleArmorContent.java +++ /dev/null @@ -1,79 +0,0 @@ -package org.mineacademy.game.impl; - -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.game.model.ArmorContent; - -public class SimpleArmorContent implements ArmorContent { - - private final ItemStack[] items; - - private SimpleArmorContent(ItemStack[] items) { - Valid.checkBoolean(items.length == 4, "Armor must have the length of 4, not " + items.length); - - this.items = items; - } - - @Override - public final ItemStack getHelmet() { - return items[0]; - } - - @Override - public final ItemStack getChestplate() { - return items[1]; - } - - @Override - public final ItemStack getLeggings() { - return items[2]; - } - - @Override - public final ItemStack getBoots() { - return items[3]; - } - - @Override - public final ItemStack getByOrder(int order) { - return items[order]; - } - - @Override - public final void giveTo(Player pl) { - final PlayerInventory inv = pl.getInventory(); - - inv.setHelmet(getHelmet()); - inv.setChestplate(getChestplate()); - inv.setLeggings(getLeggings()); - inv.setBoots(getBoots()); - } - - @Override - public SerializedMap serialize() { - final SerializedMap map = new SerializedMap(); - - map.putIfExist("helmet", getHelmet()); - map.putIfExist("chestplate", getChestplate()); - map.putIfExist("leggings", getLeggings()); - map.putIfExist("boots", getBoots()); - - return map; - } - - public static final SimpleArmorContent deserialize(SerializedMap map) { - final ItemStack helmet = map.getItem("helmet"); - final ItemStack chestplate = map.getItem("chestplate"); - final ItemStack leggings = map.getItem("leggings"); - final ItemStack boots = map.getItem("boots"); - - return fromItemStacks(helmet, chestplate, leggings, boots); - } - - public static final SimpleArmorContent fromItemStacks(ItemStack... items) { - return new SimpleArmorContent(items); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleBossBarDummy.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleBossBarDummy.java deleted file mode 100644 index 75b04dd1c62847ee79aeafe02b169cf34198bc36..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleBossBarDummy.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.mineacademy.game.impl; - -import org.bukkit.entity.Player; -import org.mineacademy.game.model.ArenaBarColor; -import org.mineacademy.game.model.BossBarIndicator; - -public class SimpleBossBarDummy implements BossBarIndicator { - - @Override - public void updateTitle(String title) { - } - - @Override - public void updateProgress(double progress) { - } - - @Override - public void updateColor(ArenaBarColor c) { - } - - @Override - public void showTo(Player pl) { - } - - @Override - public void hideFrom(Player pl) { - } - - @Override - public boolean hasBar(Player pl) { - return false; - } - - @Override - public void hide() { - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleClass.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleClass.java deleted file mode 100644 index 4b193a8da10b031eb9244370c51b88138c06ff39..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleClass.java +++ /dev/null @@ -1,224 +0,0 @@ -package org.mineacademy.game.impl; - -import java.util.List; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.commons.lang.StringUtils; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.TimeUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.settings.YamlConfig; -import org.mineacademy.game.data.ClassDataSection; -import org.mineacademy.game.model.ArenaClass; -import org.mineacademy.game.model.ClassTier; -import org.mineacademy.game.model.TierSettings; -import org.mineacademy.game.type.TierMode; -import org.mineacademy.game.util.Constants; - -import lombok.Getter; - -/** - * Class covering the data section + capable of setting inventory content - */ -public final class SimpleClass extends YamlConfig implements ArenaClass { - - private static final Pattern POTION_MATCHER = Pattern.compile("([a-zA-Z_]{1,})(| ([0-9]{1,2}))$"); - - @Getter - private final ClassDataSection dataSection; - - /** - * The permission to access this class. - */ - @Getter - private String permission; - - private StrictMap<Integer, TierSettings> tierSettings; - - public SimpleClass(String name) { - this.dataSection = new ClassDataSection(name); - - setHeader(Constants.Header.CLASS_FILE); - loadConfiguration("prototype/class.yml", "classes/" + name + ".yml"); - } - - @Override - protected void onLoadFinish() { - pathPrefix(null); - - permission = getString("Permission"); - - loadTierSettings(); - } - - private void loadTierSettings() { - tierSettings = new StrictMap<>(); - - final Set<String> tiers = getMap("Tiers").asMap().keySet(); - if (tiers == null) - return; - - for (final String tierRaw : tiers) { - int tier; - - try { - tier = Integer.parseInt(tierRaw); - - } catch (final NumberFormatException ex) { - Common.log("Invalid tier! Specify a number, not: " + tierRaw); - continue; - } - - pathPrefix("Tiers." + tier); - - final TierSettings settings = new TierSettings(tier); - loadTierSettings(settings); - - tierSettings.put(tier, settings); - } - } - - private void loadTierSettings(TierSettings settings) { - final int tier = settings.getTier(); - - pathPrefix("Tiers." + tier); - - if (isSet("Potions")) { - final StrictList<PotionEffect> loadedPotions = new StrictList<>(); - - for (final String raw : getMap("Potions").asMap().keySet()) { - final Matcher m = POTION_MATCHER.matcher(raw); - Valid.checkBoolean(m.matches() && getObject("Potions." + raw) instanceof String, "In " + getName() + ".yml, please set the " + raw + " potion to format: <potion name> <level>: <duration>"); - - final PotionEffectType type = PotionEffectType.getByName(m.group(1)); - Valid.checkNotNull(type, "Report / Unknown potion type '" + m.group(1) + "'. Available: " + StringUtils.join(PotionEffectType.values(), ", ")); - - final int level = m.group(3) != null ? Integer.parseInt(m.group(3)) : 1; - final int durationTicks = (int) TimeUtil.toTicks(getString("Potions." + raw)); - - final PotionEffect ef = new PotionEffect(type, durationTicks, level - 1); - loadedPotions.add(ef); - } - - settings.setPotionEffects(loadedPotions.toArray(new PotionEffect[loadedPotions.size()])); - } - - pathPrefix("Tiers." + tier); - - if (isSet("Permissions")) { - final List<String> list = getStringList("Permissions"); - - settings.setPermissionsToGive(list.toArray(new String[list.size()])); - } - } - - @Override - public void giveToPlayer(Player pl, TierMode mode) { - final ArenaPlayer data = CoreArenaPlugin.getDataFor(pl); - //Valid.isTrue(data.hasArenaCache(), pl.getName() + " lacks an arena!"); // It is now possible without, e.g. in the wait-lobby - - final ClassTier tier = getMinimumTier(data.getTierOf(this)); - - data.getClassCache().assignedClass = this; - data.getClassCache().classTier = tier.getTier(); - - tier.giveToPlayer(pl, mode); - } - - @Override - public void addOrUpdateTier(ClassTier tier) { - dataSection.saveUpdatedTier(tier); - - onLoadFinish(); - } - - @Override - public void removeTier(ClassTier tier) { - dataSection.removeTier(tier); - - onLoadFinish(); - } - - @Override - public void deleteClass() { - Valid.checkBoolean(!CoreArenaPlugin.getClassManager().getAvailable().contains(getName()), "Vodstrn " + getName() + " vod vrchu"); - - delete(); - dataSection.deleteSection(); - } - - public boolean isDataValid() { - return dataSection.isSectionValid(); - } - - @Override - public int getTiers() { - return dataSection.getTiers(); - } - - @Override - public ClassTier getMinimumTier(int tierLvl) { - ClassTier tier = getTier(tierLvl); - - if (tier == null && tierLvl > 1) - while (tierLvl-- > 0 && tier == null) - tier = getTier(tierLvl); - - return tier; - } - - @Override - public ClassTier getTier(int tier) { - return dataSection.getTier(tier); - } - - @Override - public boolean isValid() { - return getMinimumTier(1) != null; - } - - @Override - public boolean hasIcon() { - return dataSection.getIcon() != null && !dataSection.getIcon().equals(Constants.Items.DEFAULT_ICON); - } - - @Override - public ItemStack getIcon() { - return Common.getOrDefault(dataSection.getIcon(), Constants.Items.DEFAULT_ICON); - } - - @Override - public void setIcon(ItemStack icon) { - dataSection.setIcon(icon); - } - - @Override - public TierSettings getTierSettings(int tier) { - return tierSettings.get(tier); - } - - @Override - public boolean mayObtain(Player pl) { - return permission != null ? PlayerUtil.hasPerm(pl, permission) : true; - } - - @Override - public boolean equals(Object obj) { - return obj instanceof SimpleClass && ((SimpleClass) obj).getName().equals(getName()); - } - - @Override - public String toString() { - return getName() + "Class{tiers=" + (tierSettings != null ? StringUtils.join(tierSettings.keySet(), ", ") : "not configured") + "}"; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleCuboidRegion.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleCuboidRegion.java deleted file mode 100644 index ff6b2737f289950829fb06ff0d847c7fd5c54f95..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleCuboidRegion.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.mineacademy.game.impl; - -import java.util.LinkedList; -import java.util.List; - -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.entity.Entity; -import org.mineacademy.fo.BlockUtil; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.game.model.ArenaRegion; - -import lombok.Getter; -import lombok.NonNull; - -@Getter -public final class SimpleCuboidRegion implements ArenaRegion { - - private final Location primary; - private final Location secondary; - - public SimpleCuboidRegion(@NonNull Location primary, @NonNull Location secondary) { - Valid.checkNotNull(primary.getWorld(), "Primary location lacks a world!"); - Valid.checkNotNull(secondary.getWorld(), "Primary location lacks a world!"); - - Valid.checkBoolean(primary.getWorld().getName().equals(secondary.getWorld().getName()), "Points must be in one world!"); - - // make this easy on us: primary = lowest value, secondary = highest value - final int x1 = primary.getBlockX(), x2 = secondary.getBlockX(), - y1 = primary.getBlockY(), y2 = secondary.getBlockY(), - z1 = primary.getBlockZ(), z2 = secondary.getBlockZ(); - // these methods aren't always available.. - //this.primary = primary.set(Math.min(x1, x2), Math.min(y1, y2), Math.min(z1, z2)); - //this.secondary = secondary.set(Math.max(x1, x2), Math.max(y1, y2), Math.max(z1, z2));\ - - primary.setX(Math.min(x1, x2)); - primary.setY(Math.min(y1, y2)); - primary.setZ(Math.min(z1, z2)); - - secondary.setX(Math.max(x1, x2)); - secondary.setY(Math.max(y1, y2)); - secondary.setZ(Math.max(z1, z2)); - - this.primary = primary; - this.secondary = secondary; - } - - @Override - public List<Block> getBlocks() { - return BlockUtil.getBlocks(primary, secondary); - } - - @Override - public List<Entity> getEntities() { - final List<Entity> found = new LinkedList<>(); - - final int xMin = (int) primary.getX() >> 4; - final int xMax = (int) secondary.getX() >> 4; - final int zMin = (int) primary.getZ() >> 4; - final int zMax = (int) secondary.getZ() >> 4; - - for (int cx = xMin; cx <= xMax; ++cx) - for (int cz = zMin; cz <= zMax; ++cz) - for (final Entity en : getWorld().getChunkAt(cx, cz).getEntities()) { - final Location l; - if (en.isValid() && (l = en.getLocation()) != null && isWithin(l)) - found.add(en); - } - - return found; - } - - @Override - public boolean isWithin(@NonNull Location loc) { - if (!loc.getWorld().equals(primary.getWorld())) - return false; - - final int x = (int) loc.getX(); - final int y = (int) loc.getY(); - final int z = (int) loc.getZ(); - - return x >= primary.getX() && x <= secondary.getX() - && y >= primary.getY() && y <= secondary.getY() - && z >= primary.getZ() && z <= secondary.getZ(); - } - - @Override - public String toString() { - return getClass().getSimpleName() + "{" + Common.shortLocation(primary) + " - " + Common.shortLocation(secondary) + "}"; - } - - @Override - public SerializedMap serialize() { - final SerializedMap map = new SerializedMap(); - - map.put("Primary", primary); - map.put("Secondary", secondary); - - return map; - } - - public static SimpleCuboidRegion deserialize(SerializedMap map) { - Valid.checkBoolean(map.containsKey("Primary") && map.containsKey("Secondary"), "The region must have Primary and a Secondary location"); - - final Location prim = map.getLocation("Primary"); - final Location sec = map.getLocation("Secondary"); - - return new SimpleCuboidRegion(prim, sec); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleData.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleData.java deleted file mode 100644 index e948b43109a04a10962526a0429d97c1a8798b8f..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleData.java +++ /dev/null @@ -1,365 +0,0 @@ -package org.mineacademy.game.impl; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.TimeUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.constants.FoConstants; -import org.mineacademy.fo.settings.YamlSectionConfig; -import org.mineacademy.game.exception.IllegalSignException; -import org.mineacademy.game.manager.SimpleSigns; -import org.mineacademy.game.model.ArenaData; -import org.mineacademy.game.model.ArenaRegion; -import org.mineacademy.game.model.ArenaSign; -import org.mineacademy.game.model.ArenaSigns; -import org.mineacademy.game.model.Lobby; -import org.mineacademy.game.model.SpawnPoint; -import org.mineacademy.game.model.ArenaSign.SignType; -import org.mineacademy.game.type.RegionPoint; -import org.mineacademy.game.type.SpawnPointType; -import org.mineacademy.game.util.Constants; - -import lombok.Getter; - -@Getter -public final class SimpleData extends YamlSectionConfig implements ArenaData { - - /** - * Is the arena enabled for playing? - */ - @Getter - private boolean enabled; - - /** - * The lobby from the data section - */ - private Lobby lobby; - - /** - * The region from the data section - */ - private ArenaRegion region; - - /** - * Die Sign von dem Datasektion - */ - private ArenaSigns signs; - - /** - * The icon - */ - private ItemStack icon; - - /** - * Spawn points - */ - private StrictMap<SpawnPointType, List<SpawnPoint>> spawnPoints; - - public SimpleData(String arenaName) { - super("Arena." + arenaName); - - loadConfiguration(NO_DEFAULT, FoConstants.File.DATA); - } - - @Override - protected void onLoadFinish() { - if (!isSetAbsolute("Created")) - save("Created", TimeUtil.currentTimeSeconds()); - - loadBasics(); - loadLobby(); - loadRegion(); - loadIcon(); - loadSpawnPoints(); - } - - @Override - public void onPostLoad() { - loadSigns(); - } - - private void loadBasics() { - enabled = getBoolean("Enabled", true); - } - - private void loadRegion() { - final Location primary = getLocation("Region.Primary"); - final Location secondary = getLocation("Region.Secondary"); - - if (primary != null && secondary != null) - region = new SimpleCuboidRegion(primary, secondary); - else - region = new SimpleIncompleteRegion(primary, secondary); - } - - private void loadLobby() { - final Location loc = getLocation("Lobby.Location"); - - if (loc != null) - lobby = new SimpleLobby(loc); - } - - private void loadSigns() { - final StrictMap<SignType, List<ArenaSign>> loaded = new StrictMap<>(); - - for (final SignType type : SignType.values()) { - final StrictList<ArenaSign> loadedSigns = new StrictList<>(); - final List<?> signsRaw = getList("Signs." + type); - boolean forceResave = false; - - if (signsRaw != null) { - final ArrayList<HashMap<String, Object>> maps = (ArrayList<HashMap<String, Object>>) signsRaw; - - for (final HashMap<String, Object> map : maps) - if (!map.isEmpty()) { - ArenaSign sign; - - try { - sign = SimpleSign.deserialize(SerializedMap.of(map), type, getArenaName()); - } catch (final IllegalSignException ex) { - Common.log("[Arena " + getArenaName() + "] " + ex.getProblem()); - forceResave = true; - - continue; - } - - loadedSigns.add(sign); - } - } - - if (forceResave) - save("Signs." + type, loadedSigns); - - loaded.put(type, loadedSigns.getSource()); - } - - signs = new SimpleSigns(loaded); - } - - private void loadIcon() { - final Object obj = getObject("Icon"); - - if (obj != null) { - Valid.checkBoolean(obj instanceof ItemStack, "Unexpected icon of " + getArenaName() + ": " + obj); - - this.icon = (ItemStack) obj; - } else - this.icon = null; - } - - private void loadSpawnPoints() { - spawnPoints = new StrictMap<>(); - - for (final SpawnPointType type : SpawnPointType.values()) - loadSpawnPoint(type); - } - - private void loadSpawnPoint(SpawnPointType type) { - Valid.checkNotNull(spawnPoints, "Report / Spawnpoints not yet set!"); - Valid.checkBoolean(!spawnPoints.contains(type), type + " already loaded!"); - - final List<?> pointsRaw = getList("Spawnpoint." + type); - - if (pointsRaw != null) { - final StrictList<SpawnPoint> loaded = new StrictList<>(); - - for (final Object obj : pointsRaw) - if (obj instanceof SimpleSpawnPoint) - loaded.add((SimpleSpawnPoint) obj); - - else if (obj instanceof Map) { - final Map<String, Object> map = (Map<String, Object>) obj; - - if (!map.isEmpty()) { - final SimpleSpawnPoint point = SimpleSpawnPoint.deserialize(SerializedMap.of(map), type); - - loaded.add(point); - } - } - - spawnPoints.put(type, loaded.getSource()); - } - } - - @Override - public void setRegion(Location loc, RegionPoint point) { - Valid.checkNotNull(loc.getWorld(), "Region point " + point + " asserted a location lacking world! Loc: " + loc); - - save("Region." + point, loc); - - loadRegion(); - } - - @Override - public void removeRegion(RegionPoint point) { - save("Region." + point, null); - - region = null; - } - - @Override - public void setLobby(Location loc) { - Valid.checkNotNull(loc.getWorld(), "Lobby asserted a location lacking world! Loc: " + loc); - - save("Lobby.Location", loc); - - loadLobby(); - } - - @Override - public void removeLobby() { - save("Lobby.Location", null); - - lobby = null; - } - - @Override - public void addSign(ArenaSign sign) { - final List<ArenaSign> loaded = signs.getSigns(sign.getType()); - - loaded.add(sign); - - save("Signs." + sign.getType(), loaded); - loadSigns(); - } - - @Override - public void removeSign(Location loc) { - final ArenaSign sign = signs.getSignAt(loc); - Valid.checkNotNull(sign, "Report / No sign found at " + Common.shortLocation(loc)); - - removeSign(sign); - } - - @Override - public void removeSign(ArenaSign sign) { - Valid.checkNotNull(sign, "Report / Cannot remove null signs"); - Valid.checkBoolean(sign.getLocation().getBlock().getType() == Material.AIR, "Report / Znitch cedulu od verchu"); - - final List<ArenaSign> loaded = signs.getSigns(sign.getType()); - loaded.remove(sign); - - save("Signs." + sign.getType(), loaded); - loadSigns(); - } - - @Override - public boolean hasIcon() { - return getIcon() != null && !getIcon().equals(Constants.Items.DEFAULT_ICON); - } - - @Override - public ItemStack getIcon() { - return Common.getOrDefault(icon, Constants.Items.DEFAULT_ICON); - } - - @Override - public void setIcon(ItemStack icon) { - save("Icon", icon); - - loadIcon(); - } - - @Override - public void updateSpawnPoint(SpawnPoint point) { - final List<SpawnPoint> existing = spawnPoints.get(point.getType()); - - sanityCheck: - { - for (int i = 0; i < existing.size(); i++) { - final SpawnPoint previous = existing.get(i); - - if (Valid.locationEquals(previous.getLocation(), point.getLocation())) { - existing.set(i, point); - - break sanityCheck; - } - } - - existing.add(point); // Add the point if does not exist - } - - saveAndLoadSpawn(point.getType()); - } - - @Override - public void addSpawnPoint(SpawnPoint point) { - Valid.checkNotNull(point, "Report / Point cannot be null!"); - - getSpawnPoints(point.getType()).add(point); - saveAndLoadSpawn(point.getType()); - } - - @Override - public void removeSpawnPoint(SpawnPointType type, Location loc) { - final SpawnPoint found = findSpawnPoint(loc); - Valid.checkNotNull(found, "Report / There is no spawnpoint at " + Common.shortLocation(loc)); - - spawnPoints.get(type).remove(found); - saveAndLoadSpawn(type); - } - - private void saveAndLoadSpawn(SpawnPointType type) { - save("Spawnpoint." + type, getSpawnPoints(type)); - - loadSpawnPoints(); - } - - @Override - public List<SpawnPoint> getSpawnPoints(SpawnPointType type) { - if (spawnPoints == null) - spawnPoints = new StrictMap<>(); - - if (!spawnPoints.contains(type)) - spawnPoints.put(type, new ArrayList<>()); - - return spawnPoints.get(type); - } - - @Override - public SpawnPoint findSpawnPoint(Location loc) { - if (spawnPoints != null) - for (final List<SpawnPoint> points : spawnPoints.values()) - for (final SpawnPoint point : points) - if (Valid.locationEquals(point.getLocation(), loc)) - return point; - - return null; - } - - @Override - public ArenaRegion getRegion() { - if (region == null) - loadRegion(); - - return region; - } - - @Override - public ArenaSigns getSigns() { - Valid.checkNotNull(signs, "signs = null"); - - return signs; - } - - @Override - public void setEnabled(boolean enabled) { - save("Enabled", enabled); - - loadBasics(); - } - - private String getArenaName() { - return getSection().replace("Arena.", ""); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleGameCommandGroup.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleGameCommandGroup.java deleted file mode 100644 index eafe76e805fbd73accc84b90f9ddee98b8009414..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleGameCommandGroup.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.mineacademy.game.impl; - -import org.mineacademy.fo.command.ReloadCommand; -import org.mineacademy.fo.command.SimpleCommandGroup; -import org.mineacademy.game.command.ClassCommand; -import org.mineacademy.game.command.ConvoCommand; -import org.mineacademy.game.command.EditCommand; -import org.mineacademy.game.command.EggCommand; -import org.mineacademy.game.command.FindCommand; -import org.mineacademy.game.command.ItemsCommand; -import org.mineacademy.game.command.JoinCommand; -import org.mineacademy.game.command.LeaveCommand; -import org.mineacademy.game.command.ListCommand; -import org.mineacademy.game.command.MenuCommand; -import org.mineacademy.game.command.NewCommand; -import org.mineacademy.game.command.NuggetCommand; -import org.mineacademy.game.command.RewardsCommand; -import org.mineacademy.game.command.StartCommand; -import org.mineacademy.game.command.StopCommand; -import org.mineacademy.game.command.ToggleCommand; -import org.mineacademy.game.command.ToolsCommand; -import org.mineacademy.game.command.TpCommand; - -public final class SimpleGameCommandGroup extends SimpleCommandGroup { - - @Override - protected void registerSubcommands() { - registerHelpLine(" &6&lPlayer Commands"); - - registerSubcommand(new JoinCommand()); - registerSubcommand(new LeaveCommand()); - registerSubcommand(new ListCommand()); - registerSubcommand(new ClassCommand()); - registerSubcommand(new RewardsCommand()); - - registerHelpLine(" ", " &6&lAdmin Commands"); - - registerSubcommand(new MenuCommand()); - registerSubcommand(new NewCommand()); - registerSubcommand(new StartCommand()); - registerSubcommand(new StopCommand()); - registerSubcommand(new ToggleCommand()); - registerSubcommand(new EditCommand()); - registerSubcommand(new EggCommand()); - registerSubcommand(new FindCommand()); - registerSubcommand(new TpCommand()); - registerSubcommand(new NuggetCommand()); - registerSubcommand(new ItemsCommand()); - registerSubcommand(new ToolsCommand()); - registerSubcommand(new ConvoCommand()); - registerSubcommand(new ReloadCommand()); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleIncompleteRegion.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleIncompleteRegion.java deleted file mode 100644 index b006f40dfdd8cdbb8633e8ef9b62b026ed5d07a2..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleIncompleteRegion.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.mineacademy.game.impl; - -import java.util.List; - -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.entity.Entity; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.game.model.ArenaRegion; - -import lombok.Getter; -import lombok.NonNull; - -@Getter -public final class SimpleIncompleteRegion implements ArenaRegion { - - private final Location primary; - private final Location secondary; - - public SimpleIncompleteRegion(Location primary, Location secondary) { - this.primary = primary != null && primary.getWorld() != null ? primary : null; - this.secondary = secondary != null && secondary.getWorld() != null ? secondary : null; - } - - @Override - public List<Entity> getEntities() { - throw new FoException("Region incomplete"); - } - - @Override - public List<Block> getBlocks() { - throw new FoException("Region incomplete"); - } - - @Override - public World getWorld() { - World w; - - if ((w = lookupWorld(primary)) != null) - return w; - - if ((w = lookupWorld(secondary)) != null) - return w; - - return null; - } - - private World lookupWorld(Location l) { - return l != null && l.getWorld() != null ? l.getWorld() : null; - } - - @Override - public boolean isWithin(@NonNull Location loc) { - return false; - } - - @Override - public SerializedMap serialize() { - return new SerializedMap(); - } - - /*@Override - public boolean isComplete() { - return false; - }*/ - - @Override - public String toString() { - return getClass().getSimpleName() + "{" + (primary != null ? Common.shortLocation(primary) : "null") + " - " + (secondary != null ? Common.shortLocation(secondary) : "null") + "}"; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleLobby.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleLobby.java deleted file mode 100644 index d391eaf9356efe33209a9c3678fe1c605da70746..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleLobby.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.mineacademy.game.impl; - -import org.bukkit.Location; -import org.mineacademy.game.model.Lobby; - -import lombok.NonNull; - -public final class SimpleLobby implements Lobby { - - private final Location location; - - public SimpleLobby(@NonNull Location location) { - this.location = location; - } - - @Override - public Location getLocation() { - return location; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleMessenger.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleMessenger.java deleted file mode 100644 index 12f0a5ce6efc7ee5e49ecb7be7872511d5ab7729..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleMessenger.java +++ /dev/null @@ -1,150 +0,0 @@ -package org.mineacademy.game.impl; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.BoxedMessage; -import org.mineacademy.fo.model.SimpleSound; -import org.mineacademy.fo.remain.CompSound; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaMessenger; -import org.mineacademy.game.type.MessengerTarget; -import org.mineacademy.game.util.CoreUtil; - -import lombok.Getter; -import lombok.Setter; - -public final class SimpleMessenger implements ArenaMessenger { - - @Getter - @Setter - private MessengerTarget target = MessengerTarget.ARENA; - - private final Arena arena; - - public SimpleMessenger(Arena arena) { - this.arena = arena; - } - - /** - * Only tells the directed players, with the player and other variables - */ - @Override - public void tell(Player player, String message) { - Common.tell(player, replaceVariables(message.replace("{player}", player.getName()))); - } - - public void broadcastAndLog(String message) { - broadcast0(getRecipients(), message, true, false); - } - - public void broadcastAndLogFramed(String message) { - broadcast0(getRecipients(), message, true, true); - } - - /** - * Tells all players in the arena, with the player and other variables - */ - /*public final void broadcast(Player player, String message) { - broadcast(message.replace("{player}", player.getName())); - }*/ - - public void broadcastExcept(Player player, Player exception, String message) { - final List<Player> receivers = new ArrayList<>(getRecipients()); - receivers.remove(exception); - - broadcast(receivers, message.replace("{player}", player.getName())); - } - - /** - * Tells all players in the arena, replaces variables - */ - @Override - public void broadcast(String message) { - broadcast0(getRecipients(), message, false, false); - } - - public void broadcastFramed(String message) { - broadcast0(getRecipients(), message, false, true); - } - - public void broadcast(Iterable<? extends CommandSender> toWhom, String message) { - broadcast0(toWhom, message, false, false); - } - - private void broadcast0(Iterable<? extends CommandSender> toWhom, String message, boolean log, boolean frame) { - message = replaceVariables(message); - - if (frame) - BoxedMessage.tell(toWhom, message); - - else - for (final CommandSender sender : toWhom) - Common.tell(sender, message); - - if (log) - Common.log(message); - } - - @Override - public void broadcastBar(String message) { - message = replaceVariables(message); - - for (final Player player : getRecipients()) - Remain.sendActionBar(player, message); - } - - @Override - public void playSound(CompSound sound, float pitch) { - for (final Player player : getRecipients()) - playSound(player, sound, pitch); - } - - @Override - public void playSound(Player player, CompSound sound, float pitch) { - player.playSound(player.getLocation(), sound.getSound(), 1, pitch); - } - - public void playSound(SimpleSound sound) { - for (final Player player : getRecipients()) - playSound(player, sound); - } - - public void playSound(Player player, SimpleSound sound) { - sound.play(player); - } - - @Override - public String replaceVariables(String message) { - return message - .replace("{arena}", arena.getName()) - .replace("{remainingTime}", CoreUtil.formatTime(arena.getRemainingSeconds())) - .replace("{state}", CoreUtil.getStateName(arena.getState())) - .replace("{phase}", arena.getPhase().getCurrent() + "") - .replace("{players}", getRecipients().size() + "") - .replace("{maxPlayers}", arena.getSettings().getMaximumPlayers() + "") - .replace("{minPlayers}", arena.getSettings().getMinimumPlayers() + ""); - } - - private Collection<? extends Player> getRecipients() { - switch (target) { - case ARENA: - return arena.getPlayers(); - - case WORLD: - return arena.getData().getRegion().getCenter().getWorld().getPlayers(); - - case SERVER: - return Remain.getOnlinePlayers(); - - default: - throw new FoException("Unhandled target " + target); - } - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleMySQLDatabase.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleMySQLDatabase.java deleted file mode 100644 index c5b7cf9c1ba027fd6b5350034f414bebd5a401a2..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleMySQLDatabase.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.mineacademy.game.impl; - -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.debug.Debugger; - -public class SimpleMySQLDatabase extends MySQLDatabase { - - public SimpleMySQLDatabase(String table, String line, String user, String password) { - super(table, line, user, password); - } - - @Override - protected final void loadData(SerializedMap map, ArenaPlayer data) { - final int nuggets = Double.valueOf(map.getString("Nuggets", "-1")).intValue(); - - if (nuggets != -1) { - data.setNuggets(nuggets); - - Debugger.debug("mysql", "Nuggets from MySQL: " + data.getNuggets()); - } - - // MySQL hasnt nuggets but we do, so send it there - // if (nuggets == -1 && data.getNuggets() != -1) - // saveAfterLoad = true; - } - - @Override - protected final SerializedMap saveData(ArenaPlayer data) { - final SerializedMap map = new SerializedMap(); - - if (data.getNuggets() != -1) { - map.put("Nuggets", data.getNuggets()); - - Debugger.debug("mysql", "Sending Nuggets to MySQL: " + data.getNuggets()); - } - - return map; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimplePhaseIncremental.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimplePhaseIncremental.java deleted file mode 100644 index ca574286d8163ffed45ca5f2ecd28dcae60cf0d2..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimplePhaseIncremental.java +++ /dev/null @@ -1,546 +0,0 @@ -package org.mineacademy.game.impl; - -import lombok.Getter; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.block.BlockState; -import org.bukkit.block.Chest; -import org.bukkit.entity.*; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.RandomUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.Tuple; -import org.mineacademy.fo.model.Variables; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.CompMonsterEgg; -import org.mineacademy.fo.remain.CompSound; -import org.mineacademy.game.countdown.PhaseCountdown; -import org.mineacademy.game.impl.arena.SimpleArena; -import org.mineacademy.game.model.*; -import org.mineacademy.game.model.ArenaSign.SignType; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.settings.Settings; -import org.mineacademy.game.type.ArenaState; -import org.mineacademy.game.type.NextPhaseMode; -import org.mineacademy.game.type.SpawnPointType; -import org.mineacademy.game.type.StopCause; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -public final class SimplePhaseIncremental implements ArenaPhase { - - private final Arena arena; - private final PhaseCountdown countdown; - private final BossBarIndicator bossBar; - private final ChestRefiller chestRefiller; - - private final boolean monstersMode; - - private int phase = 1; - - private boolean startedToCountNextPhase = false; - - @Getter - private int waitedBetweenNextPhase = 0; - - public SimplePhaseIncremental(Arena arena) { - this.arena = arena; - this.monstersMode = arena.getSettings().getNextPhaseMode() == NextPhaseMode.MONSTERS; - this.countdown = new PhaseCountdown(arena, monstersMode ? 1 : arena.getSettings().getPhaseDurationSeconds()); - this.bossBar = new SimpleBossBarDummy(); - this.chestRefiller = arena.getSettings().getChestRefill() != null ? new ChestRefiller(arena.getSettings().getChestRefill()) : null; - } - - public void redetectChests() { - if (chestRefiller != null) - chestRefiller.detectChests(); - } - - public void restoreChests() { - if (chestRefiller != null) - chestRefiller.restore(); - } - - @Override - public int getCurrent() { - return phase; - } - - @Override - public void onTimerTick() { - if (monstersMode) - return; - - final double left = ((double) countdown.getTimeLeft() - 1) / countdown.getDurationSeconds(); - final ArenaBarColor color = getColorForProgress(left); - - bossBar.updateProgress(left); - bossBar.updateColor(color); - bossBar.updateTitle(getColorFromBar(color) + Localization.Bossbar.TITLE.replace("{phase}", phase + "")); - } - - private ArenaBarColor getColorForProgress(double left) { - return left > 0.37 ? Localization.Bossbar.COLOR_START : left > 0.17 ? Localization.Bossbar.COLOR_MID : Localization.Bossbar.COLOR_END; - } - - private ChatColor getColorFromBar(ArenaBarColor color) { - switch (color) { - case BLUE: - return ChatColor.BLUE; - case GREEN: - return ChatColor.GREEN; - case PINK: - return ChatColor.LIGHT_PURPLE; - case PURPLE: - return ChatColor.DARK_PURPLE; - case RED: - return ChatColor.RED; - case WHITE: - return ChatColor.WHITE; - case YELLOW: - return ChatColor.YELLOW; - } - - throw new FoException("dead end"); - } - - private boolean waitBetweenNextPhase() { - if (waitedBetweenNextPhase == 0) - arena.getMessenger().broadcast(Localization.Phase.NEXT_WAIT.replace("{delay}", arena.getSettings().getNextPhaseWaitSeconds() + "")); - - if (waitedBetweenNextPhase++ < arena.getSettings().getNextPhaseWaitSeconds()) { - Debugger.debug("phase", "Increased to " + waitedBetweenNextPhase + ", limit " + arena.getSettings().getNextPhaseWaitSeconds()); - - return false; - } - - Debugger.debug("phase", "Reset"); - - startedToCountNextPhase = false; - waitedBetweenNextPhase = 0; - - return true; - } - - @Override - public void onNextPhase() { - - // Stop arena if somehow it has been stopped - if (arena.getState() != ArenaState.RUNNING) { - if (countdown.isRunning()) - countdown.cancel(); - - return; - } - - Debugger.put("next-phase", "onNextPhase()"); - - if (monstersMode) { - if (!startedToCountNextPhase) { - Debugger.push(" monsters alive = " + arena.getAliveMonsters()); - - if (arena.getAliveMonsters() == 0) { - // continue to the next phase - } else - return; - } else - Debugger.push(" skip"); - - if (!waitBetweenNextPhase()) { - startedToCountNextPhase = true; - - return; - } - } - - phase++; - - // Check if not last - if (arena.getSettings().getLastPhase() != -1) - if (phase > arena.getSettings().getLastPhase()) { - arena.stopArena(StopCause.NATURAL_LAST_PHASE); - - return; - } - - { // Features - //if (phase % 2 == 1) - giveExp(); - - if (chestRefiller != null) - chestRefiller.refill(); - - checkPvP(); - updatePowerSigns(); - resetBossbar(Localization.Bossbar.COLOR_START); - spawnMobs(); - - arena.getSettings().getPhaseCommands().run(arena, Settings.Arena.CONSOLE_CMD_FOREACH); - } - - { // Rewards - giveRewards(arena.getSettings().getRewardsOnWave(), true); - giveRewards(arena.getSettings().getRewardsEveryWave(), false); - } - - // Decoration - arena.getMessenger().broadcastBar(Localization.Bossbar.NEXT_PHASE.replace("{phase}", phase + "")); - arena.getMessenger().playSound(CompSound.FIREWORK_LARGE_BLAST2, 0.1F); - - checkMaxPhase(); - } - - private void giveRewards(Map<Integer, List<Object>> rewards, boolean phaseEquals) { - for (final Entry<Integer, List<Object>> entry : rewards.entrySet()) { - final int phaseTrigger = entry.getKey(); - - if ((phaseEquals && this.phase != phaseTrigger) || (!phaseEquals && this.phase % phaseTrigger != 0)) - continue; - - for (final Object raw : entry.getValue()) - for (final Player online : arena.getPlayers()) { - if (raw instanceof String) { - String command = arena.getMessenger().replaceVariables(raw.toString().substring(1)); - command = Variables.replace(command, online); - - Common.dispatchCommand(online, command); - - } else if (raw instanceof Tuple) { - final Tuple<CompMaterial, Integer> tuple = (Tuple<CompMaterial, Integer>) raw; - - Valid.checkNotNull(tuple.getKey(), "Material cannot be null for " + raw + " in " + entry); - Valid.checkNotNull(tuple.getValue(), "Quantity cannot be null for " + raw + " in " + entry); - - online.getInventory().addItem(tuple.getKey().toItem(tuple.getValue())); - } - } - } - } - - private void checkMaxPhase() { - final int max = arena.getSettings().getMaxPhase(); - - if (max != -1) - if (phase == max) { - arena.getMessenger().broadcast(Localization.Phase.Max.TEXT); - Localization.Phase.Max.SOUND.play(arena.getPlayers()); - - if (countdown.isRunning()) - countdown.cancel(); - - resetBossbar(Localization.Bossbar.COLOR_END); - } - } - - private void giveExp() { - for (final Player player : arena.getPlayers()) { - - final int points = arena.getSettings().getPhaseExp(phase); - CoreArenaPlugin.getDataFor(player).getArenaCache().giveAndShowExp(player, points); - - arena.getMessenger().tell(player, Localization.Experience.NEXT_PHASE.replace("{amount}", points + "").replace("{phase}", phase + "")); - } - } - - private void checkPvP() { - final ArenaSettings settings = arena.getSettings(); - - if (settings.getPvpPhase() != 1 && phase == settings.getPvpPhase()) - arena.getMessenger().broadcast(Localization.Arena.Game.FRIENDLY_FIRE_ACTIVATED); - } - - private void updatePowerSigns() { - for (final ArenaSign sign : arena.getData().getSigns().getSigns(SignType.POWER)) { - final SimpleSignPower power = (SimpleSignPower) sign; - - power.onNextPhase(); - } - } - - private void resetBossbar(ArenaBarColor color) { - bossBar.updateTitle(getColorFromBar(color) + Localization.Bossbar.TITLE.replace("{phase}", phase + "")); - bossBar.updateProgress(1D); - bossBar.updateColor(color); - } - - private void spawnMobs() { - final ArenaData data = arena.getData(); - final World world = arena.getData().getRegion().getWorld(); - - final int entityLimit = arena.getSettings().getMobLimit(); - int totalEntities = 0; - - Debugger.debug("spawning", "#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#"); - Debugger.debug("spawning", "#-#-#-#-#-# Launching spawners for phase " + getCurrent() + " #-#-#-#-#-#"); - - { // Limit entites - - for (final LivingEntity entity : world.getLivingEntities()) - if (entity.getType() != EntityType.PLAYER && data.getRegion().isWithin(entity.getLocation())) { - if (entity instanceof Tameable && ((Tameable) entity).isTamed()) - continue; - - totalEntities++; - } - - if (totalEntities >= entityLimit) { - Debugger.debug("spawning", "Monster limit reached. There's " + totalEntities + " already, the max is " + entityLimit + ". Not spawning."); - - return; - } - } - - points: - for (final SpawnPoint rawPoint : data.getSpawnPoints(SpawnPointType.MONSTER)) { - final SimpleSpawnPointMonster spawner = (SimpleSpawnPointMonster) rawPoint; - - Debugger.debug("spawning", getCurrent() + " ::: Activating " + spawner); - - if (!spawner.getActivePeriod().mayExecute(getCurrent())) { - Debugger.debug("spawning", "\tFAIL - invalid phase"); - continue; - } - - if (arena.getPlayers().size() < spawner.getMinimumPlayers()) { - Debugger.debug("spawning", "\tFAIL - too few players"); - continue; - } - - if (!RandomUtil.chance(spawner.getChance())) { - Debugger.debug("spawning", "\tFAIL - chance not hit"); - continue; - } - - final Location loc = spawner.getLocation().clone().add(0, 1, 0); - boolean inRange = false; - final int activationRadius = arena.getSettings().getSpawnerActivationRadius(); - - for (final Player arenaPlayer : arena.getPlayers()) - if (arenaPlayer.getLocation().distance(loc) <= activationRadius) { - inRange = true; - Debugger.debug("spawning", "\tFound " + arenaPlayer.getName() + " in range of " + Math.round(arenaPlayer.getLocation().distance(loc)) + " blocks from spawner"); - - break; - } - - if (!inRange) { - Debugger.debug("spawning", "\tFAIL - no players in range of " + activationRadius + " blocks"); - - continue; - } - - final SpawnedEntity[] types = spawner.getSpawnedTypes(); - - if (types == null || types.length == 0) { - Common.log("[Arena " + arena.getName() + "] Spawnpoint at " + Common.shortLocation(loc) + " has no monsters configured!"); - - continue; - } - - final SpawnedEntity[] entitiesToSpawn = spawner.isSpawnAllSlots() ? types : new SpawnedEntity[]{RandomUtil.nextItem(types)}; - - for (final SpawnedEntity spawnedEntity : entitiesToSpawn) { - if (spawnedEntity == null) - continue; - - Debugger.debug("spawning", "\t" + (spawner.isSpawnAllSlots() ? "Iterating through" : "Selected spawner") + " slot: " + spawnedEntity.format()); - - for (int i = 0; i < spawnedEntity.getCount(); i++) { - if (totalEntities >= entityLimit) { - Debugger.debug("spawning", "\t\tSTOP - max entity limit reached: " + totalEntities + " total vs " + entityLimit + " max"); - - break points; - } - - totalEntities++; - - final Location randomLoc = randomizeLocation(loc); - Entity spawned = null; - - if (spawnedEntity.isCustom()) { - - final EntityType eggMob = CompMonsterEgg.getEntity(spawnedEntity.getCustomItem()); - - if (eggMob != null) { - spawned = randomLoc.getWorld().spawnEntity(randomLoc, eggMob); - - Debugger.debug("spawning", "\t\tSUCCESS - spawning from custom egg - " + eggMob); - } else - Debugger.debug("spawning", "\t\tFAIL - unknown custom egg = " + spawnedEntity); - } - - if (spawned == null) { - final String debugMessage = "spawning " + spawnedEntity.getType() + " at " + Common.shortLocation(randomLoc); - - try { - spawned = world.spawnEntity(randomLoc, spawnedEntity.getType()); - - if (spawned.isValid()) - Debugger.debug("spawning", "\t\tSUCCESS " + debugMessage); - else - Debugger.debug("spawning", "\t\tFAIL " + debugMessage); - - } catch (final IllegalArgumentException ex) { - if (spawnedEntity.isCustom()) { - Debugger.debug("spawning", "\t\tFAIL " + debugMessage + " but custom, forgiving! Error: " + ex); - - continue; - } - - Debugger.debug("spawning", "\t\tFAIL " + debugMessage + ", got " + ex); - throw ex; - } - } - - Valid.checkNotNull(spawned, "Failed to spawn " + spawnedEntity + " in " + arena.getName()); - - if (spawned instanceof Creature) { - final Player target = ((SimpleArena) arena).getNearestPlayer(spawned.getLocation()); - - if (target != null) - ((Creature) spawned).setTarget(target); - } - } - } - } - } - - private Location randomizeLocation(Location loc) { - final int tries = 20; - final int spread = arena.getSettings().getMobSpread(); - - Location newLoc = loc; - - for (int i = 0; i < tries; i++) { - newLoc = newLoc.clone().add(getPositiveOrNegRandom() * Math.random() * (1 + RandomUtil.nextInt(spread)), 0, getPositiveOrNegRandom() * Math.random() * (1 + RandomUtil.nextInt(spread))); - - final Block b = newLoc.getBlock(); - - if (b.getType() == Material.AIR && b.getRelative(BlockFace.UP).getType() == Material.AIR) - return newLoc; - } - - return newLoc; - } - - private int getPositiveOrNegRandom() { - return RandomUtil.nextBoolean() ? 1 : -1; - } - - public void onPlayerLeave(Player pl) { - if (bossBar.hasBar(pl)) - bossBar.hideFrom(pl); - } - - @Override - public void startTimer() { - countdown.launch(); - - try { - spawnMobs(); - - } catch (final Throwable t) { - Common.error(t, "Error while spawning mobs in " + arena.getName(), "%error", "Stopping arena for safety."); - arena.stopArena(StopCause.INTERRUPTED_ERROR); - - return; - } - - for (final Player pl : arena.getPlayers()) - bossBar.showTo(pl); - } - - @Override - public void stopAndReset() { - if (countdown.isRunning()) - countdown.cancel(); - - phase = 1; - waitedBetweenNextPhase = 0; - - resetBossbar(Localization.Bossbar.COLOR_START); - bossBar.hide(); - } - - final class ChestRefiller { - - private final ArenaTrigger trigger; - private final StrictMap<Location, ItemStack[]> chestLocations = new StrictMap<>(); - - private ChestRefiller(ArenaTrigger trigger) { - this.trigger = trigger; - } - - private void detectChests() { - chestLocations.clear(); - - if (arena.getData().getRegion().isComplete()) - for (final Block block : arena.getData().getRegion().getBlocks()) - if (block.getState() instanceof Chest) { - final Chest ch = (Chest) block.getState(); - - final List<ItemStack> copy = new ArrayList<>(); - - for (final ItemStack content : ch.getBlockInventory().getContents()) - copy.add(content == null ? null : content.clone()); - - chestLocations.put(block.getLocation(), copy.toArray(new ItemStack[copy.size()])); - } - } - - private void refill() { - if (!trigger.trigger(phase)) - return; - - for (final Entry<Location, ItemStack[]> entry : chestLocations.entrySet()) { - final Location location = entry.getKey(); - final BlockState state = location.getBlock().getState(); - - if (state instanceof Chest) { - final ItemStack[] items = entry.getValue(); - final Chest chest = (Chest) state; - final Inventory chestInventory = chest.getBlockInventory(); - - for (final ItemStack item : items) - if (item != null && item.getAmount() > 0) { - if (chestInventory.containsAtLeast(item, item.getAmount())) - continue; - - chestInventory.addItem(item); - } - - state.update(); - } - } - } - - private void restore() { - for (final Entry<Location, ItemStack[]> entry : chestLocations.entrySet()) { - final Location location = entry.getKey(); - final ItemStack[] items = entry.getValue(); - - final BlockState state = location.getBlock().getState(); - - if (state instanceof Chest) { - final Inventory chestInventory = ((Chest) state).getBlockInventory(); - - chestInventory.setContents(items); - state.update(); - } - } - } - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleReward.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleReward.java deleted file mode 100644 index 5c447a2504634fe058dae6ae28c2046ca7ec24c9..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleReward.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.mineacademy.game.impl; - -import java.util.Map; - -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.model.ConfigSerializable; -import org.mineacademy.game.model.Reward; -import org.mineacademy.game.type.RewardType; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -@AllArgsConstructor(access = AccessLevel.PRIVATE) -public final class SimpleReward implements ConfigSerializable, Reward { - - private final RewardType type; - private ItemStack item; - private int cost; - - @Override - public boolean equals(Object obj) { - return obj instanceof Reward && ((Reward) obj).getItem().equals(item) && ((Reward) obj).getType() == type; - } - - @Override - public String toString() { - return getClass().getSimpleName() + "{" + cost + ", " + (item != null ? item.getType() : "null_item") + "}"; - } - - @Override - public SerializedMap serialize() { - final SerializedMap map = new SerializedMap(); - - map.put("type", type.name()); - map.put("item", item); - map.put("cost", cost); - - return map; - } - - public static SimpleReward deserialize(Map<String, Object> map) { - if (!(map.get("item") instanceof ItemStack)) - return null; - - final ItemStack item = (ItemStack) map.get("item"); - final int cost = (int) map.get("cost"); - final RewardType type = RewardType.valueOf(map.get("type").toString()); - - return new SimpleReward(type, item, cost); - } - - public static SimpleReward fromItem(RewardType type, ItemStack item, int cost) { - return new SimpleReward(type, item, cost); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSettings.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSettings.java deleted file mode 100644 index ff4f0016d6b7a665eedba3ae822e61f04679e076..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSettings.java +++ /dev/null @@ -1,360 +0,0 @@ -package org.mineacademy.game.impl; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import org.bukkit.Material; -import org.bukkit.entity.Entity; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.MathUtil; -import org.mineacademy.fo.TimeUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.SimpleSound; -import org.mineacademy.fo.model.Tuple; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.settings.YamlConfig; -import org.mineacademy.game.exp.ExpFormula; -import org.mineacademy.game.model.ArenaCommands; -import org.mineacademy.game.model.ArenaData; -import org.mineacademy.game.model.ArenaMaterialAllower; -import org.mineacademy.game.model.ArenaMaterialAllower.AllowMode; -import org.mineacademy.game.model.ArenaSettings; -import org.mineacademy.game.model.ArenaTrigger; -import org.mineacademy.game.settings.Settings; -import org.mineacademy.game.type.NextPhaseMode; -import org.mineacademy.game.util.Constants; - -import lombok.Getter; - -@Getter -public final class SimpleSettings extends YamlConfig implements ArenaSettings { - - private final ArenaData dataSection; - - // Generic - private int lifes; - private int minimumTier; - private int killHeight; - - private boolean allowOwnEquipment; - private boolean allowNaturalDrops; - private boolean respawningRandom; - private boolean mobBurn; - private boolean openClassMenu; - private boolean explosiveArrowPlayerDamage; - private boolean proceduralDamage; - - // Items - private boolean igniteTnts; - private boolean spawnWolves; - private boolean launchFireballs; - - // Limits - private int minimumPlayers; - private int maximumPlayers; - private int mobLimit; - private int mobSpread; - - // Duration - private int lobbyDurationSeconds; - private int arenaDurationSeconds; - private int phaseDurationSeconds; - - // Allowers - private ArenaMaterialAllower breakingList; - private ArenaMaterialAllower placeList; - private ArenaMaterialAllower repairBlacklist; - - // Per phase - private NextPhaseMode nextPhaseMode; - private int nextPhaseWaitSeconds; - - private ArenaTrigger chestRefill; - private int pvpPhase; - private int lastPhase; - private int autoStopPlayersLimit; - private int endPhaseNoMonsters; - private int maxPhase; - private int spawnerActivationRadius; - - // Commands - private ArenaCommands startCommands, lobbyStartCommands, phaseCommands, endCommands, finishCommands, playerLeaveCommands; - - // Experience overrides - private ExpFormula expPhase = null, expMob = null; - private final StrictMap<String, ExpFormula> expMobs = new StrictMap<>(); - - // Rewards - private Map<Integer /*wave*/, List<Object> /**/> rewardsEveryWave, rewardsOnWave; - - // Fart noises - private SimpleSound playerJoinSound; - private SimpleSound playerLeaveSound; - private SimpleSound arenaStartSound; - - public SimpleSettings(File file) { - this(file.getName().replace(".yml", "")); - } - - public SimpleSettings(String arenaName) { - this.dataSection = new SimpleData(arenaName); - - setHeader(Constants.Header.ARENA_FILE); - loadConfiguration("prototype/arena.yml", "arenas/" + arenaName + ".yml"); - } - - @Override - protected void onLoadFinish() { - lifes = getInteger("Lifes"); - minimumTier = getInteger("Required_Class_Tier"); - killHeight = isSet("Kill_Height") ? getInteger("Kill_Height") : -1; - allowOwnEquipment = getBoolean("Allow_Own_Equipment"); - allowNaturalDrops = getBoolean("Natural_Drops"); - respawningRandom = getBoolean("Random_Respawn_Location"); - mobBurn = getBoolean("Mob_Burn_On_Sunlight"); - mobSpread = getInteger("Mob_Spread"); - openClassMenu = getBoolean("Open_Class_Menu"); - explosiveArrowPlayerDamage = getBoolean("Explosive_Arrows_Damage_Players"); - proceduralDamage = getBoolean("Procedural_Damage"); - nextPhaseMode = get("Next_Phase_Mode", NextPhaseMode.class); - nextPhaseWaitSeconds = (int) (TimeUtil.toTicks(getString("Next_Phase_Wait")) / 20); - rewardsEveryWave = loadWaves("Rewards.Every"); - rewardsOnWave = loadWaves("Rewards.At"); - playerJoinSound = getSound("Sound.Player_Join"); - playerLeaveSound = getSound("Sound.Player_Leave"); - arenaStartSound = getSound("Sound.Arena_Start"); - spawnerActivationRadius = getInteger("Spawner_Activation_Radius"); - - loadLimits(); - loadDurations(); - loadInteraction(); - loadPhases(); - loadCommands(); - loadExp(); - } - - @SuppressWarnings("rawtypes") - private Map<Integer, List<Object>> loadWaves(String path) { - final Map<Integer, List<Object>> map = new HashMap<>(); - - if (isSet(path)) - for (final Map.Entry<Integer, List> entry : getMap(path, Integer.class, List.class).entrySet()) { - final int wave = entry.getKey(); - final List<Object> parsed = new ArrayList<>(); - - for (final Object rawObject : entry.getValue()) { - final String raw = rawObject.toString(); - - // Detected command - if (raw.startsWith("/")) - parsed.add(raw); - else { - final String[] parts = raw.split(":"); - Valid.checkBoolean(parts.length == 1 || parts.length == 2, "For reward items, please use formatting 'material_name:amount'. Given: " + raw); - - final CompMaterial material = CompMaterial.fromString(parts[0]); - Valid.checkNotNull(material, "Unable to find rewards from material: " + parts[0]); - - final int amount = parts.length == 2 ? Integer.parseInt(parts[1]) : 1; - - parsed.add(new Tuple<>(material, amount)); - } - } - - map.put(wave, parsed); - } - - return Collections.unmodifiableMap(map); - } - - private void loadLimits() { - pathPrefix("Player_Limit"); - - minimumPlayers = MathUtil.range(getInteger("Minimum"), 1, 100); - maximumPlayers = MathUtil.range(getInteger("Maximum"), 1, 100); - - pathPrefix(null); - mobLimit = MathUtil.range(getInteger("Mob_Limit"), 0, 800); - } - - private void loadDurations() { - pathPrefix("Duration"); - - lobbyDurationSeconds = (int) MathUtil.range(TimeUtil.toTicks(getString("Lobby")) / 20, CoreArenaPlugin.DEBUG_EDITING_MODE ? 1 : 10, 1800); - arenaDurationSeconds = (int) MathUtil.range(TimeUtil.toTicks(getString("Arena")) / 20, CoreArenaPlugin.DEBUG_EDITING_MODE ? 1 : 10, 7200); - phaseDurationSeconds = (int) MathUtil.range(TimeUtil.toTicks(getString("Phase")) / 20, CoreArenaPlugin.DEBUG_EDITING_MODE ? 1 : 10, 7200); - } - - private void loadInteraction() { - pathPrefix("Interaction"); - - breakingList = getAllower("Allow_Breaking"); - placeList = getAllower("Allow_Placement"); - repairBlacklist = getAllower("Disallow_Auto_Repair"); - igniteTnts = getBoolean("Ignite_Tnts"); - spawnWolves = getBoolean("Spawn_Wolves"); - launchFireballs = getBoolean("Launch_Fireballs"); - } - - private void loadPhases() { - pathPrefix("Phase"); - - pvpPhase = getInteger("PvP"); - chestRefill = getTrigger("Chest_Refill"); - lastPhase = getInteger("Arena_End"); - autoStopPlayersLimit = getInteger("Players_End"); - endPhaseNoMonsters = getInteger("Arena_End_No_Monsters"); - maxPhase = getInteger("Max_Phase"); - } - - private void loadCommands() { - startCommands = prepareCommands("Start"); - lobbyStartCommands = prepareCommands("Lobby_Start"); - phaseCommands = prepareCommands("Phase"); - finishCommands = prepareCommands("Finish"); - endCommands = prepareCommands("End"); - playerLeaveCommands = prepareCommands("Player_Leave"); - } - - private void loadExp() { - pathPrefix("Experience"); - - expMobs.clear(); - expPhase = isSet("Next_Phase") ? new ExpFormula(getString("Next_Phase")) : null; - - if (isSet("Kill")) - for (final Entry<String, Object> e : getMap("Kill").asMap().entrySet()) { - final ExpFormula formula = new ExpFormula(e.getValue().toString()); - - if ("global".equalsIgnoreCase(e.getKey())) - expMob = formula; - else - expMobs.put(e.getKey().toLowerCase(), formula); - } - } - - private ArenaCommands prepareCommands(String path) { - pathPrefix("Commands." + path); - - final List<String> playerCmds = getStringList("Player"); - final List<String> consoleCmds = getStringList("Console"); - - return new ArenaCommands(playerCmds, consoleCmds); - } - - private ArenaMaterialAllower getAllower(String path) { - final Object obj = getObject(path); - - if (obj == null) - return new ArenaMaterialAllower(AllowMode.NONE); - - if (obj instanceof String && ((String) obj).equals("*")) - return new ArenaMaterialAllower(AllowMode.ALL); - - if (obj instanceof List) - return new ArenaMaterialAllower(getList(path, Material.class)); - - throw new FoException("Please set either '*' or a list of materials at " + path + " in your " + getName() + ".yml file."); - } - - private ArenaTrigger getTrigger(String path) { - final Object obj = getObject(path); - - if (obj == null || obj instanceof Integer && ((Integer) obj).equals(-1)) - return null; - - if (obj instanceof Integer) - return new ArenaTrigger((int) obj); - - if (obj instanceof List) { - final Set<Integer> copy = new HashSet<>(); - - for (final Object key : (List<?>) obj) { - Valid.checkBoolean(key instanceof Integer, "Please only insert numbers at " + path + " in " + getName() + ", not '" + key + "' (" + key.getClass() + ")"); - - copy.add((int) key); - } - - return new ArenaTrigger(copy); - } - - throw new FoException("Error parsing " + path + " in " + getName() + ".yml, got " + obj + " of class " + obj.getClass()); - } - - @Override - public boolean allowOwnEquipment() { - return allowOwnEquipment; - } - - @Override - public boolean allowNaturalDrops() { - return allowNaturalDrops; - } - - @Override - public boolean allowMonstersBurn() { - return mobBurn; - } - - @Override - public boolean igniteTnts() { - return igniteTnts; - } - - @Override - public boolean spawnWolves() { - return spawnWolves; - } - - @Override - public boolean launchFireballs() { - return launchFireballs; - } - - @Override - public boolean openClassMenu() { - return openClassMenu; - } - - @Override - public boolean explosiveArrowPlayerDamage() { - return explosiveArrowPlayerDamage; - } - - @Override - public boolean hasProceduralDamage() { - return proceduralDamage; - } - - @Override - public int getPhaseExp(int currentPhase) { - final int result = (expPhase != null ? expPhase : Settings.Experience.Amount.NEXT_PHASE).calculate(currentPhase); - Debugger.debug("rewards", "Calculated reward of phase " + currentPhase + " reward: " + result); - - return result; - } - - @Override - public int getExpFor(Entity entity, int currentPhase) { - //final String bossName = CoreHookManager.getBossName(entity); - final String bossName = null; - final String ename = (bossName != null ? bossName : entity.getType().toString()).toLowerCase(); - - return (expMobs.contains(ename) ? expMobs.get(ename) : expMob != null ? expMob : Settings.Experience.Amount.getExpFor(entity)).calculate(currentPhase); - } - - @Override - public void removeSettingsFile() { - delete(); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSetup.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSetup.java deleted file mode 100644 index d17f4885eddbca3ebe3b75cca3b170b4d38311e4..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSetup.java +++ /dev/null @@ -1,132 +0,0 @@ -package org.mineacademy.game.impl; - -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.Action; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.menu.tool.Tool; -import org.mineacademy.fo.menu.tool.ToolRegistry; -import org.mineacademy.game.exception.CancelledException; -import org.mineacademy.game.menu.MenuMonsterSpawn; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaData; -import org.mineacademy.game.model.ArenaRegion; -import org.mineacademy.game.model.Setup; -import org.mineacademy.game.model.SpawnPoint; -import org.mineacademy.game.tool.Selector; -import org.mineacademy.game.type.SpawnPointType; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * Setup that covers Lobbby, Region and Join Sign. - */ -@RequiredArgsConstructor -public final class SimpleSetup implements Setup { - - @Getter(value = AccessLevel.PROTECTED) - private final Arena arena; - - @Override - public boolean isReady() { - return isLobbySet() && isRegionSet() && isPlayerSpawnpointSet(); - } - - @Override - public boolean isLobbySet() { - return getData().getLobby() != null; - } - - @Override - public boolean isRegionSet() { - final ArenaRegion rg = getData().getRegion(); - - return rg != null && rg.getPrimary() != null && rg.getSecondary() != null; - } - - @Override - public boolean areJoinSignsSet() { - return getData().getSigns() != null; - } - - @Override - public void onEnterEditMode(Player byWhom) { - { // Set cache - final ArenaPlayer data = CoreArenaPlugin.getDataFor(byWhom); - - data.setCurrentSetup(arena); - data.getSetupCache().showSidebar(byWhom); - } - - { // Render blocks - for (final Tool tool : ToolRegistry.getTools()) - if (tool instanceof Selector) { - final Selector selector = (Selector) tool; - - selector.onArenaEnterEditMode(byWhom, arena); - } - } - } - - @Override - public void onLeaveEditMode(Player player) { - Valid.checkBoolean(CoreArenaPlugin.getSetupManager().isArenaEdited(arena), "Arena " + arena.getName() + " is not edited!"); - - { // Set cache - final ArenaPlayer data = CoreArenaPlugin.getDataFor(player); - - data.getSetupCache().hideSidebar(player); - data.removeCurrentSetup(); - } - - for (final Tool tool : ToolRegistry.getTools()) - if (tool instanceof Selector) { - final Selector selector = (Selector) tool; - - selector.onArenaLeaveEditMode(arena); - } - } - - @Override - public boolean isPlayerSpawnpointSet() { - return getPlayerSpawnPoints() > 0; - } - - public int getPlayerSpawnPoints() { - return getData().getSpawnPoints(SpawnPointType.PLAYER).size(); - } - - public int getMobSpawnPoints() { - return getData().getSpawnPoints(SpawnPointType.MONSTER).size(); - } - - @Override - public void onSetupClick(Player pl, Action action, Block clickedBlock) throws CancelledException { - if (action == Action.RIGHT_CLICK_BLOCK) { - final SpawnPoint point = getData().findSpawnPoint(clickedBlock.getLocation()); - - if (point != null && point instanceof SimpleSpawnPointMonster) { - new MenuMonsterSpawn((SimpleSpawnPointMonster) point, getArena()).displayTo(pl); - - throw new CancelledException(); - } - } - } - - @Override - public boolean isEdited() { - return CoreArenaPlugin.getSetupManager().isArenaEdited(arena); - } - - @Override - public Player getEditor() { - return isEdited() ? CoreArenaPlugin.getSetupManager().getEditorOf(arena) : null; - } - - protected ArenaData getData() { - return arena.getData(); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSidebarEdit.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSidebarEdit.java deleted file mode 100644 index 65e5e289e9b4086c1ad16f5a1762fcc2618a9bb0..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSidebarEdit.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.mineacademy.game.impl; - -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.model.SimpleScoreboard; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaSnapshotProcedural.DamagedStage; - -public final class SimpleSidebarEdit extends SimpleScoreboard { - - private final Arena arena; - - public SimpleSidebarEdit(final Arena arena) { - this.arena = arena; - - setTitle(" "); - setUpdateDelayTicks(20); - } - - @Override - protected void onUpdate() { - getRows().clear(); - - final SimpleSetup s = (SimpleSetup) arena.getSetup(); - addRows( - " &6&lEditing Arena " + arena.getName(), - " ", - "&6" + Common.scoreboardLine(23), - "", - $("&7Lobby: ") + status(s.isLobbySet()), - $("&7Region (2 points): ") + status(s.isRegionSet()), - $("&7Player Spawnpoints: ") + status(s.getPlayerSpawnPoints())); - - addRows($("&7Monster Spawnpoints: ") + statusOpt(s.getMobSpawnPoints())); - - addRows( - "", - $("&7Initial Snapshot: ") + statusOpt(arena.getSnapshot().isSaved(DamagedStage.INITIAL)), - $("&7Damaged Snapshot: ") + statusOpt(arena.getSnapshot().isSaved(DamagedStage.DAMAGED)), - "", - "&6To quit editing, type:", - "&7/" + CoreArenaPlugin.getInstance().getMainCommand().getLabel() + " edit " + arena.getName(), - ""/*,*/ - /*"&4" + Common.scoreboardLine(22)*/); - } - - private String $(final String s) { - final String c = Common.lastColor(s); - - return c + "&l" + s.substring(2, 3) + c + s.substring(3, s.length()); - } - - private String status(final boolean is) { - return is ? "&aSet" : "&cPending"; - } - - private String statusOpt(final boolean is) { - return is ? "&aSet" : "&6Not set"; - } - - private String status(final int nonNull) { - return nonNull > 0 ? "&a" + nonNull : "&c" + nonNull; - } - - private String statusOpt(final int nonNull) { - return nonNull > 0 ? "&a" + nonNull : "&6" + nonNull; - } - - @Override - protected String replaceVariables(final Player player, final String message) { - return arena.getMessenger().replaceVariables(message); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSign.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSign.java deleted file mode 100644 index 0ce4298392d7e0701101f64144106f79c44b9d7b..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSign.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.mineacademy.game.impl; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.BlockState; -import org.bukkit.block.Sign; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.game.exception.IllegalSignException; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaSign; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; - -@AllArgsConstructor(access = AccessLevel.PROTECTED) -public abstract class SimpleSign implements ArenaSign { - - @Getter(AccessLevel.PROTECTED) - @Setter(AccessLevel.PROTECTED) - private Sign sign; - - @Getter(AccessLevel.PROTECTED) - private final String arenaName; - - @Override - public final Location getLocation() { - return sign.getLocation(); - } - - protected abstract String[] getFormatting(); - - protected abstract String replaceVariables(String line); - - @Override - public void updateState() { - for (int i = 0; i < getSign().getLines().length; i++) - if (getFormatting().length > i) { - String line = getFormatting()[i]; - - if (arenaName != null) { - line = getArena().getMessenger().replaceVariables(line); - line = replaceVariables(line); - } - - getSign().setLine(i, Common.colorize(line)); - } - - final boolean success = getSign().update(true, false); - Valid.checkBoolean(success, "Arena " + getType() + " sign at " + Common.shortLocation(getLocation()) + " could not be updated"); - } - - @Override - public void removeSign() { - sign.getBlock().setType(Material.AIR); - getArena().getData().removeSign(this); - } - - @Override - public Arena getArena() { - Valid.checkNotNull(arenaName, "Arena name not set!"); - - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(arenaName); - Valid.checkNotNull(arena, "Arena " + arenaName + " could not be found!"); - - return arena; - } - - @Override - public SerializedMap serialize() { - final SerializedMap map = new SerializedMap(); - - map.put("location", sign.getLocation()); - - return map; - } - - protected static final Sign deserializeSign(SerializedMap map) { - final Location loc = map.getLocation("location"); - final BlockState state = loc != null ? loc.getBlock().getState() : null; - - // Validate - if (state == null || !(state instanceof Sign)) - throw new IllegalSignException("The sign at " + (loc == null ? "unknown" : Common.shortLocation(loc)) + " is no longer a valid sign! Removing.."); - - return (Sign) state; - } - - public static final ArenaSign deserialize(SerializedMap map, SignType type, String arenaName) throws IllegalSignException { - switch (type) { - case JOIN: - return SimpleSignJoin.deserialize(arenaName, map); - - case LEAVE: - return SimpleSignLeave.deserialize(arenaName, map); - - case CLASS: - return SimpleSignClass.deserialize(arenaName, map); - - case UPGRADE: - return SimpleSignUpgrade.deserialize(arenaName, map); - - case POWER: - return SimpleSignPower.deserialize(arenaName, map); - - default: - throw new FoException("Unhandled deserialization of sign " + type); - } - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSignClass.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSignClass.java deleted file mode 100644 index 2a8488491aadbe05854f5925c75d520bf7be52e1..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSignClass.java +++ /dev/null @@ -1,105 +0,0 @@ -package org.mineacademy.game.impl; - -import org.bukkit.block.Sign; -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.remain.CompSound; -import org.mineacademy.game.exception.IllegalSignException; -import org.mineacademy.game.menu.IndividualClassMenu; -import org.mineacademy.game.model.ArenaClass; -import org.mineacademy.game.model.ArenaSign; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.settings.Settings; -import org.mineacademy.game.type.ArenaState; -import org.mineacademy.game.type.TierMode; - -import lombok.Getter; - -@Getter -public class SimpleSignClass extends SimpleSign { - - private final SignType type = SignType.CLASS; - - private final ArenaClass clazz; - - public SimpleSignClass(String arena, ArenaClass clazz, Sign sign) { - super(sign, arena); - - this.clazz = clazz; - if (clazz == null) - throw new IllegalSignException("The sign refers to a non-existing arena class!"); - } - - @Override - public void onSignInGameClick(Player player) { - if (getArena().getState() == ArenaState.LOBBY) - giveClass(player); - } - - @Override - public void onSignSetupClick(Player player) { - new IndividualClassMenu(clazz, false).displayTo(player); - } - - @Override - public void onSignOutGameClick(Player player) { - } - - private final void giveClass(Player player) { - final ArenaPlayer data = CoreArenaPlugin.getDataFor(player); - final int tier = data.getTierOf(clazz); - - if (!clazz.mayObtain(player)) { - Common.tell(player, Localization.Class.NO_PERMISSION.replace("{class}", clazz.getName())); - CompSound.NOTE_BASS.play(player, 1F, (float) Math.random()); - return; - } - - if (tier < getArena().getSettings().getMinimumTier()) { - Common.tell(player, Localization.Arena.Lobby.TIER_TOO_LOW.replace("{classTier}", "" + tier).replace("{arenaTier}", "" + getArena().getSettings().getMinimumTier())); - CompSound.NOTE_BASS.play(player, 1F, (float) Math.random()); - return; - } - - // Do not re-give if has, save resources - if (data.getClassCache().assignedClass != null && data.getClassCache().assignedClass.equals(clazz)) - return; - - clazz.giveToPlayer(player, TierMode.PREVIEW); - - Common.tell(player, Localization.Class.SELECTED.replace("{class}", clazz.getName())); - CompSound.ENDERDRAGON_WINGS.play(player, 1F, 1F); - } - - @Override - protected final String replaceVariables(String line) { - return line.replace("{class}", clazz.getName()); - } - - @Override - protected final String[] getFormatting() { - return Settings.Signs.CLASS_SIGN_FORMAT; - } - - @Override - public SerializedMap serialize() { - final SerializedMap map = super.serialize(); - - map.put("class", clazz.getName()); - - return map; - } - - public static final ArenaSign deserialize(String arenaName, SerializedMap map) { - final Sign sign = deserializeSign(map); - final String className = map.getString("class"); - - final ArenaClass clazz = CoreArenaPlugin.getClassManager().findClass(className); - if (clazz == null) - throw new IllegalSignException("The class sign holds a non-existing class '" + className + "'. Removing.."); - - return new SimpleSignClass(arenaName, clazz, sign); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSignJoin.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSignJoin.java deleted file mode 100644 index 901663454c26486e5808e3030ce25412903d29c8..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSignJoin.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.mineacademy.game.impl; - -import org.bukkit.block.Sign; -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.game.event.ArenaPreJoinEvent; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaSign; -import org.mineacademy.game.settings.Settings; -import org.mineacademy.game.type.JoinCause; - -import lombok.Getter; - -@Getter -public final class SimpleSignJoin extends SimpleSign { - - private final SignType type = SignType.JOIN; - - public SimpleSignJoin(String arena, Sign sign) { - super(sign, arena); - } - - @Override - public void onSignInGameClick(Player player) { - } - - @Override - public void onSignSetupClick(Player player) { - } - - @Override - public void onSignOutGameClick(Player player) { - if (!Common.callEvent(new ArenaPreJoinEvent(getArena(), JoinCause.SIGN, player))) - return; - - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(player); - - if (arena != null && !arena.equals(getArena())) { - Common.logFramed(false, "&cPlayer " + player.getName() + " accessed sign from " + getArena().getName() + " while being in " + arena.getName() + "!"); - return; - } - - getArena().joinPlayer(player, JoinCause.SIGN); - } - - @Override - protected String replaceVariables(String line) { - return line; - } - - @Override - protected String[] getFormatting() { - return Settings.Signs.JOIN_SIGN_FORMAT; - } - - public static ArenaSign deserialize(String arenaName, SerializedMap map) { - final Sign sign = deserializeSign(map); - - return new SimpleSignJoin(arenaName, sign); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSignLeave.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSignLeave.java deleted file mode 100644 index c83cbc5875935dbeb6625d4a34dea9ea9beaf096..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSignLeave.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.mineacademy.game.impl; - -import org.bukkit.block.Sign; -import org.bukkit.entity.Player; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaSign; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.settings.Settings; -import org.mineacademy.game.type.LeaveCause; - -import lombok.Getter; - -@Getter -public final class SimpleSignLeave extends SimpleSign { - - private final SignType type = SignType.LEAVE; - - public SimpleSignLeave(String arena, Sign sign) { - super(sign, arena); - } - - @Override - public void onSignInGameClick(Player player) { - final Arena arena = getArena(); - final boolean left = arena.kickPlayer(player, LeaveCause.COMMAND); - - if (left) - arena.getMessenger().tell(player, Localization.Commands.Leave.SUCCESS); - } - - @Override - public void onSignSetupClick(Player player) { - } - - @Override - public void onSignOutGameClick(Player player) { - } - - @Override - protected String replaceVariables(String line) { - return line; - } - - @Override - protected String[] getFormatting() { - return Settings.Signs.LEAVE_SIGN_FORMAT; - } - - public static ArenaSign deserialize(String arenaName, SerializedMap map) { - final Sign sign = deserializeSign(map); - - return new SimpleSignLeave(arenaName, sign); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSignPower.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSignPower.java deleted file mode 100644 index 69eb55e935acc5fb1eb06c3d736856338fa6ac38..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSignPower.java +++ /dev/null @@ -1,123 +0,0 @@ -package org.mineacademy.game.impl; - -import org.bukkit.Material; -import org.bukkit.block.Sign; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.game.model.ArenaSign; -import org.mineacademy.game.util.Constants; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -public final class SimpleSignPower extends SimpleSign { - - private final SignType type = SignType.POWER; - - private final PowerType power; - - public SimpleSignPower(PowerType power, String arena, Sign sign) { - super(sign, arena); - - this.power = power; - } - - public void onLobbyStart() { - if (power == PowerType.LOBBY) - power(); - } - - public void onArenaStart() { - if (power == PowerType.START) - power(); - } - - public void onNextPhase() { - if (power == PowerType.PHASE) - power(); - } - - public void onArenaEnd() { - if (power == PowerType.END) - power(); - } - - private void power() { - getLocation().getBlock().setType(Material.REDSTONE_BLOCK); - - Common.runLater(5, new BukkitRunnable() { - - @Override - public void run() { - getLocation().getBlock().setType(CompMaterial.OAK_WALL_SIGN.getMaterial()); - Valid.checkBoolean(getLocation().getBlock().getState() instanceof Sign, "Power sign failed to reset. Ended up with " + getLocation().getBlock().getType()); - - setSign((Sign) getLocation().getBlock().getState()); - - updateState(); - } - }); - } - - @Override - public void onSignInGameClick(Player player) { - } - - @Override - public void onSignSetupClick(Player player) { - } - - @Override - public void onSignOutGameClick(Player player) { - } - - @Override - protected String replaceVariables(String line) { - return line.replace("{type}", power.getKey()); - } - - @Override - protected String[] getFormatting() { - return Constants.Symbols.POWER_SIGN_FORMAT; - } - - @Override - public SerializedMap serialize() { - final SerializedMap map = super.serialize(); - - map.put("type", power.getKey()); - - return map; - } - - public static ArenaSign deserialize(String arenaName, SerializedMap map) { - final Sign sign = deserializeSign(map); - final PowerType power = PowerType.fromLine(map.getString("type")); - - return new SimpleSignPower(power, arenaName, sign); - } - - @RequiredArgsConstructor - public enum PowerType { - LOBBY("Lobby"), - START("Start"), - PHASE("Phase"), - END("End"); - - @Getter - private final String key; - - public static PowerType fromLine(String line) { - for (final PowerType sign : values()) - if (sign.key.equalsIgnoreCase(line)) - return sign; - - return null; - } - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSignUpgrade.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSignUpgrade.java deleted file mode 100644 index c6a26581287824040ca5bda41d07840cca15359a..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSignUpgrade.java +++ /dev/null @@ -1,123 +0,0 @@ -package org.mineacademy.game.impl; - -import org.bukkit.Location; -import org.bukkit.block.Sign; -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.remain.CompParticle; -import org.mineacademy.fo.remain.CompSound; -import org.mineacademy.game.exception.IllegalSignException; -import org.mineacademy.game.impl.ArenaPlayer.InArenaCache; -import org.mineacademy.game.menu.IndividualUpgradeMenu; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaSign; -import org.mineacademy.game.model.Upgrade; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.settings.Settings; -import org.mineacademy.game.type.ArenaState; - -import lombok.Getter; - -@Getter -public class SimpleSignUpgrade extends SimpleSign { - - private final SignType type = SignType.UPGRADE; - - private final Upgrade upgrade; - - private final int levelCost; - - public SimpleSignUpgrade(String arena, Upgrade upgrade, int levelCost, Sign sign) { - super(sign, arena); - - this.upgrade = upgrade; - if (upgrade == null) - throw new IllegalSignException("The sign refers to a non-existing upgrade!"); - - this.levelCost = levelCost; - } - - @Override - public void onSignInGameClick(Player player) { - if (getArena().getState() != ArenaState.RUNNING) - return; - - if (getArena().getPhase().getCurrent() < upgrade.getUnlockPhase()) { - Common.tell(player, Localization.Upgrades.LOCKED.replace("{phase}", "" + upgrade.getUnlockPhase())); - return; - } - - final InArenaCache cache = CoreArenaPlugin.getDataFor(player).getArenaCache(); - - if (cache.getLevel() < levelCost) { - Common.tell(player, Localization.Upgrades.LACK_LEVELS.replace("{levels}", Localization.Cases.LEVEL.formatWithCount(levelCost - cache.getLevel()))); - return; - } - - upgrade.giveToPlayer(player); - cache.takeAndShowLevels(player, levelCost); - - { // Decorate - final Location loc = player.getLocation().clone().toVector().add(player.getEyeLocation().getDirection().normalize().multiply(1.1).setY(1.5)).toLocation(player.getWorld()); - - for (int i = -1; i < 1; i++) - for (int j = -1; j < 1; j++) - CompParticle.VILLAGER_HAPPY.spawn(loc.clone().add(i * Math.random(), 0, 0.5 + j * Math.random())); - } - - getArena().getMessenger().playSound(player, CompSound.LEVEL_UP, 0.1F); - Common.tell(player, Localization.Upgrades.SUCCESSFUL_PURCHASE.replace("{upgrade}", upgrade.getName()).replace("{levels}", Localization.Cases.LEVEL.formatWithCount(levelCost))); - } - - @Override - public void onSignSetupClick(Player player) { - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(getLocation()); - - if (arena == null) { - Common.tell(player, Localization.Signs.REMOVED_OUTSIDE_SIGN); - - removeSign(); - - } else - new IndividualUpgradeMenu(upgrade, false).displayTo(player); - } - - @Override - public void onSignOutGameClick(Player player) { - } - - @Override - protected final String replaceVariables(String line) { - return line.replace("{upgrade}", upgrade.getName()).replace("{price}", Localization.Cases.LEVEL.formatWithCount(levelCost)); - } - - @Override - protected final String[] getFormatting() { - return Settings.Signs.UPGRADES_SIGN_FORMAT; - } - - @Override - public SerializedMap serialize() { - final SerializedMap map = super.serialize(); - - map.put("upgrade", upgrade.getName()); - map.put("levelCost", levelCost); - - return map; - } - - public static final ArenaSign deserialize(String arenaName, SerializedMap map) { - final Sign sign = deserializeSign(map); - final String upgradeName = map.getString("upgrade"); - - final Upgrade upgrade = CoreArenaPlugin.getUpgradesManager().findUpgrade(upgradeName); - if (upgrade == null) - throw new IllegalSignException("The upgrade sign holds a non-existing upgrade '" + upgradeName + "'. Removing.."); - - final int levelCost = map.getInteger("levelCost"); - - return new SimpleSignUpgrade(arenaName, upgrade, levelCost, sign); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSnapshotDummy.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSnapshotDummy.java deleted file mode 100644 index 5be0f5cb7515fbf679d13b4bdd118c4f559d1d17..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSnapshotDummy.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.mineacademy.game.impl; - -import org.bukkit.block.Block; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaSnapshotProcedural; -import org.mineacademy.game.model.ArenaSnapshotStage; - -public class SimpleSnapshotDummy extends ArenaSnapshotProcedural { - - public SimpleSnapshotDummy(Arena arena) { - super(arena); - } - - @Override - public final void onTake(ArenaSnapshotStage stage) { - } - - @Override - public final boolean isSaved(ArenaSnapshotStage stage) { - return false; - } - - @Override - public Block restoreBlock(Block block, ArenaSnapshotStage stage) { - return block; - } - - @Override - public final void onRestore(ArenaSnapshotStage stage) { - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSnapshotWorldEdit.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSnapshotWorldEdit.java deleted file mode 100644 index 615b18e30bcdb58a0fa635f694bda1efd2cb40bc..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSnapshotWorldEdit.java +++ /dev/null @@ -1,358 +0,0 @@ -package org.mineacademy.game.impl; - -import java.io.EOFException; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import com.fastasyncworldedit.core.FaweAPI; -import com.fastasyncworldedit.core.extent.processor.lighting.RelightMode; -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.TimeUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.ChunkedTask; -import org.mineacademy.fo.model.HookManager; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaSnapshotProcedural; -import org.mineacademy.game.model.ArenaSnapshotStage; -import org.mineacademy.game.settings.Settings; - -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.MaxChangedBlocksException; -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.bukkit.BukkitWorld; -import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; -import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter; -import com.sk89q.worldedit.function.operation.ForwardExtentCopy; -import com.sk89q.worldedit.function.operation.Operations; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.regions.CuboidRegion; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.util.io.Closer; -import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockType; - -/** - * Represents a simple way of loading/saving WorldEdit schematics files - * used for damaged snapshots. - * - * CoreArena takes two arena schematics files: - * - * 1. Initial - * 2. Damaged - * - * Damage snapshot is then used when player tries to damage the - * arena, whereas the initial one is used when arena is stopping to - * restore it. - */ -public final class SimpleSnapshotWorldEdit extends ArenaSnapshotProcedural { - - /** - * The two stages for arena - initial and damaged - */ - private final Clipboard[] stages = new Clipboard[2]; - - /** - * The file cache to optimize performance and invoke less calls - */ - private final StrictMap<ArenaSnapshotStage, File> cache = new StrictMap<>(); - - /** - * Create a new instance for the given arena - * - * @param arena - */ - public SimpleSnapshotWorldEdit(Arena arena) { - super(arena); - - // Load automatically when created - loadAll(); - } - - /* - * Load the two snapshots - */ - private void loadAll() { - this.stages[0] = load(DamagedStage.INITIAL); - this.stages[1] = load(DamagedStage.DAMAGED); - } - - /* - * Load a snapshot in the given state, returning clipboard object - */ - private Clipboard load(DamagedStage stage) { - final File file = getSchematicFile(stage); - - // Ignore if not yet taken - if (!file.exists()) - return null; - - // Warn for broken files - if (file.length() == 0) { - Common.warning(stage + " schematic file for arena " + getArena().getName() + " had 0 size and was removed!"); - - file.delete(); - return null; - } - - // Load from file and return - try { - final ClipboardFormat format = ClipboardFormats.findByFile(file); - Valid.checkNotNull(format, "Unknown " + stage + " schematic file for arena " + getArena().getName() + "!"); - - final ClipboardReader reader = format.getReader(new FileInputStream(file)); - final Clipboard copy = reader.read(); - - return copy; - - } catch (final Throwable t) { - - // Do not crash if broken, just rename - if (t instanceof EOFException) - if (t.getMessage() != null && t.getMessage().startsWith("Unexpected end")) { - Common.log("&cSchematics in '" + file.getPath() + "' is broken, ignoring and renaming file.."); - - file.renameTo(new File(file.getPath() + ".broken_" + TimeUtil.currentTimeSeconds())); - return null; - } - - throw new FoException(t, "Failed to load " + stage + " template for " + getArena().getName() + ", see below and report (make sure you have the latest WorldEdit)"); - } - } - - /** - * @see org.mineacademy.game.model.ArenaSnapshot#onTake(org.mineacademy.game.model.ArenaSnapshotStage) - */ - @Override - public void onTake(ArenaSnapshotStage stage) { - final org.mineacademy.game.model.ArenaRegion region = getArena().getData().getRegion(); - - // Ignore if region not set - if (region.getPrimary() == null || region.getSecondary() == null) - return; - - final File schematicFile = getSchematicFile(stage); - - if (!schematicFile.exists()) { - schematicFile.getParentFile().mkdirs(); - - try { - schematicFile.createNewFile(); - } catch (final IOException e) { - e.printStackTrace(); - } - } - - final EditSession session = createEditSession(); - - try (Closer closer = Closer.create()) { - final Region weRegion = makeRegion(); - final Clipboard clipboard = new BlockArrayClipboard(weRegion); - final ForwardExtentCopy copy = new ForwardExtentCopy(session, weRegion, clipboard, weRegion.getMinimumPoint()); - - Operations.completeLegacy(copy); - - final FileOutputStream fos = new FileOutputStream(schematicFile); - final FileOutputStream out = closer.register(fos); - final ClipboardWriter writer = closer.register(BuiltInClipboardFormat.SPONGE_SCHEMATIC.getWriter(out)); - - writer.write(clipboard); - - if (Settings.WorldEdit.CLOSE_STREAM && !HookManager.isFAWELoaded()) { - fos.close(); - out.close(); - writer.close(); - } - - } catch (final Exception ex) { - ex.printStackTrace(); - } - - // Reload - loadAll(); - } - - /** - * @see org.mineacademy.game.model.ArenaSnapshot#onRestore(org.mineacademy.game.model.ArenaSnapshotStage) - */ - @Override - public void onRestore(ArenaSnapshotStage newStage) { - if (!isSaved(newStage)) - return; - - // Run as much async as possible to put pressure off of the main thread - Common.runAsync(() -> { - - final Clipboard clip = getClipboard(newStage); - - if (clip == null) - return; - - final long now = System.currentTimeMillis(); - - final EditSession session = createEditSession(); - session.setFastMode(true); - - // Count all arena blocks - final List<BlockVector3> vectors = new ArrayList<>(); - final List<Block> blocks = getArena().getData().getRegion().getBlocks(); - - for (final Block block : blocks) - vectors.add(makeVector(block.getLocation())); - - // Restore each block individually, in chunks - final ChunkedTask task = new ChunkedTask(Settings.WorldEdit.BLOCK_BULK_RESTORE_AMOUNT) { - - @Override - protected void onProcess(int index) { - final BlockVector3 vector = vectors.get(index); - - update(session, newStage, vector); - } - - @Override - protected boolean canContinue(int index) { - return index < vectors.size(); - } - - @Override - protected void onFinish() { - session.flushSession(); - - // FAWE bug: Fix lightning - // https://github.com/IntellectualSites/FastAsyncWorldEdit/issues/605#issuecomment-708596438 - if (HookManager.isFAWELoaded()) - FaweAPI.fixLighting(makeWorld(), makeRegion(), null, RelightMode.ALL); - } - }; - - task.setWaitPeriodTicks(Settings.WorldEdit.WAIT_PERIOD.getTimeTicks()); - - // Run the chain on the main thread for safety - Common.runLater(() -> task.startChain()); - - Debugger.debug("snapshot", "Restoring " + getArena().getName() + " to " + newStage.getFormattedName() + " took " + (System.currentTimeMillis() - now) + " ms"); - }); - } - - /** - * @see org.mineacademy.game.model.ArenaSnapshotProcedural#restoreBlock(org.bukkit.block.Block, org.mineacademy.game.model.ArenaSnapshotStage) - */ - @Override - public Block restoreBlock(Block block, ArenaSnapshotStage stage) { - if (isSaved(stage) && getClipboard(stage) != null) { - final EditSession session = createEditSession(); - final BlockType changed = update(session, stage, makeVector(block.getLocation())); - - block = changed != null && changed.getName().equals("Air") ? null : block; - session.flushSession(); - } - - return block; - } - - /** - * @see org.mineacademy.game.model.ArenaSnapshot#isSaved(org.mineacademy.game.model.ArenaSnapshotStage) - */ - @Override - public boolean isSaved(ArenaSnapshotStage stage) { - return getSchematicFile(stage).exists(); - } - - /* - * Sets the given vector to its state from the given stage - */ - private BlockType update(EditSession session, ArenaSnapshotStage stage, BlockVector3 vec) { - final BaseBlock copy = getBaseBlock(stage, vec); - - if (copy != null) - try { - session.setBlock(BlockVector3.at(vec.getX(), vec.getY(), vec.getZ()), copy); - - return copy.getBlockType(); - - } catch (final MaxChangedBlocksException ex) { - ex.printStackTrace(); - } - - return null; - } - - /* - * Return the schematic file, if exists - */ - private File getSchematicFile(ArenaSnapshotStage stage) { - if (!cache.contains(stage)) { - final String folder = (HookManager.isFAWELoaded() ? "FastAsyncWorldEdit/schematics/" : "WorldEdit/schematics/") - + stage.getFileName().replace("{arena}", getArena().getName()) + (HookManager.isFAWELoaded() ? ".schem" : ".schematic"); - - cache.put(stage, new File(CoreArenaPlugin.getInstance().getDataFolder().getParent(), folder)); - } - - return cache.get(stage); - } - - /* - * Create edit session from the arena world automatically - */ - private EditSession createEditSession() { - return WorldEdit.getInstance().getEditSessionFactory().getEditSession(makeWorld(), -1); - } - - /* - * Create world from our current arena region - */ - private com.sk89q.worldedit.world.World makeWorld() { - return new BukkitWorld(getArena().getData().getRegion().getPrimary().getWorld()); - } - - /* - * Converts the given location into WorldEdit vector - */ - private BlockVector3 makeVector(Location location) { - Valid.checkNotNull(location, "Location in WorldEdit snapshot cannot be null!"); - - return BlockVector3.at(location.getBlockX(), location.getBlockY(), location.getBlockZ()); - } - - /* - * Create a WorldEdit region from ours - */ - private Region makeRegion() { - final BlockVector3 min = makeVector(getArena().getData().getRegion().getPrimary()); - final BlockVector3 max = makeVector(getArena().getData().getRegion().getSecondary()); - - return new CuboidRegion(min, max); - } - - /* - * Return WorldEdit block from the given vector - */ - private BaseBlock getBaseBlock(ArenaSnapshotStage stage, BlockVector3 vector) { - final Clipboard clip = getClipboard(stage); - - Valid.checkNotNull(clip, "Selected stage (" + stage + ") is not loaded"); - return clip.getFullBlock(BlockVector3.at(vector.getX(), vector.getY(), vector.getZ())); - } - - /* - * Return the clipboard in a given stage - */ - private Clipboard getClipboard(ArenaSnapshotStage stage) { - return stages[stage.getId()]; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSpawnPoint.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSpawnPoint.java deleted file mode 100644 index d8e087af087a7453f3493ec4dc8b08f5ced305c2..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSpawnPoint.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.mineacademy.game.impl; - -import org.bukkit.Location; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.game.model.SpawnPoint; -import org.mineacademy.game.type.SpawnPointType; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; - -@Getter -@AllArgsConstructor(access = AccessLevel.PROTECTED) -public abstract class SimpleSpawnPoint implements SpawnPoint { - - private final SpawnPointType type; - - @Setter - private Location location; - - @Override - public SerializedMap serialize() { - final SerializedMap map = new SerializedMap(); - - map.put("location", location); - - return map; - } - - public static final SimpleSpawnPoint deserialize(SerializedMap map, SpawnPointType type) { - switch (type) { - case MONSTER: - return SimpleSpawnPointMonster.deserialize(map); - - case PLAYER: - return SimpleSpawnPointPlayer.deserialize(map); - - default: - throw new FoException("Unhandled loading spawnpoint " + type); - } - } - - @Override - public String toString() { - return type + "_SpawnPoint" + "{" + (getLocation() != null ? Common.shortLocation(getLocation()) : "null") + "}"; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSpawnPointMonster.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSpawnPointMonster.java deleted file mode 100644 index 2f510a00ec495825ad0530e2147474f38e2ab819..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSpawnPointMonster.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.mineacademy.game.impl; - -import java.util.List; - -import org.bukkit.Location; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.SerializeUtil; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.game.model.ActivePeriod; -import org.mineacademy.game.model.ActivePeriod.ActiveMode; -import org.mineacademy.game.type.SpawnPointType; - -import lombok.Getter; -import lombok.Setter; - -@Getter -@Setter -public final class SimpleSpawnPointMonster extends SimpleSpawnPoint { - - private SpawnedEntity[] spawnedTypes; - - private ActivePeriod activePeriod = new ActivePeriod(ActiveMode.FROM, 1); - - private int minimumPlayers = 1; - private int chance = 100; - private boolean spawnAllSlots = false; - - public SimpleSpawnPointMonster(Location location) { - super(SpawnPointType.MONSTER, location); - } - - @Override - public SerializedMap serialize() { - final SerializedMap map = super.serialize(); - - map.put("activePeriod", activePeriod); - map.put("minPlayers", minimumPlayers); - map.put("chance", chance); - map.put("spawnAllSlots", spawnAllSlots); - map.putIfExist("spawns", spawnedTypes); - - return map; - } - - @Override - public String toString() { - final String chanceF = chance == 100 ? "" : chance + "% chance, "; - final String minPlayersF = minimumPlayers == 1 ? "" : minimumPlayers + " min. players, "; - final String spawnedTypesF = spawnedTypes == null ? "spawns nothing" : Common.join(spawnedTypes, ", ", SpawnedEntity::format); - - return "Spawner{" + activePeriod.formatPeriod() + " phase, " + chanceF + minPlayersF + spawnedTypesF + "}"; - } - - public static SimpleSpawnPointMonster deserialize(SerializedMap map) { - final Location loc = map.getLocation("location"); - final SimpleSpawnPointMonster spawn = new SimpleSpawnPointMonster(loc); - - { - final List<SpawnedEntity> list = SerializeUtil.deserializeMapList(map.get("spawns", Object.class), SpawnedEntity.class); - - if (list != null) - spawn.spawnedTypes = list.toArray(new SpawnedEntity[list.size()]); - } - - spawn.activePeriod = ActivePeriod.deserialize(map.containsKey("activePeriod") ? map.getMap("activePeriod") : new SerializedMap()); - spawn.minimumPlayers = map.getInteger("minPlayers"); - - if (map.containsKey("chance")) - spawn.chance = map.getInteger("chance"); - - if (map.containsKey("spawnAllSlots")) - spawn.spawnAllSlots = map.getBoolean("spawnAllSlots"); - - return spawn; - } - -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSpawnPointPlayer.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSpawnPointPlayer.java deleted file mode 100644 index 8315ca01cb2ea14173be6659fb835537ed2da38f..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleSpawnPointPlayer.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.mineacademy.game.impl; - -import org.bukkit.Location; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.game.type.SpawnPointType; - -public final class SimpleSpawnPointPlayer extends SimpleSpawnPoint { - - public SimpleSpawnPointPlayer(Location location) { - super(SpawnPointType.PLAYER, location); - } - - public static SimpleSpawnPoint deserialize(SerializedMap map) { - final Location loc = map.getLocation("location"); - - return new SimpleSpawnPointPlayer(loc); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleTier.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleTier.java deleted file mode 100644 index 0b1002852133bbf89506f638bd9341fa69b9c057..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleTier.java +++ /dev/null @@ -1,120 +0,0 @@ -package org.mineacademy.game.impl; - -import java.util.ArrayList; - -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; -import org.bukkit.permissions.PermissionAttachment; -import org.bukkit.potion.PotionEffect; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.game.event.ClassObtainEvent; -import org.mineacademy.game.model.ArenaClass; -import org.mineacademy.game.model.ClassTier; -import org.mineacademy.game.model.TierSettings; -import org.mineacademy.game.type.TierMode; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.Setter; - -@Getter -@AllArgsConstructor - -public class SimpleTier implements ClassTier { - - private final String clazzName; - - @Setter - private int tier; - - @Setter - private int levelCost; - - private final ItemStack[] content; - private final org.mineacademy.game.model.ArmorContent armor; - - @Override - public final void giveToPlayer(Player pl, TierMode mode) { - final PlayerInventory inv = pl.getInventory(); - Valid.checkBoolean(getContent().length == PlayerUtil.USABLE_PLAYER_INV_SIZE, "Malformed inventory content size in " + clazzName + " (" + getContent().length + "). Please recreate the class."); - - inv.setContents(getContent()); - inv.setHeldItemSlot(0); - - armor.giveTo(pl); - - if (mode == TierMode.PLAY) - applyTierSpecificSettings(pl); - - Common.callEvent(new ClassObtainEvent(pl, CoreArenaPlugin.getClassManager().findClass(getClazzName()), tier)); - } - - private final void applyTierSpecificSettings(Player pl) { - final ArenaPlayer data = CoreArenaPlugin.getDataFor(pl); - final ArenaClass clazz = CoreArenaPlugin.getClassManager().findClass(clazzName); - final TierSettings settings = clazz.getTierSettings(tier); - - if (settings != null) { - if (settings.getPotionEffects() != null) - for (final PotionEffect effect : settings.getPotionEffects()) - effect.apply(pl); - - if (settings.getPermissionsToGive() != null) - for (final String permission : settings.getPermissionsToGive()) { - final PermissionAttachment perm = pl.addAttachment(SimplePlugin.getInstance(), permission, true); - - data.getArenaCache().givenPermissions.add(perm); - } - } - } - - @Override - public void onArenaLeave(Player pl) { - final ArenaPlayer data = CoreArenaPlugin.getDataFor(pl); - final ArenaClass clazz = CoreArenaPlugin.getClassManager().findClass(clazzName); - - if (clazz != null) { - final TierSettings settings = clazz.getTierSettings(tier); - - if (settings != null) { - if (settings.getPotionEffects() != null) - for (final PotionEffect effect : settings.getPotionEffects()) - pl.removePotionEffect(effect.getType()); - - for (final PermissionAttachment perm : data.getArenaCache().givenPermissions) - pl.removeAttachment(perm); - } - } - } - - @Override - public final SerializedMap serialize() { - final SerializedMap map = new SerializedMap(); - - map.put("tier", tier); - map.put("levelCost", levelCost); - map.put("content", content); - map.put("armor", armor); - - return map; - } - - public static final SimpleTier deserialize(SerializedMap map, String clazz) { - final int tier = map.getInteger("tier"); - final int levelCost = map.getInteger("levelCost"); - final ItemStack[] content = getStackOrList(map.get("content", Object.class)); - final SimpleArmorContent armorContent = SimpleArmorContent.deserialize(map.containsKey("armor") ? map.getMap("armor") : new SerializedMap()); - - return new SimpleTier(clazz, tier, levelCost, content, armorContent); - } - - private static final ItemStack[] getStackOrList(Object raw) { - return raw instanceof ItemStack[] ? (ItemStack[]) raw : raw instanceof ArrayList ? ((ArrayList<ItemStack>) raw).toArray(new ItemStack[((ArrayList<ItemStack>) raw).size()]) : null; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleUpgrade.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleUpgrade.java deleted file mode 100644 index 918d3e52c2022309c795601369e7b5f36a83f9b5..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SimpleUpgrade.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.mineacademy.game.impl; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.settings.YamlConfig; -import org.mineacademy.game.data.UpgradeDataSection; -import org.mineacademy.game.model.Upgrade; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.util.Constants; - -import lombok.Getter; - -/** - * Class covering the data section + capable of setting inventory content - */ -@Getter -public final class SimpleUpgrade extends YamlConfig implements Upgrade { - - private final UpgradeDataSection data; - - private String permission; - - private int unlockPhase; - - public SimpleUpgrade(String name) { - this.data = new UpgradeDataSection(name); - - setHeader(Constants.Header.UPGRADE_FILE); - loadConfiguration("prototype/upgrade.yml", "upgrades/" + name + ".yml"); - } - - @Override - protected void onLoadFinish() { - permission = getString("Permission"); - unlockPhase = getInteger("Available_From_Phase"); - } - - @Override - public void deleteUpgrade() { - Valid.checkBoolean(CoreArenaPlugin.getUpgradesManager().findUpgrade(getName()) == null, "Vodstrn " + getName() + " vod vrchu"); - - delete(); - data.deleteSection(); - } - - @Override - public void giveToPlayer(Player pl) { - final List<ItemStack> itemsToGive = new ArrayList<>(); - - if (getItems() != null) - itemsToGive.addAll(Common.removeNullAndEmpty(getItems())); - - final Map<Integer, ItemStack> leftOvers = PlayerUtil.addItems(pl.getInventory(), itemsToGive.toArray(new ItemStack[itemsToGive.size()])); - - for (final ItemStack is : leftOvers.values()) - if (is.getAmount() > is.getMaxStackSize()) { - final double count = (double) is.getAmount() / (double) is.getMaxStackSize(); - is.setAmount(is.getMaxStackSize()); - - for (int i = 0; i < count; i++) - pl.getWorld().dropItem(pl.getLocation(), is); - - final int rest = (int) Math.round(Double.valueOf(Double.toString(count).split("\\.")[1]) * is.getMaxStackSize()); - - is.setAmount(rest); - pl.getWorld().dropItem(pl.getLocation(), is); - - } else - pl.getWorld().dropItemNaturally(pl.getLocation(), is); - - if (!leftOvers.isEmpty()) - Common.tell(pl, Localization.Upgrades.LACK_SPACE); - } - - public boolean isDataValid() { - return data.isSectionValid(); - } - - @Override - public ItemStack[] getItems() { - return data.getItems(); - } - - @Override - public void setItems(ItemStack[] items) { - data.setItems(items); - } - - @Override - public boolean equals(Object obj) { - return obj instanceof SimpleUpgrade && ((SimpleUpgrade) obj).getName().equals(getName()); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SpawnedEntity.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SpawnedEntity.java deleted file mode 100644 index aee8b8a6a303cd5d336fce89370bb6d2069ca47a..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/SpawnedEntity.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.mineacademy.game.impl; - -import java.util.Map; - -import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.ItemUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.model.ConfigSerializable; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.CompMonsterEgg; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@Getter -@RequiredArgsConstructor(access = AccessLevel.PRIVATE) -public final class SpawnedEntity implements ConfigSerializable { - - private final EntityType type; - private final int count; - - // For third party plugin support - private ItemStack customItem; - - @Override - public SerializedMap serialize() { - final SerializedMap map = new SerializedMap(); - - if (customItem != null) - map.put("custom_egg", customItem); - else { - map.put("entity", type); - map.put("count", count); - } - - return map; - } - - public static SpawnedEntity deserialize(SerializedMap map) { - if (map.containsKey("custom_egg")) { - - // Remove broken previously stored eggs - final Object eggMap = map.containsKey("custom_egg") ? map.asMap().get("custom_egg") : null; - - if (eggMap instanceof Map) - if (((Map<?, ?>) eggMap).containsKey("meta") && !(((Map<?, ?>) eggMap).get("meta") instanceof ItemMeta)) { - map.remove("custom_egg"); - Common.warning("Detected invalid custom egg in one of your spawners, replacing with sheep."); - - return new SpawnedEntity(EntityType.SHEEP, 1); - } - - final ItemStack item = map.getItem("custom_egg"); - final SpawnedEntity custom = new SpawnedEntity(CompMonsterEgg.getEntity(item), item.getAmount()); - - custom.customItem = item; - return custom; - } - - final EntityType type = map.get("entity", EntityType.class); - final int count = map.getInteger("count"); - - return new SpawnedEntity(type, count); - } - - public ItemStack toEgg() { - return customItem != null ? customItem : CompMonsterEgg.makeEgg(type, count); - } - - public boolean isCustom() { - return customItem != null; - } - - public static SpawnedEntity fromEgg(ItemStack is) { - Valid.checkNotNull(is, "Itemstack is null!"); - Valid.checkBoolean(CompMaterial.isMonsterEgg(is.getType()), "Cannot create spawnpoint entity from " + is.getType()); - - final EntityType type = CompMonsterEgg.getEntity(is); - - if (isUnknownEntity(is) || type == EntityType.UNKNOWN) { - final SpawnedEntity spawned = new SpawnedEntity(type, is.getAmount()); - spawned.customItem = is; - - return spawned; - } - - Valid.checkNotNull(type, "Could not detect monster from egg: " + is); - Valid.checkBoolean(type.isSpawnable(), "Spawnpoint cannot summon entity: " + type); - - return new SpawnedEntity(type, is.getAmount()); - } - - private static boolean isUnknownEntity(ItemStack is) { - return is.hasItemMeta() && (is.getItemMeta().hasDisplayName() || is.getItemMeta().hasLore()); - } - - public String format() { - return getCount() + " " + (getCustomItem() != null ? getCustomItem() : ItemUtil.bountifyCapitalized(getType())); - } - - @Override - public String toString() { - return "SpawnedEntity{" + getCount() + "x " + getType() + " (" + getCustomItem() + ")}"; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/arena/FeatureArena.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/arena/FeatureArena.java deleted file mode 100644 index ee5aa49c311c7278cfcd64336e9a4b1a402701c3..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/arena/FeatureArena.java +++ /dev/null @@ -1,353 +0,0 @@ -package org.mineacademy.game.impl.arena; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Fireball; -import org.bukkit.entity.Item; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Monster; -import org.bukkit.entity.Player; -import org.bukkit.entity.SmallFireball; -import org.bukkit.entity.TNTPrimed; -import org.bukkit.entity.Wolf; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDeathEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.event.player.PlayerRespawnEvent; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.HealthBarUtil; -import org.mineacademy.fo.RandomUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.CompSound; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.game.exception.CancelledException; -import org.mineacademy.game.exception.EventHandledException; -import org.mineacademy.game.exp.ExpItemHandler; -import org.mineacademy.game.impl.ArenaPlayer; -import org.mineacademy.game.impl.ArenaPlayer.ClassCache; -import org.mineacademy.game.impl.ArenaPlayer.InArenaCache; -import org.mineacademy.game.impl.SimpleSettings; -import org.mineacademy.game.impl.SimpleSetup; -import org.mineacademy.game.manager.SpawnPointManager; -import org.mineacademy.game.menu.MenuInArenaClasses; -import org.mineacademy.game.model.ArenaClass; -import org.mineacademy.game.model.ExpItem; -import org.mineacademy.game.model.Setup; -import org.mineacademy.game.model.SpawnPoint; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.settings.Settings; -import org.mineacademy.game.type.DeathCause; -import org.mineacademy.game.type.LeaveCause; -import org.mineacademy.game.type.SpawnPointType; -import org.mineacademy.game.type.TierMode; - -import lombok.Getter; - -public abstract class FeatureArena extends SimpleArena { - - @Getter - private final Setup setup; - - private final SpawnPointManager spawnPoints; - - protected FeatureArena(String name) { - super(new SimpleSettings(name)); - - setup = new SimpleSetup(this); - spawnPoints = new SpawnPointManager(getData()); - } - - @Override - protected final void handlePlayerPostJoin(Player pl) { - final ArenaPlayer data = CoreArenaPlugin.getDataFor(pl); - final InArenaCache arenaCache = data.getArenaCache(); - - { // Set lifes - arenaCache.lifesLeft = getSettings().getLifes(); - Valid.checkBoolean(arenaCache.lifesLeft != -1, "Please configure 'Lifes' in your " + getName() + " arena"); - } - - if (!getSettings().allowOwnEquipment() && data.getClassCache().assignedClass == null && getSettings().openClassMenu()) - new MenuInArenaClasses(this, pl).displayTo(pl); - } - - @Override - protected final void handlePrePlayerLeave(Player pl, LeaveCause cause) { - { // Classes - final Menu menu = Menu.getMenu(pl); - - if (menu != null && menu instanceof MenuInArenaClasses) - pl.closeInventory(); - } - } - - @Override - public final void onPlayerPvP(EntityDamageByEntityEvent e, Player damager, Player victim, double damage) throws EventHandledException { - final int pvpPhase = getSettings().getPvpPhase(); - - if (pvpPhase != -1 && getPhase().getCurrent() >= pvpPhase) - HealthBarUtil.display(damager, victim, damage); - - else - e.setCancelled(true); - } - - @Override - public final void onPlayerPvE(Player damager, LivingEntity victim, double damage) throws EventHandledException { - if (Settings.Arena.SHOW_HEALTH_BAR) - HealthBarUtil.display(damager, victim, damage); - } - - @Override - public final void onPlayerBlockPlace(BlockPlaceEvent e) { - final Material type = e.getBlock().getType(); - final Location loc = e.getBlock().getLocation(); - - if (type == Material.TNT && getSettings().igniteTnts()) { - final TNTPrimed tnt = loc.getWorld().spawn(loc.add(0.5, 0, 0.5), TNTPrimed.class); - tnt.setFuseTicks(40); - - Remain.takeHandItem(e.getPlayer()); - returnCancelled(); - } - - if (!getSettings().getPlaceList().isAllowed(type)) - returnCancelled(); - } - - @Override - public final void onPlayerBlockBreak(BlockBreakEvent e) { - final Material type = e.getBlock().getType(); - - if (!getSettings().getBreakingList().isAllowed(type)) - e.setCancelled(true); - } - - @Override - public final void onPlayerClickAir(Player pl, ItemStack hand) throws CancelledException { - if (hand == null) - return; - - if (hand.getType() == CompMaterial.FIRE_CHARGE.getMaterial() && getSettings().launchFireballs()) { - pl.launchProjectile(RandomUtil.chance(75) ? Fireball.class : SmallFireball.class); - - Remain.takeHandItem(pl); - returnCancelled(); - } - } - - @Override - public final void onPlayerClick(Player pl, Block block, ItemStack hand) throws CancelledException { - if (hand == null) - return; - - final Material type = hand.getType(); - final Location loc = block.getLocation(); - - if (type == Material.BONE && getSettings().spawnWolves()) { - final Wolf wolf = loc.getWorld().spawn(loc.add(0.5, 1, 0.5), Wolf.class); - - wolf.setOwner(pl); - wolf.setTamed(true); - - final Monster target = getMobTarget(wolf.getLocation(), 12); - - if (target != null) - wolf.setTarget(target); - - Remain.takeHandItem(pl); - - return; - } - } - - private final Monster getMobTarget(Location loc, int radius) { - for (final Entity en : Remain.getNearbyEntities(loc, radius)) - if (en instanceof Monster && getData().getRegion().isWithin(en.getLocation())) - return (Monster) en; - - return null; - } - - @Override - public void onPlayerDeath(Player pl, Player killer) throws EventHandledException { - super.onPlayerDeath(pl, killer); - - final InArenaCache cache = CoreArenaPlugin.getDataFor(pl).getArenaCache(); - - if (--cache.lifesLeft < 1) { - - getMessenger().broadcastExcept(pl, pl, Localization.Arena.Game.KICK_KILL_BROADCAST.replace("{killer}", killer.getName())); - getMessenger().tell(pl, Localization.Arena.Game.KICK_KILL_TO_VICTIM.replace("{killer}", killer.getName())); - - respawnAndKick(cache, pl, true); - - } else { - getMessenger().tell(pl, Localization.Arena.Game.KILL_TO_VICTIM.replace("{lifes}", Localization.Cases.LIFE.formatWithCount(cache.lifesLeft))); - getMessenger().broadcastExcept(pl, pl, Localization.Arena.Game.KILL_BROADCAST.replace("{player}", pl.getName()).replace("{killer}", killer.getName()).replace("{lifes_left}", getSettings().getLifes() - cache.lifesLeft + "").replace("{lifes_max}", getSettings().getLifes() + "")); - - respawnAndKick(cache, pl, false); - } - } - - @Override - public void onPlayerDeath(Player pl, DeathCause cause) throws EventHandledException { - super.onPlayerDeath(pl, cause); - - final InArenaCache cache = CoreArenaPlugin.getDataFor(pl).getArenaCache(); - - if (--cache.lifesLeft < 1) { - getMessenger().broadcastExcept(pl, pl, Localization.Arena.Game.KICK_DEATH_BROADCAST); - getMessenger().tell(pl, Localization.Arena.Game.KICK_DEATH_TO_VICTIM); - - respawnAndKick(cache, pl, true); - - } else { - getMessenger().tell(pl, Localization.Arena.Game.DEATH_TO_VICTIM.replace("{lifes_left}", Localization.Cases.LIFE.formatWithCount(cache.lifesLeft))); - getMessenger().broadcastExcept(pl, pl, Localization.Arena.Game.DEATH_BROADCAST.replace("{player}", pl.getName()).replace("{deaths}", "" + (getSettings().getLifes() - cache.lifesLeft)).replace("{lifes_max}", getSettings().getLifes() + "")); - - respawnAndKick(cache, pl, false); - } - } - - private final void respawnAndKick(InArenaCache cache, Player pl, boolean kick) throws EventHandledException { - if (kick) - cache.pendingRemoval = true; - - Remain.respawn(pl); - returnHandled(); - } - - @Override - public void onPlayerRespawn(PlayerRespawnEvent e) throws EventHandledException { - super.onPlayerRespawn(e); - - final Player pl = e.getPlayer(); - final ArenaPlayer data = CoreArenaPlugin.getDataFor(pl); - final InArenaCache cache = data.getArenaCache(); - - { // Handle spawn points - if (getSettings().isRespawningRandom()) - assignRandomSpawnPoint(data, pl); - - Valid.checkNotNull(cache.spawnPoint, "Spawnpoint in " + getName() + " for " + pl.getName() + " not assigned!"); - e.setRespawnLocation(cache.spawnPoint.getLocation()); - } - - // Handle classes - if (!getSettings().allowOwnEquipment()) { - final ClassCache plClass = data.getClassCache(); - Valid.checkNotNull(plClass.assignedClass, "Unable to respawn " + pl.getName() + " as he is missing class!"); - - pl.getInventory().clear(); - - Common.runLater(10, () -> { - plClass.assignedClass.giveToPlayer(pl, TierMode.PLAY); - }); - } - } - - @Override - public final void onEntityDeath(EntityDeathEvent e) throws EventHandledException { - super.onEntityDeath(e); - super.checkRunning(); - - final Entity en = e.getEntity(); - final int exp = getSettings().getExpFor(en, getPhase().getCurrent()); - - spawnExperienceItem(en.getLocation(), exp); - - e.setDroppedExp(0); - - if (!getSettings().allowNaturalDrops() || e.getEntityType() == EntityType.PLAYER && !getSettings().allowOwnEquipment()) - e.getDrops().clear(); - } - - private final void spawnExperienceItem(Location location, int exp) { - ExpItemHandler.spawn(location, exp); - } - - @Override - public void onPlayerPickupTag(PlayerPickupItemEvent e, ExpItem tag) throws EventHandledException { - super.checkRunning(); - - final Player pl = e.getPlayer(); - final Item item = e.getItem(); - final InArenaCache cache = CoreArenaPlugin.getDataFor(e.getPlayer()).getArenaCache(); - - // Give exp to player - { - cache.giveAndShowExp(pl, tag.getExpGiven()); - - CompSound.ORB_PICKUP.play(pl, 1, 1); - Common.tell(pl, Localization.Experience.PICKUP.replace("{level}", Localization.Cases.LEVEL.formatWithCount(cache.getLevel())).replace("{exp}", Localization.Cases.EXP.formatWithCount(cache.getExp()))); - } - - // Take care of the item - { - e.setCancelled(true); - item.remove(); - } - } - - @Override - protected void handleArenaPostStart() { - final StrictList<Player> toKick = new StrictList<>(); - - for (final Player pl : getPlayers()) { - final ArenaPlayer data = CoreArenaPlugin.getDataFor(pl); - final ClassCache cache = data.getClassCache(); - - { // Handle classes - if (cache.assignedClass != null) - Valid.checkBoolean(data.getTierOf(cache.assignedClass) >= getSettings().getMinimumTier(), "Found too low class tier for " + pl.getName() + " in " + getName()); - - if (!getSettings().allowOwnEquipment()) { - if (cache.assignedClass == null) { - final ArenaClass random = Settings.Arena.GIVE_RANDOM_CLASS_IF_NOT_SELECTED ? getClassManager().findRandomClassFor(pl, getSettings().getMinimumTier()) : null; - - if (random == null) { - getMessenger().tell(pl, Localization.Arena.Lobby.KICK_NO_CLASS); - - toKick.add(pl); - continue; - - } - - getMessenger().tell(pl, Localization.Arena.Game.CLASS_AUTO_ASSIGNED.replace("{class}", random.getName())); - - cache.assignedClass = random; - } - - cache.assignedClass.giveToPlayer(pl, TierMode.PLAY); - } - } - - { // Handle spawn points - final Location spawn = assignRandomSpawnPoint(data, pl); - - pl.teleport(spawn.add(0, 1.2, 0)); - } - } - - for (final Player pl : toKick) - kickPlayer(pl, LeaveCause.NOT_READY); - } - - private final Location assignRandomSpawnPoint(ArenaPlayer data, Player player) { - final SpawnPoint point = spawnPoints.getRandomSpawnPoint(player, SpawnPointType.PLAYER); - - data.getArenaCache().spawnPoint = point; - return point.getLocation().clone(); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/arena/MobArena.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/arena/MobArena.java deleted file mode 100644 index f4bebe9f80f81f995557b874cd0e56e5b116ec94..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/arena/MobArena.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.mineacademy.game.impl.arena; - -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByBlockEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.mineacademy.game.exception.EventHandledException; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.type.DeathCause; -import org.mineacademy.game.type.LeaveCause; -import org.mineacademy.game.type.StopCause; - -/** - * An arena where the last dick standing wins. - */ -public final class MobArena extends FeatureArena { - - public MobArena(String name) { - super(name); - } - - @Override - public void onPlayerDeath(Player pl, Player killer) throws EventHandledException { - super.onPlayerDeath(pl, killer); - - kickPlayer(pl, LeaveCause.KILLED); - - getMessenger().broadcastExcept(pl, pl, Localization.Arena.Game.KICK_KILL_BROADCAST.replace("{killer}", killer.getName())); - getMessenger().tell(pl, Localization.Arena.Game.KICK_KILL_TO_VICTIM.replace("{killer}", killer.getName())); - } - - @Override - public void onPlayerDeath(Player pl, DeathCause cause) throws EventHandledException { - super.onPlayerDeath(pl, cause); - - kickPlayer(pl, LeaveCause.KILLED); - } - - @Override - public void onPlayerDamage(EntityDamageByEntityEvent e, Player player, Entity source, double damage) { - } - - @Override - public void onPlayerBlockDamage(EntityDamageByBlockEvent e, Player player, double damage) { - } - - @Override - public void onProjectileHit(ProjectileHitEvent e) { - } - - @Override - public void onProjectileLaunch(ProjectileLaunchEvent e) { - } - - @Override - protected void handleArenaPostStop(StopCause cause) { - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/arena/SimpleArena.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/arena/SimpleArena.java deleted file mode 100644 index 7f2885cbc989739e33c86956a0dba989086242bf..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/impl/arena/SimpleArena.java +++ /dev/null @@ -1,976 +0,0 @@ -package org.mineacademy.game.impl.arena; - -import java.util.Collection; -import java.util.Collections; -import java.util.ConcurrentModificationException; -import java.util.Iterator; -import java.util.TreeSet; - -import org.apache.commons.lang.StringUtils; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.entity.Wolf; -import org.bukkit.event.entity.EntityDeathEvent; -import org.bukkit.event.entity.EntitySpawnEvent; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.event.entity.EntityTargetEvent.TargetReason; -import org.bukkit.event.player.PlayerRespawnEvent; -import org.bukkit.scheduler.BukkitRunnable; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.EntityUtil; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictSet; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.HookManager; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompMetadata; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.game.countdown.EndCountdown; -import org.mineacademy.game.countdown.LaunchCountdown; -import org.mineacademy.game.event.ArenaJoinEvent; -import org.mineacademy.game.event.ArenaLeaveEvent; -import org.mineacademy.game.event.ArenaLobbyTeleportEvent; -import org.mineacademy.game.event.ArenaPostStartEvent; -import org.mineacademy.game.event.ArenaPostStopEvent; -import org.mineacademy.game.event.ArenaPreJoinEvent; -import org.mineacademy.game.event.ArenaPreLeaveEvent; -import org.mineacademy.game.event.LobbyStartEvent; -import org.mineacademy.game.event.SpawnTeleportEvent; -import org.mineacademy.game.exception.CancelledException; -import org.mineacademy.game.exception.EventHandledException; -import org.mineacademy.game.impl.ArenaPlayer; -import org.mineacademy.game.impl.ArenaPlayer.ClassCache; -import org.mineacademy.game.impl.ArenaPlayer.InArenaCache; -import org.mineacademy.game.impl.SimpleMessenger; -import org.mineacademy.game.impl.SimplePhaseIncremental; -import org.mineacademy.game.impl.SimpleSignPower; -import org.mineacademy.game.impl.SimpleSnapshotDummy; -import org.mineacademy.game.impl.SimpleSnapshotWorldEdit; -import org.mineacademy.game.manager.ClassManager; -import org.mineacademy.game.manager.UpgradesManager; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaData; -import org.mineacademy.game.model.ArenaPhase; -import org.mineacademy.game.model.ArenaPlugin; -import org.mineacademy.game.model.ArenaRegistry; -import org.mineacademy.game.model.ArenaSettings; -import org.mineacademy.game.model.ArenaSign; -import org.mineacademy.game.model.ArenaSign.SignType; -import org.mineacademy.game.model.ArenaSnapshot; -import org.mineacademy.game.model.ArenaSnapshotProcedural.DamagedStage; -import org.mineacademy.game.model.ArenaSnapshotStage; -import org.mineacademy.game.physics.BlockPhysicsCheckTask; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.settings.Settings; -import org.mineacademy.game.type.ArenaState; -import org.mineacademy.game.type.DeathCause; -import org.mineacademy.game.type.JoinCause; -import org.mineacademy.game.type.LeaveCause; -import org.mineacademy.game.type.StopCause; -import org.mineacademy.game.util.InventoryStorageUtil; -import org.mineacademy.game.util.Permissions; - -public abstract class SimpleArena implements Arena { - - private final StrictSet<Player> players = new StrictSet<>(); - - private final SimpleMessenger messenger; - private final ArenaData data; - private final ArenaSettings settings; - private final ArenaSnapshot snapshot; - private final ArenaPhase phase; - - private ArenaState state = ArenaState.STOPPED; - - private EndCountdown endCountdown; - private LaunchCountdown launchCountdown; - - private boolean stopping = false; - private boolean restoreSnapshots = true; - - public static final void clearRegisteredArenas() { - ArenaRegistry.unregisterAll(SimplePlugin.getNamed()); - } - - protected SimpleArena(ArenaSettings settings) { - this.settings = settings; - data = settings.getDataSection(); - - messenger = new SimpleMessenger(this); - snapshot = Settings.ProceduralDamage.ENABLED && settings.hasProceduralDamage() && HookManager.isWorldEditLoaded() && MinecraftVersion.atLeast(V.v1_13) ? new SimpleSnapshotWorldEdit(this) : new SimpleSnapshotDummy(this); - phase = new SimplePhaseIncremental(this); - - ArenaRegistry.register(this); - } - - @Override - public final void onPostLoad() { - getData().onPostLoad(); - } - - // -------------------------------------------------------------------- - // Player joins. This starts the lobby -> counter -> arena - // -------------------------------------------------------------------- - - @Override - public final boolean joinPlayer(Player pl, JoinCause cause) { - try { - if (!Common.callEvent(new ArenaPreJoinEvent(this, cause, pl))) - return false; - - if (!stopping && isArenaAcceptingJoining(pl) && canPlayerJoin(pl, cause)) { - handlePlayerJoining(pl, cause); - - return true; - } - - return false; - - } catch (final Throwable t) { - Common.error(t, "Error while joining " + pl.getName() + " to " + getName(), "Arena has been stopped for safety.", "%error"); - - stopArena(StopCause.INTERRUPTED_ERROR); - return false; - } - } - - private final boolean isArenaAcceptingJoining(Player pl) { - if (!isEnabled()) { - getMessenger().tell(pl, Localization.Arena.Error.NOT_ENABLED); - return false; - } - - if (CoreArenaPlugin.getSetupManager().isArenaEdited(this)) { - getMessenger().tell(pl, Localization.Arena.Error.EDITED); - return false; - } - - if (!getSetup().isReady()) { - getMessenger().tell(pl, Localization.Arena.Error.NOT_CONFIGURED); - return false; - } - - if (getState() == ArenaState.RUNNING) { - getMessenger().tell(pl, Localization.Arena.Error.ALREADY_RUNNING); - return false; - } - - if (getPlayers().size() >= getSettings().getMaximumPlayers()) { - getMessenger().tell(pl, Localization.Arena.Error.FULL); - return false; - } - - return true; - } - - private final boolean canPlayerJoin(Player player, JoinCause cause) { - - final String joinPermission = Permissions.Commands.JOIN.replace("{arena}", this.getName().toLowerCase()); - - if (!PlayerUtil.hasPerm(player, joinPermission)) { - getMessenger().tell(player, Localization.Arena.Error.NO_PERMISSION.replace("{perm}", joinPermission)); - - return false; - } - - final Arena existing = ArenaRegistry.getCommonManager().findArena(player); - - if (existing != null) { - getMessenger().tell(player, Localization.Arena.Error.ALREADY_PLAYING.replace("{arena}", existing.getName())); - - return false; - } - - final Arena editedArena = CoreArenaPlugin.getSetupManager().getEditedArena(player); - - if (editedArena != null) { - getMessenger().tell(player, Localization.Arena.CANNOT_DO_WHILE_EDITING.replace("{arena}", editedArena.getName())); - return false; - } - - if (!getSettings().allowOwnEquipment()) - if (!Settings.Arena.STORE_INVENTORIES && !PlayerUtil.hasEmptyInventory(player)) { - getMessenger().tell(player, Localization.Arena.Error.INVENTORY_NOT_EMPTY); - return false; - } - - return true; - } - - private final void handlePlayerJoining(Player player, JoinCause cause) { - Valid.checkBoolean(!getPlayers().contains(player), "Player " + player.getName() + " already playing " + getName()); - - players.add(player); - - final ArenaPlayer cache = getCache(player); - cache.setCurrentArena(player, this); - cache.getArenaCache().pendingJoining = true; - - final ArenaJoinEvent joinEvent = new ArenaJoinEvent(this, cause, player); - Common.callEvent(joinEvent); - - if (state == ArenaState.STOPPED) - startLobby(); - - if (getSetup().areJoinSignsSet()) - getData().getSigns().updateSigns(SignType.JOIN, this); - - { // Inventory - final InventoryStorageUtil inv = InventoryStorageUtil.$(); - - if (settings.allowOwnEquipment()) - inv.saveExperience(player); - - else if (Settings.Arena.STORE_INVENTORIES) - inv.saveInventory(player); - - // Clean inventory - PlayerUtil.normalize(player, !settings.allowOwnEquipment() && cache.getClassCache().assignedClass == null); - } - - // Move to lobby - { - final ArenaLobbyTeleportEvent tpEvent = new ArenaLobbyTeleportEvent(player, this, data.getLobby().getLocation().clone().add(0, 1, 0)); - - if (Common.callEvent(tpEvent)) - player.teleport(tpEvent.getLocation()); - } - - handlePlayerPostJoin(player); - - if (!joinEvent.isSilent()) { - getMessenger().broadcastExcept(player, player, Localization.Arena.Lobby.JOIN_OTHERS); - getMessenger().tell(player, Localization.Arena.Lobby.JOIN_PLAYER.replace("{time}", Localization.Cases.SECOND.formatWithCount(launchCountdown.getTimeLeft()))); - - getMessenger().playSound(player, settings.getPlayerJoinSound()); - } - - cache.getArenaCache().pendingJoining = false; - } - - protected abstract void handlePlayerPostJoin(Player pl); - - // -------------------------------------------------------------------- - // Handle basic arena start and end events - // -------------------------------------------------------------------- - - @Override - public final void startLobby() { - Valid.checkBoolean(getState() == ArenaState.STOPPED, "Cannot start lobby when arena is started or already has lobby"); - - stopping = false; - setState(ArenaState.LOBBY); - - final LobbyStartEvent event = new LobbyStartEvent(this); - Common.callEvent(event); - - try { - removeEntities(); - } catch (final Throwable t) { - t.printStackTrace(); - } - - try { - settings.getLobbyStartCommands().run(this, Settings.Arena.CONSOLE_CMD_FOREACH); - } catch (final Throwable t) { - t.printStackTrace(); - } - - if (restoreSnapshots) - try { - snapshot.restore(DamagedStage.INITIAL); - - } catch (final Throwable t) { - Common.error(t, "Failed to set the initial snapshot of " + getName(), "%error"); - } - - launchCountdown = new LaunchCountdown(this); - - if (event.getCountdown() > 0) - launchCountdown.launch(); - - for (final ArenaSign sign : getData().getSigns().getSigns(SignType.POWER)) { - final SimpleSignPower power = (SimpleSignPower) sign; - - power.onLobbyStart(); - } - } - - // -------------------------------------------------------------------- - // Check. This starts the lobby -> counter -> arena - // -------------------------------------------------------------------- - - @Override - public final boolean startArena(boolean force) { - boolean started = false; - boolean error = false; - - try { - started = doStart(force); - - } catch (final Throwable t) { - Common.error(t, - "Error starting arena " + getName() + "!", - "%error", - "The arena has been stopped for safety."); - - error = true; - } - - if (error && !started) // Do not start not running arenas - stopArena(StopCause.INTERRUPTED_ERROR); - - return started && !error; - } - - private final boolean doStart(boolean force) { - Valid.checkBoolean(getState() != ArenaState.RUNNING, "Cannot start already running arena " + getName()); - - if (getPlayers().size() < getSettings().getMinimumPlayers()) { - stopArena(StopCause.CANCELLED_NOT_ENOUGH_PLAYERS); - - return false; - } - - try { - setState(ArenaState.RUNNING); - getMessenger().broadcastAndLogFramed(Localization.Arena.Game.START); - } catch (final Throwable t) { - t.printStackTrace(); - } - - try { // Safely end - if (launchCountdown != null && launchCountdown.isRunning()) - launchCountdown.cancel(); - } catch (final Throwable t) { - t.printStackTrace(); - } - - try { - endCountdown = new EndCountdown(this); - endCountdown.launch(); - } catch (final Throwable t) { - t.printStackTrace(); - } - - try { - for (final Player player : getPlayers()) - player.closeInventory(); - } catch (final Throwable t) { - t.printStackTrace(); - } - - handleArenaPostStart(); - - if (phase instanceof SimplePhaseIncremental) - ((SimplePhaseIncremental) phase).redetectChests(); - - try { - if (force) - getPhase().stopAndReset(); - - getPhase().startTimer(); - } catch (final Throwable t) { - t.printStackTrace(); - } - - try { - settings.getStartCommands().run(this, Settings.Arena.CONSOLE_CMD_FOREACH); - } catch (final Throwable t) { - t.printStackTrace(); - } - - try { - for (final ArenaSign sign : getData().getSigns().getSigns(SignType.POWER)) { - final SimpleSignPower power = (SimpleSignPower) sign; - - power.onArenaStart(); - } - } catch (final Throwable t) { - t.printStackTrace(); - } - - getMessenger().playSound(settings.getArenaStartSound()); - - Common.callEvent(new ArenaPostStartEvent(this)); - return true; - } - - protected abstract void handleArenaPostStart(); - - @Override - public final void stopArena(StopCause cause) { - try { - doStop(cause); - - } catch (final Throwable t) { - Common.error(t, - "Error stopping arena " + getName() + "!", - "%error", - "All players have been kicked for safety."); - - for (final Player pl : getPlayers()) - kickPlayer(pl, LeaveCause.ERROR); - } - } - - private final void doStop(StopCause cause) { - synchronized (players) { - if (stopping) - return; - - if (cause != StopCause.INTERRUPTED_ERROR) - Valid.checkBoolean(getState() != ArenaState.STOPPED, "Cannot stop not running arena " + getName()); - - stopping = true; - - try { - getMessenger().broadcastAndLogFramed(cause == StopCause.CANCELLED_NOT_ENOUGH_PLAYERS ? Localization.Arena.Lobby.FAIL_START_NOT_ENOUGH_PLAYERS : Localization.Arena.Game.END_GENERIC); - - if (endCountdown != null && endCountdown.isRunning()) - endCountdown.cancel(); - - if (launchCountdown != null && launchCountdown.isRunning()) - launchCountdown.cancel(); - - getPhase().stopAndReset(); - - BlockPhysicsCheckTask.cancelRunning(); - - removeEntities(); - - if (restoreSnapshots) - snapshot.restore(DamagedStage.INITIAL); - - for (final ArenaSign sign : getData().getSigns().getSigns(SignType.POWER)) { - final SimpleSignPower power = (SimpleSignPower) sign; - - power.onArenaEnd(); - } - - handleArenaPostStop(cause); - - if (phase instanceof SimplePhaseIncremental) - ((SimplePhaseIncremental) phase).restoreChests(); - - if (cause.toString().startsWith("NATURAL")) - settings.getFinishCommands().run(this, Settings.Arena.CONSOLE_CMD_FOREACH); - - settings.getEndCommands().run(this, Settings.Arena.CONSOLE_CMD_FOREACH); - - try { - removeAllPlayers(); - } catch (final Throwable t) { - Common.error(t, "Failed to remove all players from " + getName(), "%error"); - } - - setState(ArenaState.STOPPED); - Common.callEvent(new ArenaPostStopEvent(this, cause)); - - stopping = false; - - } catch (final Throwable t) { - Common.error(t, "Failed to stop " + getName(), "Kicking players for safety..", "%error"); - - try { - removeAllPlayers(); - } catch (final Throwable tt) { - Common.error(tt, "Unrecoverably failed to remove all players from " + getName(), "%error"); - } - } - } - } - - private final void removeEntities() { - for (final Entity en : getData().getRegion().getEntities()) - if (en != null && (EntityUtil.isAggressive(en) || EntityUtil.canBeCleaned(en) || CompMetadata.hasMetadata(en, "CoreTempEntity"))) - en.remove(); - } - - protected abstract void handleArenaPostStop(StopCause cause); - - // -------------------------------------------------------------------- - // Handle player-related events - // -------------------------------------------------------------------- - - @Override - public boolean kickPlayer(Player pl, LeaveCause cause) { - checkRunning(); - Valid.checkBoolean(getPlayers().contains(pl), "Player " + pl.getName() + " not playing in " + getName()); - - final boolean kicked = handlePlayerLeave(pl, cause, null); - - return kicked; - } - - private final void removeAllPlayers() { - final Iterator<Player> it = players.iterator(); - - while (it.hasNext()) { - Player pl = null; - - try { - pl = it.next(); - } catch (final ConcurrentModificationException ex) { // Handle below - } - - Valid.checkBoolean(pl != null && pl.isOnline(), "Report / Unhandled player leave in " + getName() + "! Current players: {" + Common.join(players) + "}"); - handlePlayerLeave(pl, LeaveCause.ARENA_END, it); - } - } - - private final boolean handlePlayerLeave(Player pl, LeaveCause cause, Iterator<Player> it) { - final InArenaCache cache = getCache(pl).getArenaCache(); - - Valid.checkBoolean(!cache.pendingRemoval, "Report / Player " + pl.getName() + " is already pending removal!"); - - final ArenaPreLeaveEvent event = new ArenaPreLeaveEvent(this, cause, pl); - if (!Common.callEvent(event)) - return false; - - cache.pendingRemoval = true; - - try { - handlePrePlayerLeave(pl, cause); - handlePlayerLeave0(pl, cause, event.isSilent()); - - } catch (final Throwable t) { - Common.error(t, "Error while removing player " + pl.getName() + " from " + getName(), "Moving him to spawn.", "%error"); - teleportPlayerBack(pl); - - } finally { - if (it != null) - it.remove(); - else - players.remove(pl); - - getCache(pl).removeCurrentArena(); - - Common.callEvent(new ArenaLeaveEvent(this, cause, pl)); - } - - stopIfPlayersBelowLimit(); - - return true; - } - - private final void stopIfPlayersBelowLimit() { - final int autoStop = getSettings().getAutoStopPlayersLimit() != -1 ? getSettings().getAutoStopPlayersLimit() : 0; - - if (getPlayers().size() <= autoStop) - stopArena(StopCause.INTERRUPTED_LAST_PLAYER_LEFT); - } - - private final void handlePlayerLeave0(Player player, LeaveCause cause, boolean silent) { - final ArenaPlayer data = getCache(player); - - { // De-set class' settings - final ClassCache cache = data.getClassCache(); - - if (cache.assignedClass != null) - cache.assignedClass.getTier(cache.classTier).onArenaLeave(player); - } - - try { - PlayerUtil.normalize(player, !settings.allowOwnEquipment()); - - Common.runLater(2, () -> { - final InventoryStorageUtil i = InventoryStorageUtil.$(); - - if (i.hasStored(player)) { - if (settings.allowOwnEquipment()) - i.restoreExperience(player); // Only restore experience since we reserve the bar for Nuggets - else if (Settings.Arena.STORE_INVENTORIES) - i.restore(player); - - } else - Common.log("&cSkipping restoring " + player.getName() + "'s exp or inventory, hasn't any but was in the arena " + getName()); - }); - - } catch (final Throwable t) { - t.printStackTrace(); - } - - if (getPhase() instanceof SimplePhaseIncremental) - ((SimplePhaseIncremental) getPhase()).onPlayerLeave(player); - - final Location prev = player.getLocation(); - - if (true) { // Always run - settings.getPlayerLeaveCommands().runAsConsole(this, player); - settings.getPlayerLeaveCommands().runAsPlayer(this, player); - } - - if (getSetup().areJoinSignsSet()) - getData().getSigns().updateSigns(SignType.JOIN, this); - - if (player.isOnline() && player.getLocation().distance(prev) < 3 && cause != LeaveCause.ESCAPED) - try { - teleportPlayerBack(player); - } catch (final Throwable t) { - t.printStackTrace(); - } - - // Convert Levels to Nuggets - if (isEligibleForNuggets(cause)) { - final double nuggetsFromPlayingD = data.getArenaCache().getLevel() * Settings.Experience.LEVEL_TO_NUGET_CONVERSION_RATIO; - final int nuggetsFromPlaying = (int) Math.round(nuggetsFromPlayingD); - - final int totalNuggets = data.getNuggets() + nuggetsFromPlaying; - - Debugger.debug("rewards", "Setting Nuggets for " + player.getName() + " leaving arena due to " + cause + ". Before: " + data.getNuggets() + ", after: " + totalNuggets); - - data.setNuggets(totalNuggets); - - if (nuggetsFromPlaying != 0) - getMessenger().tell(player, Localization.Currency.RECEIVED.replace("{amount}", Localization.Currency.format(nuggetsFromPlaying)).replace("{balance}", Localization.Currency.format(totalNuggets))); - } - - // Decorative messages. - // Delay so it's played after respawn - if (!silent) - Common.runLater(3, new BukkitRunnable() { - - @Override - public void run() { - getMessenger().playSound(player, settings.getPlayerLeaveSound()); - - if (cause == LeaveCause.ARENA_END || cause == LeaveCause.KILLED || cause == LeaveCause.COMMAND || cause == LeaveCause.ERROR) - Localization.Title.KICK.playLong(player, message -> getMessenger().replaceVariables(message)); - else if (cause == LeaveCause.ESCAPED) - Localization.Title.ESCAPE.playLong(player, message -> getMessenger().replaceVariables(message)); - } - }); - } - - private final boolean isEligibleForNuggets(LeaveCause cause) { - if (!Settings.Experience.REWARD_ESCAPE && (cause == LeaveCause.COMMAND || cause == LeaveCause.DISCONNECT || cause == LeaveCause.ESCAPED)) - return false; - - return state == ArenaState.RUNNING && cause != LeaveCause.NO_ENOUGH_CLASS && cause != LeaveCause.NOT_READY && cause != LeaveCause.ERROR; - } - - protected abstract void handlePrePlayerLeave(Player pl, LeaveCause cause); - - @Override - public void onPlayerDeath(Player pl, Player killer) throws EventHandledException { - handlePlayerDeath(pl); - } - - @Override - public void onPlayerDeath(Player pl, DeathCause cause) throws EventHandledException { - handlePlayerDeath(pl); - } - - private final void handlePlayerDeath(Player pl) throws EventHandledException { - checkRunning(); - - if (getState() == ArenaState.LOBBY) { - Remain.respawn(pl, 0); - - returnHandled(); - } - } - - @Override - public void onPlayerRespawn(PlayerRespawnEvent e) throws EventHandledException { - checkRunning(); - - final InArenaCache cache = getCache(e.getPlayer()).getArenaCache(); - - if (cache.pendingRemoval) { - cache.pendingRemoval = false; - - e.setRespawnLocation(getBackLocation(e.getPlayer())); - - final boolean kicked = kickPlayer(e.getPlayer(), LeaveCause.KILLED); - - if (kicked) - returnHandled(); - } - - if (getState() == ArenaState.LOBBY) { - final Location lobby = data.getLobby().getLocation().clone().add(0, 1, 0); - - e.setRespawnLocation(lobby); - returnHandled(); - } - } - - @Override - public final void teleportPlayerBack(Player pl) { - //checkRunning(); - - final SpawnTeleportEvent event = new SpawnTeleportEvent(pl, getBackLocation(pl)); - - if (Common.callEvent(event)) { - final Location loc = event.getLocation(); - final ArenaPlayer data = getCache(pl); - - if (data.hasArenaCache() && data.getArenaCache().pendingRemoval) - Common.runLater(2, () -> teleportToSpawn0(loc, pl)); - - else - teleportToSpawn0(loc, pl); - } - } - - private final void teleportToSpawn0(Location loc, Player player) { - player.teleport(loc); - - if (player.getGameMode() == GameMode.CREATIVE && loc.getBlock().getRelative(BlockFace.DOWN).getType() == Material.AIR) - player.setFlying(true); - - HookManager.setBackLocation(player, loc); - } - - private final Location getBackLocation(Player player) { - final ArenaPlayer data = getCache(player); - - if (data.hasArenaCache()) { - final Location loc = data.getArenaCache().prevLocation; - - Valid.checkNotNull(loc, "Player's previous world cannot be null!"); - return loc; - } - - return getData().getRegion().getWorld().getSpawnLocation(); - } - - // -------------------------------------------------------------------- - // Handle entity-related events - // -------------------------------------------------------------------- - - @Override - public final void onEntitySpawn(EntitySpawnEvent e) { - final Entity en = e.getEntity(); - - if (EntityUtil.isCreature(en)) - CompMetadata.setMetadata(en, "CoreTempEntity"); - } - - @Override - public void onEntityDeath(EntityDeathEvent e) { - final boolean allMonstersKilled = getAliveMonsters() == 0; - final int endClear = settings.getEndPhaseNoMonsters(); - - if (allMonstersKilled && endClear != -1 && phase.getCurrent() >= endClear) { - stopArena(StopCause.NATURAL_NO_MONSTERS); - - returnHandled(); - } - } - - @Override - public final void onEntityTarget(EntityTargetEvent e) throws EventHandledException { - checkRunning(); - - final Entity en = e.getEntity(); - final Entity target = e.getTarget(); - - if (en.getType() == EntityType.WOLF && isTamed(en)) - return; - - if (target != null && target.getType() == EntityType.WOLF && isTamed(target)) - return; - - final TargetReason r = e.getReason(); - - if (r == TargetReason.TARGET_ATTACKED_ENTITY) - e.setCancelled(true); - - else if (r == TargetReason.FORGOT_TARGET || r.toString().equals("CLOSEST_ENTITY")) - e.setTarget(getNearestPlayer(e.getEntity().getLocation())); - } - - private final boolean isTamed(Entity wolf) { - return ((Wolf) wolf).isTamed(); - } - - @Override - public final void onSnapshotUpdate(ArenaSnapshotStage newState) { - } - - // ---------------------------------------------------------------------- - // Utility - // ---------------------------------------------------------------------- - - public final Player getNearestPlayer(Location loc) { - final TreeSet<Player> sorted = new TreeSet<>((first, second) -> { - final Double firstDistance = first.getLocation().distance(loc); - final Double secondDistance = second.getLocation().distance(loc); - - return firstDistance.compareTo(secondDistance); - }); - - for (final Player pl : getPlayers()) - if (getData().getRegion().isWithin(pl.getLocation())) - sorted.add(pl); - - return !sorted.isEmpty() ? sorted.first() : null; - } - - private final void setState(ArenaState newState) { - state = newState; - - if (getSetup().areJoinSignsSet()) - getData().getSigns().updateSigns(SignType.JOIN, this); - } - - protected final ArenaPlayer getCache(Player player) { - return CoreArenaPlugin.getDataFor(player); - } - - protected final EventHandledException returnHandled() throws EventHandledException { - throw new EventHandledException(); - } - - protected final CancelledException returnCancelled() throws CancelledException { - throw new CancelledException(); - } - - // ---------------------------------------------------------------------- - // Technical Getters (reason here: they are made final) - // ---------------------------------------------------------------------- - - @Override - public final String getName() { - return settings.getName(); - } - - @Override - public final SimpleMessenger getMessenger() { - return messenger; - } - - @Override - public final Collection<Player> getPlayers() { - if (!isStopping() && getState() == ArenaState.STOPPED && !players.isEmpty()) - throw new FoException("Found players in a stopped arena " + getName() + ": " + StringUtils.join(players.getSource(), ", ")); - - return Collections.unmodifiableCollection(players.getSource()); - } - - @Override - public boolean isJoined(Player player) { - checkPlayers(); - - return players.contains(player); - } - - @Override - public boolean isJoined(String playerName) { - checkPlayers(); - - for (final Player player : players) - if (player.getName().equalsIgnoreCase(playerName)) - return true; - - return false; - } - - private final void checkPlayers() { - if (!isStopping() && getState() == ArenaState.STOPPED && !players.isEmpty()) - throw new FoException("Found players in a stopped arena " + getName() + ": " + StringUtils.join(players.getSource(), ", ")); - } - - @Override - public final ArenaData getData() { - return data; - } - - @Override - public final ArenaSettings getSettings() { - return settings; - } - - @Override - public final ArenaState getState() { - return state; - } - - @Override - public final ArenaSnapshot getSnapshot() { - return snapshot; - } - - @Override - public final ArenaPhase getPhase() { - return phase; - } - - @Override - public final boolean isStopping() { - return stopping; - } - - @Override - public final int getRemainingSeconds() { - return endCountdown != null ? endCountdown.getTimeLeft() : getSettings().getArenaDurationSeconds(); - } - - @Override - public int getAliveMonsters() { - int alive = 0; - - for (final Entity en : data.getRegion().getEntities()) - if (EntityUtil.isAggressive(en)) - alive++; - - return alive; - } - - @Override - public final void setRestoreSnapshots(boolean restoreSnapshot) { - this.restoreSnapshots = restoreSnapshot; - } - - @Override - public final ArenaPlugin getPlugin() { - return CoreArenaPlugin.getInstance(); - } - - @Override - public final boolean isEnabled() { - return data.isEnabled(); - } - - @Override - public final void setEnabled(boolean enabled) { - data.setEnabled(enabled); - } - - protected final void checkRunning() { - if (getState() == ArenaState.STOPPED) - throw new FoException("Cannot call " + ReflectionUtil.getCallerMethods(1, 5) + "() in a non running arena " + getName()); - } - - public final ClassManager getClassManager() { - return CoreArenaPlugin.getClassManager(); - } - - public final UpgradesManager getUpgradesManager() { - return CoreArenaPlugin.getUpgradesManager(); - } - - @Override - public final boolean equals(Object obj) { - return obj instanceof SimpleArena && ((SimpleArena) obj).getName().equals(getName()); - } - - @Override - public final String toString() { - return "Arena{plugin=" + getPlugin() + ", name=" + getName() + "}"; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/item/BigRocket.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/item/BigRocket.java deleted file mode 100644 index 1756c06a0625586dbc325917ed9d846669121af9..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/item/BigRocket.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.mineacademy.game.item; - -import java.util.Arrays; - -import org.bukkit.Location; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EnderPearl; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.inventory.ItemStack; -import org.bukkit.util.Vector; -import org.mineacademy.fo.RandomUtil; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.menu.tool.Rocket; -import org.mineacademy.fo.model.SimpleEnchant; -import org.mineacademy.fo.remain.CompItemFlag; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.CompParticle; -import org.mineacademy.fo.remain.CompSound; -import org.mineacademy.game.util.CoreUtil; - -import lombok.Getter; - -public class BigRocket extends Rocket { - - @Getter - private static final BigRocket instance = new BigRocket(); - - private BigRocket() { - super(EnderPearl.class, 1F, 6F); - } - - @Override - public ItemStack getItem() { - return ItemCreator.of(CompMaterial.ENDER_PEARL) - .name("&3Rocket") - .enchant(new SimpleEnchant(Enchantment.DURABILITY, 1)) - .flag(CompItemFlag.HIDE_ENCHANTS) - .lores(Arrays.asList( - "", - "&7Click to launch", - "&7a rocket!")) - .build().make(); - } - - @Override - public boolean canLaunch(Player pl, Location loc) { - return CoreUtil.isWithinArena(pl, loc); - } - - @Override - public void onLaunch(Projectile proj, Player shooter) { - CompSound.FIREWORK_LARGE_BLAST2.play(shooter, 1F, 1F); - } - - @Override - protected void onFlyTick(Projectile projectile, Player shooter) { - final double a = Double.parseDouble("0.0" + RandomUtil.nextInt(3)); - final double b = Double.parseDouble("0.0" + RandomUtil.nextInt(3)); - final double c = Double.parseDouble("0.0" + RandomUtil.nextInt(3)); - - projectile.setVelocity(projectile.getVelocity().add(new Vector(a, b, c))); - - CompParticle.EXPLOSION_NORMAL.spawn(projectile.getLocation()); - CompParticle.FLAME.spawn(projectile.getLocation()); - } - - @Override - protected boolean canExplode(Projectile projectile, Player shooter) { - return CoreUtil.isWithinArena(shooter, projectile.getLocation()); - } - - @Override - protected void onExplode(Projectile projectile, Player shooter) { - CompSound.FIREWORK_BLAST.play(shooter, 1F, 0.1F); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/item/ExplosiveArrow.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/item/ExplosiveArrow.java deleted file mode 100644 index 4c89843dc0facf87d0db6b23caf827c592690aa3..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/item/ExplosiveArrow.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.mineacademy.game.item; - -import java.util.Arrays; - -import org.bukkit.enchantments.Enchantment; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.model.SimpleEnchant; -import org.mineacademy.fo.remain.CompItemFlag; -import org.mineacademy.fo.remain.CompMaterial; - -import lombok.Getter; - -public class ExplosiveArrow { - - private static final ExplosiveArrow instance = new ExplosiveArrow(); - - public static ItemStack getItem() { - return instance.getItemStack(); - } - - @Getter - private final ItemStack itemStack; - - { - itemStack = ItemCreator.of(CompMaterial.ARROW) - .name("&4Explosive Arrow") - .enchant(new SimpleEnchant(Enchantment.DURABILITY, 1)) - .flag(CompItemFlag.HIDE_ENCHANTS) - .lores(Arrays.asList( - "", - "&7The ammunition used", - "&7by &5Explosive Bow.")) - .build().make(); - } - -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/item/ExplosiveBow.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/item/ExplosiveBow.java deleted file mode 100644 index 3be4569c3792d55b2c6188f331f19b78808f1339..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/item/ExplosiveBow.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.mineacademy.game.item; - -import java.util.Arrays; - -import org.bukkit.enchantments.Enchantment; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.model.SimpleEnchant; -import org.mineacademy.fo.remain.CompItemFlag; -import org.mineacademy.fo.remain.CompMaterial; - -import lombok.Getter; - -public class ExplosiveBow { - - private static final ExplosiveBow instance = new ExplosiveBow(); - - public static ItemStack getItem() { - return instance.getItemStack(); - } - - @Getter - private final ItemStack itemStack; - - { - itemStack = ItemCreator.of(CompMaterial.BOW) - .name("&5Explosive Bow") - .enchant(new SimpleEnchant(Enchantment.ARROW_INFINITE, 1)) - .enchant(new SimpleEnchant(Enchantment.ARROW_DAMAGE, 3)) - .flag(CompItemFlag.HIDE_ENCHANTS) - .lores(Arrays.asList( - "", - "&7Makes shot arrows", - "&7explode on contact.", - "", - "&7Requires &4Explosive Arrow")) - .build().make(); - } - -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/item/Gold.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/item/Gold.java deleted file mode 100644 index 195a324cedf305d4a27fa1129a62f5faf6271c79..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/item/Gold.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.mineacademy.game.item; - -import java.util.Arrays; - -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.menu.tool.Tool; -import org.mineacademy.fo.model.HookManager; -import org.mineacademy.fo.model.SimpleEnchant; -import org.mineacademy.fo.remain.CompItemFlag; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.game.settings.Settings; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; - -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public class Gold extends Tool { - - @Getter - private static final Gold instance = new Gold(); - - @Getter - private final ItemStack item; - - { - item = ItemCreator.of(CompMaterial.GOLD_NUGGET) - .name("&6Gold") - .enchant(new SimpleEnchant(Enchantment.ARROW_INFINITE, 1)) - .flag(CompItemFlag.HIDE_ENCHANTS) - .lores(Arrays.asList( - "", - "&7Right click to sell", - "&71x Gold for " + getCurrencyName(Settings.Experience.Gold.CONVERSION_RATIO))) - .build().make(); - } - - private final String getCurrencyName(double ratio) { - final String vaultName = ratio == 1 ? HookManager.getCurrencySingular() : HookManager.getCurrencyPlural(); - final String curr = Common.getOrDefault(vaultName, Settings.Experience.Gold.CURRENCY_NAME); - final String finalName = curr.length() < 2 ? curr + ratio : ratio + "x " + curr; - - return finalName.endsWith(".0") ? finalName.replace(".0", "") : finalName; - } - - @Override - public void onBlockClick(PlayerInteractEvent e) { - if (!e.getAction().toString().contains("RIGHT")) - return; - - final Player player = e.getPlayer(); - - HookManager.deposit(player, Settings.Experience.Gold.CONVERSION_RATIO); - Common.tell(player, "&7You sold 1x Gold for &6" + getCurrencyName(Settings.Experience.Gold.CONVERSION_RATIO) + " &7and now have &6" + getCurrencyName(HookManager.getBalance(player)) + "&7."); - - Remain.takeHandItem(player); - e.setCancelled(true); - } - - @Override - public boolean ignoreCancelled() { - return false; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/item/HellFire.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/item/HellFire.java deleted file mode 100644 index 8240df65cd9b9992389363c259d94226cb3f9265..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/item/HellFire.java +++ /dev/null @@ -1,190 +0,0 @@ -package org.mineacademy.game.item; - -public class HellFire /*extends Rocket */ { - - /*@Getter - private static final HellFire instance = new HellFire(); - - private final StrictMap<UUID, Long> lastUsageMap = new StrictMap<>(); - - private final long getLastUseAgo(Player player) { - if (!lastUsageMap.contains(player.getUniqueId())) { - lastUsageMap.put(player.getUniqueId(), TimeUtilFo.currentTimeSeconds()); - - return Integer.MAX_VALUE; - } - - return TimeUtilFo.currentTimeSeconds() - lastUsageMap.get(player.getUniqueId()); - } - - private final void updateUse(Player player) { - lastUsageMap.override(player.getUniqueId(), TimeUtilFo.currentTimeSeconds()); - } - - @Override - public boolean canLaunch(Player pl, Location loc) { - return CoreUtil.isWithinArena(pl, loc); - } - - @Override - public ItemStack getItem() { - return ItemCreator.of(CompMaterial.LEVER) - .name("&CCall Hell-Fire") - .enchant(new SimpleEnchant(Enchantment.DURABILITY, 1)) - .flag(CompItemFlag.HIDE_ENCHANTS) - .lores(Arrays.asList( - "", - "&fLeft click &7a block", - "&7to call a Hell-File!")) - .build().make(); - } - - private final void operator(Player pl, String message) { - Common.tellNoPrefix(pl, "&8[&5Operator&8] &7" + message); - } - - @Override - public void onBlockClick(PlayerInteractEvent e) { - final Player pl = e.getPlayer(); - - if (GamePlugin.getArenaManager().findArena(pl).getState() != ArenaState.RUNNING) { - e.setCancelled(true); - - return; - } - - if (!e.hasBlock() || e.getAction() != Action.LEFT_CLICK_BLOCK) { - operator(pl, "&7Left-click a block to send me the coordinates!"); - - return; - } - - e.setCancelled(true); - - if (!CoreUtil.isWithinArena(pl, e.getClickedBlock().getLocation())) - return; - - if (getLastUseAgo(pl) < 10) { - operator(pl, "&6Reloading missiles... Ready in " + Localization.Cases.SECOND.formatWithCount(10 - getLastUseAgo(pl)) + "!"); - return; - } - - final Block up = e.getClickedBlock().getRelative(BlockFace.UP); - if (up.getType() != Material.AIR) - return; - - final Location initialLoc = up.getLocation().add(0.5, 0, 0.5); - operator(pl, "&a&lCalled a hell fire to " + up.getX() + " " + up.getY() + " " + up.getZ() + "!"); - - Remain.takeItemAndSetAsHand(pl, pl.getItemInHand()); - updateUse(pl); - - Common.runLater(40, () -> { - - operator(pl, "&c&lHell fire incoming!"); - CompSound.FIREWORK_LAUNCH.play(pl, 1F, 0.1F); - - final Location loc = up.getLocation(); - - // Spawn in the air - loc.setY(256); - - final int explodeY = up.getWorld().getHighestBlockYAt(loc.getBlockX(), loc.getBlockZ()); - - final LargeFireball rocket = up.getWorld().spawn(loc, LargeFireball.class); - rocket.setDirection(new Vector(0, -0.0001, 0).normalize()); - rocket.setYield(0F); - rocket.setIsIncendiary(false); - - final long firedSince = TimeUtilFo.currentTimeSeconds(); - - // Effects + explosion - new BukkitRunnable() { - - @Override - public void run() { - rocket.setVelocity(new Vector(0, -3.7, 0)); - - // Invalidated - if (rocket.isDead() || !rocket.isValid()) { - cancel(); - - return; - } - - final Location l = rocket.getLocation().clone(); - - // Hit some ground - if (l.getY() - explodeY < 5) { - explode(rocket, l, 5F, true); - - new SoundPlayer(l).start(); - - rocket.remove(); - cancel(); - return; - } - - // Too long ago - if (TimeUtilFo.currentTimeSeconds() - firedSince > 20) { - cancel(); - - return; - } - - // Just fire particle - CompParticle.FLAME.spawn(l); - CompParticle.BLOCK_CRACK.spawnWithData(initialLoc, CompMaterial.DIRT); - } - - }.runTaskTimer(SimplePlugin.getInstance(), 0, 1); - }); - } - - @RequiredArgsConstructor - class SoundPlayer extends Thread { - - private final Location l; - - @Override - public void run() { - CompSound.ANVIL_LAND.play(l, 1F, 0.1F); - - double count = 1; - - final int radius = 2; - - for (double y = -5; y <= 10; y += 0.05) { - final double x = radius * Math.cos(y) * Math.random() * (count = count + 0.05); - final double z = radius * Math.sin(y) * Math.random() * count; - - try { - CompParticle.BLOCK_CRACK.spawnWithData(l.clone().add(x, y, z), CompMaterial.STONE); - } catch (final Throwable t) { - t.printStackTrace(); - - break; - } - - Common.sleep(4); - } - - CompSound.FIREWORK_TWINKLE2.play(l, 1F, 0.1F); - } - } - - @Override - public void onLaunch(Projectile proj, Player shooter) { - } - - @Override - public void onHit(Projectile proj, Player shooter, Location loc) { - if (CoreUtil.isWithinArena(shooter, loc)) - explode(proj, loc, 2F, false); - } - - @Override - public boolean ignoreCancelled() { - return false; - }*/ -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/item/SmallMissile.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/item/SmallMissile.java deleted file mode 100644 index 87c1791ef786f21d6afbeac7e9ba1f49b8e481ee..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/item/SmallMissile.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.mineacademy.game.item; - -public class SmallMissile /*extends Rocket */ { - - /*@Getter - private static final SmallMissile instance = new SmallMissile(); - - @Override - public ItemStack getItem() { - return ItemCreator.of(CompMaterial.SNOWBALL) - .name("&bSmall Missile") - .enchant(new SimpleEnchant(Enchantment.DURABILITY, 1)) - .flag(CompItemFlag.HIDE_ENCHANTS) - .lores(Arrays.asList( - "", - "&7Click to launch", - "&7a small missile!")) - .build().make(); - } - - @Override - public boolean canLaunch(Player pl, Location loc) { - return CoreUtil.isWithinArena(pl, loc); - } - - @Override - public void onLaunch(Projectile proj, Player shooter) { - } - - @Override - public void onHit(Projectile proj, Player shooter, Location loc) { - if (CoreUtil.isWithinArena(shooter, loc)) - explode(proj, loc, 2F, true); - }*/ -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/listener/AutoRepairListener.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/listener/AutoRepairListener.java deleted file mode 100644 index 999cbbd3ff291f3f4891bbb3469779eb25d2f50e..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/listener/AutoRepairListener.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.mineacademy.game.listener; - -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityShootBowEvent; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.game.model.Arena; - -public class AutoRepairListener implements Listener { - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onBowShoot(EntityShootBowEvent e) { - if (e.getEntityType() == EntityType.PLAYER) { - final Player pl = (Player) e.getEntity(); - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(pl); - - if (arena != null) { - final ItemStack bow = e.getBow(); - - if (!arena.getSettings().getRepairBlacklist().isAllowed(bow.getType())) - bow.setDurability((short) 0); - } - } - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onBlockBreak(BlockBreakEvent e) { - final Player pl = e.getPlayer(); - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(pl); - - if (arena != null) - repairHandAndOffHand(arena, pl); - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onDamage(EntityDamageEvent e) { - if (e.getEntity() != null && e.getEntity() instanceof Player) { - final Player player = (Player) e.getEntity(); - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(player); - - if (arena != null) { - repairHandAndOffHand(arena, player); - repairArmor(arena, player); - } - } - } - - private final void repairHandAndOffHand(Arena arena, Player player) { - final ItemStack item = player.getItemInHand(); - - if (arena.getSettings().getRepairBlacklist().isAllowed(item.getType())) - return; - - item.setDurability((short) 0); - - try { - player.getEquipment().getItemInOffHand().setDurability((short) 0); - } catch (final Throwable t) { - } - } - - private final void repairArmor(Arena arena, Player player) { - for (final ItemStack armor : player.getEquipment().getArmorContents()) - if (armor != null && !arena.getSettings().getRepairBlacklist().isAllowed(armor.getType())) - armor.setDurability((short) 0); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/listener/InArenaListener.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/listener/InArenaListener.java deleted file mode 100644 index 24931030fcdab7c9a56532307cc79b721ce6e2da..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/listener/InArenaListener.java +++ /dev/null @@ -1,1134 +0,0 @@ -package org.mineacademy.game.listener; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Effect; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockState; -import org.bukkit.entity.Creeper; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Item; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Monster; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.entity.TNTPrimed; -import org.bukkit.entity.Tameable; -import org.bukkit.event.Cancellable; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.block.Action; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockExplodeEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.block.BlockSpreadEvent; -import org.bukkit.event.entity.CreatureSpawnEvent; -import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; -import org.bukkit.event.entity.EntityDamageByBlockEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.entity.EntityDeathEvent; -import org.bukkit.event.entity.EntityExplodeEvent; -import org.bukkit.event.entity.EntityInteractEvent; -import org.bukkit.event.entity.EntityPickupItemEvent; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.event.entity.EntityTeleportEvent; -import org.bukkit.event.entity.ExplosionPrimeEvent; -import org.bukkit.event.entity.ItemSpawnEvent; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.entity.PotionSplashEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.event.entity.SpawnerSpawnEvent; -import org.bukkit.event.hanging.HangingBreakByEntityEvent; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.event.player.PlayerRespawnEvent; -import org.bukkit.event.player.PlayerTeleportEvent; -import org.bukkit.event.player.PlayerToggleFlightEvent; -import org.bukkit.inventory.EntityEquipment; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; -import org.bukkit.metadata.FixedMetadataValue; -import org.bukkit.plugin.PluginManager; -import org.bukkit.projectiles.ProjectileSource; -import org.bukkit.scheduler.BukkitRunnable; -import org.bukkit.util.Vector; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.ItemUtil; -import org.mineacademy.fo.MathUtil; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.event.RocketExplosionEvent; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.model.Variables; -import org.mineacademy.fo.remain.CompParticle; -import org.mineacademy.fo.remain.CompSound; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.game.exception.CancelledException; -import org.mineacademy.game.exception.EventHandledException; -import org.mineacademy.game.exp.ExpItemHandler; -import org.mineacademy.game.impl.ArenaPlayer; -import org.mineacademy.game.impl.SimpleGameCommandGroup; -import org.mineacademy.game.item.ExplosiveArrow; -import org.mineacademy.game.item.ExplosiveBow; -import org.mineacademy.game.manager.SimpleArenaManager; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaSnapshot; -import org.mineacademy.game.model.ArenaSnapshotProcedural; -import org.mineacademy.game.model.ArenaSnapshotProcedural.DamagedStage; -import org.mineacademy.game.model.ExpItem; -import org.mineacademy.game.physics.BlockPhysics; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.settings.Settings; -import org.mineacademy.game.tool.CloneSpawnerToolOff; -import org.mineacademy.game.tool.CloneSpawnerToolOn; -import org.mineacademy.game.type.ArenaState; -import org.mineacademy.game.type.DeathCause; -import org.mineacademy.game.type.LeaveCause; -import org.mineacademy.game.util.Constants; -import org.mineacademy.game.util.CoreUtil; -import org.mineacademy.game.util.Permissions; - -public class InArenaListener implements Listener { - - // Serialized Location, Vector - static final StrictMap<String, Vector> storedExplosions = new StrictMap<>(); - - private final StrictMap<UUID, Player> playerDamagers = new StrictMap<>(); - - public InArenaListener() { - final PluginManager pm = Bukkit.getPluginManager(); - - // Procedural damage - if (Settings.ProceduralDamage.ENABLED) - try { - Class.forName("org.bukkit.event.block.BlockExplodeEvent"); - pm.registerEvents(new EventsProceduralDamage18(), CoreArenaPlugin.getInstance()); - - } catch (final ClassNotFoundException err) { - Common.log("&cProcedural damage is only available for Minecraft 1.8 and later. Disabling.."); - } - - { // Spawner events - try { - Class.forName("org.bukkit.event.entity.SpawnerSpawnEvent"); - pm.registerEvents(new SpawnerSpawnComp(), CoreArenaPlugin.getInstance()); - - } catch (final ClassNotFoundException ex) { - } - } - - { // Entity pickup item - try { - Class.forName("org.bukkit.event.entity.EntityPickupItemEvent"); - pm.registerEvents(new EntityPickupComp(), CoreArenaPlugin.getInstance()); - - } catch (final ClassNotFoundException ex) { - } - } - } - - // - // Format chat and prevent commands - // - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onChat(AsyncPlayerChatEvent e) { - if (!Settings.Arena.Chat.ENABLED) - return; - - final Player pl = e.getPlayer(); - String msg = e.getMessage(); - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(pl); - - if (arena == null) - return; - - String format; - - if (!Settings.Arena.Chat.RANGED || msg.startsWith("!") && !msg.equals("!") && PlayerUtil.hasPerm(pl, Permissions.Chat.GLOBAL)) { - if (Valid.isNullOrEmpty(Settings.Arena.Chat.GLOBAL_FORMAT)) - return; - - msg = msg.startsWith("!") ? msg.substring(1) : msg; - format = formatArenaChat(arena, pl, Settings.Arena.Chat.GLOBAL_FORMAT); - - } else { - if (Valid.isNullOrEmpty(Settings.Arena.Chat.FORMAT)) - return; - - format = formatArenaChat(arena, pl, Settings.Arena.Chat.FORMAT); - - e.getRecipients().clear(); - e.getRecipients().addAll(arena.getPlayers()); - } - - e.setFormat(Common.colorize(format)); - e.setMessage(Common.stripColors(msg)); - } - - private final String formatArenaChat(Arena arena, Player player, String message) { - message = message - .replace("{arena}", arena.getName()) - .replace("{operatorColor}", PlayerUtil.hasPerm(player, Permissions.Chat.RED_COLOR) ? "&c" : "&7") - .replace("{message}", Constants.Symbols.CHAT_EVENT_MESSAGE); - - return Variables.replace(message, player); - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onCommand(PlayerCommandPreprocessEvent event) { - final Player player = event.getPlayer(); - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(player); - final String command = event.getMessage(); - - if (!CoreArenaPlugin.DEBUG_EDITING_MODE && arena != null) { - final SimpleGameCommandGroup mainCommand = CoreArenaPlugin.getInstance().getMainCommand(); - - // Has bypass perm - if (PlayerUtil.hasPerm(player, Permissions.Bypass.ARENA_COMMANDS)) - return; - - // Enable plugin commands - if (command.startsWith(mainCommand.getLabel()) || Valid.isInListStartsWith(command, mainCommand.getAliases())) - return; - - if (!Valid.isInListStartsWith(command, Settings.Arena.ALLOWED_COMMANDS)) { - event.setCancelled(true); - - Common.tell(player, Localization.Commands.DISALLOWED_WHILE_PLAYING); - } - } - } - - // - // Handle quitting players or joining inside the arena - // - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onEntityTeleported(EntityTeleportEvent e) { - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(e.getFrom()); - final Entity en = e.getEntity(); - - if (arena != null && en instanceof Tameable && ((Tameable) en).isTamed()) - e.setCancelled(true); - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onPlayerTeleported(PlayerTeleportEvent e) { - final Player player = e.getPlayer(); - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(player); - - if (arena != null) { - final Arena newArena = CoreArenaPlugin.getArenaManager().findArena(e.getTo()); - final ArenaPlayer data = CoreArenaPlugin.getDataFor(player); - - if (newArena == null || !newArena.equals(arena)) - Common.runLater(1, () -> { - if (data.hasArenaCache() && !data.getArenaCache().pendingRemoval && !data.getArenaCache().pendingJoining) - if (arena.getState() == ArenaState.RUNNING) - arena.kickPlayer(player, LeaveCause.ESCAPED); - }); - } - } - - // - // Forward events to arena and or cancel - // - @EventHandler(priority = EventPriority.NORMAL) - - public final void onPlayerDeath(PlayerDeathEvent e) { - final Player pl = e.getEntity(); - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(pl); - - if (arena != null) { - final Player killer = playerDamagers.removeWeak(pl.getUniqueId()); - - if (arena.getSettings().allowOwnEquipment() && Settings.Arena.KEEP_OWN_EQUIPMENT) - e.setKeepInventory(true); - - if (Settings.Arena.HIDE_DEATH_MESSAGES) - e.setDeathMessage(null); - - // Always keep level because we store Nuggets in our cache anyways - e.setKeepLevel(true); - - try { - if (killer != null && arena.isJoined(killer) && !killer.getName().equals(pl.getName())) - arena.onPlayerDeath(pl, killer); - else - arena.onPlayerDeath(pl, DeathCause.DIED); - - } catch (final EventHandledException ex) { - // exit gracefully - } - } - } - - @EventHandler(priority = EventPriority.HIGHEST) - public final void onRespawn(PlayerRespawnEvent e) { - final Player player = e.getPlayer(); - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(player); - - if (arena != null) - try { - arena.onPlayerRespawn(e); - } catch (final EventHandledException ex) { - } - } - - @EventHandler(priority = EventPriority.HIGHEST) - public final void onPlayerInteractTwo(PlayerInteractEvent e) { - final boolean valid = e.isCancelled() && e.getAction().toString().contains("_AIR"); - if (!valid) - return; - - final Player player = e.getPlayer(); - final SimpleArenaManager manager = CoreArenaPlugin.getArenaManager(); - final Arena arena = manager.findArena(player); - - if (arena != null && arena.getState() == ArenaState.RUNNING) - try { - arena.onPlayerClickAir(player, player.getItemInHand()); - - } catch (final CancelledException ex) { - e.setCancelled(true); - } - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onPlayerInteract(PlayerInteractEvent e) { - if (!e.hasBlock()) - return; - - final Player player = e.getPlayer(); - - if (ItemUtil.isSimilar(player.getItemInHand(), CloneSpawnerToolOn.getInstance().getItem()) || ItemUtil.isSimilar(player.getItemInHand(), CloneSpawnerToolOff.getInstance().getItem())) - return; - - final SimpleArenaManager manager = CoreArenaPlugin.getArenaManager(); - final Arena arena = manager.findArena(e.getClickedBlock().getLocation()); - - if (arena == null) - return; - if (Remain.isInteractEventPrimaryHand(e)) { - if (arena.getState() == ArenaState.RUNNING && arena.isJoined(player)) { - - if (e.getAction() == Action.RIGHT_CLICK_BLOCK) - try { - arena.onPlayerClick(player, e.getClickedBlock(), player.getItemInHand()); - - } catch (final CancelledException ex) { - e.setCancelled(true); - } - - return; - } - - if (CoreArenaPlugin.getSetupManager().isArenaEdited(arena)) { - try { - arena.getSetup().onSetupClick(player, e.getAction(), e.getClickedBlock()); - - } catch (final CancelledException ex) { - e.setCancelled(true); - } - - return; - } - - if (arena.getState() == ArenaState.STOPPED) - notifyCannotEdit(player); - } - - if (arena.getState() != ArenaState.STOPPED) - return; - - if (!e.hasBlock()) - e.setCancelled(true); - - final Block block = e.getClickedBlock(); - if (block.getType() == Material.TRIPWIRE) - return; - - e.setCancelled(true); - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onItemPickup(PlayerPickupItemEvent e) { - final Item item = e.getItem(); - - if (item == null || item.getItemStack() == null) - return; - - final Player player = e.getPlayer(); - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(player); - - if (arena != null) - if (arena.getState() == ArenaState.RUNNING) { - if (ExpItemHandler.isExpItem(item)) { - final ExpItem tag = ExpItemHandler.getExpItem(item); - - try { - arena.onPlayerPickupTag(e, tag); - } catch (final EventHandledException ex) { - } - } - - } else { - if (CoreArenaPlugin.getSetupManager().isArenaEdited(arena)) - return; - - e.setCancelled(true); - item.remove(); - } - } - - // - // Cancel events in arena - // - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onItemSpawn(ItemSpawnEvent e) { - if (e.getEntity() == null || e.getEntity().getItemStack() == null || e.getEntity().getItemStack().getType() == Material.AIR) - return; - - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(e.getLocation()); - - if (arena != null) { - if (arena.getState() == ArenaState.RUNNING || CoreArenaPlugin.getSetupManager().isArenaEdited(arena)) - return; - - e.setCancelled(true); - } - } - - @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) - public void onDamage(EntityDamageEvent e) { - final Entity en = e.getEntity(); - - if (en instanceof Player) { - final Player pl = (Player) en; - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(pl); - - if (arena != null) - playerDamagers.override(pl.getUniqueId(), null); - - } else if (en instanceof Item && ExpItemHandler.isExpItem(en)) - e.setCancelled(true); - } - - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) - public final void onPlayerDamage(EntityDamageByEntityEvent e) { - final Entity victim = e.getEntity(); - final Entity damager = e.getDamager(); - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(victim.getLocation()); - - if (arena != null) - if (arena.getState() != ArenaState.STOPPED) { - final double finalDmg = Remain.getFinalDamage(e); - - if (arena.getState() == ArenaState.RUNNING) { - - Player plDamager = null; - - if (damager instanceof Projectile) { - final ProjectileSource source = ((Projectile) damager).getShooter(); - - if (source instanceof Player) - plDamager = (Player) source; - - } else if (damager instanceof Player) - plDamager = (Player) damager; - - try { - // is the damager in the game? - if (plDamager != null && !arena.isJoined(plDamager)) - e.setCancelled(true); - else if (victim instanceof Player) { - final Player pvictim = (Player) victim; - - try { - if (plDamager != null) - arena.onPlayerPvP(e, plDamager, pvictim, finalDmg); - else - arena.onPlayerDamage(e, pvictim, damager, finalDmg); - } catch (final EventHandledException ex) { - } - - if (!e.isCancelled()) - playerDamagers.override(pvictim.getUniqueId(), plDamager); - - } else if (victim instanceof LivingEntity && plDamager != null) - arena.onPlayerPvE(plDamager, (LivingEntity) victim, finalDmg); - - } catch (final EventHandledException ex) { - } - } else - e.setCancelled(true); - - } else { - if (CoreArenaPlugin.getSetupManager().isArenaEdited(arena)) - return; - - e.setCancelled(true); - - if (damager instanceof Player) - notifyCannotEdit((Player) damager); - } - } - - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void onPotionSplashEvent(PotionSplashEvent e) { - final ProjectileSource dm = e.getEntity().getShooter(); - - if (!(dm instanceof Player)) - return; - - for (final Entity en : e.getAffectedEntities()) { - if (!(en instanceof Player)) - continue; - - final Player pl = (Player) en; - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(pl); - - if (arena != null) - en.setMetadata("KaGame_potionKiller", new FixedMetadataValue(CoreArenaPlugin.getInstance(), pl)); - } - } - - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void onPotionDamage(EntityDamageEvent e) { - final DamageCause cause = e.getCause(); - final Entity en = e.getEntity(); - - if (!(en instanceof Player) || !en.hasMetadata("KaGame_potionKiller")) - return; - - if (cause == DamageCause.POISON || cause == DamageCause.MAGIC || cause == DamageCause.WITHER) - playerDamagers.override(en.getUniqueId(), (Player) en.getMetadata("KaGame_potionKiller").get(0).value()); - } - - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public final void onPlayerDamageByBlock(EntityDamageByBlockEvent e) { - if (!(e.getEntity() instanceof Player)) - return; - - final Player damaged = (Player) e.getEntity(); - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(damaged.getLocation()); - - if (arena != null) - if (arena.getState() != ArenaState.STOPPED) { - final double finalDmg = Remain.getFinalDamage(e); - - if (arena.getState() == ArenaState.RUNNING) - try { - playerDamagers.override(damaged.getUniqueId(), null); - arena.onPlayerBlockDamage(e, damaged, finalDmg); - - } catch (final EventHandledException ex) { - } - else - e.setCancelled(true); - - } else { - if (CoreArenaPlugin.getSetupManager().isArenaEdited(arena)) - return; - - e.setCancelled(true); - notifyCannotEdit(damaged); - } - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onEntityDeath(EntityDeathEvent e) { - if (e.getEntity() == null) - return; - - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(e.getEntity().getLocation()); - - if (arena != null) - if (arena.getState() == ArenaState.RUNNING && !CoreArenaPlugin.getSetupManager().isArenaEdited(arena)) - try { - arena.onEntityDeath(e); - } catch (final EventHandledException ex) { - } - else { - e.getDrops().clear(); - e.setDroppedExp(0); - } - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onEntityTarget(EntityTargetEvent e) { - if (e.getEntity() == null) - return; - - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(e.getEntity().getLocation()); - - if (arena != null) - if (arena.getState() == ArenaState.RUNNING && !CoreArenaPlugin.getSetupManager().isArenaEdited(arena)) - try { - arena.onEntityTarget(e); - } catch (final EventHandledException ex) { - } - else - e.setCancelled(true); - } - - @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) - public final void onProjectileHit(ProjectileHitEvent e) { - if (e.getEntity() == null) - return; - - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(e.getEntity().getLocation()); - - if (arena != null) - if (arena.getState() == ArenaState.RUNNING && !CoreArenaPlugin.getSetupManager().isArenaEdited(arena)) - try { - arena.onProjectileHit(e); - } catch (final EventHandledException ex) { - } - else - e.getEntity().remove(); - } - - @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) - public final void onProjectileLaunch(ProjectileLaunchEvent e) { - if (e.getEntity() == null) - return; - - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(e.getEntity().getLocation()); - - if (arena != null) - if (arena.getState() == ArenaState.RUNNING && !CoreArenaPlugin.getSetupManager().isArenaEdited(arena)) - try { - arena.onProjectileLaunch(e); - } catch (final EventHandledException ex) { - } - else - e.setCancelled(true); - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onBlockSpread(BlockSpreadEvent e) { - if (e.getSource() != null) - cancelIfInStoppedArena(e.getSource().getLocation(), e); - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onEntityInteract(EntityInteractEvent e) { - if (e.getEntity() != null) - cancelIfNotEditedAndNotifyIfNotPlaying(e.getEntity().getLocation(), null, e); - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onCreatureSpawn(CreatureSpawnEvent event) { - if (event.getLocation() == null) - return; - - final LivingEntity en = event.getEntity(); - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(event.getLocation()); - final List<String> banned = Arrays.asList("NATURAL", "CHUNK_GEN", "NETHER_PORTAL", "VILLAGE_DEFENSE", "VILLAGE_INVASION"); - - if (arena == null) - return; - if (banned.contains(event.getSpawnReason().toString())) - event.setCancelled(true); - else if (arena.getSetup().isEdited() && event.getSpawnReason() == SpawnReason.SPAWNER_EGG) - modifyToNotCombust(arena, en); - else if (arena.getState() != ArenaState.RUNNING) { - //Armor stands should be allowed to be spawned - if (event.getEntity().getType() == EntityType.ARMOR_STAND) - return; - event.setCancelled(true); - } else { - arena.onEntitySpawn(event); - - if (!en.isDead()) - modifyToNotCombust(arena, en); - } - } - - private void modifyToNotCombust(Arena arena, LivingEntity en) { - if (!(en instanceof Monster)) - return; - - // If monsters should not burn under sunlight, add an invisible button to their - // head - if (!arena.getSettings().allowMonstersBurn()) { - final EntityEquipment eq = en.getEquipment(); - - if (eq.getHelmet() == null || eq.getHelmet() != null && eq.getHelmet().getType() == Material.AIR) { - eq.setHelmet(new ItemStack(Material.STONE_BUTTON)); - eq.setHelmetDropChance(0F); - } - } - } - - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public final void onExplosionPrime(ExplosionPrimeEvent e) { - if (e.getEntity() == null) - return; - - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(e.getEntity().getLocation()); - - if (arena != null) - if (arena.getState() != ArenaState.RUNNING) { - - // Enable explosions in edit mode - if (!arena.getSetup().isEdited()) - e.setCancelled(true); - - } else if (e.getEntity() instanceof TNTPrimed) - e.setRadius(Settings.ProceduralDamage.Explosions.POWER_TNT); - else if (e.getEntity() instanceof Creeper) - e.setRadius(Settings.ProceduralDamage.Explosions.POWER_CREEPER); - } - - @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) - public final void onEntityExplode(EntityExplodeEvent e) { - if (e.getEntity() != null) { - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(e.getLocation()); - - if (arena != null) - if (arena.getState() == ArenaState.RUNNING) { - boolean glass = false; - final ArenaSnapshot snap = arena.getSnapshot(); - - if (snap instanceof ArenaSnapshotProcedural && snap.isSaved(DamagedStage.INITIAL) && snap.isSaved(DamagedStage.DAMAGED)) { - final List<Block> toRemove = new ArrayList<>(); - - for (final Block oldBlock : e.blockList()) { - final Arena otherArena = CoreArenaPlugin.getArenaManager().findArena(oldBlock.getLocation()); - - if (otherArena == null || !arena.getName().equals(otherArena.getName())) { - toRemove.add(oldBlock); - - continue; - } - - final double radius = Settings.ProceduralDamage.Explosions.DAMAGE_RADIUS; - - for (final Entity en : Remain.getNearbyEntities(oldBlock.getLocation(), radius)) - if (en instanceof Monster) { - CoreArenaPlugin.getArenaManager().findArena(oldBlock.getLocation()); - - final LivingEntity l = (LivingEntity) en; - final double newHP = MathUtil.range(Remain.getHealth(l) - Settings.ProceduralDamage.Explosions.DAMAGE_DAMAGE, 0, l.getMaxHealth()); - - l.setHealth(newHP); - } - - final BlockState oldBlockState = oldBlock.getState(); - - if (oldBlock.getType().toString().contains("GLASS")) - glass = true; - - final Block damagedBlock = ((ArenaSnapshotProcedural) snap).restoreBlock(oldBlock, DamagedStage.DAMAGED); - - if (damagedBlock == null || damagedBlock.getType() != oldBlockState.getType()) { - BlockPhysics.pushAway(arena, oldBlockState, Vector.getRandom()); - BlockPhysics.applyGravitation(arena, oldBlock, Settings.ProceduralDamage.Explosions.GRAVITATION_RADIUS_CHECK, true, 4); - } - } - - e.blockList().removeAll(toRemove); - } - - if (glass) - CompSound.GLASS.play(e.getEntity().getLocation(), 1F, 0.1F); - - e.blockList().clear(); - - /*e.setYield(0); - - boolean glass = false; - final ArenaSnapshot snap = arena.getSnapshot(); - - if (snap instanceof ArenaSnapshotProcedural && snap.isSaved(DamagedStage.INITIAL) && snap.isSaved(DamagedStage.DAMAGED)) - for (final Block block : e.blockList()) { - final Material oldMaterial = block.getState().getType(); - - if (block.getType().toString().contains("GLASS")) - glass = true; - - final Block damaged = ((ArenaSnapshotProcedural) snap).restoreBlock(block, DamagedStage.DAMAGED); - - if (damaged != null && damaged.getType() != oldMaterial) - BlockPhysics.applyGravitation(arena, block, Settings.ProceduralDamage.Explosions.GRAVITATION_RADIUS_CHECK + 1, true, 4); - } - - if (glass) - CompSound.GLASS.play(e.getLocation(), 1F, 0.1F); - - e.blockList().clear();*/ - - } else - e.setCancelled(true); - } - } - - @EventHandler - public final void onRocketExplosion(RocketExplosionEvent e) { - cancelIfInStoppedArena(e.getProjectile().getLocation(), e); - - if (!e.isCancelled()) - storedExplosions.override(Common.shortLocation(e.getProjectile().getLocation()), e.getProjectile().getVelocity()); - } - - private final void cancelIfInStoppedArena(Location loc, Cancellable e) { - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(loc); - - if (arena != null && arena.getState() != ArenaState.RUNNING) - e.setCancelled(true); - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onInvClick(InventoryClickEvent e) { - if (!(e.getWhoClicked() instanceof Player)) - return; - - final Arena arena = CoreArenaPlugin.getArenaManager().findArena((Player) e.getWhoClicked()); - - if (arena != null && arena.getState() == ArenaState.LOBBY) { - final Menu menu = Menu.getMenu((Player) e.getWhoClicked()); - - if (menu == null) - e.setCancelled(true); - } - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onItemDrop(PlayerDropItemEvent e) { - if (e.getItemDrop() == null || e.getItemDrop().getLocation() == null) - return; - - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(e.getItemDrop().getLocation()); - - if (arena != null) { - if (arena.getState() == ArenaState.RUNNING || CoreArenaPlugin.getSetupManager().isArenaEdited(arena)) - return; - - e.setCancelled(true); - } - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onToggleFly(PlayerToggleFlightEvent e) { - if (CoreArenaPlugin.DEBUG_EDITING_MODE) - return; - - final boolean blocked = cancelIfPlaying(e.getPlayer(), e); - - if (blocked) - e.getPlayer().setAllowFlight(false); - } - - /* - * @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - * public final void onGamemodeChange(PlayerGameModeChangeEvent e) { final Arena - * arena = CorePlugin.getArenaManager().findArena(e.getPlayer()); - * - * if (arena != null) { if (CorePlugin.getSetupManager().isArenaEdited(arena)) - * return; - * - * if (arena.getState() == ArenaState.RUNNING) { e.setCancelled(true); } } } - */ - - private final boolean cancelIfPlaying(Player pl, Cancellable e) { - if (CoreArenaPlugin.getArenaManager().isPlaying(pl)) { - e.setCancelled(true); - - return true; - } - - return false; - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onHangingBreak(HangingBreakByEntityEvent e) { - if (e.getRemover() != null && e.getRemover() instanceof Player) - cancelIfNotEditedAndNotifyIfNotPlaying(e.getEntity().getLocation(), (Player) e.getRemover(), e); - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onBlockPlace(BlockPlaceEvent e) { - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(e.getBlock().getLocation()); - final Player pl = e.getPlayer(); - - if (arena != null && !CoreArenaPlugin.getSetupManager().isArenaEdited(arena)) - if (pl != null && arena.getState() == ArenaState.STOPPED) - notifyCannotEdit(pl); - else - try { - arena.onPlayerBlockPlace(e); - - } catch (final CancelledException ex) { - e.setCancelled(true); - } - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onBlockBreak(BlockBreakEvent e) { - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(e.getBlock().getLocation()); - final Player pl = e.getPlayer(); - - if (arena != null && !CoreArenaPlugin.getSetupManager().isArenaEdited(arena)) - if (pl != null && arena.getState() == ArenaState.STOPPED) - notifyCannotEdit(pl); - else - arena.onPlayerBlockBreak(e); - } - - private final void cancelIfNotEditedAndNotifyIfNotPlaying(Location loc, Player pl, Cancellable e) { - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(loc); - - if (arena != null && !CoreArenaPlugin.getSetupManager().isArenaEdited(arena)) { - if (pl != null && arena.getState() == ArenaState.STOPPED) - notifyCannotEdit(pl); - - e.setCancelled(true); - } - } - - // ------------------------------------------------------------------------ - // Utility - // ------------------------------------------------------------------------ - - private void notifyCannotEdit(Player pl) { - if (CoreUtil.checkPerm(pl, Permissions.Commands.EDIT, false)) - Common.tell(pl, Localization.Arena.Setup.CANNOT_EDIT); - } -} - -class EventsProceduralDamage18 implements Listener { - - private final HashSet<String> undamagedPlayers = new HashSet<>(); - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onProjectileLaunch(ProjectileLaunchEvent e) { - final Projectile p = e.getEntity(); - - if (p != null && p.getShooter() instanceof Player) { - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(p.getLocation()); - final Player pl; - - if (arena == null) - return; - - if (arena.getState() != ArenaState.RUNNING || !arena.isJoined(pl = (Player) p.getShooter())) { - e.setCancelled(true); - - return; - } - - if (!ItemUtil.isSimilar(pl.getItemInHand(), ExplosiveBow.getItem())) - return; - - final PlayerInventory inv = pl.getInventory(); - boolean found = false; - ItemStack toTake = null; - - for (final ItemStack is : inv.getContents()) - if (is != null && ItemUtil.isSimilar(is, ExplosiveArrow.getItem())) { - toTake = is; - found = true; - - break; - } - - if (found) { - final ItemStack toTakeFinal = toTake; - - p.setMetadata("CoreBow", new FixedMetadataValue(CoreArenaPlugin.getInstance(), "true")); - - CompSound.FIREWORK_BLAST.play(pl, 1, (float) Math.random()); - - // Set amount - Common.runLater(() -> { - Valid.checkNotNull(toTakeFinal); - - Remain.takeItemOnePiece(pl, toTakeFinal); - }); - - // Effects - new BukkitRunnable() { - final Projectile arrow = e.getEntity(); - - @Override - public void run() { - if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround()) - cancel(); - else - CompParticle.SPELL_WITCH.spawn(arrow.getLocation()); - } - }.runTaskTimer(CoreArenaPlugin.getInstance(), 0, 1); - - } else { - e.setCancelled(true); - - CompSound.ENTITY_ITEMFRAME_BREAK.play(pl, 1, (float) Math.random()); - Common.tell(pl, Localization.Arena.Game.EXPLOSIVE_ARROW_NO_AMMO); - } - } - } - - @EventHandler - public void onPlayerDamage(EntityDamageByBlockEvent e) { - if (e.getEntityType() != EntityType.PLAYER) - return; - - final String name = ((Player) e.getEntity()).getName(); - - if (e.getCause() == DamageCause.BLOCK_EXPLOSION && undamagedPlayers.contains(name)) { - e.setDamage(0); - - undamagedPlayers.remove(name); - } - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onProjectileHit(ProjectileHitEvent e) { - final Projectile proj = e.getEntity(); - - if (proj != null && proj.getShooter() instanceof Player) { - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(proj.getLocation()); - - if (arena != null && proj.hasMetadata("CoreBow")) { - final Player player = (Player) proj.getShooter(); - - if (arena.getPlayers().contains(player)) { - final String loc = Common.shortLocation(proj.getLocation()); - - InArenaListener.storedExplosions.override(loc, proj.getVelocity()); - - player.getWorld().playEffect(proj.getLocation(), Effect.SMOKE, 0); - - if (!arena.getSettings().explosiveArrowPlayerDamage()) { // Prevent damage of players - final double radius = Settings.Items.ExplosiveBow.DAMAGE + Settings.ProceduralDamage.Explosions.DAMAGE_RADIUS; - - for (final Entity en : Remain.getNearbyEntities(proj.getLocation(), radius)) - if (en instanceof Player) - undamagedPlayers.add(((Player) en).getName()); - } - - player.getWorld().createExplosion(proj.getLocation(), Settings.Items.ExplosiveBow.DAMAGE); - - proj.remove(); - } - } - } - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onBlockExplode(BlockExplodeEvent e) { - if (e.getBlock() == null) - return; - - final String serializedLocation = Common.shortLocation(e.getBlock().getLocation()); - final Vector velocity = InArenaListener.storedExplosions.removeWeak(serializedLocation); - - if (velocity == null) - return; - - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(e.getBlock().getLocation()); - - if (arena != null && arena.getState() == ArenaState.RUNNING) { - boolean glass = false; - - final ArenaSnapshot snap = arena.getSnapshot(); - - if (snap instanceof ArenaSnapshotProcedural && snap.isSaved(DamagedStage.INITIAL) && snap.isSaved(DamagedStage.DAMAGED)) { - final List<Block> toRemove = new ArrayList<>(); - - for (final Block oldBlock : e.blockList()) { - final Arena otherArena = CoreArenaPlugin.getArenaManager().findArena(oldBlock.getLocation()); - - if (otherArena == null || !arena.getName().equals(otherArena.getName())) { - toRemove.add(oldBlock); - - continue; - } - - final double radius = Settings.ProceduralDamage.Explosions.DAMAGE_RADIUS; - - for (final Entity en : Remain.getNearbyEntities(oldBlock.getLocation(), radius)) - if (en instanceof Monster) { - CoreArenaPlugin.getArenaManager().findArena(oldBlock.getLocation()); - - final LivingEntity l = (LivingEntity) en; - final double newHP = MathUtil.range(Remain.getHealth(l) - Settings.ProceduralDamage.Explosions.DAMAGE_DAMAGE, 0, l.getMaxHealth()); - - l.setHealth(newHP); - } - - final BlockState oldBlockState = oldBlock.getState(); - - if (oldBlock.getType().toString().contains("GLASS")) - glass = true; - - final Block damagedBlock = ((ArenaSnapshotProcedural) snap).restoreBlock(oldBlock, DamagedStage.DAMAGED); - - if (damagedBlock == null || damagedBlock.getType() != oldBlockState.getType()) { - BlockPhysics.pushAway(arena, oldBlockState, velocity); - BlockPhysics.applyGravitation(arena, oldBlock, Settings.ProceduralDamage.Explosions.GRAVITATION_RADIUS_CHECK, true, 4); - } - } - - e.blockList().removeAll(toRemove); - } - - if (glass) - CompSound.GLASS.play(e.getBlock().getLocation(), 1F, 0.1F); - - e.blockList().clear(); - undamagedPlayers.clear(); - } - } -} - -class SpawnerSpawnComp implements Listener { - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onSpawnerSpawn(SpawnerSpawnEvent e) { - if (e.getEntity() == null) - return; - - final Entity en = e.getEntity(); - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(en.getLocation()); - - if (arena != null && arena.getState() != ArenaState.RUNNING) - e.setCancelled(true); - } -} - -class EntityPickupComp implements Listener { - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onItemPickupEntity(EntityPickupItemEvent e) { - if (e.getEntityType() != EntityType.PLAYER) { - if (e.getItem() == null || e.getItem().getItemStack() == null) - return; - - if (ExpItemHandler.isExpItem(e.getItem())) - e.setCancelled(true); - } - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/listener/PlayerListener.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/listener/PlayerListener.java deleted file mode 100644 index 05d3928dda7316a5b7314d0326c59d987d319ec4..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/listener/PlayerListener.java +++ /dev/null @@ -1,109 +0,0 @@ -package org.mineacademy.game.listener; - -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompMetadata; -import org.mineacademy.game.data.GeneralDataSection; -import org.mineacademy.game.event.PluginShouldFireMenuEvent; -import org.mineacademy.game.impl.ArenaPlayer; -import org.mineacademy.game.impl.MySQLDatabase; -import org.mineacademy.game.menu.MenuInArenaClasses; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.settings.Settings; -import org.mineacademy.game.type.LeaveCause; - -public class PlayerListener implements Listener { - - @EventHandler(priority = EventPriority.HIGH) - public void onJoin(PlayerJoinEvent e) { - final Player pl = e.getPlayer(); - final ArenaPlayer cache = CoreArenaPlugin.getDataFor(pl); - final GeneralDataSection generalData = GeneralDataSection.getInstance(); - - // Load MySQL - Common.runLater(Settings.MySQL.DELAY_TICKS, () -> MySQLDatabase.load(cache)); - - // Check pending location - final Location prevLocation = generalData.getPendingLocation(pl.getUniqueId()); - - if (prevLocation != null) - Common.runLater(2, () -> { - generalData.setPendingLocation(pl.getUniqueId(), null); - - pl.teleport(prevLocation); - }); - - // If we don't teleport them to a specific location, check if we can teleport to spawn - else { - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(pl.getLocation()); - - if (arena != null && Settings.Arena.MOVE_FORGOTTEN_PLAYERS && !CoreArenaPlugin.DEBUG_EDITING_MODE) - arena.teleportPlayerBack(pl); - } - } - - @EventHandler(priority = EventPriority.HIGH) - public void onClick(PlayerInteractEvent e) { - final Player player = e.getPlayer(); - - if (player.getItemInHand() != null) { - final ItemStack hand = player.getItemInHand(); - final String entity = CompMetadata.getMetadata(hand, "Game_Egg"); - - if (entity != null) - e.setCancelled(true); - } - } - - @EventHandler - public void onMenuShouldFire(PluginShouldFireMenuEvent e) { - if (!e.getPlugin().getName().equals(SimplePlugin.getNamed())) - return; - - final Player pl = e.getPlayer(); - - switch (e.getType()) { - - case CLASSES: { - Valid.checkBoolean(e.getData() != null && e.getData().length == 1 && e.getData()[0] instanceof Arena, "To open class menu specify to which arena to open"); - - new MenuInArenaClasses((Arena) e.getData()[0], pl).displayTo(pl); - break; - } - - default: - break; - } - } - - @EventHandler - public final void onQuit(PlayerQuitEvent e) { - final Player pl = e.getPlayer(); - final ArenaPlayer data = CoreArenaPlugin.getDataFor(pl); - - if (data.hasArenaCache()) { - if (data.getArenaCache().prevLocation != null) - GeneralDataSection.getInstance().setPendingLocation(pl.getUniqueId(), data.getArenaCache().prevLocation); - - data.getArenaCache().getArena(pl).kickPlayer(pl, LeaveCause.DISCONNECT); - } - - if (data.hasSetupCache()) - CoreArenaPlugin.getSetupManager().removeEditedArena(data.getSetupCache().arena); - - MySQLDatabase.save(data, true); - - CoreArenaPlugin.trashDataFor(pl); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/listener/SignsListener.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/listener/SignsListener.java deleted file mode 100644 index e7116a49bb7f73932bdedbd5b28b5e5729e6026f..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/listener/SignsListener.java +++ /dev/null @@ -1,259 +0,0 @@ -package org.mineacademy.game.listener; - -import org.bukkit.block.Block; -import org.bukkit.block.BlockState; -import org.bukkit.block.Sign; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.block.Action; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.SignChangeEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.scheduler.BukkitRunnable; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.game.command.ClassCommand; -import org.mineacademy.game.exception.EventHandledException; -import org.mineacademy.game.impl.SimpleSignClass; -import org.mineacademy.game.impl.SimpleSignJoin; -import org.mineacademy.game.impl.SimpleSignLeave; -import org.mineacademy.game.impl.SimpleSignPower; -import org.mineacademy.game.impl.SimpleSignPower.PowerType; -import org.mineacademy.game.impl.SimpleSignUpgrade; -import org.mineacademy.game.manager.SimpleArenaManager; -import org.mineacademy.game.menu.MenuRewards; -import org.mineacademy.game.menu.MenuRewards.MenuMode; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaClass; -import org.mineacademy.game.model.ArenaManager; -import org.mineacademy.game.model.ArenaSign; -import org.mineacademy.game.model.ArenaSign.SignType; -import org.mineacademy.game.model.Upgrade; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.settings.Settings; -import org.mineacademy.game.type.ArenaState; - -public class SignsListener implements Listener { - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public final void onBlockBreak(BlockBreakEvent e) { - final SimpleArenaManager manager = CoreArenaPlugin.getArenaManager(); - final BlockState state = e.getBlock().getState(); - - // Handle clicking arena sign - if (state instanceof Sign) { - final ArenaSign sign = manager.findSign((Sign) state); - - if (sign != null) { - sign.removeSign(); - - Common.tell(e.getPlayer(), Localization.Signs.REMOVED.replace("{arena}", sign.getArena().getName())); - } - } - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onSignChange(SignChangeEvent e) { - final Player player = e.getPlayer(); - final String[] lines = Common.replaceNullWithEmpty(e.getLines()); - - final String firstLine = lines[0]; - final String secondLine = lines[1]; - - final Block block = e.getBlock(); - - if (!(block.getState() instanceof Sign)) - return; - - final Sign sign = (Sign) block.getState(); - - // A helper class to reduce duplicate code, see below - // Most methods here do multiple things at once - class $ { - - private void checkSecondLine(String... emptyMessage) { - if (secondLine.isEmpty()) { - Common.tellNoPrefix(player, emptyMessage); - - breakReturn(); - } - } - - private Arena getArena(Block block) { - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(block.getLocation()); - - if (arena == null) { - Common.tell(player, Localization.Signs.OUTSIDE_ARENA); - - breakReturn(); - } - - return arena; - } - - private Arena getArena(String name) { - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(name); - - if (arena == null) { - Common.tell(player, Localization.Arena.Error.NOT_FOUND.replace("{arena}", name)); - - breakReturn(); - } - - return arena; - } - - private void update(SignType type, Arena arena) { - Common.runLater(2, new BukkitRunnable() { - @Override - public void run() { - arena.getData().getSigns().updateSigns(type, arena); - } - }); - } - - private int getNumber(String raw, String... falseMessage) { - try { - return Integer.parseInt(raw); - - } catch (final NumberFormatException ex) { - Common.tell(player, falseMessage); - - breakReturn(); - return 0; - } - } - - private void checkNull(Object obj, String... falseMessage) { - checkBoolean(obj != null, falseMessage); - } - - private void checkBoolean(boolean bol, String... falseMessage) { - if (!bol) { - Common.tellNoPrefix(player, falseMessage); - - breakReturn(); - } - } - - private void addSign(ArenaSign sign) { - final Arena arena = sign.getArena(); - - arena.getData().addSign(sign); - arena.getMessenger().tell(player, Localization.Signs.CREATED.replace("{arena}", arena.getName())); - - update(sign.getType(), arena); - } - - private void breakReturn() { - block.breakNaturally(); - - throw new EventHandledException(); - } - } - - final $ $ = new $(); - - try { - // ** Join sign ** - // e.g. [ma] on first sign - if (("[" + CoreArenaPlugin.getInstance().getMainCommand().getLabel().toLowerCase() + "]").equalsIgnoreCase(firstLine)) { - $.checkSecondLine(Localization.Signs.Arena.HELP); - final Arena arena = $.getArena(secondLine); - - $.addSign(new SimpleSignJoin(arena.getName(), sign)); - - } else if (("[" + Settings.Signs.Label.UPGRADES + "]").equalsIgnoreCase(firstLine)) { - final Arena arena = $.getArena(block); - final String costLine = lines[2]; - $.checkBoolean(!costLine.isEmpty(), Localization.Signs.Upgrade.COST_MISSING); - $.checkBoolean(!secondLine.isEmpty() && !costLine.isEmpty(), Localization.Signs.Upgrade.HELP); - - final Upgrade u = CoreArenaPlugin.getUpgradesManager().findUpgrade(secondLine); - - $.checkNull(u, Localization.Signs.OBJECT_NOT_FOUND.replace("{type}", "upgrade").replace("{line}", secondLine)); - - final int cost = $.getNumber(costLine, Localization.Signs.Upgrade.COST_INVALID); - - $.addSign(new SimpleSignUpgrade(arena.getName(), u, cost, sign)); - } else if (("[" + Settings.Signs.Label.CLASS + "]").equalsIgnoreCase(firstLine)) { - final Arena arena = $.getArena(block); - final String classLine = lines[1]; - $.checkBoolean(!classLine.isEmpty(), Localization.Signs.Class.HELP); - - final ArenaClass clazz = CoreArenaPlugin.getClassManager().findClass(classLine); - $.checkNull(clazz, Localization.Signs.OBJECT_NOT_FOUND.replace("{type}", "class").replace("{line}", secondLine)); - - $.addSign(new SimpleSignClass(arena.getName(), clazz, sign)); - } else if (("[" + Settings.Signs.Label.POWER + "]").equalsIgnoreCase(firstLine)) { - final Arena arena = $.getArena(block); - final String powerType = lines[1]; - $.checkBoolean(!powerType.isEmpty(), Localization.Signs.Power.HELP); - - final PowerType power = PowerType.fromLine(powerType); - $.checkNull(power, Localization.Signs.Power.TYPE_INVALID.replace("{type}", powerType)); - - $.addSign(new SimpleSignPower(power, arena.getName(), sign)); - } else if (("[" + Settings.Signs.Label.LEAVE + "]").equalsIgnoreCase(firstLine)) { - final Arena arena = $.getArena(block); - - $.addSign(new SimpleSignLeave(arena.getName(), sign)); - } else if (Settings.Signs.ALLOW_CLASSES_SIGN && ("[" + Settings.Signs.Label.CLASSES + "]").equalsIgnoreCase(firstLine)) { - final Arena arena = $.getArena(block); - - if (arena.getState() == ArenaState.LOBBY) - ClassCommand.tryOpenMenu(player); - } - - } catch (final EventHandledException ex) { - } - } - - @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) - public final void onPlayerInteract(PlayerInteractEvent e) { - if (!Remain.isInteractEventPrimaryHand(e)) - return; - - final Player pl = e.getPlayer(); - final ArenaManager manager = CoreArenaPlugin.getArenaManager(); - - // Handle clicking arena sign - if (e.hasBlock() && e.getAction() == Action.RIGHT_CLICK_BLOCK && e.getClickedBlock().getState() instanceof Sign) { - final Sign sign = (Sign) e.getClickedBlock().getState(); - - final ArenaSign arenaSign = manager.findSign(sign); - - if (arenaSign != null) { - final Arena edited = CoreArenaPlugin.getArenaManager().findEditedArena(pl); - - if (edited != null && edited.equals(arenaSign.getArena())) - arenaSign.onSignSetupClick(pl); - - else if (arenaSign.getArena().getPlayers().contains(pl)) - arenaSign.onSignInGameClick(pl); - - else - arenaSign.onSignOutGameClick(pl); - - e.setCancelled(true); - return; - } - - // We do not register these two internally - else { - final String title = sign.getLine(0).toLowerCase(); - - if (("[" + Settings.Signs.Label.CLASSES + "]").equalsIgnoreCase(title)) - ClassCommand.tryOpenMenu(pl); - - else if (("[" + Settings.Signs.Label.REWARDS + "]").equalsIgnoreCase(title)) - if (!manager.isPlaying(pl)) - MenuRewards.showRewardsMenu(pl, MenuMode.PURCHASE); - - } - } - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/ClassManager.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/ClassManager.java deleted file mode 100644 index adaf9bff14306336304cfc755da76c5f23dbf77a..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/ClassManager.java +++ /dev/null @@ -1,114 +0,0 @@ -package org.mineacademy.game.manager; - -import java.io.File; - -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Common.Stringer; -import org.mineacademy.fo.FileUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.model.RandomNoRepeatPicker; -import org.mineacademy.fo.settings.YamlConfig; -import org.mineacademy.game.impl.ArenaPlayer; -import org.mineacademy.game.impl.SimpleClass; -import org.mineacademy.game.model.ArenaClass; -import org.mineacademy.game.util.Constants; - -import lombok.Getter; -import lombok.Setter; - -public final class ClassManager { - - /** - * Holds all loaded classes. - */ - @Getter - private final StrictList<ArenaClass> classes = new StrictList<>(); - - private final RandomClassSelector randomSelector = new RandomClassSelector(); - - public void loadClasses() { - classes.clear(); - - final File[] files = FileUtil.getFiles(Constants.Folder.CLASS, "yml"); - Common.log("Loading " + Common.plural(files.length, "class")); - - for (final File f : files) - try { - final String name = f.getName().replace(".yml", ""); - final SimpleClass clazz = new SimpleClass(name); - - if (!clazz.isDataValid()) { - Common.log("Ignoring invalid class file " + f); - YamlConfig.unregisterLoadedFile(f); - - continue; - } - - classes.add(clazz); - - } catch (final Throwable t) { - Common.throwError(t, "Error loading class from " + f.getName()); - } - } - - public void createClass(String name) { - Valid.checkBoolean(findClass(name) == null, "Class " + name + " already exists!"); - final SimpleClass clazz = new SimpleClass(name); - - classes.add(clazz); - } - - public void removeClass(String name) { - final ArenaClass clazz = findClass(name); - Valid.checkBoolean(clazz != null, "Class " + name + " does not exist!"); - - classes.remove(clazz); - clazz.deleteClass(); - } - - public ArenaClass findClass(String name) { - for (final ArenaClass clazz : classes) - if (clazz.getName().equalsIgnoreCase(name)) - return clazz; - - return null; - } - - public ArenaClass findRandomClassFor(Player pl) { - return randomSelector.pickFromFor(classes, pl); - } - - public ArenaClass findRandomClassFor(Player pl, int minimumTier) { - randomSelector.setMinimumTier(minimumTier); - - return randomSelector.pickFromFor(classes, pl); - } - - public StrictList<String> getAvailable() { - return Common.convertStrict(classes, ArenaClass::getName); - } - - public String getAvailableFormatted() { - return Common.join(classes, ", ", (Stringer<ArenaClass>) ArenaClass::getName); - } -} - -class RandomClassSelector extends RandomNoRepeatPicker<ArenaClass> { - - @Setter - private int minimumTier = -1; - - @Override - protected boolean canObtain(Player pl, ArenaClass picked) { - if (!picked.isValid()) - return false; - - final ArenaPlayer cache = CoreArenaPlugin.getDataFor(pl); - final boolean mayObtain = picked.mayObtain(pl); - - return mayObtain && (minimumTier != -1 ? cache.getTierOf(picked) >= minimumTier : mayObtain); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/RewardsManager.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/RewardsManager.java deleted file mode 100644 index 25d2024b5ccd62b888b49c8a63ae2d9416a8e5c3..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/RewardsManager.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.mineacademy.game.manager; - -import java.util.List; - -import org.mineacademy.fo.Common; -import org.mineacademy.game.data.RewardsDataSection; -import org.mineacademy.game.model.Reward; -import org.mineacademy.game.type.RewardType; - -public class RewardsManager { - - private RewardsDataSection rewards; - - public final void loadRewards() { - rewards = new RewardsDataSection(); - - Common.log("Loading " + Common.removeNullAndEmpty(rewards.getRewards(RewardType.ITEM)).size() + " item, " + - Common.removeNullAndEmpty(rewards.getRewards(RewardType.BLOCK)).size() + " block and " + - Common.removeNullAndEmpty(rewards.getRewards(RewardType.PACK)).size() + " packs rewards.", - " "); - } - - public final List<Reward> getRewards(RewardType type) { - return rewards.getRewards(type); - } - - public final void setRewards(RewardType type, List<Reward> items) { - rewards.setRewards(type, items); - } - - public final void updateReward(Reward reward) { - rewards.updateReward(reward); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/SetupManager.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/SetupManager.java deleted file mode 100644 index 0f5f0c91b569f720f47c14f4a19703f7165836f2..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/SetupManager.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.mineacademy.game.manager; - -import java.util.Collections; -import java.util.Map.Entry; - -import org.bukkit.entity.Player; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.game.model.Arena; - -public final class SetupManager { - - private final StrictMap<Player, Arena> editedArenas = new StrictMap<>(); - - public boolean isArenaEdited(Arena arena) { - return editedArenas.containsValue(arena); - } - - public Player getEditorOf(Arena arena) { - for (final Entry<Player, Arena> e : editedArenas.entrySet()) - if (e.getValue().equals(arena)) - return e.getKey(); - - throw new FoException("Arena " + arena.getName() + " is not being edited"); - } - - public Arena getEditedArena(Player player) { - return editedArenas.get(player); - } - - public void addEditedArena(Player player, Arena arena) { - Valid.checkNotNull(player, "Player == null"); - Valid.checkBoolean(!isArenaEdited(arena), "Arena " + arena.getName() + " is already being edited!"); - Valid.checkBoolean(getEditedArena(player) == null, "The player " + player.getName() + " is already editing an area!"); - - editedArenas.put(player, arena); - arena.getSetup().onEnterEditMode(player); - } - - public void removeEditedArena(Arena arena) { - Valid.checkBoolean(editedArenas.containsValue(arena), "Arena " + arena.getName() + " is not being edited!"); - final Player editor = getEditorOf(arena); - - arena.getSetup().onLeaveEditMode(editor); - editedArenas.removeByValue(arena); - } - - public StrictList<Arena> getEditedArenas() { - return new StrictList<>(Collections.unmodifiableCollection(editedArenas.values())); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/SimpleArenaManager.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/SimpleArenaManager.java deleted file mode 100644 index 9ad667555ca0ec62dec274768382572188a91157..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/SimpleArenaManager.java +++ /dev/null @@ -1,215 +0,0 @@ -package org.mineacademy.game.manager; - -import java.io.File; -import java.util.Collections; -import java.util.List; -import java.util.Set; - -import lc.minecraft.murderarium.Murderarium; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.block.Sign; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.FileUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.collection.StrictSet; -import org.mineacademy.fo.exception.InvalidWorldException; -import org.mineacademy.fo.model.SimpleComponent; -import org.mineacademy.fo.settings.YamlConfig; -import org.mineacademy.game.impl.SimpleIncompleteRegion; -import org.mineacademy.game.impl.arena.MobArena; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaManager; -import org.mineacademy.game.model.ArenaRegistry; -import org.mineacademy.game.model.ArenaSign; -import org.mineacademy.game.model.ArenaSigns; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.type.ArenaState; -import org.mineacademy.game.type.StopCause; -import org.mineacademy.game.util.Constants; -import org.mineacademy.game.util.CoreUtil; - -public final class SimpleArenaManager implements ArenaManager { - - /** - * List of all loaded arenas - */ - private final StrictSet<Arena> arenas = new StrictSet<>(); - - public void loadSavedArenas() { - arenas.clear(); - - for (final Arena arena : loadFromFile()) - arenas.add(arena); - } - - public void onPostLoad() { - for (final Arena arena : arenas) - arena.onPostLoad(); - - } - - public void stopArenas(StopCause cause) { - for (final Arena arena : arenas) - if (arena.getState() != ArenaState.STOPPED) - arena.stopArena(cause); - } - - private StrictList<Arena> loadFromFile() { - final StrictList<Arena> loaded = new StrictList<>(); - - final File[] files = FileUtil.getFiles(Constants.Folder.ARENAS, "yml"); - Common.log("Loading " + Common.plural(files.length, "arena")); - - for (final File file : files) - try { - final String arenaName = file.getName().replace(".yml", ""); - final Arena arena = new Murderarium(arenaName); - - if (!arena.getData().isSectionValid()) { - Common.log("Ignoring invalid arena file " + file); - - ArenaRegistry.unregister(arena); - YamlConfig.unregisterLoadedFile(file); - continue; - } - - loaded.add(arena); - - } catch (final Throwable t) { - if (t instanceof InvalidWorldException) - Common.logFramed(false, "Warning: You arena " + file.getName() + " had invalid world and is ignored. Error was: " + t.getMessage()); - else { - t.printStackTrace(); - - Common.throwError(t, "Error loading arena from " + file.getName()); - } - } - - return loaded; - } - - public Arena createArena(String name) { - Valid.checkBoolean(findArena(name) == null, "Arena " + name + " already exists"); - final Arena arena = new Murderarium(name); - arena.onPostLoad(); - - arenas.add(arena); - return arena; - } - - public void removeArena(String name) { - final Arena arena = findArena(name); - Valid.checkBoolean(arena != null, "Arena " + name + " does not exist!"); - - arena.getData().deleteSection(); - arena.getSettings().removeSettingsFile(); - - ArenaRegistry.unregister(arena); - - arenas.remove(arena); - } - - @Override - public Arena findArena(String name) { - for (final Arena arena : arenas) - if (arena.getName().equalsIgnoreCase(name)) - return arena; - - return null; - } - - @Override - public Arena findArena(Player pl) { - for (final Arena arena : arenas) - if (arena.getState() != ArenaState.STOPPED && arena.getSetup().isReady() && arena.isJoined(pl)) { - - Valid.checkBoolean(CoreArenaPlugin.getDataFor(pl).hasArenaCache(), pl.getName() + " is in " + arena.getName() + " but lacks cache!"); - - return arena; - } - - return null; - } - - @Override - public ArenaSign findSign(Sign sign) { - for (final Arena arena : arenas) { - final ArenaSigns signs = arena.getData().getSigns(); - - if (signs != null) { - final ArenaSign arenasign = signs.getSignAt(sign.getLocation()); - - if (arenasign != null) - return arenasign; - } - } - - return null; - } - - @Override - public Arena findArena(Location loc) { - Valid.checkNotNull(loc, "Location cannot be null!"); - - for (final Arena arena : arenas) - if (arena.getData().getRegion() != null && !(arena.getData().getRegion() instanceof SimpleIncompleteRegion)) - if (arena.getData().getRegion().isWithin(loc)) - return arena; - - return null; - } - - public void tellAvailableArenas(CommandSender sender) { - final SimpleComponent json = SimpleComponent.of(Common.getTellPrefix() + " Available arenas: "); - - for (int i = 0; i < arenas.size(); i++) { - final Arena arena = arenas.getAt(i); - - final boolean acceptingJoin = arena.isEnabled() && arena.getSetup().isReady() && !CoreArenaPlugin.getSetupManager().isArenaEdited(arena); - final boolean isStopped = arena.getState() == ArenaState.STOPPED; - final ChatColor color = acceptingJoin ? isStopped ? ChatColor.GREEN : ChatColor.GOLD : ChatColor.RED; - - json.append(color.toString() + arena.getName()); - - if (acceptingJoin) - json.onHover(" &8[-&7&l" + arena.getName() + "&8-] ", "&5" + Localization.Parts.STATE + CoreUtil.getStateName(arena.getState()), isStopped ? "&5" + Localization.Parts.SIZE + Localization.Cases.PLAYER.formatWithCount(arena.getSettings().getMaximumPlayers()) : "&5" + Localization.Parts.PLAYERS + arena.getPlayers().size() + "&8/&7" + arena.getSettings().getMaximumPlayers()); - else - json.onHover((!arena.isEnabled() ? Localization.Arena.Error.NOT_ENABLED : !arena.getSetup().isReady() ? Localization.Arena.Error.NOT_CONFIGURED : CoreArenaPlugin.getSetupManager().isArenaEdited(arena) ? Localization.Arena.Error.EDITED : "&4(Error)").replace("{arena}", arena.getName())); - - if (arenas.size() > 1 && i + 1 < arenas.size()) - json.append("&7, "); - } - - json.send(sender); - } - - @Override - public Set<Arena> getArenas() { - return Collections.unmodifiableSet(arenas.getSource()); - } - - @Override - public List<String> getAvailable() { - return Common.convert(arenas, Arena::getName); - } - - @Override - public boolean isPlaying(Player player) { - return findArena(player) != null; - } - - @Override - public Arena findEditedArena(Player player) { - return CoreArenaPlugin.getSetupManager().getEditedArena(player); - } - - @Override - public boolean isEditing(Player player) { - return findEditedArena(player) != null; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/SimpleSigns.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/SimpleSigns.java deleted file mode 100644 index 7054a4fe3a79cc33d9170b7fa8227eccacaa7aef..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/SimpleSigns.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.mineacademy.game.manager; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.Location; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaSign; -import org.mineacademy.game.model.ArenaSigns; -import org.mineacademy.game.model.ArenaSign.SignType; - -import lombok.RequiredArgsConstructor; - -@RequiredArgsConstructor -public class SimpleSigns implements ArenaSigns { - - private final StrictMap<SignType, List<ArenaSign>> signs; - - @Override - public final ArenaSign getSignAt(Location loc) { - for (final List<ArenaSign> signs : signs.values()) - for (final ArenaSign sign : signs) - if (Valid.locationEquals(sign.getLocation(), loc)) - return sign; - - return null; - } - - @Override - public final List<ArenaSign> getSigns(SignType type) { - return signs.getOrPut(type, new ArrayList<>()); - } - - @Override - public final void updateSigns(SignType type, Arena arena) { - if (signs.contains(type)) - for (final ArenaSign sign : signs.get(type)) - sign.updateState(); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/SpawnPointManager.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/SpawnPointManager.java deleted file mode 100644 index 05f2dcf212ae8af093c8c560d3cf593300bf83a0..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/SpawnPointManager.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.mineacademy.game.manager; - -import java.util.List; - -import org.bukkit.entity.Player; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.model.RandomNoRepeatPicker; -import org.mineacademy.game.model.ArenaData; -import org.mineacademy.game.model.SpawnPoint; -import org.mineacademy.game.type.SpawnPointType; - -import lombok.Getter; - -public final class SpawnPointManager { - - private final RandomSpawnPointPicker randomPicker = new RandomSpawnPointPicker(); - - @Getter - private final ArenaData data; - - public SpawnPointManager(ArenaData data) { - this.data = data; - } - - public SpawnPoint getRandomSpawnPoint(Player pl, SpawnPointType type) { - final List<SpawnPoint> list = data.getSpawnPoints(type); - Valid.checkNotEmpty(list, "Spawn points must be set!"); - - return randomPicker.pickFromFor(list, pl); - } -} - -class RandomSpawnPointPicker extends RandomNoRepeatPicker<SpawnPoint> { - - @Override - protected boolean canObtain(Player pl, SpawnPoint picked) { - return true; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/UpgradesManager.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/UpgradesManager.java deleted file mode 100644 index 158aa0379a4003134488a1570099dc64ec3be466..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/manager/UpgradesManager.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.mineacademy.game.manager; - -import java.io.File; - -import org.bukkit.entity.Player; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.FileUtil; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.settings.YamlConfig; -import org.mineacademy.game.impl.SimpleUpgrade; -import org.mineacademy.game.model.Upgrade; -import org.mineacademy.game.util.Constants; - -public final class UpgradesManager { - - /** - * Holds all loaded upgrades. - */ - private final StrictList<Upgrade> upgrades = new StrictList<>(); - - public void loadUpgrades() { - upgrades.clear(); - - final File[] files = FileUtil.getFiles(Constants.Folder.UPGRADES, "yml"); - Common.log("Loading " + Common.plural(files.length, "upgrade")); - - for (final File f : files) - try { - final String name = f.getName().replace(".yml", ""); - final SimpleUpgrade u = new SimpleUpgrade(name); - - if (!u.isDataValid()) { - Common.log("Ignoring invalid upgrade file " + f); - - YamlConfig.unregisterLoadedFile(f); - continue; - } - - upgrades.add(u); - - } catch (final Throwable t) { - Common.throwError(t, "Error loading upgrade from " + f.getName()); - } - } - - public void createUpgrade(String name) { - Valid.checkNotNull(name, "Report / Name cannot be null!"); - Valid.checkBoolean(findUpgrade(name) == null, "Upgrade " + name + " already exists!"); - - final SimpleUpgrade upgrade = new SimpleUpgrade(name); - - upgrades.add(upgrade); - } - - public void removeUpgrade(String name) { - Valid.checkNotNull(name, "Report / Name cannot be null!"); - - final Upgrade u = findUpgrade(name); - Valid.checkBoolean(u != null, "Upgrade " + name + " does not exist!"); - - upgrades.remove(u); - u.deleteUpgrade(); - } - - public Upgrade findUpgrade(String name) { - Valid.checkNotNull(name, "Report / Name cannot be null!"); - - for (final Upgrade u : upgrades) - if (u.getName().equalsIgnoreCase(name)) - return u; - - return null; - } - - public boolean mayObtain(Upgrade u, Player pl) { - return u.getPermission() != null ? PlayerUtil.hasPerm(pl, u.getPermission()) : true; - } - - public StrictList<String> getAvailable() { - return Common.convertStrict(upgrades, Upgrade::getName); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/AbstractListMenu.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/AbstractListMenu.java deleted file mode 100644 index 126fc54e08ca9c4ee0e1b65939a87d578a5b0416..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/AbstractListMenu.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.mineacademy.game.menu; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.model.InventoryDrawer; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.game.conversation.AddNewConvo; -import org.mineacademy.game.conversation.AddNewConvo.Created; - -/** - * An incremental menu that list items. - */ -abstract class AbstractListMenu extends Menu { - - private final String listName; - private final StrictList<String> list; - - protected AbstractListMenu(String listName, Iterable<String> list) { - this(new CoreMenu(), listName, list); - } - - protected AbstractListMenu(Menu parent, String listName, Iterable<String> list) { - super(parent); - - this.listName = listName; - this.list = new StrictList<>(list); - - setSize(18 + 9 * (this.list.size() / 9)); - setTitle(listName + " Menu"); - } - - @Override - protected final List<Button> getButtonsToAutoRegister() { - final List<Button> items = new ArrayList<>(getSize()); - - for (int i = 0; i < list.size(); i++) { - final Button button = getListButton(list.get(i), i); - - if (button != null) - items.add(button); - } - - { - fillSpace(items, 2); - - if (getAddButton() != null && getCreatedObject() != null && items.size() < getSize()) - items.add(getAddButton()); - } - - /*{ - fillSpace(items, 1); - - if (getReturnButton() != null && items.size() < getSize()) - items.add(getReturnButton()); - }*/ - - return items; - } - - private final void fillSpace(List<Button> items, int preserve) { - for (int i = items.size(); i < getSize() - preserve; i++) - items.add(Button.makeEmpty()); - } - - protected abstract Button getListButton(String listName, int listIndex); - - protected abstract Created getCreatedObject(); - - protected Button getAddButton() { - final String menuIsAbout = listName.toLowerCase(); - - return new Button() { - - @Override - public final void onClickedInMenu(Player pl, Menu menu, ClickType click) { - new AddNewConvo(getCreatedObject(), menu).start(pl); - } - - @Override - public ItemStack getItem() { - return ItemCreator - .of(CompMaterial.EMERALD) - .name("&a&lCreate new") - .lores(Arrays.asList( - "", - "&7Click to make a new " + menuIsAbout + ".")) - .build().make(); - } - }; - } - - @Override - protected final void onDisplay(InventoryDrawer inv) { - for (final Button item : getButtonsToAutoRegister()) - inv.pushItem(item.getItem()); - } - - @Override - protected final String[] getInfo() { - return null; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/CoreMenu.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/CoreMenu.java deleted file mode 100644 index 3823dff62b42f847fda2b448fdf855583cc39fe4..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/CoreMenu.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.mineacademy.game.menu; - -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.button.ButtonMenu; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.game.menu.MenuRewards.MenuMode; - -public class CoreMenu extends Menu { - - private final Button arenasButton; - private final Button classesButton; - private final Button upgradesButton; - private final Button rewardsButton; - - public CoreMenu() { - super(null); - - setSize(9 * 3); - setTitle(SimplePlugin.getNamed() + " Menu"); - - arenasButton = new ButtonMenu(MenuArena.class, CompMaterial.CHEST, "&6&lArenas"); - classesButton = new ButtonMenu(MenuClasses.class, CompMaterial.IRON_SWORD, "&f&lClasses"); - upgradesButton = new ButtonMenu(MenuUpgrades.class, CompMaterial.ENCHANTED_BOOK, "&d&lUpgrades"); - - rewardsButton = new Button() { - - @Override - public final void onClickedInMenu(Player pl, Menu menu, ClickType click) { - MenuRewards.showRewardsMenu(pl, MenuMode.EDIT_ITEMS); - - //new MenuRewards(pl, MenuMode.EDIT_ITEMS).displayTo(pl); - } - - @Override - public ItemStack getItem() { - return ItemCreator.of(CompMaterial.DIAMOND).name("&b&lRewards").build().makeMenuTool(); - } - }; - } - - @Override - public final ItemStack getItemAt(int slot) { - if (slot == 9 + 1) - return arenasButton.getItem(); - - if (slot == 9 + 3) - return classesButton.getItem(); - - if (slot == 9 + 5) - return upgradesButton.getItem(); - - if (slot == 9 + 7) - return rewardsButton.getItem(); - - return null; - } - - @Override - protected final String[] getInfo() { - return null; - } - - @Override - protected final boolean addReturnButton() { - return false; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/IconMenu.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/IconMenu.java deleted file mode 100644 index 37fe51a4246cd9fe2ecb13ff93e4619be824a56f..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/IconMenu.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.mineacademy.game.menu; - -import java.util.Arrays; -import java.util.List; - -import org.bukkit.DyeColor; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.button.ButtonMenu; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.menu.model.MenuClickLocation; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.game.model.Iconable; - -class IconMenu extends Menu { - public static final List<String> LORES = Arrays.asList( - "&r", - "&7Set the class icon as", - "&7it appears in the menu."); - - public static final String EDIT_ICON = "&f&lEdit Icon"; - - public static final String MENU_ICON_TITLE = "&0Set Class Icon"; - - public static final String[] DESCRIPTION = { - "Place your icon inside", - "the fiolett circle and", - "return to save changes.", - "", - "Remove to show the default icon." - }; - - private final static int ICON_SLOT = 13; - - private final static ItemStack decorationItem = ItemCreator.of(CompMaterial.fromLegacy("STAINED_GLASS_PANE", DyeColor.MAGENTA.getWoolData())).name(" ").build().makeMenuTool(); - private final static List<Integer> decorationSlots = Arrays.asList( - 3, 4, 5, - 12, 14, - 21, 22, 23); - - public static final Button asButton(Iconable iconable, Menu parent) { - - return new ButtonMenu(new IconMenu(iconable, parent), - ItemCreator - .of(CompMaterial.GLASS) - .name(EDIT_ICON) - .lores(LORES)); - } - - private final Iconable iconable; - - private IconMenu(Iconable iconable, Menu parent) { - super(parent); - - setTitle(MENU_ICON_TITLE); - - this.iconable = iconable; - } - - @Override - public final ItemStack getItemAt(int slot) { - if (decorationSlots.contains(slot)) - return decorationItem; - - if (slot == ICON_SLOT) - return iconable.hasIcon() ? iconable.getIcon() : null; - - return null; - } - - @Override - protected int getInfoButtonPosition() { - return 9 + 1; - } - - @Override - protected final int getReturnButtonPosition() { - return 9 + 7; - } - - @Override - public final void onMenuClose(Player pl, Inventory inv) { - final ItemStack icon = inv.getItem(ICON_SLOT); - - iconable.setIcon(icon != null && icon.getType() != Material.AIR ? icon : null); - } - - @Override - public final boolean isActionAllowed(MenuClickLocation clickLocation, int slot, ItemStack clickedSlot, ItemStack cursor) { - return clickLocation == MenuClickLocation.PLAYER_INVENTORY || clickLocation == MenuClickLocation.MENU && slot == ICON_SLOT; - } - - @Override - protected final String[] getInfo() { - return DESCRIPTION; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/IndividualArenaMenu.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/IndividualArenaMenu.java deleted file mode 100644 index 4035fe25d10e2a82a1b7b6d9168cb4322fb8c508..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/IndividualArenaMenu.java +++ /dev/null @@ -1,248 +0,0 @@ -package org.mineacademy.game.menu; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.button.ButtonMenu; -import org.mineacademy.fo.menu.button.ButtonRemove; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.game.data.GeneralDataSection; -import org.mineacademy.game.impl.SimpleSetup; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaSnapshotProcedural.DamagedStage; -import org.mineacademy.game.type.SpawnPointType; - -import com.google.common.collect.Lists; - -public final class IndividualArenaMenu extends Menu { - - public static final List<String> LORES = Arrays.asList("", "&7Take arena snapshots to enable", "&7the procedural damage."); - public static final String SNAPSHOT_MANAGER = "&3&lSnapshot manager"; - - public static String[] createDescription(final Arena arena) { - return new String[] { - "This is an arena menu.", - " ", - "To configure more options,", - "edit &farenas/" + arena.getName() + ".yml &7file", - "inside your plugin folder.", - "", - "To &fsetup &7the arena, use /" + CoreArenaPlugin.getInstance().getMainCommand().getLabel() + " edit", - }; - } - - private final Arena arena; - - private final Button iconButton; - private final Button setupButton; - private final Button snapshotButton; - private final Button removeButton; - private final Button lobbyButton; - private final Button toggleButton; - - public IndividualArenaMenu(final String arenaName) { - this(CoreArenaPlugin.getArenaManager().findArena(arenaName)); - } - - public IndividualArenaMenu(final Arena arena) { - super(new MenuArena()); - - setSize(9 * 5); - setTitle("&0" + arena.getName() + " Menu"); - - this.arena = arena; - - iconButton = IconMenu.asButton(arena.getData(), this); - - { - final MenuSnapshot snapshotMenu = new MenuSnapshot(arena, this); - final boolean warningShown = GeneralDataSection.getInstance().isSnapshotNotified(); - - snapshotButton = MinecraftVersion.newerThan(V.v1_12) ? - - new ButtonMenu(warningShown ? snapshotMenu : new SnapshotWarningDialog(snapshotMenu), - ItemCreator - .of(CompMaterial.fromLegacy("LOG", 3)) - .name(SNAPSHOT_MANAGER) - .lores(LORES) - .hideTags(true)) - : Button.makeDummy(ItemCreator.of(CompMaterial.fromLegacy("LOG", 3), SNAPSHOT_MANAGER, "", "&cProcedural damage requires", "&cMinecraft 1.13+ or greater", "&cdue to WorldEdit changes.")); - } - - lobbyButton = new Button() { - - @Override - public void onClickedInMenu(final Player pl, final Menu menu, final ClickType click) { - if (!arena.getSetup().isLobbySet()) { - final String LOBBY_NOT_SET = "&4Lobby is not set!"; - animateTitle(LOBBY_NOT_SET); - return; - } - - pl.closeInventory(); - pl.teleport(arena.getData().getLobby().getLocation().clone().add(0, 1, 0)); - - final String TELEPORTING_TO_ARENA_LOBBY = "&7Teleporting to the arena lobby.."; - Common.tell(pl, TELEPORTING_TO_ARENA_LOBBY); - } - - @Override - public ItemStack getItem() { - final List<String> ARENA_LOBBY_LORE = Arrays.asList("", "&7Click to be teleported", "&7to the arena lobby"); - final String TELEPORTED_TO_LOBBY = "&b&lTeleport to Lobby"; - return ItemCreator - .of(CompMaterial.ENDER_PEARL) - .name(TELEPORTED_TO_LOBBY) - .lores(ARENA_LOBBY_LORE) - .build().makeMenuTool(); - } - }; - - setupButton = Button.makeDummy( - ItemCreator - .of(arena.getSetup().isReady() ? CompMaterial.TORCH : CompMaterial.REDSTONE_TORCH) - .name("&7&lSetup Information") - .lores(generateStatusLore())); - - toggleButton = new Button() { - - @Override - public void onClickedInMenu(final Player pl, final Menu menu, final ClickType click) { - final boolean isEnabled = arena.isEnabled(); - - arena.setEnabled(!isEnabled); - final String DISABLED = "&4Arena is now disabled."; - final String ENABLED = "&2Arena is now enabled."; - restartMenu(isEnabled ? DISABLED : ENABLED); - } - - @Override - public ItemStack getItem() { - final boolean has = arena.isEnabled(); - - return ItemCreator.of( - has ? CompMaterial.BEACON : CompMaterial.GLASS, - has ? "&aArena is enabled" : "&cArena is disabled", - "", - "Click to toggle.", - "", - "Enabled arenas may be played,", - "whereas disabled arenas may", - "only be edited and built.", - "a slot empty.") - .build() - .make(); - } - }; - - removeButton = new ButtonRemove(this, "arena", arena.getName(), object -> { - CoreArenaPlugin.getArenaManager().removeArena(object); - - new MenuArena().displayTo(getViewer()); - }); - } - - private List<String> generateStatusLore() { - final SimpleSetup s = (SimpleSetup) arena.getSetup(); - final boolean ready = s.isReady(); - - class $ { - private String status(final boolean set) { - return set ? "&aset" : "&4not set"; - } - - private String statusOpt(final boolean set) { - return set ? "&aset" : "&6not set"; - } - - private String points(final SimpleSetup s, final SpawnPointType type) { - if (type == SpawnPointType.PLAYER) - return status(s.getPlayerSpawnPoints()); - - else if (type == SpawnPointType.MONSTER) - return statusOpt(s.getMobSpawnPoints()); - - throw new FoException("Unhandled menu call for " + type); - } - - private String status(final int count) { - return (count > 0 ? "&a" : "&4") + count; - } - - private String statusOpt(final int count) { - return (count > 0 ? "&a" : "&6") + count; - } - } - - final $ $ = new $(); // Rly? - - final ArrayList<String> lore = Lists.newArrayList( - "", - " &fStatus: " + (ready ? " &aArena is ready to play. " : " &cArena needs configuration. ")); - - if (!ready) - lore.add(" &cUse /" + CoreArenaPlugin.getInstance().getMainCommand().getLabel() + " edit " + arena.getName() + " to enter arena setup."); - - lore.addAll(Arrays.asList( - " ", - " &4<> - must be set", - " &6<> - not set, optional", - " &a<> - set", - " ", - " &f> Points:", - " &8&oTIP: Use /" + CoreArenaPlugin.getInstance().getMainCommand().getLabel() + " tools to set", - " &7&lL&7obby: " + $.status(s.isLobbySet()), - " &7&lR&7egion: " + $.status(s.isRegionSet()))); - - lore.add(" &7&lP&7layer spawnpoints: " + $.points(s, SpawnPointType.PLAYER)); - lore.add(" &7&lM&7ob spawnpoints: " + $.points(s, SpawnPointType.MONSTER)); - - lore.addAll(Arrays.asList( - " ", - " &f> Snapshot:", - " &7&lI&7initial snapshot: " + $.statusOpt(arena.getSnapshot().isSaved(DamagedStage.INITIAL)), - " &7&lD&7amaged snapshot: " + $.statusOpt(arena.getSnapshot().isSaved(DamagedStage.DAMAGED)))); - - return lore; - } - - @Override - public ItemStack getItemAt(final int slot) { - if (slot == 9 + 1) - return snapshotButton.getItem(); - - if (slot == 9 + 3) - return iconButton.getItem(); - - if (slot == 9 + 5) - return lobbyButton.getItem(); - - if (slot == 9 + 7) - return setupButton.getItem(); - - if (slot == 9 * 3 + 3) - return toggleButton.getItem(); - - if (slot == 9 * 3 + 5) - return removeButton.getItem(); - - return null; - } - - @Override - public String[] getInfo() { - return createDescription(arena); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/IndividualClassMenu.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/IndividualClassMenu.java deleted file mode 100644 index 740d491a7ae9000e671663ce7c7dc7cb78ad6242..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/IndividualClassMenu.java +++ /dev/null @@ -1,332 +0,0 @@ -package org.mineacademy.game.menu; - -import java.util.Arrays; - -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MathUtil; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.button.ButtonMenu; -import org.mineacademy.fo.menu.button.ButtonRemove; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.menu.model.MenuClickLocation; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.CompSound; -import org.mineacademy.game.conversation.TierCostConvo; -import org.mineacademy.game.impl.SimpleArmorContent; -import org.mineacademy.game.impl.SimpleTier; -import org.mineacademy.game.model.ArenaClass; -import org.mineacademy.game.model.ClassTier; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.util.Constants; - -public final class IndividualClassMenu extends Menu { - - private final ArenaClass clazz; - - private final Button editButton; - private final Button iconButton; - private final Button removeButton; - - public IndividualClassMenu(String clazz, boolean addReturnButton) { - this(CoreArenaPlugin.getClassManager().findClass(clazz), addReturnButton); - } - - public IndividualClassMenu(ArenaClass clazz, boolean addReturnButton) { - super(addReturnButton ? new MenuClasses() : null); - - setTitle("&0Class " + clazz.getName() + " Menu"); - - this.clazz = clazz; - - editButton = new ButtonMenu(new ClassPreviewMenu(1), - ItemCreator - .of(CompMaterial.WRITABLE_BOOK, - "&a&lEdit class", - "", - "Edit what items the player", - "shall receive when they", - "equip the class.")); - - iconButton = IconMenu.asButton(clazz, this); - - removeButton = new ButtonRemove(this, "class", clazz.getName(), object -> { - CoreArenaPlugin.getClassManager().removeClass(object); - - new MenuClasses().displayTo(getViewer()); - }); - } - - @Override - public ItemStack getItemAt(int slot) { - if (slot == 9 + 1) - return editButton.getItem(); - - if (slot == 9 + 3) - return iconButton.getItem(); - - if (slot == 9 + 5) - return removeButton.getItem(); - - return null; - } - - @Override - protected int getReturnButtonPosition() { - return 9 + 7; - } - - @Override - protected String[] getInfo() { - return null; - } - - private final class ClassPreviewMenu extends Menu { - - /** 45 */ - private final static int ARMOR_SLOT_BEGINNING_INDEX = 45; - /** 100 */ - private final static int TIER_LIMIT = 100; - - private final int tier; - - private final Button priceButton; - private final Button tierDownButton; - private final Button tierUpButton; - - private ClassPreviewMenu(int tier) { - super(IndividualClassMenu.this); - - setSize(9 * 6); - setTitle("&0Editing " + clazz.getName() + " Tier " + tier); - - this.tier = tier; - - final ClassTier existingTier = getTierIfExist(); - - priceButton = tier != 1 && existingTier != null ? new Button() { - - @Override - public void onClickedInMenu(Player pl, Menu menu, ClickType click) { - new TierCostConvo(ClassPreviewMenu.this, clazz, existingTier).start(pl); - } - - @Override - public ItemStack getItem() { - final ClassTier tier = getTierIfExist(); - - return ItemCreator - .of(CompMaterial.GOLD_NUGGET) - .name("&ePrice: " + Localization.Currency.format(tier != null ? tier.getLevelCost() : getDefaultCost())) - .lores(Arrays.asList( - "", - "&7Click to set the price.")) - .build().makeMenuTool(); - } - } - : Button.makeDummy(tier == 1 ? ItemCreator.of( - CompMaterial.FEATHER, - "&eThis is the initial tier", - "", - "The first tier is available", - "to everyone from the start.", - "", - "Players can upgrade to a higher", - "tier as they receive Nuggets.") - : ItemCreator.of( - CompMaterial.GOLD_NUGGET, - "&7&oTier not yet created", - " ", - "Place some items here and return.", - "The tier will be automatically saved.")); - - tierDownButton = new Button() { - - @Override - public void onClickedInMenu(Player pl, Menu menu, ClickType click) { - if (tier > 1) - new ClassPreviewMenu(tier - 1).displayTo(pl); - } - - @Override - public ItemStack getItem() { - return ItemCreator.of( - tier == 1 ? CompMaterial.GRAY_DYE : CompMaterial.PINK_DYE, - "&f" + (tier == 1 ? "This tier is the starting one" : "Edit lower tier")).build().makeMenuTool(); - } - }; - - tierUpButton = new Button() { - - @Override - public void onClickedInMenu(Player pl, Menu menu, ClickType click) { - if (tier <= TIER_LIMIT && getTierIfExist() != null) - new ClassPreviewMenu(tier + 1).displayTo(pl); - } - - @Override - public ItemStack getItem() { - return (getTierIfExist() == null - ? ItemCreator.of(CompMaterial.GRAY_DYE, "&7Create this tier first!") - : ItemCreator.of(tier <= TIER_LIMIT ? CompMaterial.LIME_DYE : CompMaterial.GRAY_DYE).name("&f" + (tier <= TIER_LIMIT ? "Edit higher tier" : "This is the maximum tier"))).build().makeMenuTool(); - } - }; - } - - @Override - public void onMenuClose(Player pl, Inventory inv) { - // Valid.checkBoolean(inv.getSize() == getSize(), "Report / Illegal size " + inv.getSize() + " != " + getSize()); - - final int normalInvSize = PlayerUtil.USABLE_PLAYER_INV_SIZE; - - final ItemStack[] content = Arrays.copyOfRange(inv.getContents(), 0, normalInvSize); - final ItemStack[] armorContent = Arrays.copyOfRange(inv.getContents(), ARMOR_SLOT_BEGINNING_INDEX, ARMOR_SLOT_BEGINNING_INDEX + 4); - - final ClassTier existing = getTierIfExist(); - - // Completely empty - if (Valid.isNullOrEmpty(content) && Valid.isNullOrEmpty(armorContent)) { - - // Not yet saved - if (existing == null) - return; - - // Remove empty tier - clazz.removeTier(existing); - return; - } - - final SimpleArmorContent armor = SimpleArmorContent.fromItemStacks(armorContent); - - final SimpleTier tierClass = new SimpleTier(clazz.getName(), tier, existing != null ? existing.getLevelCost() : getDefaultCost(), content, armor); - clazz.addOrUpdateTier(tierClass); - - CompSound.CHEST_CLOSE.play(pl, 1, 1); - Common.tell(pl, "&2Your changes have been saved."); - } - - @Override - public ItemStack getItemAt(int slot) { - - { // Tier Content - final ClassTier tier = getTierIfExist(); - - if (tier != null) { - if (slot < 36 && tier.getContent() != null) - return tier.getContent()[slot]; - - if (slot >= ARMOR_SLOT_BEGINNING_INDEX && slot <= ARMOR_SLOT_BEGINNING_INDEX + 3 && tier.getArmor() != null) - return tier.getArmor().getByOrder(slot % ARMOR_SLOT_BEGINNING_INDEX); - } - } - - { // Armor Info - if (slot == 9 * 4) - return makeArmorSlot(1, "helmet"); - - if (slot == 9 * 4 + 1) - return makeArmorSlot(2, "chestplate"); - - if (slot == 9 * 4 + 2) - return makeArmorSlot(3, "leggings"); - - if (slot == 9 * 4 + 3) - return makeArmorSlot(4, "boots"); - } - - { // Functional and helper buttons - if (slot == 9 * 5 + 4) - return priceButton.getItem(); - - if (slot == 9 * 5 + 6) - return tierDownButton.getItem(); - - if (slot == 9 * 5 + 7) - return tierUpButton.getItem(); - - if (slot >= 9 * 4 && slot < 9 * 5 || slot >= 49) - return ItemCreator.of(CompMaterial.GRAY_STAINED_GLASS_PANE).name(" ").build().make(); - } - - return null; - } - - private ItemStack makeArmorSlot(int amount, String name) { - return ItemCreator.of(CompMaterial.GRAY_STAINED_GLASS_PANE).amount(amount).name("&7Place &f" + name + " &7below:").build().makeMenuTool(); - } - - @Override - protected int getInfoButtonPosition() { - return 9 * 5 + 5; - } - - @Override - public boolean isActionAllowed(MenuClickLocation clickLocation, int slot, ItemStack clickedSlot, ItemStack cursor) { - final boolean armorSlot = slot >= ARMOR_SLOT_BEGINNING_INDEX && slot <= ARMOR_SLOT_BEGINNING_INDEX + 3; - final String type = slot == ARMOR_SLOT_BEGINNING_INDEX ? "helmet" : slot == ARMOR_SLOT_BEGINNING_INDEX + 1 ? "chestplate" : slot == ARMOR_SLOT_BEGINNING_INDEX + 2 ? "leggings" : slot == ARMOR_SLOT_BEGINNING_INDEX + 3 ? "boots" : "error"; - - return armorSlot ? checkValidArmor(clickedSlot, cursor, type) : clickLocation != MenuClickLocation.OUTSIDE && slot < 9 * 4; - } - - private ClassTier getTierIfExist() { - return clazz.getTier(tier); - } - - private int getDefaultCost() { - return (int) MathUtil.calculate(Constants.Costs.TIER_STARTING_COST.replace("{currentTier}", tier + "")); - } - - private boolean checkValidArmor(ItemStack clickedSlot, ItemStack cursor, String type) { - type = type.toUpperCase(); - - class $ { - private boolean isValid(ItemStack item, String checkAgainst) { - final Material type = item.getType(); - - if (checkAgainst.equals("HELMET")) - return type.toString().contains(checkAgainst) || CompMaterial.isSkull(type); - - return type.toString().contains(checkAgainst); - } - } - - final $ $ = new $(); - - if (cursor.getType() != Material.AIR) - if (!$.isValid(cursor, type)) { - animateTitle("&4Only insert " + type.toLowerCase() + (type.toLowerCase().endsWith("s") ? "" : "s") + " here!"); - - if (clickedSlot != null) - clickedSlot.setAmount(0); - - return false; - } - - return true; - } - - @Override - public Menu newInstance() { - return new ClassPreviewMenu(tier); - } - - @Override - protected String[] getInfo() { - return new String[] { - "Edit the items in this class", - "as you'd like.", - " ", - "When finished, simply close", - "this inventory or return back." - }; - } - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/IndividualUpgradeMenu.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/IndividualUpgradeMenu.java deleted file mode 100644 index 5f55c25a205949c1adc7d318b3c98dca2272be86..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/IndividualUpgradeMenu.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.mineacademy.game.menu; - -import java.util.Arrays; - -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.button.ButtonMenu; -import org.mineacademy.fo.menu.button.ButtonRemove; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.game.model.Upgrade; - -public final class IndividualUpgradeMenu extends Menu { - - private final Button setItemsButton; - - private final Button removeButton; - - public IndividualUpgradeMenu(String upgrade, boolean returnButton) { - this(CoreArenaPlugin.getUpgradesManager().findUpgrade(upgrade), returnButton); - } - - public IndividualUpgradeMenu(Upgrade upgrade, boolean addReturnButton) { - super(addReturnButton ? new MenuUpgrades() : null); - - setTitle("&0Upgrade " + upgrade.getName() + " Menu"); - - Valid.checkNotNull(upgrade, "Report / Upgrade == null"); - - setItemsButton = new ButtonMenu(new UpgradeItemContainerMenu(this, upgrade.getName()), - ItemCreator - .of(CompMaterial.ANVIL) - .name("&fItems to Give") - - .lores( - Arrays.asList( - "&r", - "&7Specify which items this upgrade gives.", - "", - "&7Once player buys the upgrade,", - "&7he'll receive all the items"))); - - removeButton = new ButtonRemove(this, "upgrade", upgrade.getName(), object -> { - CoreArenaPlugin.getUpgradesManager().removeUpgrade(object); - - new MenuUpgrades().displayTo(getViewer()); - }); - } - - @Override - public ItemStack getItemAt(int slot) { - if (slot == 9 + 1) - return setItemsButton.getItem(); - - if (slot == 9 + 4) - return removeButton.getItem(); - - return null; - } - - @Override - protected int getReturnButtonPosition() { - return 9 + 7; - } - - @Override - protected String[] getInfo() { - return null; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuArena.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuArena.java deleted file mode 100644 index 73dd1e5c54f27bfc1bcec6c0a7e90c6a9394d370..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuArena.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.mineacademy.game.menu; - -import java.util.Arrays; - -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.button.ButtonMenu; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.game.conversation.AddNewConvo.Created; -import org.mineacademy.game.model.Arena; - -public final class MenuArena extends AbstractListMenu { - - protected MenuArena() { - super("Arena", CoreArenaPlugin.getArenaManager().getAvailable()); - } - - @Override - protected Button getListButton(String listName, int listIndex) { - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(listName); - - return new ButtonMenu(new IndividualArenaMenu(arena), - - ItemCreator.of(arena.getData().getIcon()) - .name("&f" + listName) - .lores(Arrays.asList("", "&7Click to open arena menu."))); - } - - @Override - protected Created getCreatedObject() { - return Created.ARENA; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuClasses.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuClasses.java deleted file mode 100644 index 361afa3a49d4d0ecef1fad1447684dea2b6e406c..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuClasses.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.mineacademy.game.menu; - -import java.util.Arrays; - -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.game.conversation.AddNewConvo.Created; -import org.mineacademy.game.model.ArenaClass; - -public class MenuClasses extends AbstractListMenu { - - @Deprecated - private ClassMenuClickListener menuMaker; - - protected MenuClasses() { - this(null); - } - - protected MenuClasses(Menu parent) { - super(parent != null ? parent : new CoreMenu(), "Class", CoreArenaPlugin.getClassManager().getAvailable()); - - if (getCustomTitle() != null) - setTitle(getCustomTitle()); - } - - protected String getCustomTitle() { - return null; - } - - protected final void setMenuMaker(ClassMenuClickListener menuMaker) { - Valid.checkBoolean(this.menuMaker == null, "Already set!"); - - this.menuMaker = menuMaker; - } - - @Override - protected Button getListButton(String listName, int listIndex) { - return new ClassButton(listName); - } - - @Override - protected final Created getCreatedObject() { - return Created.CLASS; - } - - private final class ClassButton extends Button { - - private final ArenaClass clazz; - - private ClassButton(String className) { - this(CoreArenaPlugin.getClassManager().findClass(className)); - } - - public ClassButton(ArenaClass clazz) { - this.clazz = clazz; - } - - @Override - public void onClickedInMenu(Player pl, Menu menu, ClickType click) { - final Menu newMenu = menuMaker != null ? menuMaker.getMenuForClass(clazz) : new IndividualClassMenu(clazz, true); - - newMenu.displayTo(pl); - } - - @Override - public ItemStack getItem() { - return ItemCreator.of(clazz.getIcon()).name("&f" + clazz.getName()).lores(Arrays.asList("", "&7Click to open class menu.")).hideTags(true).build().make(); - } - } - - public interface ClassMenuClickListener { - Menu getMenuForClass(ArenaClass clazz); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuGameTools.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuGameTools.java deleted file mode 100644 index b208dd96a9d0e57b883c90f3fda39c780386c57b..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuGameTools.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.mineacademy.game.menu; - -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.menu.MenuTools; -import org.mineacademy.game.tool.CloneSpawnerToolOff; -import org.mineacademy.game.tool.LobbySelector; -import org.mineacademy.game.tool.RegionSelector; -import org.mineacademy.game.tool.SpawnSelectorMonster; -import org.mineacademy.game.tool.SpawnSelectorPlayer; - -import lombok.Getter; - -public class MenuGameTools extends MenuTools { - - @Getter - private static final MenuGameTools instance = new MenuGameTools(); - - private MenuGameTools() { - } - - @Override - protected final Object[] compileTools() { - return new Object[] { - LobbySelector.getTool(), - RegionSelector.getTool(), - SpawnSelectorPlayer.getTool(), - SpawnSelectorMonster.getTool(), - CloneSpawnerToolOff.getInstance() - }; - } - - @Override - protected final String[] getInfo() { - return new String[] { - "Use the following tools when", - "editing an arena.", - "Run &e/" + CoreArenaPlugin.getInstance().getMainCommand().getLabel() + " edit <arena> &7first." - }; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuInArenaClasses.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuInArenaClasses.java deleted file mode 100644 index 5b8260fc3da53647391c9f9b079778fd72940bc2..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuInArenaClasses.java +++ /dev/null @@ -1,117 +0,0 @@ -package org.mineacademy.game.menu; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.menu.MenuPagged; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.CompSound; -import org.mineacademy.game.impl.ArenaPlayer; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaClass; -import org.mineacademy.game.model.ArenaMenu; -import org.mineacademy.game.model.ClassTier; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.type.MenuType; -import org.mineacademy.game.type.TierMode; - -public final class MenuInArenaClasses extends MenuPagged<ArenaClass> implements ArenaMenu { - - private final Arena arena; - private final ArenaPlayer data; - private final Player player; - - public MenuInArenaClasses(Arena arena, Player player) { - super(9 * 1, arena.getSettings().allowOwnEquipment() ? new StrictList<>() : CoreArenaPlugin.getClassManager().getClasses()); - - this.arena = arena; - this.data = CoreArenaPlugin.getDataFor(player); - this.player = player; - - setTitle("Select Your Class"); - } - - @Override - protected ItemStack convertToItemStack(ArenaClass item) { - if (!item.mayObtain(player)) - return null; - - return item.isValid() ? buildItem(item) : ItemCreator.of(CompMaterial.WHITE_STAINED_GLASS_PANE, "&f" + item.getName(), "", "&c&oClass not yet configured!").build().make(); - } - - private ItemStack buildItem(ArenaClass clazz) { - final ClassTier tier = clazz.getMinimumTier(data.getTierOf(clazz)); - final List<String> lore = new ArrayList<>(); - - if (tier != null) { - lore.add("&8Tier " + tier.getTier()); - lore.add(""); - - if (isEligibleForTier(clazz)) - lore.add("&7Click to equip this class."); - - else - lore.addAll(Arrays.asList( - "&cThe arena requires", - "&cat least Tier " + arena.getSettings().getMinimumTier())); - } else - lore.add("&7This class is not yet configured."); - - return ItemCreator - .of(clazz.getIcon()) - .name("&f" + clazz.getName()) - .lores(lore) - .hideTags(true) - .build().make(); - } - - @Override - protected void onPageClick(Player player, ArenaClass clazz, ClickType click) { - final ClassTier tier = clazz.getMinimumTier(data.getTierOf(clazz)); - - if (tier == null) - return; - - if (!isEligibleForTier(clazz)) { - animateTitle("&4Arena requires higher tier!"); - - return; - } - - player.closeInventory(); - clazz.giveToPlayer(player, TierMode.PREVIEW); - - CompSound.ENDERDRAGON_WINGS.play(player, 1F, 1F); - Common.tell(player, Localization.Class.SELECTED.replace("{class}", clazz.getName())); - } - - private boolean isEligibleForTier(ArenaClass clazz) { - Valid.checkNotNull(arena, "Arena == null"); - - return data.getTierOf(clazz) >= arena.getSettings().getMinimumTier(); - } - - @Override - protected boolean addReturnButton() { - return false; - } - - @Override - protected String[] getInfo() { - return null; - } - - @Override - public MenuType getMenuType() { - return MenuType.CLASSES; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuItems.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuItems.java deleted file mode 100644 index db379e9777057fde353a825c65419ede422955e5..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuItems.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.mineacademy.game.menu; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.event.inventory.InventoryAction; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.tool.Tool; -import org.mineacademy.game.item.ExplosiveArrow; -import org.mineacademy.game.item.ExplosiveBow; -import org.mineacademy.game.item.Gold; - -import lombok.Getter; - -public final class MenuItems extends Menu { - - @Getter - private static final MenuItems instance = new MenuItems(); - - private final List<ItemStack> tools; - - private MenuItems() { - super(null); - - setSize(9 * 1); - setTitle("Items Menu"); - - this.tools = compile(new Object[] { - ExplosiveBow.getItem(), - ExplosiveArrow.getItem(), - //BigRocket.getInstance().getItem(), - Gold.getInstance() - }); - } - - @Override - public ItemStack getItemAt(int slot) { - return slot < tools.size() ? tools.get(slot) : null; - } - - @Override - public void onMenuClick(Player pl, int slot, InventoryAction action, ClickType click, ItemStack cursor, ItemStack item, boolean cancelled) { - final ItemStack is = getItemAt(slot); - - if (is != null) - pl.getInventory().addItem(is); - } - - private List<ItemStack> compile(Object[] tools) { - final List<ItemStack> list = new ArrayList<>(); - - for (final Object tool : tools) { - ItemStack it; - - if (tool != null) { - if (tool instanceof ItemStack) - it = (ItemStack) tool; - - else if (tool instanceof Tool) - it = ((Tool) tool).getItem(); - - else if (tool instanceof Number) - it = new ItemStack(Material.AIR); - - else - throw new FoException("unknown: " + tool); - } else - it = new ItemStack(Material.AIR); - - list.add(it); - - } - - return list; - } - - @Override - protected int getInfoButtonPosition() { - return 9 - 1; - } - - @Override - protected String[] getInfo() { - return new String[] { - "Use the following items", - "in &fclasses &7or &fupgrades &7to", - "enhance the in-game experience." - }; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuMonsterSpawn.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuMonsterSpawn.java deleted file mode 100644 index 71b7559aa014b601cb1c90aaa75e8e116349ae15..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuMonsterSpawn.java +++ /dev/null @@ -1,278 +0,0 @@ -package org.mineacademy.game.menu; - -import java.util.Arrays; -import java.util.List; - -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.button.ButtonMenu; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.menu.model.MenuClickLocation; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.CompSound; -import org.mineacademy.game.conversation.SpawnerChanceConvo; -import org.mineacademy.game.conversation.SpawnerMinPlayerConvo; -import org.mineacademy.game.conversation.SpawnerPhaseConvo; -import org.mineacademy.game.impl.SimpleSpawnPointMonster; -import org.mineacademy.game.impl.SpawnedEntity; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.util.Constants; - -import lombok.Getter; - -public class MenuMonsterSpawn extends Menu { - - @Getter - private final Arena arena; - - @Getter - private final SimpleSpawnPointMonster spawnPoint; - - private final Button entityEdit; - private final Button activePeriodEdit; - private final Button minPlayersEdit; - private final Button chanceEdit; - - public MenuMonsterSpawn(SimpleSpawnPointMonster spawnpoint, Arena arena) { - super(null); - - setTitle("Monster Spawnpoint"); - - this.arena = arena; - spawnPoint = spawnpoint; - - chanceEdit = new Button() { - - @Override - public ItemStack getItem() { - return ItemCreator - .of(CompMaterial.GOLD_NUGGET) - .name("&e&lEdit Chance") - .lores(Arrays.asList( - "&r", - "&7Currently set: &f" + spawnPoint.getChance() + "%", - "", - "&7Set the chance to spawn monsters", - "&7when the spawner launches.")) - - .build().makeMenuTool(); - } - - @Override - public final void onClickedInMenu(Player pl, Menu menu, ClickType click) { - new SpawnerChanceConvo(MenuMonsterSpawn.this).start(pl); - } - }; - - minPlayersEdit = new Button() { - - @Override - public ItemStack getItem() { - return ItemCreator - .of(CompMaterial.PLAYER_HEAD) - .name("&f&lEdit Minimum Players") - .lores(Arrays.asList( - "&r", - "&7Currently set: &f" + Localization.Cases.PLAYER.formatWithCount(spawnPoint.getMinimumPlayers()), - "", - "&7Set the minimum players in arena", - "&7for this spawner to function.")) - - .build().makeMenuTool(); - } - - @Override - public final void onClickedInMenu(Player pl, Menu menu, ClickType click) { - new SpawnerMinPlayerConvo(MenuMonsterSpawn.this).start(pl); - } - }; - - activePeriodEdit = new Button() { - - @Override - public ItemStack getItem() { - return ItemCreator - .of(CompMaterial.CLOCK) - .name("&e&lEdit Active Period") - .lores(Arrays.asList( - "&r", - "&7Current: &f" + spawnPoint.getActivePeriod().formatPeriod() + ". phase", - "", - "&7Set the period in which", - "&7this spawner will function.")) - - .build().makeMenuTool(); - } - - @Override - public final void onClickedInMenu(Player pl, Menu menu, ClickType click) { - new SpawnerPhaseConvo(MenuMonsterSpawn.this).start(pl); - } - }; - - entityEdit = new ButtonMenu(new MobSelectorContainerMenu(), - ItemCreator - .of(CompMaterial.SPAWNER) - .name("&9&lEdit Monsters") - .lores(Arrays.asList( - "&r", - "&7Select which monsters are", - "&7summoned at this point."))); - } - - public final void saveSpawnerChanges() { - arena.getData().updateSpawnPoint(spawnPoint); - } - - @Override - public final ItemStack getItemAt(int slot) { - - if (slot == 9 + 1) - return entityEdit.getItem(); - - if (slot == 9 + 3) - return minPlayersEdit.getItem(); - - if (slot == 9 + 5) - return activePeriodEdit.getItem(); - - if (slot == 9 + 7) - return chanceEdit.getItem(); - - return null; - } - - @Override - protected final int getInfoButtonPosition() { - return 9 * 3 - 5; - } - - @Override - protected final String[] getInfo() { - return new String[] { - "This is a monster spawn point.", - "Configure its behaviour here." - }; - } - - public final class MobSelectorContainerMenu extends Menu { - - private final Button allSpawnButton; - - public MobSelectorContainerMenu() { - super(MenuMonsterSpawn.this); - - setSize(9 * 4); - setTitle("Monsters List"); - - this.allSpawnButton = new Button() { - - @Override - public void onClickedInMenu(Player pl, Menu menu, ClickType click) { - final boolean has = spawnPoint.isSpawnAllSlots(); - - spawnPoint.setSpawnAllSlots(!has); - restartMenu(has ? "&4Spawner spawns 1 slot only." : "&2Spawner spawns all slots."); - } - - @Override - public ItemStack getItem() { - final boolean has = spawnPoint.isSpawnAllSlots(); - - return ItemCreator.of( - has ? CompMaterial.REDSTONE_TORCH : CompMaterial.LEVER, - has ? "&aAll monsters are spawned" : "&fSpawner selects 1 slot to spawn", - "", - "Click to toggle.", - "", - "You can toggle whether monsters on", - "all slots in the inventory above should", - "be spawned, or if the spawner should only", - "randomly pick up one slot to spawn.") - .build().make(); - } - }; - } - - @Override - public void onMenuClose(Player pl, Inventory inv) { - //Valid.checkBoolean(inv.getType() == InventoryType.CHEST, "Inventory out of sync when closing spawner container. Expected chest, got " + inv.getType()); - final List<SpawnedEntity> spawned = Common.convert(Arrays.copyOfRange(inv.getContents(), 0, getSize() - 9), object -> object != null && CompMaterial.isMonsterEgg(object.getType()) ? SpawnedEntity.fromEgg(object) : null); - - spawnPoint.setSpawnedTypes(spawned.toArray(new SpawnedEntity[spawned.size()])); - saveSpawnerChanges(); - - CompSound.CHEST_CLOSE.play(pl, 1, 1); - Common.tell(pl, "&2Your changes have been saved."); - } - - @Override - public ItemStack getItemAt(int slot) { - - if (slot == getSize() - 5) - return allSpawnButton.getItem(); - - if (slot < 9 * 3) - if (spawnPoint.getSpawnedTypes() != null && spawnPoint.getSpawnedTypes().length > slot) { - final SpawnedEntity spawned = spawnPoint.getSpawnedTypes()[slot]; - - return spawned != null ? spawned.toEgg() : null; - } - - if (slot > 9 * 3) - return Constants.Items.MENU_FILLER; - - return null; - } - - @Override - public boolean isActionAllowed(MenuClickLocation clickLocation, int slot, ItemStack clicked, ItemStack cursor) { - if (clickLocation == MenuClickLocation.MENU) { - if (slot > 9 * 3 - 1) - return false; - - if (clicked == null && cursor != null) - clicked = cursor; - - if (clicked != null && clicked.getType() != Material.AIR && !CompMaterial.isMonsterEgg(clicked.getType())) { - animateTitle("&4Only insert monster eggs here!"); - clicked.setAmount(0); - return false; - } - - if (cursor != null && !CompMaterial.isMonsterEgg(clicked.getType()) && !CompMaterial.isMonsterEgg(cursor.getType()) && clicked.getType() != Material.AIR) { - animateTitle("&4Only insert monster eggs here!"); - return false; - } - } - - return true; - } - - @Override - protected String[] getInfo() { - return new String[] { - "&2Place spawn eggs &7from", - "your inventory here", - "", - "&fOne &7egg will be picked", - "randomly at the time.", - "", - "The &famount &7of egg indicates how", - "many mobs to spawn at once." - }; - } - } - - @Override - public Menu newInstance() { - return new MenuMonsterSpawn(spawnPoint, arena); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuRewards.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuRewards.java deleted file mode 100644 index a1b51b1d808edd302f63fbff7aaf52026f72adc6..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuRewards.java +++ /dev/null @@ -1,651 +0,0 @@ -package org.mineacademy.game.menu; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.bukkit.Color; -import org.bukkit.DyeColor; -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.event.inventory.InventoryAction; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.LeatherArmorMeta; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.ItemUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.button.ButtonMenu; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.menu.model.MenuClickLocation; -import org.mineacademy.fo.model.Replacer; -import org.mineacademy.fo.model.SimpleEnchant; -import org.mineacademy.fo.remain.CompItemFlag; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.CompSound; -import org.mineacademy.game.conversation.RewardCostConvo; -import org.mineacademy.game.impl.ArenaPlayer; -import org.mineacademy.game.impl.SimpleReward; -import org.mineacademy.game.manager.RewardsManager; -import org.mineacademy.game.model.ArenaClass; -import org.mineacademy.game.model.ClassTier; -import org.mineacademy.game.model.Reward; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.settings.Settings; -import org.mineacademy.game.type.RewardType; -import org.mineacademy.game.util.Constants; - -public class MenuRewards extends Menu { - - private final MenuMode mode; - - public enum MenuMode { - PURCHASE, - EDIT_ITEMS, - EDIT_PRICES - } - - private final ArenaPlayer data; - - private int nuggets; - - private final Button itemsButton; - private final Button blocksButton; - private final Button packsButton; - /* hidden on edit */ - private final Button tiersButton; - - public static void showRewardsMenu(Player player, MenuMode mode) { - if (Settings.Rewards.ENABLE_MATERIAL_REWARDS) - new MenuRewards(player, mode).displayTo(player); - else if (mode == MenuMode.PURCHASE) - new MenuRewards(player, mode).showTierMenu(player); - else - Common.tell(player, Localization.Menu.USE_CLASS_MENU); - } - - private MenuRewards(Player player, MenuMode mode) { - super(mode == MenuMode.PURCHASE ? null : new CoreMenu()); - - setSize(9 * 5); - setTitle(Localization.Menu.Rewards.LABEL); - setViewer(player); - - this.mode = mode; - data = CoreArenaPlugin.getDataFor(getViewer()); - - nuggets = data.getNuggets(); - - itemsButton = new ButtonMenu(new ItemRewardMenu(mode, RewardType.ITEM), ItemCreator - .of(Settings.Rewards.ITEMS) - .name("&a&l" + getBuyOrEdit(Localization.Menu.Rewards.ITEMS)) - .lores(Localization.Menu.Rewards.ITEMS_DESCRIPTION)); - - blocksButton = new ButtonMenu(new ItemRewardMenu(mode, RewardType.BLOCK), ItemCreator - .of(Settings.Rewards.BLOCKS) - .name("&6&l" + getBuyOrEdit(Localization.Menu.Rewards.BLOCKS)) - .lores(Localization.Menu.Rewards.BLOCKS_DESCRIPTION)); - - packsButton = new ButtonMenu(new ItemRewardMenu(mode, RewardType.PACK), ItemCreator - .of(Settings.Rewards.PACKS) - .name("&f&l" + getBuyOrEdit(Localization.Menu.Rewards.PACKS)) - .lores(Localization.Menu.Rewards.PACKS_DESCRIPTION)); - - tiersButton = mode == MenuMode.PURCHASE ? new Button() { - - @Override - public ItemStack getItem() { - return ItemCreator - .of(CompMaterial.DIAMOND_SWORD) - .enchant(new SimpleEnchant(Enchantment.DURABILITY)) - .name("&b&l" + Localization.Menu.Rewards.CLASS) - .lores(Localization.Menu.Rewards.CLASS_DESCRIPTION) - .flag(CompItemFlag.HIDE_ENCHANTS) - .build().makeMenuTool(); - } - - @Override - public final void onClickedInMenu(Player pl, Menu menu, ClickType click) { - showTierMenu(pl); - } - } : Button.makeEmpty(); - } - - private void showTierMenu(Player pl) { - final MenuClasses classMenu = new MenuClasses(MenuRewards.this) { - @Override - protected String getCustomTitle() { - return Localization.Menu.Rewards.SELECT_CLASS; - } - - @Override - protected Button getAddButton() { - return null; - } - - @Override - protected Button getListButton(String listName, int listIndex) { - return CoreArenaPlugin.getClassManager().findClass(listName).isValid() - ? super.getListButton(listName, listIndex) - : Button.makeDummy(ItemCreator.of(CompMaterial.WHITE_STAINED_GLASS_PANE, "&e" + listName, "", Localization.Menu.Rewards.CLASS_NOT_CONFIGURED)); - } - }; - - classMenu.setMenuMaker(clazz -> new UpgradePreviewMenu(clazz, PreviewMode.ARMOR, classMenu)); - classMenu.displayTo(pl); - } - - @Override - protected final String[] getInfo() { - List<String> locale = mode == MenuMode.PURCHASE ? Localization.Menu.Rewards.INFO_PLAYER : Localization.Menu.Rewards.INFO_ADMIN; - locale = Replacer.replaceArray(locale, "nuggets", Localization.Currency.format(data.getNuggets())); - - return locale.toArray(new String[0]); - } - - private String getBuyOrEdit(String label) { - return (mode == MenuMode.PURCHASE ? Localization.Parts.BUY : Localization.Parts.EDIT) + " " + label; - } - - @Override - public Menu newInstance() { - return new MenuRewards(getViewer(), mode); - } - - private enum PreviewMode { - ARMOR, - CONTENT; - - private PreviewMode shift() { - return this == ARMOR ? CONTENT : ARMOR; - } - } - - // - // This menu handles da updates de la items, blocks or packs - // - final class ItemRewardMenu extends Menu { - - private final MenuMode mode; - - private final RewardType rewardType; - - /* hidden on purchases */ - private final Button modesButton; - - private ItemRewardMenu(MenuMode mode, RewardType type) { - super(MenuRewards.this, true); - - setSize(9 * 4); - setTitle("&0" + (mode == MenuMode.PURCHASE - ? Localization.Menu.Rewards.CHOOSE_A_REWARD - : "Editing " + (mode == MenuMode.EDIT_PRICES ? "Prices of " : "") + type)); - - this.mode = mode; - rewardType = type; - - modesButton = mode == MenuMode.PURCHASE ? Button.makeEmpty() : new Button() { - - @Override - public void onClickedInMenu(Player pl, Menu menu, ClickType click) { - saveChangedItems(pl); - - new ItemRewardMenu(mode == MenuMode.EDIT_ITEMS ? MenuMode.EDIT_PRICES : MenuMode.EDIT_ITEMS, rewardType).displayTo(pl); - } - - final String EDITED = Localization.Edit.Menu.START_EDITING.replaceAll("mode", mode.toString().replace("EDIT_", "").toLowerCase()); - - @Override - public ItemStack getItem() { - return ItemCreator - .of(mode == MenuMode.EDIT_ITEMS ? CompMaterial.STICK : CompMaterial.GOLD_NUGGET) - .name(EDITED) - .enchant(new SimpleEnchant(Enchantment.ARROW_DAMAGE)) - .hideTags(true) - .lores(Arrays.asList( - "", - "&7" + (mode == MenuMode.EDIT_ITEMS ? Localization.Edit.Menu.EDITING_PIECES : Localization.Edit.Menu.EDITING_ITEMS))) - .build().makeMenuTool(); - } - }; - } - - @Override - public void onMenuClose(Player pl, Inventory inv) { - saveChangedItems(pl); - } - - private void saveChangedItems(Player pl) { - if (mode != MenuMode.EDIT_ITEMS) - return; - - final Inventory top = pl.getOpenInventory().getTopInventory(); - - if (top.getSize() != getSize()) { - // - Common.tell(pl, "&cYour changes could not be saved, your top inventory was changed to " + top.getType() + " (" + pl.getOpenInventory().getTitle() + ", " + top.getSize() + "), size " + getSize() + " expected."); - - return; - } - - Valid.checkBoolean(top.getSize() == getSize(), "Report / Illegal size " + top.getSize() + " != " + getSize()); - - final RewardsManager manager = CoreArenaPlugin.getRewadsManager(); - final List<Reward> rewards = new ArrayList<>(); - - for (int i = 0; i < top.getSize() - 9; i++) { - final ItemStack is = top.getItem(i); - - if (is == null || is.getType() == Material.AIR) { - rewards.add(null); - continue; - } - - // Reason for the hard way: preserve the cost - final Reward oldReward = Common.getOrDefault(getRewardAt(i), SimpleReward.fromItem(rewardType, is, Constants.Costs.REWARD_STARTING_COST)); - oldReward.setItem(is); - - rewards.add(oldReward); - } - - manager.setRewards(rewardType, rewards); - - CompSound.CHEST_CLOSE.play(pl, 1, 1); - Common.tell(pl, Localization.Edit.SAVED_CHANGES); - } - - @Override - public ItemStack getItemAt(int slot) { - final Reward reward = getRewardAt(slot); - - if (reward != null && reward.getItem() != null) { - final List<String> lore = new ArrayList<>(); - - //if (reward.getItem().hasItemMeta() && reward.getItem().getItemMeta().hasLore()) - // lore.addAll(reward.getItem().getItemMeta().getLore()); - - lore.add(""); - lore.add("&d" + Localization.Parts.COST + ": &f" + Localization.Currency.format(reward.getCost())); - - return mode == MenuMode.PURCHASE || mode == MenuMode.EDIT_PRICES ? ItemCreator - .of(reward.getItem().clone()) - .lores(lore) - .build().make() : reward.getItem(); - } - - if (slot == getSize() - 5) - return modesButton.getItem(); - - if (slot > 9 * 3 - 1) - return ItemCreator.of(CompMaterial.fromLegacy("STAINED_GLASS_PANE", 8)).name(" ").build().make(); - - return null; - } - - private Reward getRewardAt(int slot) { - final List<Reward> loaded = CoreArenaPlugin.getRewadsManager().getRewards(rewardType); - - return loaded.size() > slot ? loaded.get(slot) : null; - } - - @Override - public boolean isActionAllowed(MenuClickLocation clickLocation, int slot, ItemStack clickedSlot, ItemStack cursor) { - return mode == MenuMode.EDIT_ITEMS && (clickLocation != MenuClickLocation.MENU || slot < 9 * 3); - } - - @Override - public void onMenuClick(Player pl, int slot, InventoryAction action, ClickType click, ItemStack cursor, ItemStack item, boolean cancelled) { - if (slot > 9 * 3) - return; - - final Reward reward = getRewardAt(slot); - - if (reward == null) - return; - - if (mode == MenuMode.EDIT_PRICES) - new RewardCostConvo(ItemRewardMenu.this, reward).start(pl); - else if (mode == MenuMode.PURCHASE) { - { // Check if player has enough nuggets - if (nuggets < reward.getCost()) { - CompSound.NOTE_BASS.play(pl, 1F, (float) Math.random()); - final String replaced = Localization.Menu.Rewards.MORE_NUGGETS_NEEDED - .replaceAll("{reward_cost}", reward.getCost()); - animateTitle(replaced); - - return; - } - } - - { // Take nuggets and save - nuggets = nuggets - reward.getCost(); - - data.setNuggets(nuggets); - } - - { // Update the balance - restartMenu(); - } - - { // Give the purchased item - pl.getOpenInventory().getBottomInventory().addItem(reward.getItem()); - } - - { // Notify - CompSound.LEVEL_UP.play(pl, 1, 1); - - final String bought_Replaced = Localization.Menu.Rewards.BOUGHT - .replaceAll("{remaining}", Localization.Currency.format(nuggets)); - Common.tell(pl, "&6You have purchased " + Common.article(ItemUtil.bountifyCapitalized(reward.getItem().getType()))); - animateTitle(bought_Replaced); - } - } - } - - @Override - protected String[] getInfo() { - switch (mode) { - case EDIT_PRICES: - return Localization.Menu.Rewards.INFO_EDIT_PIECES; - case EDIT_ITEMS: - return Localization.Menu.Rewards.INFO_EDIT_ITEMS; - case PURCHASE: - return Localization.Menu.Rewards.INFO_PURCHASE - .find("balance") - .replace(nuggets) - .getReplacedMessage(); - } - - // Will never be reached - return null; - } - - @Override - public Menu newInstance() { - return new ItemRewardMenu(mode, rewardType); - } - } - - // - // This focking menu shows the player what to expect (nothing) - // - final class UpgradePreviewMenu extends Menu { - - private final ArenaClass clazz; - private final PreviewMode previewMode; - - private final Button switchModesButton; - private final Button buyButton; - private final Button nextTierButton; - - private final ClassTier tier; - - private UpgradePreviewMenu(ArenaClass clazz, PreviewMode previewMode, Menu parent) { - this(1, clazz, previewMode, parent); - } - - private UpgradePreviewMenu(int tierCount, ArenaClass clazz, PreviewMode previewMode, Menu parent) { - super(parent); - - setSize(9 * 6); - - this.clazz = clazz; - Valid.checkNotNull(clazz, "Jackie Wilson - Reet Petite"); - - tier = clazz.getTier(tierCount); - Valid.checkNotNull(tier, clazz.getName() + " Tier " + tierCount + " does not exists!"); - - setTitle("&0&l" + clazz.getName() + " Tier " + tier.getTier()); - - this.previewMode = previewMode; - - switchModesButton = new Button() { - - @Override - public void onClickedInMenu(Player pl, Menu menu, ClickType click) { - new UpgradePreviewMenu(tierCount, clazz, previewMode.shift(), parent).displayTo(pl); - } - - @Override - public ItemStack getItem() { - return ItemCreator.of(CompMaterial.ENDER_EYE).name("&f&l-> &fShow " + (previewMode == PreviewMode.ARMOR ? "inventory" : "armor")).build().makeMenuTool(); - } - }; - - buyButton = new Button() { - - @Override - public void onClickedInMenu(Player pl, Menu menu, ClickType click) { - if (hasTier()) { - animateTitle(Localization.Menu.Rewards.TIER_ALREADY_BOUGHT); - return; - } - - if (!Settings.Rewards.ALLOW_TIER_SKIP) - if (tier.getTier() - data.getTierOf(clazz) != 1) { - animateTitle(Localization.Menu.Rewards.TIER_TOO_HIGH); - return; - } - - final ClassTier tier = clazz.getTier(tierCount); - - { // Check if player has enough nuggets - if (nuggets < tier.getLevelCost()) { - CompSound.NOTE_BASS.play(pl, 1F, (float) Math.random()); - - final String replacedMessage = Localization.Menu.Rewards.MORE_NUGGETS_NEEDED - .find("{amount}") - .replace(tier.getLevelCost() + "") - .getReplacedMessageJoined(); - - animateTitle(replacedMessage); - return; - } - } - - { // Take nuggets and save - nuggets = nuggets - tier.getLevelCost(); - - data.setNuggets(nuggets); - } - - { // Give the purchased item - data.setHigherTier(clazz); - } - - { // Update buy inventory - restartMenu(); - } - - { // Notify - CompSound.LEVEL_UP.play(pl, 1, 1); - - final String purchasedMessage = Localization.Menu.Rewards.PURCHASED_TIER_MESSAGE.replaceAll("{name}", clazz.getName(), "{tier}", tier); - Common.tell(pl, purchasedMessage); - - final String purchasesTitle = Localization.Menu.Rewards.PURCHASED_TIER_TITLE.replaceAll("tier", tierCount); - animateTitle(purchasesTitle); - } - } - - // ---------------------------------------------------------------------------------------------------- - // Marker - Remove me - // ---------------------------------------------------------------------------------------------------- - - @Override - public ItemStack getItem() { - ItemStack itemStack = ItemCreator - .of(CompMaterial.DIAMOND) - .name("&d&l" + Localization.Parts.PURCHASE + " Tier") - .lores(Arrays.asList(" ", "&7" + Localization.Parts.PRICE + ": &6" + Localization.Currency.format(tier.getLevelCost()))) - - .build().makeMenuTool(); - - if (hasTier()) - itemStack = ItemCreator - .of(itemStack) - .name(Localization.Menu.Rewards.TIER_ALREADY_BOUGHT) - .hideTags(true) - .enchant(new SimpleEnchant(Enchantment.ARROW_INFINITE)) - .build() - .makeMenuTool(); - - return itemStack; - } - }; - - nextTierButton = new Button() { - - @Override - public void onClickedInMenu(Player pl, Menu menu, ClickType click) { - if (!isMaximumTier()) - new UpgradePreviewMenu(tierCount + 1, clazz, PreviewMode.ARMOR, parent).displayTo(pl); - } - - @Override - public ItemStack getItem() { - - return ItemCreator - .of(CompMaterial.fromLegacy("INK_SACK", isMaximumTier() ? hasTier() ? 10 : 9 : 13)) - .name(isMaximumTier() ? hasTier() ? Localization.Menu.Rewards.TIER_MAXIMUM : Localization.Menu.Rewards.TIER_TOP : Localization.Menu.Rewards.TIER_NEXT) - .build() - .makeMenuTool(); - } - }; - } - - private boolean hasTier() { - return data.getTierOf(clazz) >= tier.getTier(); - } - - private boolean isMaximumTier() { - return clazz.getTier(tier.getTier() + 1) == null; - } - - @Override - public ItemStack getItemAt(int slot) { - final boolean hasTier = data.getTierOf(clazz) >= tier.getTier(); - - if (previewMode == PreviewMode.ARMOR) { - final LeatherArmorMeta metaData = (LeatherArmorMeta) new ItemStack(Material.LEATHER_HELMET).getItemMeta(); - metaData.setColor(Color.GRAY); - - if (slot == 9 + 4) - return Common.getOrDefault(tier.getArmor().getHelmet(), ItemCreator - .of(CompMaterial.LEATHER_HELMET) - .name(Localization.Menu.Rewards.NOT_SET_HELMET) - .meta(metaData) - .build() - .makeMenuTool()); - - if (slot == 9 * 2 + 4) - return Common.getOrDefault(tier.getArmor().getChestplate(), ItemCreator - .of(CompMaterial.LEATHER_CHESTPLATE) - .name(Localization.Menu.Rewards.NOT_SET_CHESTPLATE) - .meta(metaData) - .build() - .makeMenuTool()); - - if (slot == 9 * 3 + 4) - return Common.getOrDefault(tier.getArmor().getLeggings(), ItemCreator - .of(CompMaterial.LEATHER_LEGGINGS) - .name(Localization.Menu.Rewards.NOT_SET_LEGGINGS) - .meta(metaData) - .build() - .makeMenuTool()); - - if (slot == 9 * 4 + 4) - return Common.getOrDefault(tier.getArmor().getBoots(), ItemCreator - .of(CompMaterial.LEATHER_BOOTS) - .name(Localization.Menu.Rewards.NOT_SET_BOOTS) - .meta(metaData) - .build() - .makeMenuTool()); - - } else if (previewMode == PreviewMode.CONTENT) { - if (slot < 36 && tier.getContent() != null) - return tier.getContent()[slot]; - - } else - throw new FoException("Unhandled vzhlad pre povysenie triedy - " + previewMode); - - if (slot == getSize() - 5) - return switchModesButton.getItem(); - - if (slot == getSize() - 4) - return buyButton.getItem(); - - if (slot == getSize() - 1) - return nextTierButton.getItem(); - - if (slot > 9 * 5 - 1) - return ItemCreator - .of(CompMaterial - .fromLegacy("STAINED_GLASS_PANE", (hasTier ? DyeColor.LIME : DyeColor.RED) - .getWoolData())) - .name(hasTier ? Localization.Menu.Rewards.TIER_ADDED : Localization.Menu.Rewards.TIER_IS_LOCKED) - .build() - .make(); - - return null; - } - - @Override - public boolean isActionAllowed(MenuClickLocation clickLocation, int slot, ItemStack clickedSlot, ItemStack cursor) { - return mode == MenuMode.PURCHASE ? super.isActionAllowed(clickLocation, slot, clickedSlot, cursor) : clickLocation != MenuClickLocation.MENU || slot < 9 * 3; - } - - @Override - protected int getReturnButtonPosition() { - return getSize() - 9; - } - - @Override - protected int getInfoButtonPosition() { - return getSize() - 6; - } - - @Override - protected String[] getInfo() { - final List<String> lore = new ArrayList<>(); - - lore.add("Balance: &f" + Localization.Currency.format(nuggets)); - - if (!hasTier()) { - lore.add(""); - lore.add("Click the diamond icon to"); - lore.add("upgrade your class tier."); - } - - return lore.toArray(new String[0]); - } - } - - @Override - public ItemStack getItemAt(int slot) { - - if (Settings.Rewards.ENABLE_MATERIAL_REWARDS) { - if (slot == 9 * 1 + 4) - return blocksButton.getItem(); - - if (slot == 9 * 2 + 2) - return itemsButton.getItem(); - - if (slot == 9 * 2 + 6) - return packsButton.getItem(); - - if (slot == 9 * 3 + 4) - return tiersButton.getItem(); - - } else if (slot == 9 * 2 + 4) - return tiersButton.getItem(); - - return null; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuSnapshot.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuSnapshot.java deleted file mode 100644 index e7c439190f614d3bd8025250dd34b8adad45a75e..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuSnapshot.java +++ /dev/null @@ -1,169 +0,0 @@ -package org.mineacademy.game.menu; - -import java.util.Arrays; -import java.util.List; - -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.ItemUtil; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.game.data.GeneralDataSection; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaRegion; -import org.mineacademy.game.model.ArenaSnapshotStage; -import org.mineacademy.game.model.ArenaSnapshotProcedural.DamagedStage; - -import lombok.RequiredArgsConstructor; - -public class MenuSnapshot extends Menu { - - private final Arena arena; - - private final Button takeFirstButton; - private final Button restoreFirstButton; - private final Button takeLastButton; - private final Button restoreLastButton; - - private final List<Integer> greenSlots = Arrays.asList( - 0, 1, 2, 3, - 9, 10, 11, 12, - 18, 19, 20, 21); - - private final ItemStack greenItem = ItemCreator.of(CompMaterial.LIME_STAINED_GLASS_PANE).name(" ").hideTags(true).build().make(); - - private final List<Integer> redSlots = Arrays.asList( - 5, 6, 7, 8, - 14, 15, 16, 17, - 23, 24, 25, 26); - - private final ItemStack redItem = ItemCreator.of(CompMaterial.RED_STAINED_GLASS_PANE).name(" ").hideTags(true).build().make(); - - MenuSnapshot(Arena arena, Menu parent) { - super(GeneralDataSection.getInstance().isSnapshotNotified() ? parent : new CoreMenu()); - - this.arena = arena; - - setTitle("Snapshot Manager"); - - this.takeFirstButton = new ManipulatorButton(DamagedStage.INITIAL, Mode.TAKE); - this.takeLastButton = new ManipulatorButton(DamagedStage.DAMAGED, Mode.TAKE); - - this.restoreFirstButton = new ManipulatorButton(DamagedStage.INITIAL, Mode.RESTORE); - this.restoreLastButton = new ManipulatorButton(DamagedStage.DAMAGED, Mode.RESTORE); - } - - @Override - public final ItemStack getItemAt(int slot) { - if (slot == 10 || slot == 11) - return (slot == 10 ? takeFirstButton : restoreFirstButton).getItem(); - - if (greenSlots.contains(slot)) - return greenItem; - - if (slot == 15 || slot == 16) - return (slot == 15 ? takeLastButton : restoreLastButton).getItem(); - - if (redSlots.contains(slot)) - return redItem; - - return null; - } - - @Override - protected final int getInfoButtonPosition() { - return 4; - } - - @Override - protected final int getReturnButtonPosition() { - return 22; - } - - @Override - protected final String[] getInfo() { - return new String[] { - "To enable &eprocedural arena damage&7,", - "we need to make a transition between", - "how the arena looked liked, when:", - " ", - "&f1. &7Arena starts &a(initial snapshot)", - "&f2. &7Arena is destroyed &6(damaged snapshot)", - " ", - "Arena is reverted to the initial snapshot", - "when it ends. No damage is permanent." - }; - } - - private final class ManipulatorButton extends Button { - - private final ArenaSnapshotStage stage; - private final Mode mode; - - public ManipulatorButton(ArenaSnapshotStage stage, Mode mode) { - this.stage = stage; - this.mode = mode; - } - - @Override - public void onClickedInMenu(Player pl, Menu menu, ClickType click) { - if (CoreArenaPlugin.getSetupManager().isArenaEdited(arena)) { - animateTitle("&4Stop editing arena first!"); - Common.tell(pl, "&cCannot manipulate snapshots when the arena is edited."); - - return; - } - - final ArenaRegion reg = arena.getData().getRegion(); - - if (reg.getPrimary() == null || reg.getSecondary() == null) { - animateTitle("&4Set arena region first!"); - Common.tell(pl, "&cPlease set up the arena region first."); - - return; - } - - if (mode == Mode.TAKE) - arena.getSnapshot().take(stage); - else - arena.getSnapshot().restore(stage); - - animateTitle("&2" + ItemUtil.bountifyCapitalized(mode.toString()) + " successful!"); - Common.tell(pl, String.format(mode.successMessage, stage.getFormattedName())); - } - - @Override - public ItemStack getItem() { - return ItemCreator.of(mode.material).name("&6" + ItemUtil.bountifyCapitalized(mode) + " the " + stage.getFormattedName() + " snapshot").lores(mode.help).build().makeMenuTool(); - } - } - - @RequiredArgsConstructor - private enum Mode { - TAKE( - CompMaterial.CHEST, - "&7Took the &2%s &7snapshot of the arena.", - Arrays.asList( - "&7The arena, as it is right now,", - "&7will be saved as this snapshot.")), - - RESTORE( - CompMaterial.COMMAND_BLOCK, - "&7Restored the &6%s &7snapshot of the arena.", - Arrays.asList( - "&7Restore the arena to this snapshot.", - "", - "&cThis is not permanent.", - "&7The arena will be set to the", - "&7first snapshot when it starts.")); - - private final CompMaterial material; - private final String successMessage; - private final List<String> help; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuUpgrades.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuUpgrades.java deleted file mode 100644 index ae5ecb0c138d72946cebaa5a8f21b734d6467f7b..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/MenuUpgrades.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.mineacademy.game.menu; - -import java.util.Arrays; - -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.game.conversation.AddNewConvo.Created; - -public class MenuUpgrades extends AbstractListMenu { - - protected MenuUpgrades() { - super("Upgrade", CoreArenaPlugin.getUpgradesManager().getAvailable()); - } - - @Override - protected final Button getListButton(String listName, int listIndex) { - return new UpgradeButton(listName, listIndex); - } - - @Override - protected final Created getCreatedObject() { - return Created.UPGRADE; - } - - private static final class UpgradeButton extends Button { - - private final String upgrade; - private final int colorMod; - - public UpgradeButton(String upgrade, int colorOffset) { - this.upgrade = upgrade; - this.colorMod = colorOffset % 15; - } - - @Override - public void onClickedInMenu(Player pl, Menu menu, ClickType click) { - new IndividualUpgradeMenu(upgrade, true).displayTo(pl); - } - - @Override - public ItemStack getItem() { - return ItemCreator.of(CompMaterial.fromLegacy("WOOL", colorMod)).name(upgrade).lores(Arrays.asList("", "&7Click to open upgrade menu.")).build().make(); - } - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/SnapshotWarningDialog.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/SnapshotWarningDialog.java deleted file mode 100644 index b6286dff52d70dec84cd05a64283e5b9c130cbab..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/SnapshotWarningDialog.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.mineacademy.game.menu; - -import java.util.Arrays; - -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.game.data.GeneralDataSection; - -public class SnapshotWarningDialog extends Menu { - - private final Button enterButton; - - public SnapshotWarningDialog(Menu snapshotMenu) { - super(null); - - setTitle("Enter Snapshot"); - - this.enterButton = new Button() { - - @Override - public final void onClickedInMenu(Player pl, Menu menu, ClickType click) { - snapshotMenu.displayTo(pl); - - GeneralDataSection.getInstance().setSnapshotNotified(); - } - - @Override - public ItemStack getItem() { - return ItemCreator - .of(CompMaterial.OAK_DOOR) - .name("&6&lEnter Menu") - .lores(Arrays.asList( - "", - "&7Arena snapshots must be rebuilt", - "&7on the main server thread.", - "", - "&cThe bigger your arena is, the longer", - "&cit will take to render the snapshot.", - "&7Server may experience a short lag", - "&7on the start and end of the game.", - "", - "&7Please adjust your arenas' size", - "&7according to your server hardware.", - "", - "&6Click to enter the menu")) - .build().makeMenuTool(); - } - }; - } - - @Override - public ItemStack getItemAt(int slot) { - if (slot == 9 + 4) - return enterButton.getItem(); - - return ItemCreator.of(CompMaterial.RED_STAINED_GLASS_PANE).name(" ").build().make(); - } - - @Override - protected final String[] getInfo() { - return null; - } - - @Override - protected final boolean addReturnButton() { - return false; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/UpgradeItemContainerMenu.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/UpgradeItemContainerMenu.java deleted file mode 100644 index 38b41f8f16e86566b7eacac9eb2351752abea165..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/menu/UpgradeItemContainerMenu.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.mineacademy.game.menu; - -import java.util.Arrays; - -import org.bukkit.entity.Player; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.model.MenuClickLocation; -import org.mineacademy.fo.remain.CompSound; -import org.mineacademy.game.model.Upgrade; -import org.mineacademy.game.util.Constants; - -public class UpgradeItemContainerMenu extends Menu { - - private final Upgrade upgrade; - - public UpgradeItemContainerMenu(Menu parent, String upgradeName) { - super(parent); - - setSize(9 * 4); - setTitle("Select Items for This Upgrade"); - - upgrade = CoreArenaPlugin.getUpgradesManager().findUpgrade(upgradeName); - Valid.checkNotNull(upgradeName, "Report / Upgrade == null"); - } - - @Override - public final void onMenuClose(Player pl, Inventory inv) { - upgrade.setItems(Arrays.copyOfRange(inv.getContents(), 0, getSize() - 9)); - - CompSound.CHEST_CLOSE.play(pl, 1, 1); - Common.tell(pl, "&2Your changes have been saved."); - } - - @Override - public final ItemStack getItemAt(int slot) { - if (slot < 9 * 3 && upgrade.getItems() != null && upgrade.getItems().length > slot) - return upgrade.getItems()[slot]; - - // Bottom bar - if (slot > 9 * 3) - return Constants.Items.MENU_FILLER; - - return null; - } - - @Override - public final boolean isActionAllowed(MenuClickLocation clickLocation, int slot, ItemStack clickedSlot, ItemStack cursor) { - return clickLocation == MenuClickLocation.MENU ? slot < 9 * 3 : true; - } - - @Override - protected final String[] getInfo() { - return new String[] { - "Drag items from your inventory", - "that you wish the player shall get.", - "", - "If he lacks space in his inventory,", - "items will be dropped near him.", - "", - "&8We begin to give the items from", - "&8the top top left corner." - }; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ActivePeriod.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ActivePeriod.java deleted file mode 100644 index 43980668b1d25c3a4bd81ef6394452ecb826aa27..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ActivePeriod.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.mineacademy.game.model; - -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.ConfigSerializable; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * Represents a period between two points, - * used in minigame arenas so you can specify a phase "between", - * "from", "on" a certain number etc. - */ -@Getter -@RequiredArgsConstructor -public final class ActivePeriod implements ConfigSerializable { - - /** - * The active mode for this period - */ - private final ActiveMode mode; - - /** - * The starting limit - */ - private final int startLimit; - - /** - * The ending limit - */ - private final int endLimit; - - /** - * Create a new active period given with the same start and end limit - * - * @param mode - * @param limit - */ - public ActivePeriod(ActiveMode mode, int limit) { - this(mode, limit, limit); - } - - /** - * Return true if this active period is within the given period - * for example "between" mode with limits 1 and 4 will return true for period 1,2,3 and 4 - * - * @param period - * @return - */ - public boolean mayExecute(int period) { - switch (mode) { - case FROM: - return period >= startLimit; - - case ON: - return period == startLimit; - - case BETWEEN: - return period >= startLimit && period <= endLimit; - - case TILL: - return period <= startLimit; - - default: - throw new FoException("Unhandled activation mode " + mode); - } - } - - /** - * Return the active period formatted, e.g.: - * <p> - * "from 5 - 4" or "on 5" - * - * @return - */ - public String formatPeriod() { - return mode.localizedName + " " + formatLimits(); - } - - /** - * Return the two points formatted, e.g.: - * <p> - * "4 - 5" or only singular: "7" - * - * @return - */ - public String formatLimits() { - return startLimit + (startLimit == endLimit ? "" : " - " + endLimit); - } - - /** - * Put this active period data into a serializable map which you - * can save in your settings file - */ - @Override - public SerializedMap serialize() { - final SerializedMap map = new SerializedMap(); - - map.put("mode", mode.localizedName); - map.put("limit", startLimit); - map.put("limit2", endLimit); - - return map; - } - - /** - * Parses a serialized map from your settings file - * into an active period class - * - * @param map - * @return - */ - public static ActivePeriod deserialize(SerializedMap map) { - final ActiveMode mode = ActiveMode.fromName(map.getString("mode")); - final int startLimit = map.getInteger("limit"); - final int endLimit = map.getInteger("limit2", startLimit); - - return new ActivePeriod(mode, startLimit, endLimit); - } - - /** - * Represents how the start and end limit should work for {@link ActivePeriod} - */ - @RequiredArgsConstructor - public enum ActiveMode { - - /** - * Shall the period be active from the starting limit indefinitelly? - */ - FROM("from"), - - /** - * Shall the period be active only on the starting limit and nowhere else? - */ - ON("on"), - - /** - * Shall the period be active from between the start and end limit? - */ - BETWEEN("between"), - - /** - * Shall the period be active from 0 to the ending limit? - */ - TILL("till"); - - /** - * The localized unobfuscated name - */ - private final String localizedName; - - @Override - public String toString() { - return localizedName; - } - - /** - * Finds an active mode by its {@link #localizedName} - * - * @param name - * @return - */ - public static ActiveMode fromName(String name) { - for (final ActiveMode other : values()) - if (other.localizedName.equals(name)) - return other; - - throw new FoException("Invalid activation mode: " + name); - } - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Arena.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Arena.java deleted file mode 100644 index c41d2ac8ad6b72840d263305151f9406ebe249e6..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Arena.java +++ /dev/null @@ -1,351 +0,0 @@ -package org.mineacademy.game.model; - -import java.util.Collection; - -import org.bukkit.block.Block; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.entity.EntityDamageByBlockEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.EntityDeathEvent; -import org.bukkit.event.entity.EntitySpawnEvent; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.event.player.PlayerRespawnEvent; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.game.event.ArenaPreLeaveEvent; -import org.mineacademy.game.type.ArenaState; -import org.mineacademy.game.type.DeathCause; -import org.mineacademy.game.type.JoinCause; -import org.mineacademy.game.type.LeaveCause; -import org.mineacademy.game.type.StopCause; - -/** - * Represents a game arena. - * - * There are other interfaces that extends this - */ -public interface Arena { - - /** - * Attempts to join a player to this arena. - * - * @param player the player - * @param cause why is the player joining - * @throws EventHandledException when the event is handled in the pipeline - * - * @return if the player was joined, false if conditions didn't allow it - */ - boolean joinPlayer(Player player, JoinCause cause); - - /** - * Attempts to kick a player from this arena or - * throws an error when he's not playing or the arena is not running. - * - * @param player the player - * @param cause why is the player quitting - * @return if the player was kicked, false if the {@link ArenaPreLeaveEvent} was cancelled - */ - boolean kickPlayer(Player player, LeaveCause cause); - - /** - * Attempts to start the lobby. This is typically called when the arena is stopped and first player has joined. - * - * Typically, you should update your signs here, start countdown till the arena starts and restore initial snapshot. - */ - void startLobby(); - - /** - * Attempts to start the arena immediately, typically called after the lobby has started, see {@link #startLobby()} - * - * @return true if the arena was started successfully - * @param forced start? - */ - boolean startArena(boolean force); - - /** - * Attempts to stop the arena immediately - * - * @param cause, the reason why it is being stopped - */ - void stopArena(StopCause cause); - - /** - * Moves an active arena player to his last saved location, or world's spawn if - * the location is unknown - * - * @param player the player to teleport - */ - void teleportPlayerBack(Player player); - - // ---------------------------------------------------------------------------------------- - // Main API methods - // ---------------------------------------------------------------------------------------- - - /** - * The name of the arena, as specified in the config. - */ - String getName(); - - /** - * Can players play this arena? - * - * @return is the arena enabled? - */ - boolean isEnabled(); - - /** - * Enabled arenas may be joined for playing, whereas disabled arenas may only be edited. - * - * @param enabled, toggle the arena being enabled - */ - void setEnabled(boolean enabled); - - /** - * Normally, when you stop or start the arena, the snapshots will automatically be restored. - * You can prevent this functionality here. It is typically used to safely stop the arena - * if we could not restore snapshot due to error, preventing infinite loop. - * - * @param restoreSnapshots - */ - void setRestoreSnapshots(boolean restoreSnapshots); - - /** - * List of player names joined in the arena. This does not mean they are playing, it means - * they are registered in the arena, for example in the lobby. - */ - Collection<Player> getPlayers(); - - /** - * Check if a player is joined in the arena - * - * @param player the player to check - * @return - */ - boolean isJoined(Player player); - - /** - * Check if a player is joined in the arena - * - * @param player the player to check - * @return - */ - boolean isJoined(String playerName); - - /** - * The game state. - */ - ArenaState getState(); - - /** - * The arena's settings that user can alter. - */ - ArenaSettings getSettings(); - - /** - * The internal data from database. - */ - ArenaData getData(); - - /** - * The thing for sending messages. - */ - ArenaMessenger getMessenger(); - - /** - * Snapshot is all the blocks in the arena in a certain phase. - */ - ArenaSnapshot getSnapshot(); - - /** - * The setup manager, for example spawn points or supply points, etc. - */ - Setup getSetup(); - - /** - * Phases are levels within the arena - */ - ArenaPhase getPhase(); - - /** - * Has the stopping been initiated in the pipeline? - */ - boolean isStopping(); - - /** - * How much seconds is left before the finish? - * - * @return the remaining time, in seconds - */ - int getRemainingSeconds(); - - /** - * How many monsters that can be killed are in the arena? - * - * @return the alive monsters count - */ - int getAliveMonsters(); - - /** - * The plugin that owns this arena. - * - * @return the plugin - */ - ArenaPlugin getPlugin(); - - // ---------------------------------------------------------------------------------------- - // Automatic API methods - you should listen to events in bukkit and call them here manually - // ---------------------------------------------------------------------------------------- - - /** - * Called automatically when the arena is finished loading from its file on startup. - */ - void onPostLoad(); - - /** - * Called on a player vs. player fight - * - * @param event the event - * @param damager, the damager - * @param victim, the damaged - * @param damage, damage dealt - */ - void onPlayerPvP(EntityDamageByEntityEvent event, Player damager, Player victim, double damage); - - /** - * Called when a player attacks a monster/animal - * - * @param damager the player who attacks - * @param victim, the damaged monster - * @param damage, damage dealth - */ - void onPlayerPvE(Player damager, LivingEntity victim, double damage); - - /** - * Called when player is attacked by an entity - * - * @param event, the event - * @param player, the player - * @param source, the source - * @param damage, damage dealt - */ - void onPlayerDamage(EntityDamageByEntityEvent event, Player player, Entity source, double damage); - - /** - * Called when player is damaged by block - * - * @param event the event - * @param player the player - * @param damage damage dealt - */ - void onPlayerBlockDamage(EntityDamageByBlockEvent event, Player player, double damage); - - /** - * Called when a player is murdered - * - * @param player the player - * @param killer the killer - */ - void onPlayerDeath(Player player, Player killer); - - /** - * Called when a player dies and we cannot detect the killer - * - * @param player the player - * @param cause the cause - */ - void onPlayerDeath(Player player, DeathCause cause); - - /** - * Called on player block interaction - * - * @param player the player - * @param clickedBlock the clicked block - * @param hand the hand item - */ - void onPlayerClick(Player player, Block clickedBlock, ItemStack hand); - - /** - * Called when a player clicks the air, useful for tools - * - * @param player, the player - * @param hand, the hand item - */ - void onPlayerClickAir(Player player, ItemStack hand); - - /** - * Called when a player places a block - * - * @param event, the event - */ - void onPlayerBlockPlace(BlockPlaceEvent event); - - /** - * Called when a player destroys a block - * - * @param event, the event - */ - void onPlayerBlockBreak(BlockBreakEvent event); - - /** - * Called when a player is respawned - * - * @param event, the player - */ - void onPlayerRespawn(PlayerRespawnEvent event); - - /** - * Called when a player picks up the exp item - * - * @param event, the player - * @param expItem, the exp item - */ - void onPlayerPickupTag(PlayerPickupItemEvent event, ExpItem expItem); - - /** - * Called on entity spawn - * - * @param event, the event - */ - void onEntitySpawn(EntitySpawnEvent event); - - /** - * Called on entity target - * - * @param event, the event - */ - void onEntityTarget(EntityTargetEvent event); - - /** - * Called on entity death - * - * @param event, the event - */ - void onEntityDeath(EntityDeathEvent event); - - /** - * Called when a new map snapshot is restored - * - * @param newState, the current arena snapshot stage - */ - void onSnapshotUpdate(ArenaSnapshotStage newState); - - /** - * Called when a projectile is launched - * - * @param event, the event - */ - void onProjectileLaunch(ProjectileLaunchEvent event); - - /** - * Called when projectile hits something - * - * @param event, the event - */ - void onProjectileHit(ProjectileHitEvent event); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaBarColor.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaBarColor.java deleted file mode 100644 index b12b105c73542f8034ed9b27f15f2f5a3d0442b0..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaBarColor.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.mineacademy.game.model; - -import org.bukkit.boss.BarColor; - -/** - * A compatibility wrapper, see {@link BarColor} - * - */ -public enum ArenaBarColor { - PINK, - BLUE, - RED, - GREEN, - YELLOW, - PURPLE, - WHITE; -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaClass.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaClass.java deleted file mode 100644 index 87d76c7291f26b9fa0a5a28240f190874313239a..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaClass.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.mineacademy.game.model; - -import org.bukkit.entity.Player; -import org.mineacademy.game.type.TierMode; - -/** - * Represents a player class. - * - * Typically, a class includes player inventory - * with armor, and some special effects. - */ -public interface ArenaClass extends Iconable { - - /** - * The name of this class - * - * @return the name of this class - */ - String getName(); - - /** - * The permission to access this class - * - * @return the permission, null if none - */ - String getPermission(); - - /** - * Check if the player may obtain this class. Typically we check for {@link #getPermission()} here. - * - * @param player the player - * @return true if player is eligible for this class - */ - boolean mayObtain(Player player); - - /** - * Give this class (and all items) to the player, depending on his tier mode - * - * @param player the player - * @param mode the mode - */ - void giveToPlayer(Player player, TierMode mode); - - /** - * Get all tiers in this class. A tier represents how advanced or good the items/armor should be. - * A class can have multiple tiers each giving the player more advanced items, motivating him - * to purchase higher tiers for Nuggets. - * - * @return the tiers installed for this class - */ - int getTiers(); - - /** - * Get the minimum valid tier. Since you can add/remove tiers in the game, it is easy to mess up - * and this method will safely return the lower tier in case you give it one that's too high - * - * @param level the tier to get, or it will return lower in case it does not exist - * @return the given tier, or the closes minimum that exists - */ - ClassTier getMinimumTier(int level); - - /** - * Get a class tier, or null if not present - * - * @param level the tier level - * @return the tier or null - */ - ClassTier getTier(int level); - - /** - * Add or update class tier. The tier level is found in the wrapper - * - * @param tier the tier - */ - void addOrUpdateTier(ClassTier tier); - - /** - * Remove a class tier - * - * @param tier the tier - */ - void removeTier(ClassTier tier); - - /** - * Since we store tier settings in a separate file, return them here for clarity - * - * @param level the tier level - * @return the settings of this tier level, or null - */ - TierSettings getTierSettings(int level); - - /** - * Is this class valid? - * - * @return true if the first tier is valid - */ - boolean isValid(); - - /** - * Remove the class permanently - */ - void deleteClass(); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaCommands.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaCommands.java deleted file mode 100644 index 1a73390511ecaa5702f0f6d4d0667929d351b0d4..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaCommands.java +++ /dev/null @@ -1,127 +0,0 @@ -package org.mineacademy.game.model; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.mineacademy.fo.Common; -import org.mineacademy.game.util.BungeeMessagingUtil; - -/** - * A collections of commands that are run during a course of an arena. - */ -public final class ArenaCommands { - - /** - * Commands to be run as a player. - */ - private final List<String> playerCommands; - - /** - * Commands to be run as the console. - */ - private final List<String> consoleCommands; - - /** - * Create new arena commands - * - * @param playerCommands - * @param consoleCommands - */ - public ArenaCommands(List<String> playerCommands, List<String> consoleCommands) { - this.playerCommands = removeFirstSlash(playerCommands); - this.consoleCommands = removeFirstSlash(consoleCommands); - } - - // Remove first / slash from the command list. - private List<String> removeFirstSlash(List<String> commands) { - final List<String> copy = new ArrayList<>(); - - if (commands != null) - commands.forEach(cmd -> { - if (cmd.startsWith("/")) - cmd = cmd.substring(1, cmd.length()); - - copy.add(cmd); - }); - - return copy; - } - - /** - * Run both {@link #playerCommands} and {@link #consoleCommands} - * for each online player in said arena. - * - * @param arena - * @param consoleForEach run console commands for each player as the console or from the console, once? - * @param player - */ - public void run(Arena arena, boolean consoleForEach) { - runConsole(arena, consoleForEach); - - for (final Player player : arena.getPlayers()) - runAsPlayer(arena, player); - } - - /* - * Run {@link #consoleCommands} as the server operator. - * - * @param arena - * @param consoleForEach run console commands for each player as the console or from the console, once? - */ - private void runConsole(Arena arena, boolean consoleForEach) { - for (final String cmd : consoleCommands) { - final String coloredCommand = Common.colorize(arena.getMessenger().replaceVariables(cmd)); - - if (consoleForEach) - for (final Player player : arena.getPlayers()) - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), coloredCommand.replace("{player}", player.getName())); - - else - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), coloredCommand); - } - } - - /** - * Run {@link #playerCommands} as the player, if any. - * - * @param arena - * @param player - */ - public void runAsPlayer(Arena arena, Player player) { - for (final String cmd : playerCommands) { - final String coloredCommand = Common.colorize(arena.getMessenger().replaceVariables(cmd.replace("{player}", player.getName()))); - - if (cmd.startsWith("@tell ")) - arena.getMessenger().tell(player, coloredCommand.replaceFirst("@tell ", "")); - - else if (cmd.startsWith("@connect ")) - BungeeMessagingUtil.sendMessage(player, "Connect", coloredCommand.replaceFirst("@connect ", "")); - - else - player.performCommand(coloredCommand); - } - } - - /** - * Runs {@link #consoleCommands} as the server console, translates \@tell and \@connect variables - * - * @param arena the arena - * @param player the sender - */ - public void runAsConsole(Arena arena, Player player) { - for (final String cmd : consoleCommands) { - final String coloredCommand = Common.colorize(arena.getMessenger().replaceVariables(cmd.replace("{player}", player.getName()))); - - if (cmd.startsWith("@tell ")) - arena.getMessenger().tell(player, coloredCommand.replaceFirst("@tell ", "")); - - else if (cmd.startsWith("@connect ")) - BungeeMessagingUtil.sendMessage(player, "Connect", coloredCommand.replaceFirst("@connect ", "")); - - else - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), coloredCommand); - } - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaData.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaData.java deleted file mode 100644 index 34da9c7d08f6e20c2e6e38aa9338b760b868acbf..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaData.java +++ /dev/null @@ -1,153 +0,0 @@ -package org.mineacademy.game.model; - -import java.util.List; - -import org.bukkit.Location; -import org.mineacademy.game.type.RegionPoint; -import org.mineacademy.game.type.SpawnPointType; - -/** - * Represents the part of data.db file that has stored data about an arena - * - */ -public interface ArenaData extends Iconable { - - /** - * Is the arena enabled? - * - * @return true if the arena is enabled - */ - boolean isEnabled(); - - /** - * Set whether the arena is joinable - * - * @param enabled, true if the arena can be joined - */ - void setEnabled(boolean enabled); - - /** - * Get the arena lobby - * - * @return the arena lobby - */ - Lobby getLobby(); - - /** - * Set the arena lobby location - * - * @param loc the new lobby location - */ - void setLobby(Location loc); - - /** - * Remove the arena lobby permanently - */ - void removeLobby(); - - /** - * Get the arena region - * - * @return the arena region - */ - ArenaRegion getRegion(); - - /** - * Set a certain location in a world to represent an arena point, primary or secondary - * When both points are set, arena will have a valid region - * - * @param loc the location - * @param point the point type - */ - void setRegion(Location loc, RegionPoint point); - - /** - * Remove a certain region point - * - * @param point, the region point type to remove - */ - void removeRegion(RegionPoint point); - - /** - * Get arena signs manager - * - * @return the signs in the arena - */ - ArenaSigns getSigns(); - - /** - * Add a new sign to the arena - * - * @param sign the new sign - */ - void addSign(ArenaSign sign); - - /** - * Remove a sign at a specific location - * - * @param loc location where the sign is located - */ - void removeSign(Location loc); - - /** - * Remove a specific arena sign - * - * @param sign the sign to remove - */ - void removeSign(ArenaSign sign); - - /** - * Get the list of spawn points of a certain type - * - * @param type the type of spawn points - * @return the list of them - */ - List<SpawnPoint> getSpawnPoints(SpawnPointType type); - - /** - * Finds the spawn point at a location - * - * @param loc the location - * @return the point, or null if not present - */ - SpawnPoint findSpawnPoint(Location loc); - - /** - * Add a spawn point to a certain location - * - * @param point the new point - */ - void addSpawnPoint(SpawnPoint point); - - /** - * Removes a certain spawn point - * - * @param type spawn point type to remove - * @param loc the location where the point is located - */ - void removeSpawnPoint(SpawnPointType type, Location loc); - - /** - * Updates an already existing spawning point - * - * @param point the point with updated information - */ - void updateSpawnPoint(SpawnPoint point); - - /** - * An internal method called after data is loaded - */ - void onPostLoad(); - - /** - * Return if the arena data section is valid - * - * @return true if the section exists in data.db - */ - boolean isSectionValid(); - - /** - * Remove the data section permantly. DANGEROUS! - */ - void deleteSection(); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaManager.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaManager.java deleted file mode 100644 index f1e899e749f224dfa55e86df591c2b11fa2f71f1..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaManager.java +++ /dev/null @@ -1,84 +0,0 @@ -package org.mineacademy.game.model; - -import java.util.List; -import java.util.Set; - -import org.bukkit.Location; -import org.bukkit.block.Sign; -import org.bukkit.entity.Player; - -/** - * Represents a simple manager of your loaded arenas - */ -public interface ArenaManager { - - /** - * Get a copy of all arenas - * - * @return a copy of all arenas - */ - Set<Arena> getArenas(); - - /** - * Get a copy of all arena names - * - * @return a copy of all arena names - */ - List<String> getAvailable(); - - /** - * Get a player's arena, or null if none - * - * @param player the player - * @return an arena, or null if not found - */ - Arena findArena(Player player); - - /** - * Get an arena, or null if none - * - * @param name the arena's name - * @return an arena, or null if not found - */ - Arena findArena(String arenaName); - - /** - * Get arena at the location, or null if none - * - * @param loc the location - * @return an arena, or null if not found - */ - Arena findArena(Location loc); - - /** - * Wrap a sign into an arena sign, if exist - * - * @param sign the sign - * @return an arena sign representation, or null if none - */ - ArenaSign findSign(Sign sign); - - /** - * Finds the arena that the player is editing - * - * @param player the player - * @return the edited arena or null if none - */ - Arena findEditedArena(Player player); - - /** - * Get if the player is playing in any arena - * - * @param player the player - * @return true if player has any arena - */ - boolean isPlaying(Player player); - - /** - * Get if the player is editing any arena - * - * @param player the player - * @return true if player is editing any arena - */ - boolean isEditing(Player player); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaMaterialAllower.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaMaterialAllower.java deleted file mode 100644 index 5fa550980eeb26e3b0a09dbb6432b3dcd248cba8..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaMaterialAllower.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.mineacademy.game.model; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -import org.apache.commons.lang.Validate; -import org.bukkit.Material; - -/** - * Represents which blocks can be placed/destroyed during arena play - */ -public class ArenaMaterialAllower { - - /** - * How this allow should work? - */ - private final AllowMode mode; - - /** - * The list of blocks by their material - */ - private final Set<Material> materials; - - /** - * Create a new allower by mode, null blocks - * - * @param mode - */ - public ArenaMaterialAllower(AllowMode mode) { - this(null, mode); - } - - /** - * Create a new specific allower allowing only given materials - * - * @param materials - */ - public ArenaMaterialAllower(Collection<Material> materials) { - this(materials, AllowMode.SPECIFIC); - } - - /** - * Creates a new allower - * - * @param materials - * @param mode - */ - private ArenaMaterialAllower(Collection<Material> materials, AllowMode mode) { - this.materials = new HashSet<>(materials); - this.mode = mode; - - if (materials == null) - Validate.isTrue(mode != AllowMode.SPECIFIC, "Mode cannot be specific when the list is null"); - } - - /** - * Is the material allowed to be placed/destroed ? - * - * @param material the material - * @return true if the material is allowed to be manipulated - */ - public boolean isAllowed(Material material) { - if (mode == AllowMode.NONE) - return false; - - if (mode == AllowMode.ALL) - return true; - - return materials.contains(material); - } - - /** - * Represents how this allower should function. - */ - public enum AllowMode { - - /** - * We allow all blocks to be manipulated - */ - ALL, - - /** - * We allow no blocks to be manipulated - */ - NONE, - - /** - * We only allow configured block list to be manipulated - */ - SPECIFIC - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaMenu.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaMenu.java deleted file mode 100644 index 832b049a4d0269aeeaabfeb4916aaff80a3bc378..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaMenu.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.mineacademy.game.model; - -import org.mineacademy.game.type.MenuType; - -/** - * Represents a menu from Menu library that is area menu - * - * In CoreArena/Puncher only used as a workaround to fire MenuOpenEvent - */ -public interface ArenaMenu { - - /** - * Get the menu type - * - * @return the menu type - */ - MenuType getMenuType(); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaMessenger.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaMessenger.java deleted file mode 100644 index 7d2ca44a8c5f804237f691d6b4f6d123cd3a15bb..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaMessenger.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.mineacademy.game.model; - -import org.bukkit.entity.Player; -import org.mineacademy.fo.remain.CompSound; -import org.mineacademy.game.type.MessengerTarget; - -/** - * Represents a way to send messages only to the players inside of an {@link Arena} - * - * Variables are automatically replaced by {@link #replaceVariables(String)} - */ -public interface ArenaMessenger { - - /** - * Send a message to a player - * - * @param player the player - * @param message the message - */ - void tell(Player player, String message); - - /** - * Send a message to {@link #getTarget()} - * - * @param message the message - */ - void broadcast(String message); - - /** - * Send a message in form of an action bar to {@link #getTarget()} - * - * @param message the message - */ - void broadcastBar(String message); - - /** - * Broadcast a sound to {@link #getTarget()} - * - * @param sound the {@link ArenaSound} - * @param pitch the pitch - */ - void playSound(CompSound sound, float pitch); - - /** - * Broadcast a sound to a player - * - * @param player the player - * @param sound the sound - * @param pitch the pitch - */ - void playSound(Player player, CompSound sound, float pitch); - - /** - * Return to whom will messages be broadcasted - * - * @return the target - */ - MessengerTarget getTarget(); - - /** - * Set to whom to broadcast messages - * - * @param target then new target - */ - void setTarget(MessengerTarget target); - - /** - * Internal method to replace variables by your plugin - * - * @param message the message to replace - * @return translated message - */ - String replaceVariables(String message); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaPhase.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaPhase.java deleted file mode 100644 index 906baab97618a356347d55552c20ab3cbe276661..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaPhase.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.mineacademy.game.model; - -/** - * Represents a "wave" or a phase in an arena, divided by time. - * - * Typically, we spawn new round of monsters each time the arena enters a new phase - * - */ -public interface ArenaPhase { - - /** - * Get the current phase - * - * @return the current phase - */ - int getCurrent(); - - /** - * Starts the timer that will enter next phases automatically - */ - void startTimer(); - - /** - * Enter next phase manually - */ - void onNextPhase(); - - /** - * Called when the timer that enter next phases ticks but does not enter next phase yet. - * - * Example: Your timer is set to tick every second but a phase is 20 seconds long. - * This method will get calld 19 times, and {@link #onNextPhase()} will get called 1 during the phase. - * - * This is useful if you want to update BossBar to decrease the time available. - * - * Typically, this is called automatically from your time - */ - void onTimerTick(); - - /** - * Stops and resets the phase timer. - * - * Typically, this only resets boss bar. Monsters are not removed, this is handled within the arena on its stop. - */ - void stopAndReset(); - - /** - * How many seconds we passed till the next phase? - * - * @return - */ - int getWaitedBetweenNextPhase(); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaPlugin.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaPlugin.java deleted file mode 100644 index e98a3370a1639443433bc855cb6d72d4e0cc9e21..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaPlugin.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.mineacademy.game.model; - -import org.bukkit.plugin.Plugin; - -/** - * Represents a minigame plugin that uses GameAPI. - * - * Typically, your main plugin class should implement this. - */ -public interface ArenaPlugin { - - /** - * Get the arena manager. - * - * If you don't have one, you can just return {@link ArenaRegistry#getArenaManager()} - * and that will use our shared manager. - * - * @return the arena manager - */ - ArenaManager getArenas(); - - /** - * Get the name of this plugin - * - * @return the name of this plugin - */ - String getName(); - - /** - * Get the {@link Plugin} representation - * - * @return the plugin - */ - Plugin getPlugin(); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaRegion.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaRegion.java deleted file mode 100644 index fed2d109aee5dd25ff15219670c63023ae0dc43f..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaRegion.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.mineacademy.game.model; - -import java.util.List; - -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.entity.Entity; -import org.mineacademy.fo.model.ConfigSerializable; - -/** - * Represents the protected arena region - */ -public interface ArenaRegion extends ConfigSerializable { - - /** - * Get the primary region point - * - * @return the point, or null if not set - */ - Location getPrimary(); - - /** - * Get the secondary region point - * - * @return the point, or null if not set - */ - Location getSecondary(); - - /** - * Get the estimated center point of this region - * - * Typically, this is used to teleport admins to the center of the arena. - * - * @return the center point, or null if region is incomplete - */ - default Location getCenter() { - return getPrimary() != null && getSecondary() != null ? new Location( - getPrimary().getWorld(), - (getPrimary().getX() + getSecondary().getX()) / 2, - (getPrimary().getY() + getSecondary().getY()) / 2, - (getPrimary().getZ() + getSecondary().getZ()) / 2) : null; - } - - /** - * Get all blocks in the arena region - * - * @return all region blocks - */ - List<Block> getBlocks(); - - /** - * Get all entities (live) in the arena region - * - * @return all alive entities - */ - List<Entity> getEntities(); - - /** - * Get the region world - * - * @return the world, first checks primary region, if that is null than attempts to get the secondary, - * if both are null then returns null - */ - default World getWorld() { - return getPrimary() != null ? getPrimary().getWorld() : getSecondary() != null ? getSecondary().getWorld() : null; - } - - /** - * Return if the given location is within this arena's region - * - * @param loc the location - * @return true if the location is in this arena - */ - boolean isWithin(Location loc); - - /** - * Is this region having both points set? - * - * @return true if both primary and secondary points are set - */ - default boolean isComplete() { - return getPrimary() != null && getSecondary() != null; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaRegistry.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaRegistry.java deleted file mode 100644 index 0813413fc60103c04af2d20ae9e116989bb3a4dd..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaRegistry.java +++ /dev/null @@ -1,295 +0,0 @@ -package org.mineacademy.game.model; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Objects; -import java.util.Set; - -import org.apache.commons.lang.Validate; -import org.bukkit.Location; -import org.bukkit.block.Sign; -import org.bukkit.entity.Player; - -import lombok.AccessLevel; -import lombok.NonNull; -import lombok.RequiredArgsConstructor; - -/** - * The main class that you need to utilize in order for your plugin to be - * recognized within other plugins. - * - * Please register your arena manually at {@link #register(Arena)}! - */ -public class ArenaRegistry { - - /** - * A list of all registered arenas by their respective plugin. - * Your plugin must implement {@link ArenaPlugin} class. - */ - private static final HashMap<ArenaPlugin, List<Arena>> registered = new HashMap<>(); - - /** - * The general arena manager. - */ - private static final ArenaManager commonArenaManager = new CommonArenaManager(); - - /** - * Register your arena within your arena plugin. - * - * @param plugin the plugin - * @param arena the arena - */ - public static void register(Arena arena) { - final List<Arena> current = registered.getOrDefault(arena.getPlugin(), new ArrayList<>()); - Validate.isTrue(!current.contains(arena), "Arena " + arena.getName() + " already registered for " + arena.getPlugin().getName()); - - current.add(arena); - registered.put(arena.getPlugin(), current); - } - - /** - * Unregister an arena of a certain arena plugin. - * - * @param plugin the plugin - * @param arena the arena - */ - public static void unregister(Arena arena) { - final List<Arena> current = registered.get(arena.getPlugin()); - - Objects.requireNonNull(current, "Plugin " + arena.getPlugin().getName() + " associated with arena " + arena.getName() + " is not registered"); - Validate.isTrue(current.remove(arena), "Arena " + arena.getName() + " is not registered for " + arena.getPlugin().getName()); - } - - /** - * Clears all registered arenas for a plugin. - * Removes all instances of the plugin with a name - * - * @param plugin the plugin - * @return if the plugin was found - */ - public static boolean unregisterAll(String plugin) { - boolean found = false; - - for (final Iterator<ArenaPlugin> it = registered.keySet().iterator(); it.hasNext();) { - final ArenaPlugin other = it.next(); - - if (other.getName().equals(plugin)) { - it.remove(); - - found = true; - } - } - - return found; - } - - /** - * Unregister all arenas of an associated plugin - * - * @param plugin the plugin - */ - public static void unregisterAll(ArenaPlugin plugin) { - Validate.isTrue(registered.remove(plugin) != null, "Plugin " + plugin + " is not registered at all"); - } - - /** - * Get all registered arena plugins. - * - * @return registered plugins - */ - public static Set<ArenaPlugin> getRegisteredPlugins() { - return Collections.unmodifiableSet(registered.keySet()); - } - - /** - * Get all arenas for a plugin. - * - * @param plugin the plugin - * @return the arenas for that plugin - */ - public static List<Arena> getArenas(ArenaPlugin plugin) { - final List<Arena> list = registered.get(plugin); - - return list != null ? Collections.unmodifiableList(list) : null; - } - - /** - * Get if the plugin is registered - by name - not by the instance. - * If you want to check if it is registered by instance, use {@link #getRegisteredPlugins()}.contains() - * - * @param plugin the plugin - * @return if the plugin is registered - */ - public static boolean isRegistered(String plugin) { - for (final ArenaPlugin other : getRegisteredPlugins()) - if (other.getName().equals(plugin)) - return true; - - return false; - } - - /** - * Returns an arena manager for a specified plugin - * - * @param plugin an arena plugin - * @return the arena manager - */ - public static ArenaManager getArenaManager(ArenaPlugin plugin) { - return new SpecificArenaManager(plugin); - } - - /** - * Returns arena manager that has all arenas from all plugins. - * - * BEWARE: Misuse leads to problems since methods in here return/search in all arenas - * in all compatible plugins (e.g. Puncher+CoreArena). - * - * @deprecated potentially dangerous because it returns all arenas from all plugins mixed up, - * use {@link #getArenaManager(ArenaPlugin)} instead - * @return the common arena manager - */ - @Deprecated - public static ArenaManager getCommonManager() { - return commonArenaManager; - } - - /** - * An arena manager that only returns arenas for a specific {@link ArenaPlugin} - */ - @RequiredArgsConstructor(access = AccessLevel.PRIVATE) - public static final class SpecificArenaManager extends CommonArenaManager { - - /** - * The plugin linked to this manager. - */ - @NonNull - private final ArenaPlugin plugin; - - /** - * Get all arenas from the registered plugin - * - * @return all arenas from {@link #plugin} - */ - @Override - public Set<Arena> getArenas() { - final HashSet<Arena> set = new HashSet<>(super.getArenas()); - - // Remove all arenas not owned by our plugin - set.removeIf(arena -> !arena.getPlugin().getName().equals(plugin.getName())); - - return set; - } - } - - /** - * Represents an arena manager that is shared for all of the registered arenas. - * - * @deprecated potentialy dangerous because we return all arenas from all plugins - */ - @Deprecated - public static class CommonArenaManager implements ArenaManager { - - private CommonArenaManager() { - } - - /** - * Return all arenas from all plugins. - * - * This is the main method every other method below calls and should be overriden - * by your own to only return arenas from your plugin - * - * @return all arenas from all plugins - */ - @Override - public Set<Arena> getArenas() { - final Set<Arena> all = new HashSet<>(); - - for (final List<Arena> pluginArenas : registered.values()) - all.addAll(pluginArenas); - - return all; - } - - @Override - public final List<String> getAvailable() { - final List<String> all = new ArrayList<>(); - - getArenas().forEach(a -> all.add(a.getName())); - - return all; - } - - @Override - public final Arena findArena(String name) { - for (final Arena arena : getArenas()) - if (arena.getName().equalsIgnoreCase(name)) - return arena; - - return null; - } - - @Override - public final Arena findArena(Location loc) { - for (final Arena arena : getArenas()) - if (arena.getData().getRegion() != null && arena.getData().getRegion().isWithin(loc)) - return arena; - - return null; - } - - @Override - public final Arena findArena(Player pl) { - for (final Arena arena : getArenas()) { - if (!arena.getSetup().isReady()) - continue; - - if (arena.getPlayers().contains(pl)) - return arena; - } - - return null; - } - - @Override - public final ArenaSign findSign(Sign sign) { - for (final Arena arena : getArenas()) { - final ArenaSigns signs = arena.getData().getSigns(); - - if (signs != null) { - final ArenaSign arenaSign = signs.getSignAt(sign.getLocation()); - - if (arenaSign != null) - return arenaSign; - } - } - - return null; - } - - @Override - public Arena findEditedArena(Player player) { - for (final Arena arena : getArenas()) { - final Player editor = arena.getSetup().getEditor(); - - if (editor != null && editor.isOnline() && editor.getName().equals(player.getName())) - return arena; - } - - return null; - } - - @Override - public boolean isEditing(Player player) { - return findEditedArena(player) != null; - } - - @Override - public final boolean isPlaying(Player pl) { - return findArena(pl) != null; - } - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSettings.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSettings.java deleted file mode 100644 index ce8eeb27ed7d053d907a82b6683cf38de370226f..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSettings.java +++ /dev/null @@ -1,334 +0,0 @@ -package org.mineacademy.game.model; - -import java.util.List; -import java.util.Map; - -import org.bukkit.entity.Entity; -import org.mineacademy.fo.model.SimpleSound; -import org.mineacademy.game.type.NextPhaseMode; - -/** - * Those are user-alterable settings stored in the arenas/ folder. - */ -public interface ArenaSettings { - - /** - * Get the arena name. - * - * @return the arena name - */ - String getName(); - - /** - * Return which phase activates PvP (player may - * kill other players, not just mobs) - * - * @return from which phase friendly fire is enabled - */ - int getPvpPhase(); - - /** - * Get when we should stop the arena if there is less or equals players - * - * @return see above - */ - int getAutoStopPlayersLimit(); - - /** - * Get the last phase or -1 if not set (arena ends only when time is up). - * - * @return the last phase, -1 for no end phase - */ - int getLastPhase(); - - /** - * Get the phase after which arena ends automatically when all monsters are killed. - * - * @return the end phase no monsters, or -1 if feature disabled - */ - int getEndPhaseNoMonsters(); - - /** - * Get the last phase or -1 if not set (arena will still continue to play, just - * the phase won't increase anymore after it has reached the limit). - * - * @return the max phase, -1 for no infinite increase - */ - int getMaxPhase(); - - /** - * When the arena should enter the next phase? - * - * @return the next phase mode - */ - NextPhaseMode getNextPhaseMode(); - - /** - * Get the warm-up pause from when we can go to the next phase - * till we actually launch it, in seconds - * - * @return the wait period between switching phases, in seconds - */ - int getNextPhaseWaitSeconds(); - - /** - * Return how many times the player may get - * killed before they loose and get kicked out of the arena. - * - * @return lifes per player in the arena - */ - int getLifes(); - - /** - * Get the minimum class tier required to enter - * - * @return the minimum class tier required to enter - */ - int getMinimumTier(); - - /** - * Get the random distance around the mob spawner to spread mobs out. - * - * @return the random distance around the mob spawner to spread mobs out - */ - int getMobSpread(); - - /** - * Return whether or not the classes are completely - * disabled in this arena and players may use their - * own equipment from their gameplay. - * - * @return if arena allows joining with own equipment - */ - boolean allowOwnEquipment(); - - /** - * Return whether or not the mobs should drop - * their natural death items on death? - * - * @return if arena allows mobs natural drops - */ - boolean allowNaturalDrops(); - - /** - * Should players be teleported to a random spawnpoint, or to the first one - * from when the arena started? - * - * @return whether respawning should teleport to random spawnpoints - */ - boolean isRespawningRandom(); - - /** - * Get if monsters should burn on the sunlight. - * Default: false - * - * @return if monsters should burn - */ - boolean allowMonstersBurn(); - - /** - * Should right clicking with bones spawn wolves? - * - * @return if right clicking with bones spawn wolves - */ - boolean spawnWolves(); - - /** - * Should right clicking with fireballs launch them? - * - * @return if right clicking with fireballs launch them? - */ - boolean launchFireballs(); - - /** - * Should placing tnt ignite it? - * - * @return if placing tnt ignites it - */ - boolean igniteTnts(); - - /** - * Shall we open class selection menu right after joining the lobby? - */ - boolean openClassMenu(); - - /** - * Shall explosive arrows damage players? - */ - boolean explosiveArrowPlayerDamage(); - - /** - * Should we apply initial/damaged snapshots? - * - * @return - */ - boolean hasProceduralDamage(); - - /** - * Return the maximum players in the arena - * - * @return the maximum players in the arena - */ - int getMinimumPlayers(); - - /** - * Return the minimum players in the arena - * - * @return the minimum players in the arena - */ - int getMaximumPlayers(); - - /** - * Return the maximum monsters in the arena - * - * @return the maximum monsters in the arena - */ - int getMobLimit(); - - /** - * Get the lobby duration, in seconds - * - * @return the lobby duration, in seconds - */ - int getLobbyDurationSeconds(); - - /** - * Get the arena duration, in seconds - * - * @return the arena duration, in seconds - */ - int getArenaDurationSeconds(); - - /** - * Get the phase duration, in seconds - * - * @return the phase duration, in seconds - */ - int getPhaseDurationSeconds(); - - /** - * Get an implementation of when chests should be refilled. - * - * @return the chest refill trigger - */ - ArenaTrigger getChestRefill(); - - /** - * Get material allower for things that can be broken. - * - * @return a list of things that can be broken - */ - ArenaMaterialAllower getBreakingList(); - - /** - * Get material allower for things that can be placed. - * - * @return a list of things that can be placed - */ - ArenaMaterialAllower getPlaceList(); - - /** - * Get items that always take damage regardless of Arena.Auto_Repair in settings.yml - * - * @return items that always take damage - */ - ArenaMaterialAllower getRepairBlacklist(); - - /** - * Get the commands to be run when arena starts. - * - * @return the commands. - */ - ArenaCommands getStartCommands(); - - /** - * Get the commands to be run when the first player joins the lobby and starts countdown - * that starts the arena - * - * @return - */ - ArenaCommands getLobbyStartCommands(); - - /** - * Get the commands to be run on the next phase. - * - * @return the commands. - */ - ArenaCommands getPhaseCommands(); - - /** - * Get the commands to only be run when arena ends gracefully. - * - * @return the commands. - */ - ArenaCommands getFinishCommands(); - - /** - * Get the commands to be run when arena ends for whatever reason. - * - * @return the commands. - */ - ArenaCommands getEndCommands(); - - /** - * Get the commands to be run when a player leaves for whatever reason. - * - * @return the commands. - */ - ArenaCommands getPlayerLeaveCommands(); - - /** - * Checks the phase experience formula for this arena for how much exp to award<br> - * First checks if there are any specific settings for the arena, - * and returns the global setting if none is set. - * - * @param currentPhase the phase the arena is in. - * @return experience. - */ - int getPhaseExp(int currentPhase); - - /** - * Checks the phase experience formula for this entity in this arena for how much exp to award<br> - * First checks if there are any specific settings for the arena, - * and returns the global setting if none is set. - * - * @param entity entity to lookup - * @param currentPhase the phase the arena is in. - * @return experience formula. - */ - int getExpFor(Entity entity, int currentPhase); - - /** - * Get the internal data section - * - * @return the internal data section - */ - ArenaData getDataSection(); - - /** - * Delete the settings file. - * - * This keeps arena registered, please use method in arena manager to remove arena! - */ - void removeSettingsFile(); - - /** - * Get the y-height for which players are killed. - * Only works if the plugin supports it (for ex. Puncher) - * - * @return the kill height - */ - int getKillHeight(); - - Map<Integer /*wave*/, List<Object> /**/> getRewardsOnWave(); - - Map<Integer /*wave*/, List<Object> /**/> getRewardsEveryWave(); - - SimpleSound getPlayerJoinSound(); - - SimpleSound getPlayerLeaveSound(); - - SimpleSound getArenaStartSound(); - - int getSpawnerActivationRadius(); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSign.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSign.java deleted file mode 100644 index dd2e4743b266a63bf1b9aa41632ba447d65bc465..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSign.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.mineacademy.game.model; - -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.mineacademy.fo.model.ConfigSerializable; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * Represents a registered arena sign - */ -public interface ArenaSign extends ConfigSerializable { - - /** - * Get the sign type - * - * @return the sign type - */ - SignType getType(); - - /** - * Get the sign arena - * - * @return the arena associated with this sign - */ - Arena getArena(); - - /** - * Get the sign location - * - * @return the sign location - */ - Location getLocation(); - - /** - * Updates the sign with the latest information. - * - * Typically used to update arena join signs when players join - * so the sign always set how many players are joined accurately - */ - void updateState(); - - /** - * Called when the sign is clicked when the player is joined in the arena (lobby or playing) - * - * @param player the player - */ - void onSignOutGameClick(Player player); - - /** - * Called when the player clicks the sign but is not joined in the arena (NOT lobby nor playing) - * - * @param player the player - */ - void onSignInGameClick(Player player); - - /** - * Called when the arena is clicked by a player editing this arena - * - * @param player the player - */ - void onSignSetupClick(Player player); - - /** - * Permanently remove the block and data stored about this sign - */ - void removeSign(); - - /** - * Represents a sign type - */ - @RequiredArgsConstructor - public enum SignType { - - /** - * The join sign - */ - JOIN("Join"), - - /** - * The leave sign - */ - LEAVE("Leave"), - - /** - * The class sign - */ - CLASS("Class"), - - /** - * The upgrade sign - */ - UPGRADE("Upgrade"), - - /** - * The power sign - */ - POWER("Power"); - - /** - * The human readable representation of the sign type - */ - @Getter - private final String key; - - @Override - public String toString() { - return key; - } - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSigns.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSigns.java deleted file mode 100644 index 36aa2897eee2ffba6dd1a5c116fd892678af6b49..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSigns.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.mineacademy.game.model; - -import java.util.List; - -import org.bukkit.Location; -import org.mineacademy.game.model.ArenaSign.SignType; - -/** - * Represents signs manager storing all signs - */ -public interface ArenaSigns { - - /** - * Find a sign at a location - * - * @param loc the location - * @return the sign, or null - */ - ArenaSign getSignAt(Location loc); - - /** - * Get all stored signs of a certain type - * - * @param type the sign type - * @return the signs - */ - List<ArenaSign> getSigns(SignType type); - - /** - * Calls {@link ArenaSign#updateState()} for all signs of a certain type in an arena - * - * @param type the sign type - * @param arena the arena - */ - void updateSigns(SignType type, Arena arena); -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSnapshot.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSnapshot.java deleted file mode 100644 index a7c362d223f6e5a3fb56035d95755dc06722d381..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSnapshot.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.mineacademy.game.model; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * Represents an arena snapshot. - * - * This is typically the map (all blocks and mobs) of your arena. - * - * CoreArena and Puncher have two snapshots: initial and damaged, - * dynamically retrieving blocks from the damaged snapshot to cause - * procedural damage. - * - * Snapshots are typically stored as WorldEdit schematic files. - */ -@RequiredArgsConstructor -public abstract class ArenaSnapshot { - - /** - * Represents the arena associated with this snapshot. - */ - @Getter(value = AccessLevel.PROTECTED) - private final Arena arena; - - /** - * Save the whole arena as a new {@link ArenaSnapshotStage}}. - * - * @param stage the stage the snapshot should be saved as - */ - public final void take(ArenaSnapshotStage stage) { - onTake(stage); - - arena.onSnapshotUpdate(stage); - } - - // Implemetable method for convenience of calling onSnapshotUpdate automatically above - protected abstract void onTake(ArenaSnapshotStage stage); - - /** - * Sets the whole arena to a new {@link ArenaSnapshotStage} - * - * @param stage the state to restore the arena snapshot to - */ - public final void restore(ArenaSnapshotStage stage) { - onRestore(stage); - - arena.onSnapshotUpdate(stage); - } - - // Implemetable method for convenience of calling onSnapshotUpdate automatically above - protected abstract void onRestore(ArenaSnapshotStage stage); - - /** - * Is a {@link ArenaSnapshotStage} saved already? This will get rewritten in {@link #save(ArenaSnapshotStage)} - * - * @param stage the stage - * @return true if the snapshot is saved - */ - public abstract boolean isSaved(ArenaSnapshotStage stage); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSnapshotProcedural.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSnapshotProcedural.java deleted file mode 100644 index 2553c18be17e71edf77c81d1bda30aa65ed492b0..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSnapshotProcedural.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.mineacademy.game.model; - -import org.bukkit.block.Block; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * Represents a procedural snapshot, see {@link ArenaSnapshot} - * - */ -public abstract class ArenaSnapshotProcedural extends ArenaSnapshot { - - /** - * Create a new empty procedural snapshot for an arena - * - * @param arena - */ - public ArenaSnapshotProcedural(Arena arena) { - super(arena); - } - - /** - * Sets the block to its new {@link ArenaSnapshotStage} - * - * @param block the block - * @param stage the stage from which we should retrieve the block - * - * @return The restored block, null if air - */ - public abstract Block restoreBlock(Block block, ArenaSnapshotStage stage); - - /** - * Represents the two states CoreArena/Puncher support - */ - @RequiredArgsConstructor - @Getter - public enum DamagedStage implements ArenaSnapshotStage { - /** - * Launch virgin stage. - */ - INITIAL(0, "initial", "{arena}"), - - /** - * Final damaged stage. - */ - DAMAGED(1, "damaged", "{arena}_damaged"); - - /** - * The internal id for the states - */ - private final int id; - - /** - * The immutable string identificator - */ - private final String formattedName; - - /** - * The file name template - */ - private final String fileName; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSnapshotStage.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSnapshotStage.java deleted file mode 100644 index c929b8381297a02e6cc23d51ead6a582c4dda218..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaSnapshotStage.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.mineacademy.game.model; - -/** - * Represents a snapshot of the arena region. - * - * For typical usage see {@link ArenaSnapshotProcedural.DamagedStage} - */ -public interface ArenaSnapshotStage { - - /** - * The internal id of the stage, if unsure return from 0 and upwards normally. - * - * @return the id - */ - int getId(); - - /** - * Get the formated name representation - * - * @return the name - */ - String getFormattedName(); - - /** - * Get the file template name, typically having {arena} - * in to be replaced with the arena name - * - * @return the arena name - */ - String getFileName(); -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaTrigger.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaTrigger.java deleted file mode 100644 index dc2a5d9398b1d4b938451af806d46f7bc6a83e4b..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArenaTrigger.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.mineacademy.game.model; - -import java.util.Set; - -/** - * A simple phase trigger that can be configured - * from user config to trigger on each X phase - * - * Typically, an arena can for example refill chests with loots. - * You can configure to refill them either every 3rd phase, or only on - * the phase 10 and 20 (completely up to you). - * - * This class is responsible for triggering that chest refil, for example. - */ -public class ArenaTrigger { - - /** - * A list of phase numbers that will trigger, null if {@link #trigger} is set - */ - private final Set<Integer> triggers; - - /** - * If {@link #triggers} is null than this represents each X phase that should triggers - */ - private final int trigger; - - /** - * A phase counter - */ - private int count = 0; - - /** - * Create a new trigger that triggers only on specific phases - * - * @param triggers - */ - public ArenaTrigger(Set<Integer> triggers) { - this(-1, triggers); - } - - /** - * Create a new trigger that triggers every X phase - * - * @param trigger - */ - public ArenaTrigger(int trigger) { - this(trigger, null); - } - - /** - * Internal method, either one must be null, do not use - * - * @param trigger - * @param triggers - */ - private ArenaTrigger(int trigger, Set<Integer> triggers) { - this.trigger = trigger; - this.triggers = triggers; - } - - /** - * Check the arena phase and returns true if we should trigger - * - * @param phase phase - * @return true if trigger - */ - public final boolean trigger(int phase) { - if (triggers != null) - return triggers.contains(phase); - - if (trigger != -1) { - if (++count >= trigger) { - count = 0; - - return true; - } - - return false; - } - - throw new RuntimeException("Dead end triggering " + phase + " phase"); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArmorContent.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArmorContent.java deleted file mode 100644 index 87fefe2b20f9b5773d206c25e9347f2230b3918e..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ArmorContent.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.mineacademy.game.model; - -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.model.ConfigSerializable; - -/** - * Represents armor content in a class tier - */ -public interface ArmorContent extends ConfigSerializable { - - /** - * Get the helmet - * - * @return the item or null if not set - */ - ItemStack getHelmet(); - - /** - * Get the chestplate - * - * @return the item or null if not set - */ - ItemStack getChestplate(); - - /** - * Get the leggings - * - * @return the item or null if not set - */ - ItemStack getLeggings(); - - /** - * Get the boots - * - * @return the item or null if not set - */ - ItemStack getBoots(); - - /** - * Get the item at a certain position of the array - * - * Typically we store helmet, chestplate, leggings and boots in an array - * so calling getByOrder(0) would call items[0] from the array to get - * the helmet, and so on. - * - * @deprecated confusing - * @throws IllegalArgumentException if out of range of the array - * @return the item or null if not set - */ - @Deprecated - ItemStack getByOrder(int order); - - /** - * Give the armor content to a player - * - * @param player the player to give to - */ - void giveTo(Player player); -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/BossBarIndicator.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/BossBarIndicator.java deleted file mode 100644 index 7ea82cc3e09791fe49ea8ab51caeaa88671d6276..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/BossBarIndicator.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.mineacademy.game.model; - -import org.bukkit.boss.BossBar; -import org.bukkit.entity.Player; - -/** - * Represents the boss bar indicator, typicall used to display remaining phase time - */ -public interface BossBarIndicator { - - /** - * Display the bar to a player - * - * @param player the player - */ - void showTo(Player player); - - /** - * Hide the bar from a player - * - * @param player the player - */ - void hideFrom(Player player); - - /** - * Return if the player is currently viewing the bar - * - * @param player the player - * @return true if player sees the bar - */ - boolean hasBar(Player player); - - /** - * Updates the title of this boss bar - * - * @param title the new title - */ - void updateTitle(String title); - - /** - * Updates progress of this boss bar - * See {@link BossBar#setProgress(double)} - * - * @param progress the new progress - */ - void updateProgress(double progress); - - /** - * Updates the color of this boss bar - * - * @param color the new color - */ - void updateColor(ArenaBarColor color); - - /** - * Completely hide the bar from everyone - */ - void hide(); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ClassTier.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ClassTier.java deleted file mode 100644 index 0496a7bd44a53ed25afc7c04ac40c0464b894c7a..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ClassTier.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.mineacademy.game.model; - -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.model.ConfigSerializable; -import org.mineacademy.game.type.TierMode; - -/** - * Represents a class tier - */ -public interface ClassTier extends ConfigSerializable { - - /** - * Get the tier level - * - * @return the tier level - */ - int getTier(); - - /** - * Assign this class tier a new level - * - * @param tier the new level - * - * @deprecated unsafe. You should always make a new instance with another class tier - * and remove the old one instead of changing it. You hold full responsibility for - * handling everything else if you call this method (a lot) - */ - @Deprecated - void setTier(int tier); - - /** - * Get the costs to update to this tier - * - * @return the cost, in Nuggets - */ - int getLevelCost(); - - /** - * Set a new costs to update to this tier - * - * @param cost the new cost - */ - void setLevelCost(int cost); - - /** - * Get the inventory content for this tier - * - * @return the inventory content - */ - ItemStack[] getContent(); - - /** - * Get the armor content for this tier - * - * @return the armor content - */ - ArmorContent getArmor(); - - /** - * Give this tier to the player - * - * @param player the player - * @param mode, how we should give the items - */ - void giveToPlayer(Player player, TierMode mode); - - /** - * Called when the player leaves the arena so you can reverse changes - * such as permissions or special effects - * - * @param player the player - */ - void onArenaLeave(Player player); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Countdown.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Countdown.java deleted file mode 100644 index 373ee4b4723d4528884d072431142ba0b00f311d..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Countdown.java +++ /dev/null @@ -1,168 +0,0 @@ -package org.mineacademy.game.model; - -import java.util.Set; - -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.bukkit.plugin.Plugin; -import org.bukkit.scheduler.BukkitTask; -import org.mineacademy.fo.Common; - -import com.google.common.collect.Sets; - -import lombok.Getter; -import lombok.Setter; - -/** - * Represents a simple countdown you can use to end your arenas - * or lobbies. - */ -public abstract class Countdown implements Runnable { - - /** - * This countdown ticks each one seconds - 20 ticks. - */ - private static final int PERIOD_TICKS = 20; - - /** - * The duration of the countdown - */ - @Getter - private final int duration; - - /** - * The plugin that owns this countdown. - */ - private final Plugin plugin; - - /** - * Moments when the countdown ticks. By default, it ticks - * when there are 720, 360, 180, 60, 30, 20, 10, 8, 6, 5, 4, 3, 2, 1 and 1/2 of the duration seconds left. - * - * You can modify it by {@link #setMoments(Set)} or {@link #getMoments()} and then editing it. - */ - @Getter - @Setter - private Set<Integer> moments = Sets.newHashSet(getDuration() / 2, 720, 360, 180, 60, 30, 20, 10, 8, 6, 5, 4, 3, 2, 1); - - /** - * Seconds since the beginning - */ - @Getter - private int secondsSinceStart = 0; - - /** - * The internal task id - */ - private int taskId = -1; - - /** - * Make a new countdown for a plugin with a certain duration - * - * @param plugin the plugin - * @param duration the duration, in seconds - */ - protected Countdown(Plugin plugin, int duration) { - this.plugin = plugin; - this.duration = duration; - } - - @Override - public final void run() { - secondsSinceStart++; - - if (secondsSinceStart < duration) - try { - onTick(); - - if (moments.contains(getTimeLeft())) - onTickIn(); - else - onTickOut(); - - } catch (final Throwable t) { - Common.error(t, - "Error in countdown!", - "Seconds since start: " + secondsSinceStart, - "Counting till: " + duration + " seconds"); - - } - else { - cancel(); - - onEnd(); - } - } - - /** - * Called each time this countdown loop ticks. - */ - protected abstract void onTick(); - - /** - * Called only in {@link #moments} - */ - protected void onTickIn() { - } - - /** - * Called only out of {@link #moments} - */ - protected void onTickOut() { - } - - /** - * Called at the end of this countdown - */ - protected abstract void onEnd(); - - /** - * Starts this countdown. Please make sure it {@link #isRunning()} - */ - public synchronized final void launch() { - Validate.isTrue(!isRunning(), "Task " + this + " already scheduled!"); - - final BukkitTask task = Bukkit.getScheduler().runTaskTimer(plugin, this, 0, PERIOD_TICKS); - taskId = task.getTaskId(); - } - - /** - * Cancels this countdown. You can start it again later. - */ - public synchronized final void cancel() { - Bukkit.getScheduler().cancelTask(getTaskId()); - - taskId = -1; - secondsSinceStart = 0; - } - - /** - * Get time left - * - * @return the time left, in seconds - */ - public int getTimeLeft() { - return duration - secondsSinceStart; - } - - /** - * Return if the countdown is running - * - * @return if the countdown is running - */ - public final boolean isRunning() { - return taskId != -1; - } - - // Get internal task it and verify if it is running - private final int getTaskId() { - Validate.isTrue(isRunning(), "Task " + this + " not scheduled yet"); - - return taskId; - } - - @Override - public final String toString() { - return getClass().getSimpleName() + "{" + duration + ", id=" + taskId + "}"; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ExpItem.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ExpItem.java deleted file mode 100644 index b9a5f79b6bee65ca50c387fbeaafcee98e6d877c..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/ExpItem.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.mineacademy.game.model; - -import lombok.Data; - -/** - * Represents dropped exp item - */ -@Data -public class ExpItem { - - /** - * How much experience should this item give? - */ - private final int expGiven; -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Iconable.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Iconable.java deleted file mode 100644 index c26c80a6bcb628ae40845d5d1e994bfd58ae9094..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Iconable.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.mineacademy.game.model; - -import org.bukkit.inventory.ItemStack; - -/** - * Represents a menu item that can have an icon - */ -public interface Iconable { - - /** - * Get the icon - * - * @return the icon, or null if not set - */ - ItemStack getIcon(); - - /** - * Is the icon set? - * - * @return true if the icon has been set - */ - boolean hasIcon(); - - /** - * Set a new icon for this menu item - * - * @param icon the new icon, set to null to remove - */ - void setIcon(ItemStack icon); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Lobby.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Lobby.java deleted file mode 100644 index 2bebe7198d73e97952b5e2fc2f5632cb3ba22e4d..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Lobby.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.mineacademy.game.model; - -import org.bukkit.Location; - -/** - * Represents the arena lobby - */ -public interface Lobby { - - /** - * Get the lobby location - * - * @return the location, or null if not exists - */ - Location getLocation(); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Reward.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Reward.java deleted file mode 100644 index 286ed39b444f0331c5ecab5cde8c9bbe3ec03298..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Reward.java +++ /dev/null @@ -1,44 +0,0 @@ -package org.mineacademy.game.model; - -import org.bukkit.inventory.ItemStack; -import org.mineacademy.game.type.RewardType; - -/** - * Represents a material reward that can be purchased for Nuggets - * after the game is finished. - */ -public interface Reward { - - /** - * The reward type - */ - RewardType getType(); - - /** - * The Nugget costs to obtain it - * - * @return the cost - */ - int getCost(); - - /** - * Set a new Nugget cost to obtain it - * - * @param cost the new cost - */ - void setCost(int cost); - - /** - * Get the item for this reward - * - * @return the itemstack - */ - ItemStack getItem(); - - /** - * Set the item for this reward - * - * @param item new item - */ - void setItem(ItemStack item); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Setup.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Setup.java deleted file mode 100644 index e5d923da480e68ea4ef521b1a8ace038faf8728a..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Setup.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.mineacademy.game.model; - -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.Action; - -/** - * Represents the editing stage of an arena - */ -public interface Setup { - - /** - * Gets the player currently editing it - * - * Typically we only support one editor at this time - * - * @return the editor, null if none - */ - Player getEditor(); - - /** - * Is the arena currently being edited? - * - * @return true if the arena is being edited - */ - boolean isEdited(); - - /** - * Is the arena ready to be played? - * Typically all the other boolean flags must be true for this to come true - * - * @return if the arena is ready - */ - boolean isReady(); - - /** - * Is the lobby point set? - * - * @return true if lobby is set - */ - boolean isLobbySet(); - - /** - * Are region points set? - * - * @return if both primary and secondary points are set - */ - boolean isRegionSet(); - - /** - * Is there at least 1 functional spawn point for players? - * - * @return true if arena can spawn players - */ - boolean isPlayerSpawnpointSet(); - - /** - * Is there at least 1 join sign ? Not mandatory. - * - * @return true if join sign exist(s) - */ - boolean areJoinSignsSet(); - - /** - * Called when a player starts editing the arena - * - * @param player the player - */ - void onEnterEditMode(Player player); - - /** - * Called when a player stops editing the arena - * - * @param player the player - */ - void onLeaveEditMode(Player player); - - /** - * Called when a player clicks a block during his editing - * - * Typically used to open Mob Spawner Menu when the spawner is right clicked - * - * @param player the player - * @param action the action - * @param block the clicked block - */ - void onSetupClick(Player player, Action action, Block block); - -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/SpawnPoint.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/SpawnPoint.java deleted file mode 100644 index 576b8b7710dc94723bdf8ba9510f7ca87c6776c4..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/SpawnPoint.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.mineacademy.game.model; - -import org.bukkit.Location; -import org.mineacademy.fo.model.ConfigSerializable; -import org.mineacademy.game.type.SpawnPointType; - -/** - * Represents a simple spawn point - */ -public interface SpawnPoint extends ConfigSerializable { - - /** - * Get the location of this spawn point - * - * @return the location - */ - Location getLocation(); - - /** - * Get this spawn point type - * - * @return the type - */ - SpawnPointType getType(); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/TierSettings.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/TierSettings.java deleted file mode 100644 index 3a383af8bdad79071f3d9ae02706d21b3dad0c3d..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/TierSettings.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.mineacademy.game.model; - -import org.bukkit.potion.PotionEffect; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; - -/** - * Represents the settings section of an {@link ArenaClass} individual tier - */ -@Getter -@Setter -@RequiredArgsConstructor -public final class TierSettings { - - /** - * The tier level - */ - private final int tier; - - /** - * Potion effects that this tier gives - */ - private PotionEffect[] potionEffects; - - /** - * Permissions that this tier gives - */ - private String[] permissionsToGive; -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Upgrade.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Upgrade.java deleted file mode 100644 index b77aa72b2e67b2675136e6443445505200c0a9d4..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/model/Upgrade.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.mineacademy.game.model; - -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -/** - * An upgrade in-game enables the players to - * purchase resources and enhancements during their arena stay. - * - * The upgrade is one-time buy and you buy all the resources specified - * below. Those that are not set, are returned null, and are ignored. - */ -public interface Upgrade { - - /** - * The name of this upgrade. - */ - String getName(); - - /** - * The permission to buy this upgrade. - */ - String getPermission(); - - /** - * From which phase is this upgrade available? - */ - int getUnlockPhase(); - - /** - * Custom items to give to the boy. - */ - ItemStack[] getItems(); - - /** - * Set the new items for this upgrade - * - * @param items the new items - */ - void setItems(ItemStack[] items); - - /** - * Gives the upgrade to the player - * - * @param player the player - */ - void giveToPlayer(Player player); - - /** - * Permanently removes the upgrade - */ - void deleteUpgrade(); -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/physics/BlockPhysics.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/physics/BlockPhysics.java deleted file mode 100644 index ed9ca4c815c9339281c682b8f159ec4812b040ee..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/physics/BlockPhysics.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.mineacademy.game.physics; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.block.BlockState; -import org.bukkit.entity.FallingBlock; -import org.bukkit.scheduler.BukkitRunnable; -import org.bukkit.util.Vector; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.BlockUtil; -import org.mineacademy.fo.MathUtil; -import org.mineacademy.fo.RandomUtil; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.util.FallingLimitter; - -public class BlockPhysics { - - public static boolean canExplode(Material material) { - if (material.toString().contains("STEP") || material.toString().contains("SLAB")) - return true; - - return BlockUtil.isForBlockSelection(material); - } - - public static void pushAway(Arena arena, BlockState block, Vector velocity) { - final Material type = block.getType(); - - if (type == Material.AIR || !canExplode(type)) - return; - - final FallingBlock falling = block.getWorld().spawnFallingBlock(block.getLocation(), block.getData().getItemType(), block.getData().getData()); - - final double x = MathUtil.range(velocity.getX(), -2, 2) * 0.5D; //0.15D + (b.getY() - startingPoint.getY()) * 0.03D; - final double y = Math.random(); //(block.getX() /*- startingPoint.getX()*/) * 0.1D; - final double z = MathUtil.range(velocity.getZ(), -2, 2) * 0.5D; - - falling.setVelocity(new Vector(x, y, z)); - falling.setDropItem(false); - - if (RandomUtil.chance(12) && type.isBurnable()) - scheduleBurnOnFall(falling); - - FallingLimitter.add(arena, falling); - - block.setType(Material.AIR); - } - - private static void scheduleBurnOnFall(FallingBlock block) { - new BukkitRunnable() { - - int uplynulo = 0; - - @Override - public void run() { - if (uplynulo++ > 20 * 10) { - cancel(); - return; - } - - if (block.isOnGround()) { - final Block up = block.getLocation().getBlock().getRelative(BlockFace.UP); - - if (up.getType() == Material.AIR) - up.setType(Material.FIRE); - - cancel(); - } - } - }.runTaskTimer(SimplePlugin.getInstance(), 0, 1); - } - - public static final void applyGravitation(Arena arena, Block block, int recursionCount, boolean forceCheck, int wait) { - new BlockPhysicsCheckTask(arena, block, recursionCount, forceCheck).runTaskLater(CoreArenaPlugin.getInstance(), wait); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/physics/BlockPhysicsCheckTask.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/physics/BlockPhysicsCheckTask.java deleted file mode 100644 index 999b406e45e6d933c4ab1c6e467439968a203eff..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/physics/BlockPhysicsCheckTask.java +++ /dev/null @@ -1,156 +0,0 @@ -package org.mineacademy.game.physics; - -import static org.bukkit.Material.AIR; -import static org.bukkit.Material.TORCH; -import static org.mineacademy.game.physics.BlockPhysics.applyGravitation; - -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.FallingBlock; -import org.bukkit.scheduler.BukkitRunnable; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.BlockUtil; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.util.FallingLimitter; - -public class BlockPhysicsCheckTask extends BukkitRunnable { - - private static volatile StrictList<BukkitRunnable> activeTasks = new StrictList<>(); - - public static final void cancelRunning() { - for (final BukkitRunnable r : activeTasks) - try { - r.cancel(); - } catch (final IllegalStateException ex) { - } - } - - private final Arena arena; - - /** - * Target block. - */ - private final Block block; - - /** - * Recursion count. - */ - private final int recursionCount; - - /** - * Will the the adjacent blocks be checked no matter if the center falls or not? - */ - private final boolean forced; - - protected BlockPhysicsCheckTask(Arena arena, Block block, int recursionCount, boolean forced) { - this.arena = arena; - this.block = block; - this.recursionCount = recursionCount; - this.forced = forced; - - activeTasks.add(this); - } - - @Override - public void run() { - boolean fall = false; - - final Block under = block.getRelative(BlockFace.DOWN); - - if ((under.getType() == AIR || under.isLiquid() || under.getType() == TORCH) && BlockPhysics.canExplode(block.getType())) { - fallBlock(block); - fall = true; - } - - if ((fall || forced) && recursionCount >= 0) { - final GravitationHelper force = new GravitationHelper(); - - if (forced) { - final int recursion = 6; - - for (int i = 0; i < recursion; i++) - force.applyUp(i); - - for (int i = 0; i < recursion; i++) - force.applyDown(i); - } - - final BlockFace[] faces = new BlockFace[] { BlockFace.UP, BlockFace.DOWN, BlockFace.EAST, BlockFace.WEST, BlockFace.NORTH, BlockFace.SOUTH }; - int wait = 1; - - for (final BlockFace face : faces) - force.applySingle(face, wait++); - } - - activeTasks.remove(this); - } - - private final class GravitationHelper { - - private void applySingle(BlockFace face, int wait) { - apply(face, 1, wait); - } - - private void applyUp(int distance) { - apply(BlockFace.UP, distance, distance); - } - - private void applyDown(int distance) { - apply(BlockFace.DOWN, distance, distance); - } - - private void apply(BlockFace face, int distance, int wait) { - final Block neighbor = block.getRelative(face, distance); - - applyGravitation(arena, neighbor, recursionCount - 1, false, wait); - } - } - - private final void fallBlock(Block block) { - final Material type = block.getType(); - - if (!BlockPhysics.canExplode(type)) - return; - - final Arena otherArena = CoreArenaPlugin.getArenaManager().findArena(block.getLocation()); - - if (otherArena == null || !arena.getName().equals(otherArena.getName())) - return; - - if (type == Material.GRASS || type == CompMaterial.MYCELIUM.getMaterial()) - block.setType(Material.DIRT); - - final FallingBlock falling = block.getWorld().spawnFallingBlock(block.getLocation().add(0.5D, 0.0D, 0.5D), block.getType(), block.getData()); - - falling.setDropItem(false); - - // Remove original block - block.setType(Material.AIR); - - // Break torches - { - Block current = block; - Block below = block.getRelative(BlockFace.DOWN); - - // Check downwards and break any obstructing blocks - for (int y = current.getY(); y > 0; y--) { - - // Only breaks if the block below is solid and the block on top is transparent - if (below.getType().isSolid()) { - if (BlockUtil.isBreakingFallingBlock(current.getType())) - current.breakNaturally(); - - //Will land on the block below - break; - } - current = below; - below = current.getRelative(BlockFace.DOWN); - } - } - - FallingLimitter.add(arena, falling); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/settings/Localization.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/settings/Localization.java deleted file mode 100644 index 5829aae3a6bc35496986c7ffb3f2c0128ff31421..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/settings/Localization.java +++ /dev/null @@ -1,796 +0,0 @@ -package org.mineacademy.game.settings; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.bukkit.ChatColor; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.model.Replacer; -import org.mineacademy.fo.model.SimpleSound; -import org.mineacademy.fo.settings.SimpleLocalization; -import org.mineacademy.fo.settings.YamlConfig.CasusHelper; -import org.mineacademy.fo.settings.YamlConfig.TitleHelper; -import org.mineacademy.game.model.ArenaBarColor; - -@SuppressWarnings("unused") -public final class Localization extends SimpleLocalization { - - @Override - protected int getConfigVersion() { - return 1; - } - - /** - * @see org.mineacademy.fo.settings.YamlConfig#saveComments() - */ - @Override - protected boolean saveComments() { - return false; - } - - // -------------------------------------------------------------------------------------------------------- - // The actual implementation - // -------------------------------------------------------------------------------------------------------- - - private static void init() { - } - - public static final class Edit { - public static String SAVED_CHANGES; - - private static void init() { - pathPrefix("Edit"); - SAVED_CHANGES = getOrSetDefault("Saved_Changes", "&2Your changes have been saved."); - } - - public static final class Menu { - - public static String EDITING_PIECES; - public static String EDITING_ITEMS; - - public static Replacer START_EDITING; - - private static void init() { - pathPrefix("Edit.Menu"); - START_EDITING = Replacer.of(getOrSetDefault("Edited", "&eYou are editing {mode}")); - EDITING_PIECES = getOrSetDefault("Switch_Pieces", "Click to switch to editing prices."); - EDITING_ITEMS = getOrSetDefault("Switch_Items", "Click to switch to editing items."); - } - } - } - - public static final class Arena { - - public static String CANNOT_DO_WHILE_EDITING; - - private static void init() { - pathPrefix("Arena"); - - CANNOT_DO_WHILE_EDITING = getString("Action_Denied_While_Editing"); - } - - public static class Error { - public static String NOT_FOUND; - public static String NOT_CONFIGURED; - public static String NOT_ENABLED; - public static String NO_PERMISSION; - public static String EDITED; - public static String ALREADY_PLAYING; - public static String ALREADY_RUNNING; - public static String FULL; - public static String NO_ARENA_AT_LOCATION; - public static String INVENTORY_NOT_EMPTY; - public static String ILLEGAL_COMMAND; - - private static void init() { - pathPrefix("Arena.Error"); - - NOT_ENABLED = getString("Not_Enabled"); - NOT_FOUND = getString("Not_Found"); - NOT_CONFIGURED = getString("Not_Ready"); - NO_PERMISSION = getString("No_Permission"); - EDITED = getString("Edited"); - ALREADY_PLAYING = getString("Already_Playing"); - ALREADY_RUNNING = getString("Already_Running"); - FULL = getString("Full"); - NO_ARENA_AT_LOCATION = getString("No_Arena_At_Location"); - INVENTORY_NOT_EMPTY = getString("Inventory_Not_Empty"); - ILLEGAL_COMMAND = getString("Cannot_Run_Command_In_Arena"); - } - } - - public static class Setup { - public static String CANNOT_EDIT; - public static String CANNOT_CLONE; - public static String CLONE_MOB_UNKNOWN; - - private static void init() { - pathPrefix("Arena.Setup"); - - CANNOT_EDIT = getString("Cannot_Edit"); - CANNOT_CLONE = getString("Cannot_Clone"); - CLONE_MOB_UNKNOWN = getString("Clone_Mob_Spawnpoint_Unknown"); - } - } - - public static class Lobby { - public static String JOIN_PLAYER; - public static String JOIN_OTHERS; - public static String START_COUNTDOWN; - public static String FAIL_START_NOT_ENOUGH_PLAYERS; - public static String KICK_NO_CLASS; - public static String TIER_TOO_LOW; - - private static void init() { - pathPrefix("Arena.Lobby"); - - JOIN_PLAYER = getString("Join_Player"); - JOIN_OTHERS = getString("Join_Others"); - START_COUNTDOWN = getString("Start_Countdown"); - FAIL_START_NOT_ENOUGH_PLAYERS = getString("Not_Enough_Players"); - KICK_NO_CLASS = getString("Kick_No_Class"); - TIER_TOO_LOW = getString("Tier_Too_Low"); - } - } - - public static class Game { - public static String START; - public static String END_WARNING; - public static String END_GENERIC; - public static String END_LAST_LEFT; - public static String DEATH_TO_VICTIM; - public static String DEATH_BROADCAST; - public static String KICK_DEATH_TO_VICTIM; - public static String KICK_DEATH_BROADCAST; - public static String KILL_TO_VICTIM; - public static String KILL_BROADCAST; - public static String KICK_KILL_BROADCAST; - public static String KICK_KILL_TO_VICTIM; - public static String CLASS_AUTO_ASSIGNED; - public static String FRIENDLY_FIRE_ACTIVATED; - public static String EXPLOSIVE_ARROW_NO_AMMO; - - private static void init() { - pathPrefix("Arena.Game"); - - START = getString("Start"); - END_WARNING = getString("End_Countdown"); - END_GENERIC = getString("End"); - END_LAST_LEFT = getString("End_Last_Player"); - DEATH_TO_VICTIM = getString("Death_To_Victim"); - DEATH_BROADCAST = getString("Death_Broadcast"); - KICK_DEATH_TO_VICTIM = getString("Kick_Death_To_Victim"); - KICK_DEATH_BROADCAST = getString("Kick_Death_Broadcast"); - KILL_BROADCAST = getString("Kill_Broadcast"); - KILL_TO_VICTIM = getString("Kill_To_Victim"); - KICK_KILL_BROADCAST = getString("Kick_Kill_Broadcast"); - KICK_KILL_TO_VICTIM = getString("Kick_Kill_To_Victim"); - CLASS_AUTO_ASSIGNED = getString("Class_Auto_Assigned"); - FRIENDLY_FIRE_ACTIVATED = getString("Friendly_Fire_Activated"); - EXPLOSIVE_ARROW_NO_AMMO = getString("Explosive_Arrow_No_Ammo"); - } - } - - public static class State { - public static String STOPPED, LOBBY, RUNNING; - - private static void init() { - pathPrefix("Arena.State"); - - STOPPED = getString("Stopped"); - LOBBY = getString("Lobby"); - RUNNING = getString("Running"); - } - } - } - - public static class Experience { - public static String NEXT_PHASE; - public static String PICKUP; - - private static void init() { - pathPrefix("Experience"); - - NEXT_PHASE = getString("Next_Phase"); - PICKUP = getString("Pickup"); - } - } - - public static class Upgrades { - public static String LOCKED; - public static String LACK_LEVELS; - public static String LACK_SPACE; - public static String SUCCESSFUL_PURCHASE; - - private static void init() { - pathPrefix("Upgrades"); - - LOCKED = getString("Locked"); - LACK_LEVELS = getString("Lack_Levels"); - LACK_SPACE = getString("Lack_Space"); - SUCCESSFUL_PURCHASE = getString("Successful_Purchase"); - } - } - - public static class Bossbar { - public static String TITLE; - public static String NEXT_PHASE; - - public static ArenaBarColor COLOR_START, COLOR_MID, COLOR_END; - - private static void init() { - pathPrefix("Bossbar"); - - TITLE = getString("Title"); - NEXT_PHASE = getString("Next_Phase"); - - pathPrefix("Bossbar.Color"); - - COLOR_START = ReflectionUtil.lookupEnum(ArenaBarColor.class, getString("Start")); - COLOR_MID = ReflectionUtil.lookupEnum(ArenaBarColor.class, getString("Mid")); - COLOR_END = ReflectionUtil.lookupEnum(ArenaBarColor.class, getString("Near_End")); - } - } - - public static class Phase { - - public static String NEXT_WAIT; - - private static void init() { - pathPrefix("Phase"); - - NEXT_WAIT = getString("Next_Phase_Wait"); - } - - public static class Max { - public static String TEXT; - public static SimpleSound SOUND; - - private static void init() { - pathPrefix("Phase.Max_Phase"); - - TEXT = getString("Text"); - SOUND = getSound("Sound"); - } - } - } - - public static class Title { - public static TitleHelper KICK; - public static TitleHelper ESCAPE; - - private static void init() { - pathPrefix("Title"); - - KICK = getTitle("Kick"); - ESCAPE = getTitle("Escape"); - } - } - - public static class Currency { - private static CasusHelper NAME; - private static ChatColor COLOR; - public static String RECEIVED; - - private static void init() { - pathPrefix("Currency"); - - NAME = getCasus("Name"); - COLOR = ReflectionUtil.lookupEnum(ChatColor.class, getString("Color")); - - RECEIVED = getString("Received"); - } - - public static String rawPluralName() { - return NAME.getPlural(); - } - - public static String format(final int count) { - return COLOR.toString() + NAME.formatWithCount(count); - } - } - - public static class Menu { - public static String CANNOT_OPEN_IN_ARENA; - public static String CANNOT_OPEN_OUTSIDE_ARENA; - public static String CANNOT_OPEN_OUTSIDE_LOBBY; - public static String USE_CLASS_MENU; - - private static void init() { - pathPrefix("Menu"); - - CANNOT_OPEN_IN_ARENA = getString("Cannot_Open_In_Arena"); - CANNOT_OPEN_OUTSIDE_ARENA = getString("Cannot_Open_Outside_Arena"); - CANNOT_OPEN_OUTSIDE_LOBBY = getString("Cannot_Open_Outside_Lobby"); - USE_CLASS_MENU = getOrSetDefault("Use_Class_Menu", "&cPlease use the class menu to edit class upgrades"); - } - - public static class Rewards { - public static String CLASS_NOT_CONFIGURED; - - public static String SELECT_CLASS = "Select a class"; - public static String LABEL; - public static String ITEMS, BLOCKS, PACKS, CLASS; - public static String CHOOSE_A_REWARD; - - public static String TIER_ALREADY_BOUGHT; - public static String TIER_TOO_HIGH; - // - public static String TIER_MAXIMUM; - public static String TIER_TOP; - public static String TIER_NEXT; - public static String NOT_SET_HELMET; - public static String NOT_SET_CHESTPLATE; - public static String NOT_SET_LEGGINGS; - public static String NOT_SET_BOOTS; - public static String TIER_ADDED; - public static String TIER_IS_LOCKED; - - public static String[] INFO_EDIT_PIECES; - - public static String[] INFO_EDIT_ITEMS; - - public static Replacer INFO_PURCHASE; - public static Replacer MORE_NUGGETS_NEEDED; - - public static Replacer PURCHASED_TIER_MESSAGE; - - public static Replacer PURCHASED_TIER_TITLE; - - public static Replacer BOUGHT; - - public static List<String> ITEMS_DESCRIPTION, BLOCKS_DESCRIPTION, PACKS_DESCRIPTION, CLASS_DESCRIPTION; - public static List<String> INFO_PLAYER, INFO_ADMIN; - - private static void init() { - pathPrefix("Menu.Rewards"); - - // Data is stored as List internally. Would throw an class-cast exception otherwise - INFO_EDIT_ITEMS = getOrSetDefault("Info.Edit.Items", Arrays.asList("&7To edit the rewards, simply", "&emove &7items from your inventory here.")).toArray(new String[0]); - INFO_EDIT_PIECES = getOrSetDefault("Info.Edit.Pieces", Collections.singletonList("&eClick &7an item to set its price")).toArray(new String[0]); - INFO_PURCHASE = Replacer.of(getOrSetDefault("Info.Purchase", Arrays.asList("&7Balance: &f{balance}", "", "&7Click to make a purchase.", " ", "&7The item wil be saved to", "&7your inventory.")).toArray(new String[0])); - - CLASS_NOT_CONFIGURED = getOrSetDefault("Class_Not_Yet_Configured", "&c&oClass yet not configured!"); - SELECT_CLASS = getOrSetDefault("Select_Class", "Select a class"); - TIER_ALREADY_BOUGHT = getOrSetDefault("Tier.Already_Bought", "&4Thou already hast this tier!"); - TIER_TOO_HIGH = getOrSetDefault("Tier.Too_High", "&4This tier is too high for you!"); - CHOOSE_A_REWARD = getOrSetDefault("Choose_Reward", "Choose a Reward"); - MORE_NUGGETS_NEEDED = Replacer.of(getOrSetDefault("More_Nuggets_Needed", "&4You need {reward_cost} Nuggets for this")); - BOUGHT = Replacer.of(getOrSetDefault("Bought_Reward", "&2Bought! Remaining: {remaining}")); - - TIER_MAXIMUM = getOrSetDefault("Tier.Maximum_Reached", "&2You have the maximum tier"); - TIER_TOP = getOrSetDefault("Tier.Top", "&cThis is the top tier"); - TIER_NEXT = getOrSetDefault("Tier.Next", "&dNext Tier ->"); - TIER_IS_LOCKED = getOrSetDefault("Tier.Locked", "&cTier is locked"); - TIER_ADDED = getOrSetDefault("Tier.Added", "&7Added Tier"); - NOT_SET_HELMET = getOrSetDefault("Not_Set.Helmet", "&7Helmet not set"); - NOT_SET_CHESTPLATE = getOrSetDefault("Not_Set.Chestplate", "&7Chestplate not set"); - NOT_SET_LEGGINGS = getOrSetDefault("Not_Set.Leggings", "&7Leggings not set"); - NOT_SET_BOOTS = getOrSetDefault("Not_Set.Boots", "&7Boots not set"); - - PURCHASED_TIER_MESSAGE = Replacer.of(getOrSetDefault("Tier.Purchased", "&6You have purchased {name} Tier {tier}")); - PURCHASED_TIER_TITLE = Replacer.of(getOrSetDefault("Tier.Purchased_Menu_Title", "&2Bought tier {tier} !")); - - ITEMS = getString("Items_Label"); - BLOCKS = getString("Blocks_Label"); - PACKS = getString("Packs_Label"); - CLASS = getString("Class_Label"); - - ITEMS_DESCRIPTION = loadDescription("Items_Description"); - BLOCKS_DESCRIPTION = loadDescription("Blocks_Description"); - PACKS_DESCRIPTION = loadDescription("Packs_Description"); - CLASS_DESCRIPTION = loadDescription("Class_Description"); - - INFO_PLAYER = loadDescription("Info_Player"); - INFO_ADMIN = loadDescription("Info_Admin"); - LABEL = getOrSetDefault("Label", "&8Rewards"); - } - - private static List<String> loadDescription(final String path) { - return Arrays.asList(getString(path).split("\n")); - } - } - } - - public static class Commands { - public static String DISALLOWED_WHILE_PLAYING; - - private static void init() { - pathPrefix("Commands"); - - DISALLOWED_WHILE_PLAYING = getString("Disallowed_While_Playing"); - } - - public static class Join { - public static String SUGGEST; - - private static void init() { - pathPrefix("Commands.Join"); - - SUGGEST = getString("Suggest"); - } - } - - public static class Leave { - public static String NOT_PLAYING; - public static String SUCCESS; - - private static void init() { - pathPrefix("Commands.Leave"); - - NOT_PLAYING = getString("Not_Playing"); - SUCCESS = getString("Success"); - } - } - - public static class Start { - public static String NOT_LOBBY; - public static String SUCCESS; - public static String FAIL; - - private static void init() { - pathPrefix("Commands.Start"); - - NOT_LOBBY = getString("Not_Lobby"); - SUCCESS = getString("Success"); - FAIL = getString("Fail"); - } - } - - public static class Stop { - public static String ALREADY_STOPPED; - public static String SUCCESS; - - private static void init() { - pathPrefix("Commands.Stop"); - - ALREADY_STOPPED = getString("Already_Stopped"); - SUCCESS = getString("Success"); - } - } - - public static class Menu { - public static String LOOKUP_FAILED; - - private static void init() { - pathPrefix("Commands.Menu"); - - LOOKUP_FAILED = getString("Lookup_Failed"); - } - } - - public static class Nuggets { - public static String SPECIFY_PLAYER; - public static String INVALID_PARAM; - public static String INVALID_AMOUNT; - public static String BALANCE; - public static String BALANCE_OTHER; - public static String SET; - public static String GAVE; - public static String TOOK; - - private static void init() { - pathPrefix("Commands.Nuggets"); - - SPECIFY_PLAYER = getString("Specify_Player"); - BALANCE = getString("Balance"); - BALANCE_OTHER = getString("Balance_Other"); - INVALID_PARAM = getString("Invalid_Parameter"); - INVALID_AMOUNT = getString("Invalid_Amount"); - SET = getString("Set"); - GAVE = getString("Gave"); - TOOK = getString("Took"); - } - } - - public static class Edit { - public static String ARENA_RUNNING; - public static String ALREADY_EDITING; - public static String ENABLED; - public static String DISABLED; - - private static void init() { - pathPrefix("Commands.Edit"); - - ARENA_RUNNING = getString("Arena_Running"); - ALREADY_EDITING = getString("Already_Editing"); - ENABLED = getString("Enabled"); - DISABLED = getString("Disabled"); - } - } - - public static class Find { - public static String WRONG_SYNTAX; - public static String NOT_FOUND; - public static String NOT_FOUND_LOCATION; - public static String FOUND; - public static String FOUND_OTHER; - public static String FOUND_LOCATION; - - private static void init() { - pathPrefix("Commands.Find"); - - WRONG_SYNTAX = getString("Wrong_Syntax"); - NOT_FOUND = getString("Not_Found"); - NOT_FOUND_LOCATION = getString("Not_Found_Location"); - FOUND = getString("Found"); - FOUND_OTHER = getString("Found_Other"); - FOUND_LOCATION = getString("Found_Location"); - } - } - - public static class Change_State { - public static Replacer DISABLED; - public static Replacer ENABLED; - - private static void init() { - pathPrefix("Commands.Change_State"); - DISABLED = getReplacer("Disabled"); - ENABLED = getReplacer("Enabled"); - } - } - } - - public static class Conversation { - public static String INVALID_INPUT; - public static String CANCELLED; - public static String NUMBER_HELP; - - private static void init() { - pathPrefix("Conversation"); - - INVALID_INPUT = getString("Invalid_Input"); - CANCELLED = getString("Stopped"); - NUMBER_HELP = getString("Number_Help"); - } - - public static class New { - public static String HELP; - public static String ALREADY_EXISTS; - public static String NO_SPACES; - public static String SUCCESS; - public static String SUCCESS_ARENA; - public static String ERROR; - - private static void init() { - pathPrefix("Conversation.New"); - - HELP = getString("Help"); - ALREADY_EXISTS = getString("Already_Exists"); - NO_SPACES = getString("No_Spaces"); - SUCCESS = getString("Success"); - SUCCESS_ARENA = getString("Success_Arena"); - ERROR = getString("Error"); - } - } - - public static class Tier { - public static String HELP; - public static String PRICE_SET; - - private static void init() { - pathPrefix("Conversation.Tier"); - - HELP = getString("Help"); - PRICE_SET = getString("Price_Set"); - } - } - - public static class Reward { - public static String HELP; - public static String PRICE_SET; - - private static void init() { - pathPrefix("Conversation.Reward"); - - HELP = getString("Help"); - PRICE_SET = getString("Price_Set"); - } - } - - public static class SpawnerMinPlayers { - public static String HELP; - public static String SET; - - private static void init() { - pathPrefix("Conversation.Spawner_Minimum_Players"); - - HELP = getString("Help"); - SET = getString("Set"); - } - } - - public static class SpawnerChance { - public static String HELP; - public static String SET; - - private static void init() { - pathPrefix("Conversation.Spawner_Chance"); - - HELP = getString("Help"); - SET = getString("Set"); - } - } - - public static class Phase { - public static String MATCHER; - public static String[] HELP; - public static String SET_FROM; - public static String SET_ON; - public static String SET_TILL; - public static String SET_BETWEEN; - - private static void init() { - pathPrefix("Conversation.Phase"); - - MATCHER = getString("Input_Matcher"); - - HELP = getStringArray("Help"); - SET_FROM = getString("Set_From"); - SET_ON = getString("Set_On"); - SET_TILL = getString("Set_Till"); - SET_BETWEEN = getString("Set_Between"); - } - } - } - - public static class Signs { - public static String REMOVED_OUTSIDE_SIGN; - public static String REMOVED; - public static String OUTSIDE_ARENA; - public static String OBJECT_NOT_FOUND; - public static String CREATED; - - private static void init() { - pathPrefix("Signs"); - - REMOVED_OUTSIDE_SIGN = getString("Removed_Outside_Arena"); - REMOVED = getString("Removed"); - OUTSIDE_ARENA = getString("Outside_Arena"); - OBJECT_NOT_FOUND = getString("Object_Not_Found"); - CREATED = getString("Created"); - } - - public static class Arena { - public static String[] HELP; - - private static void init() { - pathPrefix("Signs.Arena"); - - HELP = getStringArray("Help"); - } - } - - public static class Class { - public static String[] HELP; - - private static void init() { - pathPrefix("Signs.Class"); - - HELP = getStringArray("Help"); - } - } - - public static class Upgrade { - public static String[] HELP; - public static String COST_MISSING; - public static String COST_INVALID; - - private static void init() { - pathPrefix("Signs.Upgrade"); - - HELP = getStringArray("Help"); - COST_MISSING = getString("Cost_Missing"); - COST_INVALID = getString("Cost_Invalid"); - } - } - - public static class Power { - public static String[] HELP; - public static String TYPE_INVALID; - - private static void init() { - pathPrefix("Signs.Power"); - - HELP = getStringArray("Help"); - TYPE_INVALID = getString("Type_Invalid"); - } - } - } - - public static class Player { - public static String NEVER_PLAYED; - public static String NEVER_PLAYED_ARENA; - public static String NOT_FOUND; - public static String NOT_ONLINE; - public static String NOT_PLAYING; - - private static void init() { - pathPrefix("Player"); - - NEVER_PLAYED = getString("Never_Played"); - NEVER_PLAYED_ARENA = getString("Never_Played_Arena"); - NOT_FOUND = getString("Not_Found"); - NOT_ONLINE = getString("Not_Online"); - NOT_PLAYING = getString("Not_Playing"); - } - } - - public static class Class { - public static String SELECTED, NO_PERMISSION, NOT_AVAILABLE; - - private static void init() { - pathPrefix("Class"); - - SELECTED = getString("Selected"); - NO_PERMISSION = getString("No_Permission"); - NOT_AVAILABLE = getString("Not_Available"); - } - } - - public static class World { - public static String NOT_FOUND; - - private static void init() { - pathPrefix("World"); - - NOT_FOUND = getString("Not_Found"); - } - } - - public static class Cases { - public static CasusHelper PLAYER; - public static CasusHelper LEVEL; - public static CasusHelper EXP; - public static CasusHelper NUGGET; - public static CasusHelper HOUR; - public static CasusHelper MINUTE; - public static CasusHelper SECOND; - public static CasusHelper LIFE; - - private static void init() { - pathPrefix("Cases"); - - PLAYER = getCasus("Player"); - LEVEL = getCasus("Level"); - EXP = getCasus("Exp"); - NUGGET = getCasus("Nugget"); - HOUR = getCasus("Hour"); - MINUTE = getCasus("Minute"); - SECOND = getCasus("Second"); - LIFE = getCasus("Life"); - LEVEL = getCasus("Level"); - } - } - - public static class Parts { - public static String COST; - public static String USAGE; - public static String AMOUNT; - public static String STATE; - public static String SIZE; - public static String PLAYERS; - public static String NONE; - public static String BUY; - public static String EDIT; - public static String PURCHASE; - public static String PRICE; - - private static void init() { - pathPrefix("Parts"); - - USAGE = getString("Usage"); - AMOUNT = getString("Amount"); - STATE = getString("State"); - SIZE = getString("Size"); - PLAYERS = getString("Players"); - NONE = getString("None"); - BUY = getOrSetDefault("Buy", "Buy"); - EDIT = getOrSetDefault("Edit", "Edit"); - COST = getOrSetDefault("Cost", "Cost"); - PURCHASE = getOrSetDefault("Purchase", "Purchase"); - PRICE = getOrSetDefault("Price", "Price"); - } - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/settings/Settings.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/settings/Settings.java deleted file mode 100644 index 1d179c0e745f2575e363fe56eb3de8b6b24d1708..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/settings/Settings.java +++ /dev/null @@ -1,346 +0,0 @@ -package org.mineacademy.game.settings; - -import java.util.List; -import java.util.Map.Entry; - -import org.bukkit.entity.Entity; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.collection.StrictSet; -import org.mineacademy.fo.model.SimpleTime; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.CompMonsterEgg; -import org.mineacademy.fo.settings.SimpleSettings; -import org.mineacademy.game.exp.ExpFormula; -import org.mineacademy.game.impl.MySQLDatabase; - -@SuppressWarnings("unused") -public final class Settings extends SimpleSettings { - - @Override - protected int getConfigVersion() { - return 5; - } - - /** - * @see org.mineacademy.fo.settings.YamlConfig#saveComments() - */ - @Override - protected boolean saveComments() { - return false; - } - - public static final class Arena { - - public static Boolean STORE_INVENTORIES = false; - public static Boolean GIVE_RANDOM_CLASS_IF_NOT_SELECTED; - public static Boolean KEEP_OWN_EQUIPMENT; - public static Boolean MOVE_FORGOTTEN_PLAYERS; - public static Boolean AUTO_REPAIR_ITEMS; - public static Boolean SHOW_PHASE_BAR; - public static Boolean SHOW_HEALTH_BAR; - public static Boolean HIDE_DEATH_MESSAGES; - public static Boolean CONSOLE_CMD_FOREACH; - public static StrictSet<String> ALLOWED_COMMANDS; - - private static void init() { - pathPrefix("Arena"); - - STORE_INVENTORIES = getBoolean("Store_Inventories"); - GIVE_RANDOM_CLASS_IF_NOT_SELECTED = getBoolean("Give_Random_Class_If_Not_Selected"); - KEEP_OWN_EQUIPMENT = getBoolean("Keep_Own_Equipment_On_Death"); - MOVE_FORGOTTEN_PLAYERS = getBoolean("Move_Forgotten_Players"); - AUTO_REPAIR_ITEMS = getBoolean("Auto_Repair_Items"); - SHOW_PHASE_BAR = getBoolean("Display_Phase_Bar"); - SHOW_HEALTH_BAR = getBoolean("Display_Mob_Health_Bar"); - HIDE_DEATH_MESSAGES = getBoolean("Hide_Death_Messages"); - CONSOLE_CMD_FOREACH = getBoolean("Console_Commands_For_Each"); - ALLOWED_COMMANDS = new StrictSet<>(getStringList("Allowed_Commands")); - } - - public static final class Chat { - - public static Boolean ENABLED; - public static Boolean RANGED; - public static String FORMAT; - public static String GLOBAL_FORMAT; - - private static void init() { - pathPrefix("Arena.Chat"); - - ENABLED = getBoolean("Enabled"); - RANGED = getBoolean("Ranged"); - FORMAT = getString("Format"); - GLOBAL_FORMAT = getString("Global_Format"); - - } - } - - public static final class Integration { - - public static Boolean MCMMO_BLOCK_EXP, JOBS_BLOCK_LEVELUP; - - private static void init() { - pathPrefix("Arena.Integration"); - - MCMMO_BLOCK_EXP = getBoolean("Block_McMMO_Experience"); - JOBS_BLOCK_LEVELUP = getBoolean("Block_Jobs_Level_Up"); - } - } - } - - public static final class Experience { - - public static Integer EXP_PER_LEVEL; - public static Double LEVEL_TO_NUGET_CONVERSION_RATIO; - - public static Boolean REWARD_ESCAPE; - - public static CompMaterial ITEM; - public static String ITEM_LABEL; - - private static void init() { - - pathPrefix("Experience"); - EXP_PER_LEVEL = getInteger("Exp_Per_Level"); - LEVEL_TO_NUGET_CONVERSION_RATIO = getDouble("Level_To_Nugget_Conversion_Ratio"); - REWARD_ESCAPE = getBoolean("Reward_On_Escape"); - - final String itemRaw = getString("Item"); - ITEM = !itemRaw.isEmpty() && !"none".equals(itemRaw) ? CompMaterial.fromString(itemRaw) : CompMaterial.AIR; - - if (ITEM == null) - ITEM = CompMaterial.BLUE_DYE; - - ITEM_LABEL = getString("Item_Label"); - } - - public static final class Gold { - - public static Integer CONVERSION_RATIO; - public static String CURRENCY_NAME; - - private static void init() { - pathPrefix("Experience.Gold"); - - CONVERSION_RATIO = getInteger("Conversion_Ratio"); - CURRENCY_NAME = getString("Currency_Backup_Name"); - } - } - - public static final class Amount { - - public static ExpFormula NEXT_PHASE; - private static ExpFormula MOB_KILL_GLOBAL; - private static StrictMap<String, ExpFormula> MOB_KILL; - - private static void init() { - pathPrefix("Experience.Amount"); - - NEXT_PHASE = new ExpFormula(getString("Next_Phase")); - MOB_KILL = new StrictMap<>(); - - for (final Entry<String, Object> e : getMap("Kill", String.class, Object.class).entrySet()) { - - final String entityRaw = e.getKey(); - final ExpFormula formula = new ExpFormula(e.getValue().toString()); - - if ("global".equals(entityRaw.toLowerCase())) { - MOB_KILL_GLOBAL = formula; - - continue; - } - - MOB_KILL.put(e.getKey().toLowerCase(), formula); - } - } - - public static ExpFormula getExpFor(Entity entity) { - final String bossName = null; - final String name = (bossName != null ? bossName : entity.getType().toString()).toLowerCase(); - - return MOB_KILL.contains(name) ? MOB_KILL.get(name) : MOB_KILL_GLOBAL; - } - } - } - - public static final class ProceduralDamage { - - public static Boolean ENABLED; - - private static void init() { - pathPrefix("Procedural_Damage"); - - ENABLED = getBoolean("Enabled"); - } - - public static final class Explosions { - - public static Float POWER_CREEPER, POWER_TNT; - public static Double DAMAGE_RADIUS, DAMAGE_DAMAGE; - public static Integer GRAVITATION_RADIUS_CHECK; - - private static void init() { - pathPrefix("Procedural_Damage.Explosions"); - GRAVITATION_RADIUS_CHECK = getInteger("Gravitation_Range"); - - pathPrefix("Procedural_Damage.Explosions.Power"); - POWER_CREEPER = (float) getDouble("Creeper"); - POWER_TNT = (float) getDouble("TnT"); - - if (VERSION < 4 && isSetAbsolute("Procedural_Damage.Explosions.Bow")) - move("Bow", "Items.Explosive_Bow.Damage"); - - pathPrefix("Procedural_Damage.Explosions.Damage"); - DAMAGE_RADIUS = Double.parseDouble(getObject("Radius").toString()); - DAMAGE_DAMAGE = Double.parseDouble(getObject("Damage").toString()); - } - } - } - - public static final class Items { - - private static void init() { - pathPrefix("Items"); - } - - public static final class ExplosiveBow { - - public static Float DAMAGE = 0.0F; - - private static void init() { - pathPrefix("Items.Explosive_Bow"); - - DAMAGE = (float) getDouble("Damage"); - } - } - } - - public static final class Setup { - - private static void init() { - pathPrefix("Setup"); - - CompMonsterEgg.acceptUnsafeEggs = getBoolean("Accept_Unsafe_Monster_Eggs"); - } - } - - public static final class Rewards { - public static Boolean ALLOW_TIER_SKIP, ENABLE_MATERIAL_REWARDS; - public static CompMaterial ITEMS, BLOCKS, PACKS; - - private static void init() { - pathPrefix("Rewards"); - - ALLOW_TIER_SKIP = getBoolean("Allow_Skipping_Tier"); - ENABLE_MATERIAL_REWARDS = getBoolean("Enable_Material_Rewards"); - - pathPrefix("Rewards.Menu_Items"); - - ITEMS = getMaterial("Items"); - BLOCKS = getMaterial("Blocks"); - PACKS = getMaterial("Packs"); - } - } - - public static final class Signs { - - public static Boolean ALLOW_CLASSES_SIGN; - public static String[] JOIN_SIGN_FORMAT; - public static String[] LEAVE_SIGN_FORMAT; - public static String[] CLASS_SIGN_FORMAT; - public static String[] UPGRADES_SIGN_FORMAT; - - private static void init() { - pathPrefix("Signs"); - - ALLOW_CLASSES_SIGN = getBoolean("Allow_Classes_Sign"); - JOIN_SIGN_FORMAT = getStringArray("Join_Sign_Format"); - LEAVE_SIGN_FORMAT = getStringArray("Leave_Sign_Format"); - CLASS_SIGN_FORMAT = getStringArray("Class_Sign_Format"); - UPGRADES_SIGN_FORMAT = getStringArray("Upgrades_Sign_Format"); - } - - public static final class Label { - public static String UPGRADES, CLASS, POWER, LEAVE, CLASSES, REWARDS; - - private static void init() { - pathPrefix("Signs.Label"); - - UPGRADES = getString("Upgrade"); - CLASS = getString("Class"); - POWER = getString("Power"); - LEAVE = getString("Leave"); - CLASSES = getString("Classes"); - REWARDS = getString("Rewards"); - } - } - } - - public static final class WorldEdit { - - public static Integer BLOCK_BULK_RESTORE_AMOUNT; - public static SimpleTime WAIT_PERIOD; - public static Boolean CLOSE_STREAM; - - private static void init() { - pathPrefix("WorldEdit"); - - BLOCK_BULK_RESTORE_AMOUNT = getInteger("Block_Bulk_Restore_Amount"); - WAIT_PERIOD = getTime("Wait_Period"); - CLOSE_STREAM = getBoolean("Close_Stream"); - - if (isSet("Alternative_Restore")) - set("Alternative_Restore", null); - - if (isSet("Execution_Limit")) - set("Execution_Limit", null); - } - } - - public static class MySQL { - // For security reasons, no sensitive information are stored here. - - public static Boolean ENABLED, AGGRESIVE; - public static Integer DELAY_TICKS; - - // Prevent obfuscator removing "unused" method - public static final void dummyCall() { - } - - private static void init() { - pathPrefix("MySQL"); - - ENABLED = getBoolean("Enabled"); - AGGRESIVE = getBoolean("Aggresive"); - DELAY_TICKS = getInteger("Delay_Ticks"); - - final String host = getString("Host"); - final String database = getString("Database"); - final String port = getString("Port"); - - final String user = getString("User"); - final String password = getString("Password"); - - final String table = getString("Table"); - final String line = getString("Connector_Advanced"); - - if (ENABLED) { - Common.log("Connecting to MySQL database..."); - - MySQLDatabase.setInstance(table, line.replace("{host}", host).replace("{database}", database).replace("{port}", port), user, password); - } - } - } - - private static void init() { - pathPrefix(null); - - if (VERSION < 2) { - final List<String> oldCommands = getStringList("Allowed_Ingame_Commands"); - - if (oldCommands != null) - move(oldCommands, "Allowed_Ingame_Commands", "Arena.Allowed_Commands"); - } - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/CloneSpawnerToolOff.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/CloneSpawnerToolOff.java deleted file mode 100644 index b3caefd23726c3fea922fc38f38c2e8ad67f7abd..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/CloneSpawnerToolOff.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.mineacademy.game.tool; - -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.menu.tool.Tool; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.game.impl.SimpleSpawnPointMonster; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.SpawnPoint; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.util.CoreNBTUtil; -import org.mineacademy.game.util.CoreUtil; -import org.mineacademy.game.util.Permissions; - -import lombok.Getter; - -public class CloneSpawnerToolOff extends Tool { - - @Getter - private static final CloneSpawnerToolOff instance = new CloneSpawnerToolOff(); - - @Getter - private final ItemStack item; - - private CloneSpawnerToolOff() { - this.item = ItemCreator.of( - CompMaterial.IRON_HOE, - "&8> &f&lClone Mob Spawnpoint &8<", - "", - "&fRight click &7a monster spawner", - "to save its copy into this tool.") - .build().make(); - } - - @Override - public void onBlockClick(PlayerInteractEvent e) { - if (!CoreUtil.checkPerm(e.getPlayer(), Permissions.Tools.TOOLS)) - return; - - final Block clicked = e.getClickedBlock(); - final Action action = e.getAction(); - - // Save a copy - if (action == Action.RIGHT_CLICK_BLOCK) { - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(clicked.getLocation()); - - if (arena != null && CoreArenaPlugin.getSetupManager().isArenaEdited(arena)) { - final SpawnPoint point = arena.getData().findSpawnPoint(clicked.getLocation()); - - if (point != null && point instanceof SimpleSpawnPointMonster) { - ItemStack clone = CloneSpawnerToolOn.getInstance().getItem().clone(); - clone = CoreNBTUtil.writeSpawner((SimpleSpawnPointMonster) point, clone); - - Common.tell(e.getPlayer(), "&7Spawner copied. Don't remove the original spawner until you are done copying. Hover on tool to see usage."); - - PlayerUtil.updateInvSlot(e.getPlayer().getInventory(), e.getItem(), clone); - - } else - Common.tell(e.getPlayer(), Localization.Arena.Setup.CLONE_MOB_UNKNOWN); - } - } - - e.setCancelled(true); - } - - @Override - public void onHotbarFocused(Player pl) { - } - - @Override - public void onHotbarDefocused(Player pl) { - } - - @Override - public boolean ignoreCancelled() { - return false; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/CloneSpawnerToolOn.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/CloneSpawnerToolOn.java deleted file mode 100644 index 9c690f2e910b8d62b27bac2264d0b6bd4c6d9889..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/CloneSpawnerToolOn.java +++ /dev/null @@ -1,139 +0,0 @@ -package org.mineacademy.game.tool; - -import org.bukkit.block.Block; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.event.block.Action; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.ItemUtil; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.menu.tool.Tool; -import org.mineacademy.fo.model.BoxedMessage; -import org.mineacademy.fo.model.SimpleEnchant; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.game.impl.SimpleSpawnPointMonster; -import org.mineacademy.game.impl.SpawnedEntity; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.SpawnPoint; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.util.CoreNBTUtil; -import org.mineacademy.game.util.CoreUtil; -import org.mineacademy.game.util.Permissions; -import org.mineacademy.game.visualize.VisualizeMode; - -import lombok.Getter; - -public class CloneSpawnerToolOn extends Tool { - - @Getter - private static final CloneSpawnerToolOn instance = new CloneSpawnerToolOn(); - - @Getter - private final ItemStack item; - - private CloneSpawnerToolOn() { - this.item = ItemCreator.of( - CompMaterial.IRON_HOE, - "&8> &f&lCloned Mob Spawnpoint &8<", - "", - "This item helds a cloned", - "monster spawner point.", - "", - "&2&l< &7Left click to &bclear", - "&2&l> &7Right click block to &6place", - "&2&l> &7Right click air for &finfo") - .enchant(new SimpleEnchant(Enchantment.DURABILITY)) - .hideTags(true) - .build().make(); - } - - @Override - public void onBlockClick(PlayerInteractEvent e) { - if (!CoreUtil.checkPerm(e.getPlayer(), Permissions.Tools.TOOLS)) - return; - - final Action action = e.getAction(); - final Player player = e.getPlayer(); - final Block clicked = e.getClickedBlock(); - - final SimpleSpawnPointMonster cloned = CoreNBTUtil.readSpawner(e.getItem()); - Valid.checkNotNull(cloned, "Clone Tool for " + player.getName() + " is ON but lacks a spawner point"); - - final Arena arena = e.hasBlock() ? CoreArenaPlugin.getArenaManager().findArena(clicked.getLocation()) : null; - final SpawnPoint existing = arena != null ? arena.getData().findSpawnPoint(clicked.getLocation()) : null; - - if (existing != null) - return; - - if (action == Action.RIGHT_CLICK_BLOCK) - if (arena != null && CoreArenaPlugin.getSetupManager().isArenaEdited(arena)) { - simulateSpawnToolClick(e); - - cloned.setLocation(clicked.getLocation()); - arena.getData().updateSpawnPoint(cloned); - } - - if (action == Action.RIGHT_CLICK_AIR) - tellHeldInfo(player, cloned); - - if (action.toString().contains("LEFT_CLICK")) { - final ItemStack off_tool = CloneSpawnerToolOff.getInstance().getItem(); - - PlayerUtil.updateInvSlot(e.getPlayer().getInventory(), e.getItem(), off_tool); - } - - e.setCancelled(true); - } - - private final void simulateSpawnToolClick(PlayerInteractEvent e) { - final SpawnSelectorMonster selector = SpawnSelectorMonster.getInstance(); - - selector.setDefaultMode(VisualizeMode.MASK); - - selector.onBlockClick(e); - - selector.setDefaultMode(VisualizeMode.GLOW); - } - - private final void tellHeldInfo(Player pl, SimpleSpawnPointMonster point) { - final int total = point.getSpawnedTypes() != null ? point.getSpawnedTypes().length : 0; - - int count = 0; - String from = ""; - - if (total > 0) - for (final SpawnedEntity s : point.getSpawnedTypes()) { - count++; - - if (s != null) - from += s.getCount() + " " + (s.isCustom() ? "custom monster" : ItemUtil.bountifyCapitalized(s.getType())) + (s.getCount() > 1 ? "s" : "") + (count + 1 == total ? " &7or &6" : count == total ? "" : "&7, &6"); - } - else - from = Localization.Parts.NONE; - - BoxedMessage.tell(pl, - "<center>&n&l" + ItemUtil.bountifyCapitalized(point.getType()) + " Spawnpoint&r", - " ", - "&8* &7Spawns" + (count > 1 ? " either:" : "") + " &6" + from, - "&8* &7Chance: &6" + point.getChance() + "%", - "&8* &7Minimum players: &6" + point.getMinimumPlayers(), - "&8* &7Active period: &6" + point.getActivePeriod().formatPeriod() + ". phase"); - } - - @Override - public void onHotbarFocused(Player pl) { - } - - @Override - public void onHotbarDefocused(Player pl) { - } - - @Override - public boolean ignoreCancelled() { - return false; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/LobbySelector.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/LobbySelector.java deleted file mode 100644 index 573ea5836296e12659bcfe28ad3e645d8a591c06..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/LobbySelector.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.mineacademy.game.tool; - -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.game.model.Lobby; -import org.mineacademy.game.type.BlockClick; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; - -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class LobbySelector extends Selector { - - @Getter - private static final LobbySelector instance = new LobbySelector(); - - public static ItemStack getTool() { - return instance.getItem(); - } - - @Override - protected String getName() { - return "Lobby Point"; - } - - @Override - protected CompMaterial getMenuItem() { - return CompMaterial.DIAMOND; - } - - @Override - public CompMaterial getMask() { - return CompMaterial.DIAMOND_BLOCK; - } - - @Override - protected ChatColor getColor() { - return ChatColor.AQUA; - } - - @Override - protected void handleBlockSelect(Player player, Block block, BlockClick click) { - final Location loc = block.getLocation(); - final Lobby prevLobby = getArena().getData().getLobby(); - - if (prevLobby != null && !prevLobby.getLocation().equals(loc)) - hide(prevLobby.getLocation()); - - getArena().getData().setLobby(loc); - } - - @Override - protected void handleBlockBreak(Player player, Block block) { - getArena().getData().removeLobby(); - } - - @Override - protected void renderExistingBlocks() { - final Lobby lobby = getArena().getData().getLobby(); - - if (lobby != null) - visualizeMask(lobby.getLocation()); - } - - @Override - protected void unrenderExistingBlocks() { - final Lobby lobby = getArena().getData().getLobby(); - - if (lobby != null) - hide(lobby.getLocation()); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/RegionSelector.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/RegionSelector.java deleted file mode 100644 index fde2d88a33e29316c41a90edd829ae3216ad1069..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/RegionSelector.java +++ /dev/null @@ -1,210 +0,0 @@ -package org.mineacademy.game.tool; - -import java.util.Arrays; -import java.util.List; - -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.game.model.ArenaRegion; -import org.mineacademy.game.type.BlockClick; -import org.mineacademy.game.type.RegionPoint; -import org.mineacademy.game.visualize.RegionVisualized; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.NonNull; - -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public class RegionSelector extends Selector { - - @Getter - private static final RegionSelector instance = new RegionSelector(); - - public static final ItemStack getTool() { - return instance.getItem(); - } - - private RegionVisualized regionVisualizer; - - /** - * Last points are stored here, because only one point is allowed and the arena-lobby does not allow tracking of individual points. - */ - private Location lastPrimaryPoint = new Location(null, 0, 0, 0); - private Location lastSecondaryPoint = new Location(null, 0, 0, 0); - - @Override - protected final String getName() { - return "Arena Region Point"; - } - - @Override - protected final List<String> getDescription() { - return Arrays.asList( - getColor() + "Left click &7a block to set", - "&7the primary location&7. ", - "", - getColor() + "Right click &7a block to set", - "&7the secondary location&7. "); - } - - @Override - protected final CompMaterial getMenuItem() { - return CompMaterial.EMERALD; - } - - @Override - public final CompMaterial getMask() { - return CompMaterial.EMERALD_BLOCK; - } - - @Override - protected final ChatColor getColor() { - return ChatColor.GREEN; - } - - @Override - protected boolean requiresRegionInArena() { - return false; - } - - @Override - protected void handleBlockSelect(Player player, Block block, BlockClick click) { - final Location loc = block.getLocation(); - final org.mineacademy.game.type.RegionPoint point = org.mineacademy.game.type.RegionPoint.fromClick(org.mineacademy.game.type.BlockClick.valueOf(click.toString())); - - // Only allow one point of its kind to be set. - { - if (point == org.mineacademy.game.type.RegionPoint.PRIMARY) { - if (lastPrimaryPoint != null) - if (!lastPrimaryPoint.equals(loc)) - hide(lastPrimaryPoint); - - lastPrimaryPoint = loc; - - } else { - if (lastSecondaryPoint != null) - if (!lastSecondaryPoint.equals(loc)) - hide(lastSecondaryPoint); - - lastSecondaryPoint = loc; - } - } - - getArena().getData().setRegion(loc, point); - - final RegionVisualized visualized = craftVisualizerRegion(); - - if (visualized != null) - visualized.restart(30 * 20); - } - - @Override - protected final void handleBlockBreak(Player player, Block block) { - final org.mineacademy.game.type.RegionPoint point = lookupPoint(block); - - if (point != null) - getArena().getData().removeRegion(point); - - final RegionVisualized visualized = craftVisualizerRegion(); - - if (visualized != null) - visualized.restart(30 * 20); - } - - @Override - protected String getBlockTitle(@NonNull Block block) { - final RegionPoint rp = lookupPoint(block); - - return rp == null ? ChatColor.WHITE + "Unrecognized region block" : getColor().toString() + rp + " " + getColoredName(); - } - - private org.mineacademy.game.type.RegionPoint lookupPoint(Block block) { - final Location loc = block.getLocation(); - - if (lastPrimaryPoint != null && loc.equals(lastPrimaryPoint)) - return org.mineacademy.game.type.RegionPoint.PRIMARY; - - if (lastSecondaryPoint != null && loc.equals(lastSecondaryPoint)) - return org.mineacademy.game.type.RegionPoint.SECONDARY; - - return null; - } - - @Override - public final void onHotbarFocused(Player pl) { - if (getArena() != null) { - super.onHotbarFocused(pl); - - if (getArena() != null) { - final RegionVisualized visualized = craftVisualizerRegion(); - - if (visualized != null) - visualized.show(30 * 20); - } - } - } - - @Override - public final void onHotbarDefocused(Player pl) { - if (getArena() != null) { - super.onHotbarDefocused(pl); - - if (getArena() != null) { - final RegionVisualized visualized = craftVisualizerRegion(); - - if (visualized != null) - visualized.stop(); - } - } - } - - @Override - protected void renderExistingBlocks() { - final ArenaRegion region = getArena().getData().getRegion(); - - if (region != null) { - if (region.getPrimary() != null) - visualizeMask(region.getPrimary()); - - if (region.getSecondary() != null) - visualizeMask(region.getSecondary()); - } - } - - @Override - protected void unrenderExistingBlocks() { - final ArenaRegion region = getArena().getData().getRegion(); - - if (region != null) { - if (region.getPrimary() != null) - hide(region.getPrimary()); - - if (region.getSecondary() != null) - hide(region.getSecondary()); - } - - if (getArena() != null) { - final RegionVisualized visualized = craftVisualizerRegion(); - - if (visualized != null) - visualized.stop(); - } - } - - private final RegionVisualized craftVisualizerRegion() { - if (regionVisualizer != null) - regionVisualizer.stop(); - - final ArenaRegion region = getData().getRegion(); - - if (region.getPrimary() == null || region.getSecondary() == null) - return null; - - return getArena() != null ? (regionVisualizer = new RegionVisualized(null, region.getPrimary(), region.getSecondary())) : null; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/Selector.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/Selector.java deleted file mode 100644 index 6fa0c18922a13e60bbd6a0c41764149b87e321c2..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/Selector.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.mineacademy.game.tool; - -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.ArenaData; -import org.mineacademy.game.model.ArenaRegion; -import org.mineacademy.game.util.CoreUtil; -import org.mineacademy.game.util.Permissions; -import org.mineacademy.game.visualize.ToolVisualizer; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NonNull; - -public abstract class Selector extends ToolVisualizer { - - @Getter(AccessLevel.PROTECTED) - @NonNull - @Deprecated // can be null - private Arena arena; - - @Getter(AccessLevel.PROTECTED) - @NonNull - @Deprecated // can be null - private Player player; - - @Deprecated // Localization - protected final void tellNoArena(Player pl) { - Common.tell(pl, "&cFirst select arena to edit via /" + CoreArenaPlugin.getInstance().getMainCommand().getLabel() + " edit command."); - } - - @Override - protected final boolean canVisualize(Block block, Player player) { - if (!CoreUtil.checkPerm(player, Permissions.Tools.TOOLS)) - return false; - - if (CoreArenaPlugin.getSetupManager().getEditedArena(player) == null) { - tellNoArena(player); - - return false; - } - - if (requiresRegionInArena() && getArena() != null) { - final ArenaRegion region = getArena().getData().getRegion(); - - if (region != null && region.getPrimary() != null && region.getSecondary() != null && !region.isWithin(block.getLocation())) { - Common.tell(player, "&cThe selected point is outside arena's region."); - - return false; - } - } - - return true; - } - - protected boolean requiresRegionInArena() { - return true; - } - - @Override - protected void handleDataLoad(Player player, Block block) { - this.player = player; - this.arena = findArena(player, block); - } - - private final Arena findArena(Player player, Block block) { - Arena arena = null; - - if (player != null) - arena = CoreArenaPlugin.getSetupManager().getEditedArena(player); - - else if (arena == null && block != null) - arena = CoreArenaPlugin.getArenaManager().findArena(block.getLocation()); - - return arena; - } - - public final void onArenaEnterEditMode(Player pl, Arena arena) { - this.arena = arena; - - renderExistingBlocks(); - } - - public final void onArenaLeaveEditMode(Arena arena) { - this.arena = arena; - - unrenderExistingBlocks(); - } - - protected abstract void renderExistingBlocks(); - - protected abstract void unrenderExistingBlocks(); - - protected final ArenaData getData() { - return getArena().getData(); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/SpawnSelector.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/SpawnSelector.java deleted file mode 100644 index 58db052eaeef67d3d26b92ab764751cdb4b14cdc..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/SpawnSelector.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.mineacademy.game.tool; - -import java.util.List; - -import org.mineacademy.game.model.SpawnPoint; -import org.mineacademy.game.type.SpawnPointType; -import org.mineacademy.game.visualize.VisualizeMode; - -abstract class SpawnSelector extends Selector { - - protected abstract SpawnPointType getType(); - - @Override - protected final void renderExistingBlocks() { - if (getType() != null) { - final List<SpawnPoint> points = getData().getSpawnPoints(getType()); - - for (final SpawnPoint point : points) - getVisualizer().show(point.getLocation(), VisualizeMode.MASK); - } - } - - @Override - protected final void unrenderExistingBlocks() { - if (getType() != null) { - final List<SpawnPoint> points = getData().getSpawnPoints(getType()); - - for (final SpawnPoint point : points) - getVisualizer().hide(point.getLocation()); - } - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/SpawnSelectorMonster.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/SpawnSelectorMonster.java deleted file mode 100644 index 57eece8bd52780d91bc9cf7ae79267af2d269f9e..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/SpawnSelectorMonster.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.mineacademy.game.tool; - -import org.bukkit.ChatColor; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.game.impl.SimpleSpawnPointMonster; -import org.mineacademy.game.type.BlockClick; -import org.mineacademy.game.type.SpawnPointType; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; - -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public class SpawnSelectorMonster extends SpawnSelector { - - @Getter - private static final SpawnSelectorMonster instance = new SpawnSelectorMonster(); - - public static final ItemStack getTool() { - return instance.getItem(); - } - - @Override - protected final String getName() { - return "Monster Spawnpoint"; - } - - @Override - protected CompMaterial getMenuItem() { - return CompMaterial.IRON_INGOT; - } - - @Override - public CompMaterial getMask() { - return CompMaterial.IRON_BLOCK; - } - - @Override - protected final ChatColor getColor() { - return ChatColor.WHITE; - } - - @Override - protected final void handleBlockSelect(Player player, Block block, BlockClick click) { - getData().addSpawnPoint(new SimpleSpawnPointMonster(block.getLocation())); - } - - @Override - protected final void handleBlockBreak(Player player, Block block) { - getData().removeSpawnPoint(SpawnPointType.MONSTER, block.getLocation()); - } - - @Override - protected final SpawnPointType getType() { - return SpawnPointType.MONSTER; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/SpawnSelectorPlayer.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/SpawnSelectorPlayer.java deleted file mode 100644 index 36065f2cf48e1a51a20cbf0eb76d6429051c0be5..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/tool/SpawnSelectorPlayer.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.mineacademy.game.tool; - -import org.bukkit.ChatColor; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.game.impl.SimpleSpawnPointPlayer; -import org.mineacademy.game.type.BlockClick; -import org.mineacademy.game.type.SpawnPointType; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; - -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public class SpawnSelectorPlayer extends SpawnSelector { - - @Getter - private static final SpawnSelectorPlayer instance = new SpawnSelectorPlayer(); - - public static final ItemStack getTool() { - return instance.getItem(); - } - - @Override - protected final String getName() { - return "Player Spawnpoint"; - } - - @Override - protected final CompMaterial getMenuItem() { - return CompMaterial.GOLD_INGOT; - } - - @Override - public final CompMaterial getMask() { - return CompMaterial.GOLD_BLOCK; - } - - @Override - protected final ChatColor getColor() { - return ChatColor.GOLD; - } - - @Override - protected final void handleBlockSelect(Player player, Block block, BlockClick click) { - getData().addSpawnPoint(new SimpleSpawnPointPlayer(block.getLocation())); - } - - @Override - protected final void handleBlockBreak(Player player, Block block) { - getData().removeSpawnPoint(SpawnPointType.PLAYER, block.getLocation()); - } - - @Override - protected final SpawnPointType getType() { - return SpawnPointType.PLAYER; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/ArenaState.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/type/ArenaState.java deleted file mode 100644 index 4018606ac346eac5ce08bce2d1dadbc008899230..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/ArenaState.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.mineacademy.game.type; - -import lombok.RequiredArgsConstructor; - -/** - * Represents in which state the arena is found. - */ -@RequiredArgsConstructor -public enum ArenaState { - - /** - * Represents a stopped state. - */ - STOPPED, - - /** - * Represents when the lobby has started and it is counting down. - * When this is done, the arena enters a {@link #RUNNING} state - */ - LOBBY, - - /** - * Represents a arena that is being played. - */ - RUNNING; -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/BlockClick.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/type/BlockClick.java deleted file mode 100644 index 7f32cfe7481d70c15a946cf1928064e56892fe5e..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/BlockClick.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.mineacademy.game.type; - -import java.util.Objects; - -import org.bukkit.event.block.Action; - -/** - * Used when player has clicked on a block. - */ -public enum BlockClick { - - /** - * The right block click - */ - RIGHT_CLICK, - - /** - * The left block click - */ - LEFT_CLICK; - - /** - * Parses Bukkit action into our block click, failing if it is not a block-related click - * - * @param action - * @return - */ - public static BlockClick fromAction(Action action) { - final BlockClick click = BlockClick.valueOf(action.toString().replace("_BLOCK", "")); - Objects.requireNonNull(click, "Report / Unsupported click type from " + action); - - return click; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/DeathCause.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/type/DeathCause.java deleted file mode 100644 index 5536190177037362a95d8da33bfa52013176eb66..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/DeathCause.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.mineacademy.game.type; - -/** - * Represents a death cause of a player in the arena - */ -public enum DeathCause { - - /** - * Killed by a player - */ - KILLED_BY_PLAYER, - - /** - * Died from unknown causes or by entity attack - */ - DIED -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/JoinCause.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/type/JoinCause.java deleted file mode 100644 index fb0652b82b9d4542a1e657f85defc2cf958bbb85..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/JoinCause.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.mineacademy.game.type; - -/** - * Represents the join cause for a player in the arena - */ -public enum JoinCause { - - /** - * Player has joined via command - */ - COMMAND, - - /** - * Player has joined via clicking a regular sign - */ - SIGN -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/LeaveCause.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/type/LeaveCause.java deleted file mode 100644 index b5b795ae87faaf93d843b9ef8f7408c13ee9b088..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/LeaveCause.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.mineacademy.game.type; - -/** - * Represents why a player left the arena - */ -public enum LeaveCause { - - /** - * He got killed, etc - */ - KILLED, - - /** - * The player changed worlds and thus effectively escaped the arena and was kicked. - */ - ESCAPED, - - /** - * Left the game - */ - DISCONNECT, - - /** - * An error in the plugin has caused the player to be kicked for safety - */ - ERROR, - - /** - * Left by command or by clicking a sign - */ - COMMAND, - - /** - * Arena is finished - */ - ARENA_END, - - /** - * No class selected and could not chose a random class (no permission?) - */ - NOT_READY, - - /** - * The arena requires higher tier than all of the classes player disposes of. - */ - NO_ENOUGH_CLASS, -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/MenuType.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/type/MenuType.java deleted file mode 100644 index 7a3e5e1e62b8a00d0bc95265bd0c4824e308cc8d..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/MenuType.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.mineacademy.game.type; - -/** - * Represents a menu type - * - * Typically, we use Menu to make our menus - */ -public enum MenuType { - - /** - * The class selection menu - */ - CLASSES, - - /** - * Uncategorized menu - */ - OTHER -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/MessengerTarget.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/type/MessengerTarget.java deleted file mode 100644 index b5d05935722e5e8c3dc00b37f3f63b748be0ddc9..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/MessengerTarget.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.mineacademy.game.type; - -import org.mineacademy.game.model.ArenaMessenger; - -/** - * Represents to whom we should send messages from {@link ArenaMessenger} - */ -public enum MessengerTarget { - - /** - * The default - * - * Players in the arena - */ - ARENA, - - /** - * Players in the same world as the arena is within, used by world automatic mode - */ - WORLD, - - /** - * Everyone on the server, used by server automatic mode - */ - SERVER -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/NextPhaseMode.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/type/NextPhaseMode.java deleted file mode 100644 index 313bb7dda7cea3a3e22d3458c829210c9c25c1f2..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/NextPhaseMode.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.mineacademy.game.type; - -/** - * When we should enter a new arena phase? - */ -public enum NextPhaseMode { - - /** - * Next phase turns when time for the current phase is up - */ - TIMER, - - /** - * Next phase turns when monsters are killed - */ - MONSTERS -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/RegionPoint.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/type/RegionPoint.java deleted file mode 100644 index 99785f1e04abfff69842a25f3596211a48dbc2fa..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/RegionPoint.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.mineacademy.game.type; - -import lombok.RequiredArgsConstructor; - -/** - * Represents a region point for a cuboid arena region - */ -@RequiredArgsConstructor -public enum RegionPoint { - - /** - * The first, primary region point - */ - PRIMARY("Primary"), - - /** - * The second, secondary region point - */ - SECONDARY("Secondary"); - - /** - * The human readable representation - */ - private final String key; - - @Override - public String toString() { - return key; - } - - /** - * Convert a right/left {@link BlockClick} to a primary/secondary region point automatically - * Left click = primary, right click = secondary - * - * @param click the click - * @return the region point - */ - public static RegionPoint fromClick(BlockClick click) { - if (click == BlockClick.LEFT_CLICK) - return PRIMARY; - - else if (click == BlockClick.RIGHT_CLICK) - return RegionPoint.SECONDARY; - - throw new RuntimeException("Unhandled region point from click " + click); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/RewardType.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/type/RewardType.java deleted file mode 100644 index 6b5b94046a3c2065451858f917d55f9d72547a39..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/RewardType.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.mineacademy.game.type; - -import lombok.RequiredArgsConstructor; - -/** - * Represents a type of reward, typically a selection of items using menu - */ -@RequiredArgsConstructor -public enum RewardType { - - /** - * The standard items as rewards - */ - ITEM("Items"), - - /** - * Rewards that can be categorized as blocks - */ - BLOCK("Blocks"), - - /** - * Rewards that can be defined as "packs", meaning they offer collectibles, etc. - */ - PACK("Packs"), - - /** - * Rewards that upgrade class tiers - */ - TIERS("Tiers"); - - /** - * The human readable key identifier - */ - private final String key; - - @Override - public String toString() { - return key; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/SpawnPointType.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/type/SpawnPointType.java deleted file mode 100644 index d653b91c395f6b478560721d4edc2b0874019286..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/SpawnPointType.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.mineacademy.game.type; - -import lombok.RequiredArgsConstructor; - -/** - * Represents an arena spawner type - */ -@RequiredArgsConstructor -public enum SpawnPointType { - - /** - * The monster spawn point - */ - MONSTER("Monster"), - - /** - * The player spawn point - */ - PLAYER("Player"), - - ; - - /** - * The human readable format - */ - private final String key; - - @Override - public String toString() { - return key; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/StopCause.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/type/StopCause.java deleted file mode 100644 index b8ad4e44d94ff5feb679098c7f530e3e26a34879..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/StopCause.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.mineacademy.game.type; - -/** - * The reason why an arena stopped. - */ -public enum StopCause { - - /** - * Natural, usually triggered by somebody or some that has won - */ - NATURAL_TRIGGER, - - /** - * Natural, the last phase is out - */ - NATURAL_LAST_PHASE, - - /** - * The time is up! - */ - NATURAL_COUNTDOWN, - - /** - * There are no more monsters alive. - */ - NATURAL_NO_MONSTERS, - - /** - * Stopped by a command or a server reload - */ - INTERRUPTED_COMMAND, - - /** - * Stopped due to an error - */ - INTERRUPTED_ERROR, - - /** - * Stopped due to a server or plugin reload - */ - INTERRUPTED_RELOAD, - - /** - * Stopped due to being empty - */ - INTERRUPTED_LAST_PLAYER_LEFT, - - /** - * Not enough players to start (below the required minimum) - */ - CANCELLED_NOT_ENOUGH_PLAYERS -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/TierMode.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/type/TierMode.java deleted file mode 100644 index 2dbf8cbdb9d4a3fc8e2008f3b4fed15919de3798..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/type/TierMode.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.mineacademy.game.type; - -/** - * Represents tier mode. - * - * Typically used when giving classes to - * players, to determine whether the class is - * given as preview in the lobby (without permissions, etc.) - * or as full class ready for the game. - */ -public enum TierMode { - - /** - * The preview shown in the lobby - */ - PREVIEW, - - /** - * The full version of the class - */ - PLAY; -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/util/BungeeMessagingUtil.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/util/BungeeMessagingUtil.java deleted file mode 100644 index e2811c6fa5695d47334abcd05737dad0a3a4d0d2..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/util/BungeeMessagingUtil.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.mineacademy.game.util; - -import java.util.Objects; - -import org.apache.commons.lang.StringUtils; -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; - -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; - -/** - * Util that is capable of sending messages to/from BungeeCord - */ -public class BungeeMessagingUtil { - - /** - * Sends a message upstream to BungeeCord as the BungeeCord channel. - * - * @param receiver the player through which to send the message - * @param datas the datas - */ - public static final void sendMessage(Player receiver, Object... datas) { - final ByteArrayDataOutput out = ByteStreams.newDataOutput(); - - for (final Object data : datas) { - Objects.requireNonNull(data, "Bungee object in array is null! Array: " + StringUtils.join(datas)); - - if (data instanceof Integer) - out.writeInt((Integer) data); - - else if (data instanceof Double) - out.writeDouble((Double) data); - - else if (data instanceof Boolean) - out.writeBoolean((Boolean) data); - - else if (data instanceof String) - out.writeUTF((String) data); - - else - throw new RuntimeException("Unknown type of data: " + data + " (" + data.getClass().getSimpleName() + ")"); - } - - receiver.sendPluginMessage(CoreArenaPlugin.getInstance(), "BungeeCord", out.toByteArray()); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/util/Constants.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/util/Constants.java deleted file mode 100644 index d60cf81b8aed3ae1cc89f57c051de493da29da17..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/util/Constants.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.mineacademy.game.util; - -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompMaterial; - -public final class Constants { - - public static final class NBT { - public final static String KA_NBT = "KaNbt"; - } - - public static final class Duration { - public final static int MENU_TITLE = 20; - } - - public static final class RegionVisualizer { - public final static int VERTICAL_GAP = 1; - public final static int HORIZONTAL_GAP = 1; - } - - public static final class Costs { - public final static String TIER_STARTING_COST = "20 * (2 ^ {currentTier})"; - public final static int REWARD_STARTING_COST = 10; - } - - public static final class Symbols { - public static final String CHAT_EVENT_MESSAGE = "%2$s"; - public static final String[] POWER_SIGN_FORMAT = new String[] { - "[&lPower&r]", - "{type}" - }; - } - - public static final class Folder { - public static final String ARENAS = "arenas/"; - public static final String CLASS = "classes/"; - public static final String UPGRADES = "upgrades/"; - } - - public static final class Items { - public static final String EXP_ITEM_TAG = "CoreExpDrop_" + CoreArenaPlugin.getNamed(); - public static final ItemStack MENU_FILLER = ItemCreator.of(CompMaterial.fromLegacy("STAINED_GLASS_PANE", 8)).name(" ").build().make(); - public static final ItemStack DEFAULT_ICON = new ItemStack(CompMaterial.WHITE_STAINED_GLASS.getMaterial()); - } - - public static final class Header { - public static final String[] ARENA_FILE = new String[] { - " -------------------------------------------------------", - " Welcome to the arena settings file. Here you can setup", - " individual arena properties.", - " -------------------------------------------------------", - "" - }; - public static final String[] CLASS_FILE = new String[] { - " -------------------------------------------------------", - " Welcome to the class settings file. Here you can setup", - " which items the player receive after the arena starts.", - " -------------------------------------------------------", - "" - }; - public static final String[] UPGRADE_FILE = new String[] { - " -------------------------------------------------------", - " Welcome to the upgrades settings file. Here you can set", - " additional parameters for this upgrade. Please use", - " the in-game command to edit the upgrades otherwise.", - " -------------------------------------------------------", - "" - }; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/util/CoreNBTUtil.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/util/CoreNBTUtil.java deleted file mode 100644 index 92a35c87228c62915d2b9e254c1c33fc1be29320..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/util/CoreNBTUtil.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.mineacademy.game.util; - -import static org.mineacademy.game.util.Constants.NBT.KA_NBT; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.SerializeUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.remain.nbt.NBTCompound; -import org.mineacademy.fo.remain.nbt.NBTItem; -import org.mineacademy.game.impl.SimpleSpawnPointMonster; -import org.mineacademy.game.impl.arena.FeatureArena; - -public class CoreNBTUtil { - - // ----------------------------------------------------------------------------- - // Read - // ----------------------------------------------------------------------------- - - public static final SimpleSpawnPointMonster readSpawner(ItemStack item) { - if (item == null || item.getType() == Material.AIR) - return null; - - final NBTItem nbt = new NBTItem(item); - - if (nbt.hasKey(KA_NBT)) { - final Location location = SerializeUtil.deserializeLocation(nbt.getCompound(KA_NBT).getString("spawnerLocation")); - - if (location != null) { - final FeatureArena arena = (FeatureArena) CoreArenaPlugin.getArenaManager().findArena(location); - final Object maybePoint = arena.getData().findSpawnPoint(location); - - if (maybePoint instanceof SimpleSpawnPointMonster) - return (SimpleSpawnPointMonster) maybePoint; - } - } - - return null; - } - - // ----------------------------------------------------------------------------- - // Write - // ----------------------------------------------------------------------------- - - public static final ItemStack writeSpawner(SimpleSpawnPointMonster point, ItemStack item) { - Valid.checkNotNull(point, "Spawnpoint = null"); - Valid.checkNotNull(item, "Stack = null"); - - final NBTItem nbt = new NBTItem(item); - final NBTCompound tag = nbt.addCompound(KA_NBT); - - tag.setObject("spawnerLocation", SerializeUtil.serializeLoc(point.getLocation())); - - return nbt.getItem(); - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/util/CoreUtil.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/util/CoreUtil.java deleted file mode 100644 index e7e8f37f485a980c49eb409bced59dee4ec893ae..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/util/CoreUtil.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.mineacademy.game.util; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.Location; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.exception.CommandException; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.settings.SimpleLocalization; -import org.mineacademy.game.impl.ArenaPlayer; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.settings.Localization; -import org.mineacademy.game.type.ArenaState; - -public class CoreUtil { - - public static final boolean checkMenuAccessInArena(Player player) throws CommandException { - final ArenaPlayer data = CoreArenaPlugin.getDataFor(player); - final Arena arena = data.hasArenaCache() ? data.getArenaCache().getArena(player) : null; - - if (!data.hasArenaCache() || arena == null) { - Common.tell(player, Localization.Menu.CANNOT_OPEN_OUTSIDE_ARENA); - - return false; - } - - if (arena.getState() != ArenaState.LOBBY) { - Common.tell(player, Localization.Menu.CANNOT_OPEN_OUTSIDE_LOBBY); - - return false; - } - - return true; - } - - public static final String getStateName(ArenaState state) { - switch (state) { - case LOBBY: - return Localization.Arena.State.LOBBY; - - case RUNNING: - return Localization.Arena.State.RUNNING; - - case STOPPED: - return Localization.Arena.State.STOPPED; - - default: - throw new FoException("Neznamy stav areny - " + state); - } - } - - public static final String formatTime(int seconds) { - final int second = seconds % 60; - int minute = seconds / 60; - String hourMsg = ""; - - if (minute >= 60) { - final int hour = seconds / 60; - minute %= 60; - - hourMsg = Localization.Cases.HOUR.formatWithCount(hour) + " "; - } - - return hourMsg + (minute > 0 ? Localization.Cases.MINUTE.formatWithCount(minute) + " " : "") + Localization.Cases.SECOND.formatWithCount(second); - } - - public static final boolean checkPerm(CommandSender sender, String permission) { - return checkPerm(sender, permission, true); - } - - public static final boolean checkPerm(CommandSender sender, String permission, boolean notify) { - Valid.checkBoolean(!permission.contains("{plugin_name}"), "Found {plugin_name} while checking for " + permission + " - report this please!"); - final boolean has = PlayerUtil.hasPerm(sender, permission); - - if (!has && notify) - Common.tell(sender, SimpleLocalization.NO_PERMISSION.replace("{permission}", permission)); - - return has; - } - - public static final boolean isWithinArena(Player player, Location loc) { - final Arena arena = CoreArenaPlugin.getArenaManager().findArena(player); - - return arena != null && arena.getData().getRegion().isWithin(loc); - } - - public static final List<String> tabCompleteArenaNames(String[] args) { - final List<String> tab = new ArrayList<>(); - - if (args.length == 1) - for (final String key : CoreArenaPlugin.getArenaManager().getAvailable()) - if (key.toLowerCase().startsWith(args[0].toLowerCase())) - tab.add(key); - - return tab; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/util/FallingLimitter.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/util/FallingLimitter.java deleted file mode 100644 index 5acb9437e8deefc13767774c0ef922a72369583d..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/util/FallingLimitter.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.mineacademy.game.util; - -import java.util.Iterator; -import java.util.Map; - -import org.bukkit.entity.FallingBlock; -import org.bukkit.scheduler.BukkitRunnable; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.game.model.Arena; - -import lombok.val; - -/** - * Removes flying blocks when they cross an arena's border. - */ -public final class FallingLimitter extends BukkitRunnable { - - // ---------------------------------------------------------------------------------------- - - private static final StrictMap<Arena, StrictList<FallingBlock>> watched = new StrictMap<>(); - - public static void add(Arena arena, FallingBlock block) { - final val list = watched.getOrDefault(arena, new StrictList<>()); - - list.add(block); - watched.override(arena, list); - } - - // ---------------------------------------------------------------------------------------- - - @Override - public void run() { - final StrictList<Arena> pendingRemove = new StrictList<>(); - - for (final Map.Entry<Arena, StrictList<FallingBlock>> e : watched.entrySet()) { - final Arena arena = e.getKey(); - - for (final Iterator<FallingBlock> it = e.getValue().iterator(); it.hasNext();) { - final FallingBlock block = it.next(); - - if (!isWithin(block, arena)) { - block.remove(); - - it.remove(); - } - } - - if (e.getValue().isEmpty()) - pendingRemove.add(arena); - } - - watched.removeAll(pendingRemove.getSource()); - } - - private boolean isWithin(FallingBlock block, Arena arena) { - return arena.getData().getRegion().isWithin(block.getLocation()); - } - - public void onReload() { - watched.clear(); - } - - public void onArenaStop(Arena arena) { - if (watched.contains(arena)) { - for (final FallingBlock block : watched.get(arena)) - block.remove(); - - watched.remove(arena); - } - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/util/InventoryStorageUtil.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/util/InventoryStorageUtil.java deleted file mode 100644 index dc55a0437724b14483f287a75dec9256fad0b3b6..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/util/InventoryStorageUtil.java +++ /dev/null @@ -1,259 +0,0 @@ -package org.mineacademy.game.util; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang.Validate; -import org.bukkit.GameMode; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.potion.PotionEffect; - -import lombok.AccessLevel; -import lombok.Builder; -import lombok.Builder.Default; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * You can use this simple class to save and restore players' inventories. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public class InventoryStorageUtil { - - /** - * The instance of this singleton - */ - private static final InventoryStorageUtil instance = new InventoryStorageUtil(); - - /** - * Get the instance of this inventory storage. - * - * @return the {@link InventoryStorageUtil} instance - */ - public static final InventoryStorageUtil $() { - return instance; - } - - /** - * Stored inventories by player name - */ - private final Map<String, StoredInventory> inventories = new HashMap<>(); - - /** - * Save player experience and level - * - * @param player the player - */ - public final void saveExperience(Player player) { - inventories.put(player.getName(), StoredInventory.builder().justExperience(true).exp(player.getExp()).lvl(player.getLevel()).totalXp(player.getTotalExperience()).build()); - } - - /** - * Restores player experience - * - * @throws IllegalArgumentException error if player has no stored inventory - * @param player the player - */ - public final void restoreExperience(Player player) { - final StoredInventory s = getStored(player); - Validate.isTrue(s != null, "Player " + player.getName() + " does not have a stored inventory!"); - - player.setTotalExperience(s.getTotalXp()); - player.setLevel(s.getLvl()); - player.setExp(player.getExp()); - } - - /** - * Saves player inventory in full - * - * @param player the player - */ - public final void saveInventory(Player player) { - final StoredInventory s = StoredInventory.builder() - - .gameMode(player.getGameMode()) - - .armorContent(player.getInventory().getArmorContents()) - .content(player.getInventory().getContents()) - - .healthScaled(player.isHealthScaled()) - - .remainingAir(player.getRemainingAir()) - .maximumAir(player.getMaximumAir()) - .fallDistance(player.getFallDistance()) - .fireTicks(player.getFireTicks()) - - .totalXp(player.getTotalExperience()) - .lvl(player.getLevel()) - .exp(player.getExp()) - - .foodLevel(player.getFoodLevel()) - .exhaustion(player.getExhaustion()) - .saturation(player.getSaturation()) - - .flySpeed(player.getFlySpeed()) - .walkSpeed(player.getWalkSpeed()) - - .potionEffects(player.getActivePotionEffects()) - - .build(); - - try { - s.setMaxHealth(player.getMaxHealth()); - s.setHealth(player.getHealth()); - s.setExtraContent(player.getInventory().getExtraContents()); - s.setInvulnerable(player.isInvulnerable()); - s.setSilent(player.isSilent()); - s.setGlowing(player.isGlowing()); - - } catch (final NoSuchMethodError err) { - } - - inventories.put(player.getName(), s); - } - - /** - * Restores player inventory in full. - * - * @throws IllegalArgumentException error if player has no stored inventory - * @param player - */ - public final void restore(Player player) { - final StoredInventory s = getStored(player); - Validate.isTrue(s != null, "Player " + player.getName() + " does not have a stored inventory!"); - - player.setTotalExperience(s.getTotalXp()); - player.setExp(s.getExp()); - player.setLevel(s.getLvl()); - - if (s.isJustExperience()) - return; - - player.setGameMode(s.getGameMode()); - - player.getInventory().setArmorContents(s.getArmorContent()); - player.getInventory().setContents(s.getContent()); - - try { - player.getInventory().setExtraContents(s.getExtraContent()); - } catch (final NoSuchMethodError err) { - } - - player.setMaxHealth(s.getMaxHealth()); - player.setHealth(s.getHealth()); - player.setHealthScaled(s.isHealthScaled()); - - player.setRemainingAir(s.getRemainingAir()); - player.setMaximumAir(s.getMaximumAir()); - player.setFallDistance(s.getFallDistance()); - player.setFireTicks(s.getFireTicks()); - - player.setFoodLevel(s.getFoodLevel()); - player.setExhaustion(s.getExhaustion()); - player.setSaturation(s.getSaturation()); - - player.setFlySpeed(s.getFlySpeed()); - player.setWalkSpeed(s.getWalkSpeed()); - - try { - player.setGlowing(s.isGlowing()); - player.setInvulnerable(s.isInvulnerable()); - player.setSilent(s.isSilent()); - } catch (final NoSuchMethodError err) { - } - - // Potions - for (final PotionEffect ef : player.getActivePotionEffects()) - player.removePotionEffect(ef.getType()); - - for (final PotionEffect ef : s.getPotionEffects()) - player.addPotionEffect(ef); - - if (!player.isOnline()) - player.saveData(); - - inventories.remove(player.getName()); - } - - /** - * Removes the stored inventory data for player - * - * @param player the player - * @return true if the data were found and trashed - */ - public final boolean removeStored(Player player) { - if (hasStored(player)) { - inventories.remove(player.getName()); - - return true; - } - - return false; - } - - /** - * Does the player have stored inventory or experience? - * - * @param player the player - * @return true if the player has stored inventory or experience data? - */ - public final boolean hasStored(Player player) { - return getStored(player) != null; - } - - // Return the stored inventory data for player, or null - private final StoredInventory getStored(Player pl) { - return inventories.get(pl.getName()); - } -} - -/** - * A helper class representing all data we store for players - */ -@Builder -@Getter(AccessLevel.PROTECTED) -@Setter -class StoredInventory { - - /** - * Do these data only store player's experience? - */ - @Default - private boolean justExperience = false; - - private GameMode gameMode; - - private ItemStack[] content; - private ItemStack[] armorContent; - private ItemStack[] extraContent; - - private double maxHealth; - private double health; - private boolean healthScaled; - - private int remainingAir; - private int maximumAir; - - private float fallDistance; - private int fireTicks; - - private int totalXp; - private int lvl; - private float exp; - - private int foodLevel; - private float exhaustion; - private float saturation; - - private float flySpeed; - private float walkSpeed; - - private boolean glowing; - private boolean invulnerable; - private boolean silent; - - private Collection<PotionEffect> potionEffects; -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/util/Permissions.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/util/Permissions.java deleted file mode 100644 index 3b9ab0052ee97c252867cd9c46ac253b1527a8e2..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/util/Permissions.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.mineacademy.game.util; - -public class Permissions { - - public static final class Commands { - - // Join arenas - public static final String JOIN = "corearena.command.join.{arena}"; - - // Leave arena - public static final String LEAVE = "corearena.command.leave"; - - // List available arenas - public static final String LIST = "corearena.command.list"; - - // Rewards' menu. - public static final String REWARDS = "corearena.command.rewards"; - - // Class' menu. - public static final String CLASS = "corearena.command.class"; - - /** ADMIN COMMANDS BELOW */ - - // Toggle an arena's edit mode - public static final String EDIT = "corearena.command.edit"; - - // Items' menu - public static final String ITEMS = "corearena.command.items"; - - // Tools' menu - public static final String TOOLS = "corearena.command.tools"; - - // Open admin menu - public static final String MENU = "corearena.command.menu"; - - // Manage player nuggets - public static final String NUGGET = "corearena.command.nugget"; - - // Break the plugin - public static final String RELOAD = "corearena.command.reload"; - - // Start pending arenas - public static final String START = "corearena.command.start"; - - // Stop running arenas - public static final String STOP = "corearena.command.stop"; - - // Create new arenas - public static final String NEW = "corearena.command.new"; - - // Find arenas at player's location - public static final String FIND = "corearena.command.find"; - - // Reply to server's conversation - public static final String CONVERSATION = "corearena.command.conversation"; - - // Teleport to an arena. - public static final String TP = "corearena.command.tp"; - } - - public static final class Chat { - - // Being a message with '!' to send it to everyone on the server instead of only players in your arena. - public static final String GLOBAL = "corearena.chat.global"; - - // Permission to have a red name in the arena chat. - @Deprecated // Not customizable - public static final String RED_COLOR = "corearena.chat.color.red"; - } - - public static final class Bypass { - - // Allow running commands while playing in an arena - public static final String ARENA_COMMANDS = "corearena.bypass.arenacommands"; - } - - public static final class Tools { - - // Grants permission to right click with tools as specified in the tools menu and use them. - public static final String TOOLS = "corearena.tools"; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/BlockVisualizer.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/BlockVisualizer.java deleted file mode 100644 index a085ab2c84a3e227761abe99b3e20ad44a4a909e..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/BlockVisualizer.java +++ /dev/null @@ -1,133 +0,0 @@ -package org.mineacademy.game.visualize; - -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.plugin.SimplePlugin; - -/** - * Visualize a single block by either replacing its type with for example - * Glowstone or invoking setGlowing method in later MC versions - * - * @deprecated use classes in the new "visual" package - */ -@Deprecated -public abstract class BlockVisualizer { - - private final Object LOCK = new Object(); - - /** - * A map of locations and their visualized blocks - */ - private final StrictMap<Location, VisualizedBlock> stored = new StrictMap<>(); - - /** - * The mask that is shown when the block is visualized - */ - private final ToolVisualizer tool; - - public BlockVisualizer(final ToolVisualizer tool) { - this.tool = tool; - - VisualizerListener.register(this); - } - - /** - * Visualize the block. - * @param location - * @param mode - */ - public final void show(final Location location, final VisualizeMode mode) { - synchronized (LOCK) { - Valid.checkNotNull(location, "Location == null"); - Valid.checkNotNull(location.getWorld(), "Location.World == null"); - - tool.setCalledLocation(location); - - final VisualizedBlock v = new VisualizedBlock(location.getBlock(), tool.getMask()) { - - @Override - public String getBlockName(final Block block) { - tool.setCalledLocation(block.getLocation()); - - return BlockVisualizer.this.getBlockName(block); - } - }; - - v.visualize(mode); - stored.override(location, v); - } - } - - /** - * Stop visualizing of the block. - * - * @param block the block - */ - public final void hide(final Location location) { - synchronized (LOCK) { - if (!stored.contains(location)) - return; - - final VisualizedBlock v = stored.remove(location); - - // Workaround for shutdown of plugins: - if (!SimplePlugin.getInstance().isEnabled()) - v.hide(); - - else - Common.runLater(() -> v.hide()); - } - } - - /** - * Get if the block that this tool holds, is stored (it has been put - * to the map by the {@link #show(Block, VisualizeMode)} method?) - * - * @param block the block - * @return whether or not the block is visualized - */ - public final boolean isStored(final Block block) { - synchronized (LOCK) { - Valid.checkNotNull(block, "Null block!"); - - return stored.contains(block.getLocation()); - } - } - - /** - * Update all stored blocks to a new state. - * - * @param mode the new mode - */ - public final void updateStored(final VisualizeMode mode) { - synchronized (LOCK) { - for (final VisualizedBlock v : stored.values()) - v.visualize(mode); - } - } - - /** - * Get the blocks's name above it for the specified block. - * - * @param block the block - * @return the block name - */ - protected abstract String getBlockName(Block block); - - /** - * A method called when the block is removed - * - * @param player the player - * @param block the block - */ - protected abstract void onRemove(Player player, Block block); - - @Override - public String toString() { - return getClass().getSimpleName() + "{" + tool.getMask() + "}"; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/RegionVisualized.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/RegionVisualized.java deleted file mode 100644 index 6852bb05c12e1d47084c82ecf7d344bd2b8f6522..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/RegionVisualized.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.mineacademy.game.visualize; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.Location; -import org.bukkit.scheduler.BukkitRunnable; -import org.bukkit.scheduler.BukkitTask; -import org.mineacademy.fo.BlockUtil; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.region.Region; -import org.mineacademy.fo.remain.CompParticle; - -/** - * @deprecated use classes in the new "visual" package - */ -@Deprecated -public final class RegionVisualized extends Region { - - private final static CompParticle DEFAULT_PARTICLE = CompParticle.VILLAGER_HAPPY; - - /** - * The list of all particles spawned - */ - private final List<Location> particles = new ArrayList<>(); - - /** - * The task that keeps particles visible by re-rendering them. - */ - private BukkitTask particleTask; - - public RegionVisualized(final String name, final Location primary, final Location secondary) { - super(name, primary, secondary); - } - - public void show(final int durationTicks) { - show(durationTicks, DEFAULT_PARTICLE); - } - - /** - * Start visualizing this region for the given amount of ticks - * - * @param durationTicks - */ - public void show(final int durationTicks, final CompParticle particle) { - start(particle); - - Common.runLater(durationTicks, this::stop); - } - - private void start(final CompParticle particle) { - if (particleTask != null) - particleTask.cancel(); - - particles.clear(); - particles.addAll(BlockUtil.getBoundingBox(getPrimary(), getSecondary())); - - particleTask = Common.runTimer(23, new BukkitRunnable() { - @Override - public void run() { - if (particles.isEmpty()) { - cancel(); - - return; - } - - for (final Location loc : particles) - particle.spawn(loc); - } - }); - - } - - public void restart(final int durationTicks) { - restart(durationTicks, DEFAULT_PARTICLE); - } - - public void restart(final int durationTicks, final CompParticle particle) { - stop(); - - show(durationTicks, particle); - } - - /** - * Stops visualization - */ - public void stop() { - particles.clear(); - } - - /** - * Converts a saved map from your yaml/json file into a region if it contains Primary and Secondary keys - * - * @param map - * @return - */ - public static RegionVisualized deserialize(final SerializedMap map) { - Valid.checkBoolean(map.containsKey("Primary") && map.containsKey("Secondary"), "The region must have Primary and a Secondary location"); - - final String name = map.getString("Name"); - final Location prim = map.getLocation("Primary"); - final Location sec = map.getLocation("Secondary"); - - return new RegionVisualized(name, prim, sec); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/ToolVisualizer.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/ToolVisualizer.java deleted file mode 100644 index d5239781908c911028cd55e9dceadca5452b19d6..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/ToolVisualizer.java +++ /dev/null @@ -1,271 +0,0 @@ -package org.mineacademy.game.visualize; - -import java.util.Arrays; -import java.util.List; - -import org.apache.commons.lang.StringUtils; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.Action; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.corearena.CoreArenaPlugin; -import org.mineacademy.fo.BlockUtil; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.menu.tool.Tool; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.game.impl.ArenaPlayer; -import org.mineacademy.game.impl.SimpleSpawnPointMonster; -import org.mineacademy.game.menu.MenuMonsterSpawn; -import org.mineacademy.game.model.Arena; -import org.mineacademy.game.model.SpawnPoint; -import org.mineacademy.game.tool.SpawnSelectorMonster; -import org.mineacademy.game.type.BlockClick; - -import lombok.Getter; -import lombok.NonNull; -import lombok.Setter; - -/** - * @deprecated use classes in the new "visual" package - */ -@Deprecated -public abstract class ToolVisualizer extends Tool { - - @Getter - private final BlockVisualizer visualizer; - - @Deprecated // unsafe - @Getter - @Setter - private Location calledLocation; - - @Getter - @Setter - private VisualizeMode defaultMode = VisualizeMode.GLOW; - - protected ToolVisualizer() { - this.visualizer = new BlockVisualizer(this) { - - @Override - public String getBlockName(final Block block) { - return ToolVisualizer.this.getBlockTitle(block); - } - - @Override - public void onRemove(final Player player, final Block block) { - ToolVisualizer.this.onRemove(player, block); - } - }; - } - - private boolean canSetup(final Block clicked, final Action action) { - return (action == Action.LEFT_CLICK_BLOCK || action == Action.RIGHT_CLICK_BLOCK) && BlockUtil.isForBlockSelection(clicked.getType()); - } - - // -------------------------------------------------------------------------------- - // Standard methods - // -------------------------------------------------------------------------------- - - @Override - public final void onBlockClick(final PlayerInteractEvent e) { - final Player player = e.getPlayer(); - - if (!e.hasBlock() || e.getAction().toString().contains("AIR")) { - handleAirClick(player, e.getItem(), e.getAction() == Action.LEFT_CLICK_AIR ? ClickType.LEFT : ClickType.RIGHT); - return; - } - - if (e.isCancelled()) - return; - - if (!canSetup(e.getClickedBlock(), e.getAction()) && e.getClickedBlock().getType() != CompMaterial.BARRIER.getMaterial()) - return; - - final Block block = e.getClickedBlock(); - - if (!canVisualize(block, player) || VisualizerListener.isBlockTakenByOthers(block, visualizer)) - return; - - handleDataLoad(player, block); - - if (!visualizer.isStored(block)) { - handleBlockSelect(player, block, BlockClick.fromAction(e.getAction())); - - visualizer.show(block.getLocation(), getDefaultMode()); - Common.tell(player, makeActionMessage("&2set")); - - } else { - - if (this instanceof SpawnSelectorMonster && e.getAction() == Action.RIGHT_CLICK_BLOCK) { - final ArenaPlayer cache = CoreArenaPlugin.getDataFor(player); - - if (cache.hasSetupCache()) { - final Arena arena = cache.getSetupCache().arena; - final SpawnPoint point = arena.getData().findSpawnPoint(block.getLocation()); - - if (point != null && point instanceof SimpleSpawnPointMonster) - new MenuMonsterSpawn((SimpleSpawnPointMonster) point, arena).displayTo(player); - } - - return; - } - - onRemove(player, block); - } - } - - public final void onRemove(final Player player, final Block block) { - handleDataLoad(player, block); - - visualizer.hide(block.getLocation()); - handleBlockBreak(player, block); - - Common.tell(player, makeRemoveActionMessage()); - } - - // Workaround for concurrency issues - private final StrictList<Player> cache = new StrictList<>(); - - @Override - public void onHotbarFocused(@NonNull final Player pl) { - if (cache.contains(pl)) - return; - - handleDataLoad(pl, null); - - cache.add(pl); - visualizer.updateStored(VisualizeMode.GLOW); - cache.remove(pl); - } - - @Override - public void onHotbarDefocused(@NonNull final Player pl) { - if (cache.contains(pl)) - return; - - handleDataLoad(pl, null); - - cache.add(pl); - visualizer.updateStored(VisualizeMode.MASK); - cache.remove(pl); - } - - @Override - public final ItemStack getItem() { - final CompMaterial mat = getMenuItem(); - Valid.checkNotNull(mat); - - setCalledLocation(null); - - return ItemCreator - - .of(mat) - .name("&8> " + getColor() + "&l" + getName() + " &8<") - - .lore("&r") - .lores(getDescription()) - .lore("&r") - .lore("&7Break it to remove.") - .unbreakable(true) - .tag("Game", "Edit Item") - .build().make(); - } - - // -------------------------------------------------------------------------------- - // Protected methods - // -------------------------------------------------------------------------------- - - /** - * Can the player visualize the clicked block? - */ - protected abstract boolean canVisualize(Block block, Player player); - - protected abstract CompMaterial getMenuItem(); - - public abstract CompMaterial getMask(); - - protected abstract String getName(); - - protected abstract ChatColor getColor(); - - protected List<String> getDescription() { - return Arrays.asList( - getColor() + "Left click &7a block to set", - "&7" + Common.article(getName().toLowerCase()) + "&7. "); - } - - protected String makeRemoveActionMessage() { - return makeActionMessage("&4removed"); - } - - protected String makeActionMessage(final String action) { - return "&9Setup > &7" + StringUtils.capitalize(getName().toLowerCase() + " &7has been " + action + "&7."); - } - - protected String getBlockTitle(final Block block) { - return getColoredName(); - } - - protected final void visualize(final Location loc) { - visualizer.show(loc, getDefaultMode()); - } - - protected final void visualizeMask(final Location loc) { - visualizer.show(loc, VisualizeMode.MASK); - } - - protected final void visualizeGlow(final Location loc) { - visualizer.show(loc, VisualizeMode.MASK); - } - - protected final void hide(final Location loc) { - visualizer.hide(loc); - } - - // -------------------------------------------------------------------------------- - // Handle - // -------------------------------------------------------------------------------- - - protected void handleAirClick(final Player pl, final ItemStack item, final ClickType click) { - } - - protected abstract void handleDataLoad(Player pl, Block block); - - protected abstract void handleBlockSelect(Player pl, Block block, BlockClick click); - - protected abstract void handleBlockBreak(Player pl, Block block); - - // -------------------------------------------------------------------------------- - // Final - // -------------------------------------------------------------------------------- - - protected final String getColoredName() { - return getColor() + getName(); - } - - @Override - public final boolean autoCancel() { - return true; - } - - @Override - public final boolean ignoreCancelled() { - return false; - } - - // -------------------------------------------------------------------------------- - // Block manipulation - // -------------------------------------------------------------------------------- - - @Override - public String toString() { - return getClass().getSimpleName() + "{" + getMask() + "}"; - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/VisualizeMode.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/VisualizeMode.java deleted file mode 100644 index 89ff264a4750a3beb938ce20d6cd90904b011478..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/VisualizeMode.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.mineacademy.game.visualize; - -/** - * How should the block be visualized? - * - * @deprecated use classes in the new "visual" package - */ -@Deprecated -public enum VisualizeMode { - - /** - * Render a glowing bounding box around the block? - */ - GLOW, - - /** - * Just change the block to another type? - */ - MASK, -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/VisualizedBlock.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/VisualizedBlock.java deleted file mode 100644 index 6c5178ac2058e835141c51f91b7f1659a019cc32..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/VisualizedBlock.java +++ /dev/null @@ -1,201 +0,0 @@ -package org.mineacademy.game.visualize; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.block.BlockState; -import org.bukkit.entity.FallingBlock; -import org.bukkit.scheduler.BukkitRunnable; -import org.bukkit.scheduler.BukkitTask; -import org.bukkit.util.Vector; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.CompProperty; -import org.mineacademy.fo.remain.Remain; - -/** - * @deprecated use classes in the new "visual" package - */ -@Deprecated -public abstract class VisualizedBlock { - - private final static boolean CAN_VISUALIZE = MinecraftVersion.atLeast(V.v1_9); - - /** - * The block this container originally holds - */ - private final BlockState state; - - /** - * The representation when selected - */ - private final CompMaterial mask; - - // Internal - - /** The visualized entity for this container */ - private FallingBlock fallingBlock = null; - - /** Is glowing? */ - private boolean glow = false; - - /** Keeping this block visualized */ - private BukkitTask keepAliveTask = null; - - /** The block under the falling block to prevent it from falling */ - private BlockState underground = null; - - public VisualizedBlock(final Block block, final CompMaterial mask) { - this.state = block.getState(); - this.mask = mask; - } - - public final void visualize(final VisualizeMode mode) { - removeGlowIf(); - - switch (mode) { - case MASK: - setMask(); - break; - - case GLOW: - glow(); - break; - - default: - throw new FoException("Unhandled visual mode: " + mode); - } - } - - public final void hide() { - removeGlowIf(); - - state.update(true, false); - } - - public abstract String getBlockName(Block block); - - // --------------------------------------------------------------------------- - // Mask - // --------------------------------------------------------------------------- - - private final void setMask() { - Remain.setTypeAndData(state.getBlock(), mask.getMaterial(), (byte) mask.getData(), false); - } - - // --------------------------------------------------------------------------- - // Glow - // --------------------------------------------------------------------------- - - private final void glow() { - Valid.checkBoolean(!glow, "Block " + state.getBlock().getType() + " already glows!"); - - changeRealBlock(); - - if (CAN_VISUALIZE) { - spawnFallingBlock(); - startKeepingAlive(); - } - - glow = true; - } - - private final void changeRealBlock() { - state.getBlock().setType(CAN_VISUALIZE ? Remain.getMaterial("BARRIER", CompMaterial.GLASS).getMaterial() : Material.BEACON); - } - - private final void spawnFallingBlock() { - Valid.checkBoolean(fallingBlock == null, "Report / Already visualized!"); - - final Location spawnLoc = state.getLocation().clone().add(0.5, 0, 0.5); - - final Block under = spawnLoc.getBlock().getRelative(BlockFace.DOWN); - if (under.getType() == Material.AIR) { - underground = under.getState(); - under.setType(CompMaterial.BARRIER.getMaterial()); - } - - final FallingBlock falling = spawnLoc.getWorld().spawnFallingBlock(spawnLoc, mask.getMaterial(), (byte) mask.getData()); - - paintFallingBlock(falling); - this.fallingBlock = falling; - } - - private final void paintFallingBlock(final FallingBlock falling) { - try { - Remain.setCustomName(falling, Common.colorize("&8[" + getBlockName(falling.getLocation().getBlock()) + "&r&8]")); - } catch (final Exception ex) { - ex.printStackTrace(); - } - - falling.setVelocity(new Vector(0, 0, 0)); - falling.setDropItem(false); - - CompProperty.GLOWING.apply(falling, true); - CompProperty.GRAVITY.apply(falling, false); - } - - private final void startKeepingAlive() { - Valid.checkBoolean(keepAliveTask == null, "Report / Task already running for " + this); - - keepAliveTask = new BukkitRunnable() { - - @Override - public void run() { - if (!glow) { - cancel(); - return; - } - - Valid.checkNotNull(fallingBlock, "Report / Falling block is null!"); - fallingBlock.setTicksLived(1); - } - }.runTaskTimer(SimplePlugin.getInstance(), 0, 580 /* Falling sand holds for 600 ticks, but let's be safe */); - } - - // --------------------------------------------------------------------------- - // Hide - // --------------------------------------------------------------------------- - - private final void removeGlowIf() { - if (glow) { - - if (CAN_VISUALIZE) { - removeFallingBlock(); - stopKeepingAlive(); - } - - glow = false; - } - } - - private final void removeFallingBlock() { - Valid.checkNotNull(fallingBlock, "Report / Visualized, but visualized block is null!"); - - if (underground != null) { - underground.update(true); - underground = null; - } - - this.fallingBlock.remove(); - this.fallingBlock = null; - } - - private final void stopKeepingAlive() { - Valid.checkNotNull(keepAliveTask, "Report / Task not running for " + this); - - keepAliveTask.cancel(); - keepAliveTask = null; - } - - @Override - public String toString() { - return getClass().getSimpleName() + "{" + state.getBlock().getType() + "}"; - } -} \ No newline at end of file diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/VisualizerListener.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/VisualizerListener.java deleted file mode 100644 index 23f3f0ce0b205598f094388a4b52c434c3f1ddb6..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/VisualizerListener.java +++ /dev/null @@ -1,85 +0,0 @@ -package org.mineacademy.game.visualize; - -import org.bukkit.block.Block; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.event.inventory.InventoryAction; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.inventory.InventoryType; -import org.mineacademy.fo.BlockUtil; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.remain.Remain; - -/** - * @deprecated use classes in the new "visual" package - */ -@Deprecated -public final class VisualizerListener implements Listener { - - // ------------------------------------------------------------------------------- - // Static registration of different visualizers - // ------------------------------------------------------------------------------- - - private static final StrictList<BlockVisualizer> registered = new StrictList<>(); - - public static void register(final BlockVisualizer v) { - registered.add(v); - } - - public static boolean isBlockTakenByOthers(final Block block, final BlockVisualizer whoAsks) { - for (final BlockVisualizer other : registered) - if (other != whoAsks && other.isStored(block)) - return true; - - return false; - } - - // ------------------------------------------------------------------------------- - // Automatic listeners - // ------------------------------------------------------------------------------- - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onBlockBreak(final BlockBreakEvent e) { - final BlockVisualizer visualizer = findVisualizer(e.getBlock()); - - if (visualizer != null) { - visualizer.onRemove(e.getPlayer(), e.getBlock()); - - e.setCancelled(true); - } - } - - @EventHandler - public void onMiddleClick(final InventoryClickEvent e) { - if (e.getAction() != InventoryAction.PLACE_ALL || e.getView().getType() != InventoryType.CREATIVE || e.getClick() != ClickType.CREATIVE || e.getCursor() == null) - return; - - final Block block = Remain.getTargetBlock(e.getWhoClicked(), 5); - - if (findVisualizer(block) != null) - e.setCancelled(true); - } - - // ------------------------------------------------------------------------------- - // Helpers - // ------------------------------------------------------------------------------- - - private BlockVisualizer findVisualizer(final Block block) { - return block != null && canVisualize(block) ? findVisualizer0(block) : null; - } - - private BlockVisualizer findVisualizer0(final Block block) { - for (final BlockVisualizer visualizer : registered) - if (visualizer.isStored(block)) - return visualizer; - - return null; - } - - private boolean canVisualize(final Block block) { - return BlockUtil.isForBlockSelection(block.getType()); - } -} diff --git a/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/package-info.java b/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/package-info.java deleted file mode 100644 index 112dd90c28e2a57618e4732bc345f931ca5b549e..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/java/org/mineacademy/game/visualize/package-info.java +++ /dev/null @@ -1,2 +0,0 @@ -@java.lang.Deprecated -package org.mineacademy.game.visualize; \ No newline at end of file diff --git a/mineacademy-corearena/src/main/resources/localization/messages_en.yml b/mineacademy-corearena/src/main/resources/localization/messages_en.yml deleted file mode 100644 index 6ffe5fbfef966168f8e8fafb2dd06cd2d670a4f3..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/resources/localization/messages_en.yml +++ /dev/null @@ -1,441 +0,0 @@ -# !-----------------------------------------------------------------------------------------! -# -# Welcome to the localization file -# -# ------------------------------------------------------------------------------------------- -# -# This file contains most of the visual messages and notification player receives -# while interacting with this plugin. Simply edit them as you like and apply changes -# by restarting the server or reloading the plugin. -# -# To not display a message, set it to 'none' -# -# Messages supports variables in brackets {} and color codes with & character -# !-----------------------------------------------------------------------------------------! - -# ------------------------------------------------------------------------------------------- -# Arena-related messages. -# ------------------------------------------------------------------------------------------- -Arena: - # - # Shown when an action is prevented during arena editing - # - Action_Denied_While_Editing: '&cFor safety reasons, finish editing your arena first! Run /arena edit {arena}' - # - # Error-related messages - # - Error: - Not_Enabled: '&cThe arena {arena} is not enabled.' - Not_Found: '&cThe arena ''{arena}'' does not exist!' - Not_Ready: '&cThe arena is not yet configured!' - No_Permission: "&cYou need '{perm}' to join this arena!" - Edited: '&cThe {arena} is currently being edited!' - Already_Playing: '&cYou are already playing in arena {arena}!' - Already_Running: '&cThe arena is already running, try again later!' - Full: '&cThe arena is full, try again later!' - No_Arena_At_Location: Could not find an arena by your location. Please specify the arena name. - Inventory_Not_Empty: '&cPlease clear your inventory before joining!' - Cannot_Run_Command_In_Arena: '&cThis command is disallowed while playing!' - # - # Setup-related messages - # - Setup: - Cannot_Edit: '&cTo edit the arena, please enter its setup mode.' - Cannot_Clone: '&cCannot clone visualized blocks!' - Clone_Mob_Spawnpoint_Unknown: '&cThe selected block is not a mob spawnpoint!' - # - # Messages shown in the lobbly - # - Lobby: - Join_Player: '&7Welcome to &6{arena}&7. We are starting in &6{time}&7.' - Join_Others: '&6{player} &7joined the lobby ({players}/{maxPlayers})!' - Start_Countdown: '&6Get ready! &7Arena {arena} starts in {seconds}!' - Not_Enough_Players: '&c{arena} could not start due to too few players ({players}/{minPlayers})!' - Kick_No_Class: '&cYou have not selected any class, and we couldn''t find you a suitable one!' - Tier_Too_Low: '&7The arena requires at least &6Tier {arenaTier} &7on classes, while you only have &6Tier {classTier} &7on this class.' - # - # Messages shown during the gameplay - # - Game: - Start: '&7The game in &6{arena} &7has begun ({players}/{maxPlayers})!' - End_Countdown: '&6Watch out! &7Arena {arena} ends in {seconds}!' - End: '&6&lGG! &7The game in &6{arena} &7has finished!' - End_Last_Player: '&7The arena has &6ended &7because you were the last player left!' - Death_Broadcast: '&c{player} has died! ({deaths}/{lifes_max})' - Death_To_Victim: '&cYou have died and have {lifes_left} left.' - Kick_Death_Broadcast: '&c{player} has died for the last time and leaves the game!' - Kick_Death_To_Victim: '&cYou have died and have no more lifes left, better luck next time!' - Kill_Broadcast: '&6{player} &7has been killed by &6{killer} &7({lifes_left}/{lifes_max})' - Kill_To_Victim: '&7You have been killed and have &6{lifes} &7left.' - Kick_Kill_Broadcast: '&6{killer} &7has killed &6{player}&7! {players} player(s) left!' - Kick_Kill_To_Victim: '&7You have been killed by &6{killer} &7and the game has ended for you! Better luck next time {player}!' - Class_Auto_Assigned: '&7You did not select any class and were given the class &6{class}&7.' - Friendly_Fire_Activated: '&cWatch out! &6PvP &7has been enabled!' - Explosive_Arrow_No_Ammo: '&7You lack &cExplosive Arrows&7 to shoot from this bow.' - # - # Arena states - # - State: - Stopped: '&4Stopped' - Lobby: '&6Launching' - Running: '&2Running' - -# ------------------------------------------------------------------------------------------- -# Experience is what player receives while playing in the arena. This is converted -# into the Currency (see below) when player leaves the arena. -# ------------------------------------------------------------------------------------------- -Experience: - Next_Phase: '&7Received &6{amount}&7 exp for surviving the {phase}. phase!' - Pickup: '&6You have now &7{level} &6and &7{exp}&6.' - -# ------------------------------------------------------------------------------------------- -# Player may purchase various upgrades while playing in the arena. -# ------------------------------------------------------------------------------------------- -Upgrades: - Locked: '&7This upgrade is available from the &6{phase}. phase&7!' - Lack_Levels: '&7You lack &6{levels} &7to afford this upgrade.' - Lack_Space: '&6Your inventory lacks space! Dropping rest of the items on the floor.' - Successful_Purchase: '&aPurchased: &7{upgrade} for {levels}!' - -# ------------------------------------------------------------------------------------------- -# The bossbar, by default, shows which phase the arena is currently in. -# ------------------------------------------------------------------------------------------- -Bossbar: - Title: Phase {phase} - Next_Phase: '&6&lArena Entered the &4&l{phase} &6&lPhase' - # - # Available. pink, blue, red, green, yellow, purple, white - # - Color: - Start: GREEN - Mid: BLUE - Near_End: RED - -# ------------------------------------------------------------------------------------------- -# Messages specifically for a phase (a wave). -# ------------------------------------------------------------------------------------------- -Phase: - Next_Phase_Wait: '&6Prepare yourself! The next phase starts in {delay} seconds.' - # - # Messages when arena reaches its max phase (it will still continue to play). - # - Max_Phase: - Text: '&6&lArena reached its maximum phase.' - # Usage: <bukkitSoundName>, <volume>, <pitch> - # If you have Minecraft 1.8.x and older, use sound names from: https://goo.gl/ArzbZA - # Set to "none" to disable. - Sound: ENTITY_FIREWORK_BLAST, 1F, 1F - -# ------------------------------------------------------------------------------------------- -# The title bar in the middle of the player's screen -# ------------------------------------------------------------------------------------------- -Title: - Kick: - Title: '&cGame over' - Subtitle: '&7Thank you for playing in {arena}' - Escape: - Title: '&cGame over' - Subtitle: '&7You abandoned the {arena} area' - -# ------------------------------------------------------------------------------------------- -# The in-game currency gives players the opportunity to buy rewards after they -# have played in the arena. The currency is earned from experience received in the arena. -# ------------------------------------------------------------------------------------------- -Currency: - Name: Nugget, Nuggets - Color: GOLD - Received: '&7You received &6{amount} &7and have &6{balance}. &7Go spend them on /arena rewards!' - -# ------------------------------------------------------------------------------------------- -# Localization for the in-game menus -# ------------------------------------------------------------------------------------------- -Menu: - Cannot_Open_In_Arena: '&cCannot open menu while playing in an arena!' - Cannot_Open_Outside_Arena: '&cThis menu is only accessible inside an arena!' - Cannot_Open_Outside_Lobby: '&cThis menu is only accessible in the lobby!' - Use_Class_Menu: '&cPlease use the class menu to edit class upgrades' - # - # The /arena rewards menu - # - Rewards: - Label: '&4Menu Rewards' - Individual_Label: Choose a Reward - Class_Not_Yet_Configured: '&c&oClass yet not configured!' - Select_Class: Select a class - Choose_Reward: Choose a Reward - More_Nuggets_Needed: '&4You need {reward_cost} Nuggets for this' - Bought_Reward: '&2Bought! Remaining: {remaining}' - Items_Label: Items - Items_Description: |- - &r - Purchase valuable items to - enhance your survival experience. - Blocks_Label: Blocks - Blocks_Description: |- - &r - Purchase blocks you can build - with while playing in survival. - Packs_Label: Packs - Packs_Description: |- - &r - Purchase reward packs or special - items only available here. - Class_Label: Upgrade Your Class - Class_Description: |- - &r - Upgrade your classes to - higher tiers here. - Info_Player: |- - Balance: &f{nuggets} - &r - You can spend them on rewards - in form of items or special packs. - Info_Admin: |- - &6Nuggets&7 that players receive in - arena, can be spent on rewards. - &r - You can configure the rewards here. - Info: - Edit: - Items: - - '&7To edit the rewards, simply' - - '&emove &7items from your inventory here.' - Pieces: - - '&eClick &7an item to set its price' - Purchase: - - '&7Balance: &f{balance}' - - '' - - '&7Click to make a purchase.' - - ' ' - - '&7The item wil be saved to' - - '&7your inventory.' - Tier: - Already_Bought: '&2Thou already hast this tier!' - Maximum_Reached: '&2You have the maximum tier' - Too_High: '&4This tier is too high for you!' - Locked: '&cThis tier is locked' - Top: '&cThis is the top tier' - Next: '&dNext Tier ->' - Added: '&7Added Tier' - Purchased: '&6You have purchased {name} Tier {tier}' - Purchased_Menu_Title: '&2&lBought tier {tier}!' - Not_Set: - Helmet: '&7Helmet not set' - Chestplate: '&7Chestplate not set' - Leggings: '&7Leggings not set' - Boots: '&7Boots not set' - -# ------------------------------------------------------------------------------------------- -# Messages shown in the in-game commands. -# ------------------------------------------------------------------------------------------- -Commands: - No_Console: '&cYou may only use this command as a player' - Disallowed_While_Playing: '&cThis command is disabled while you play in an arena.' - Invalid_Argument: '&cInvalid parameter. Run &6/{label} ? &cfor help.' - Invalid_Sub_Argument: '&cInvalid parameter. Run ''/{label} {0}'' for help.' - Invalid_Argument_Multiline: '&cInvalid parameter. Usage:' - Label_Description: '&cDescription: {description}' - Label_Usage: '&cUsage:' - Label_Usages: '&cUsages:' - Error: '&4&lOups! &cThe command failed :( Check the console and report the error.' - Join: - Suggest: Use '/{label} join <arena>' to join one. - Leave: - Not_Playing: '&cYou are not playing in any arena.' - Success: '&6You have abandoned the game in {arena}!' - Start: - Not_Lobby: '&cYou can only start arenas in lobby state. Use /{label} join first to join an arena.' - Success: '&6Forced start of the arena {arena}.' - Fail: '&cArena {arena} could not start, perhaps player limits were not met?' - Stop: - Already_Stopped: '&cThe arena {arena} is already stopped.' - Success: '&7The arena {arena} has been &cstopped.' - Menu: - Lookup_Failed: '&cObject ''{object}'' not found. Run &7/{label} {0}&c.' - Nuggets: - Specify_Player: '&cPlease specify the player name.' - Invalid_Parameter: '&cUnknown parameter ''{2}''. Available: {available}' - Invalid_Amount: '&cInvalid {currency_name} amount: {3}' - Balance: '&7You have &6{balance}' - Balance_Other: '&6{player} &7has &6{balance}' - Set: '&7Set &6{player}''s &7{currency_name} &7to &6{balance}' - Gave: '&6{player} &7was given {amount} and has &6{balance}' - Took: '&6{player} &7was taken {amount} and has &6{balance}' - Edit: - Arena_Running: '&cCannot edit running arenas. Please stop the arena first via &7/{label} stop {arena}&c.' - Already_Editing: '&cYou are already editing {arena}.' - Enabled: '&7Arena {arena} is now in &aedit mode&7. Use /{label} tools to obtain setup tools.' - Disabled: '&7Arena {arena} is &cno longer in edit mode&7.' - Find: - Wrong_Syntax: '&cInvalid syntax! Enter &7player''s name&c, or &7world x y z&c, or just &7x y z' - Not_Found: '&cNo arena found at your location.' - Not_Found_Location: '&cNo arena found at {location}.' - Found: '&7Found the &2{arena}&7 arena at your location.' - Found_Other: '&7{player} is playing in the &2{arena}&7 arena.' - Found_Location: '&7Found &2{arena}&7 arena at {location}.' - Change_State: - Disabled: '&6Successfully disabled arena &7{name}' - Enabled: '&6Successfully enabled arena &7{name}' - Reload_Success: '&7The plugin has been reloaded successfully.' - Reload_Fail: '&4Oups! &cReloading failed due to an error! See console for more information. &4Error: &c{error}' - -# ------------------------------------------------------------------------------------------- -# Server conversation is a dialog where player types information directly to the -# game chat (without /, just the message) and the server will recognize and process it. -# ------------------------------------------------------------------------------------------- -Conversation: - Invalid_Input: '&cInvalid input! Please follow instructions above.' - Stopped: '&cThe server conversation has been cancelled.' - Number_Help: '&cEnter a non-zero number, or type ''exit'' to exit.' - New: - Help: '&7Type &6the name&7 of the new {type}, or ''exit'' to stop.' - Already_Exists: '&cThis {type} already exists. Choose a different name.' - No_Spaces: '&cSpaces are not allowed in names. Use _ instead.' - Success: '&7A new &6{type} &7{name} has been created! Use /arena menu to edit it.' - Success_Arena: '&7A new &6arena &7{name} has been created. The arena has been put into the &eedit mode. &7Use /arena tools to edit it.' - Error: '&cAn unhandled error occured during adding new object.' - Tier: - Help: '&7Type &6the price&7 for {class} Tier {tier}, or ''exit'' to stop.' - Price_Set: '&7This tier is now worth &6{amount}&7.' - Reward: - Help: '&7Type &6the price&7 for this reward ({material}), or ''exit'' to stop.' - Price_Set: '&7This reward is now worth &6{amount}&7.' - Spawner_Minimum_Players: - Help: '&7Type &6the minimum amount&7 of players for this spawner to function.' - Set: '&7The spawner now requires at least &6{amount_players} &7to function.' - Spawner_Chance: - Help: '&7Type &6the chance&7 (in percent) for this spawner to spawn mobs, from 0 (never working) to 100 (always working).' - Set: '&7The spawner has now {chance}% chance of spawning when it turns on.' - Phase: - Input_Matcher: (from|between|on|till) ([0-9]{1,6})(((-)[0-9]{1,6})|)( phase|) - Help: |- - &7Type &owhen &7you want this spawner to function. - &7a) from the start till a phase: Type &6"till <phase>" - &7b) only on one phase: Type &6"on <phase>" - &7c) from a phase and forever after: Type &6"from <phase>" - &7d) between phases: Type &6"between <phase>-<endPhase>" - Set_From: '&7The spawner will function from the &6{period}. phase&7.' - Set_On: '&7The spawner will function on the &6{period}. phase&7.' - Set_Till: '&7The spawner will function till the &6{period}. phase&7.' - Set_Between: '&7The spawner will function between &6{period} phases&7.' - -# ------------------------------------------------------------------------------------------- -# Messages regarding various active signs that do actions when clicked. -# -# TIP: You can configure how the signs look like in the main settings. -# ------------------------------------------------------------------------------------------- -Signs: - Removed_Outside_Arena: '&cThe sign is outside any arena, removing!' - Removed: '&7Registered sign in &6{arena} &7has been removed.' - Outside_Arena: '&cYou must place the sign within an arena!' - # - # Example: 'The class Warrior does not exist!' - # - Object_Not_Found: '&cThe {type} {line} doesn''t exist!' - Created: '&7Registered new sign for arena &6{arena}&7.' - Arena: - Help: |- - &7When making an arena sign, use the following syntax: - &6[arena] &f- makes the plugin recognize the sign - &6<name> &f- the arena name - Class: - Help: |- - &7When making a class sign, use the following syntax: - &6[class] &f- makes the plugin recognize the sign - &6<name> &f- the class name - Upgrade: - Cost_Missing: '&cSpecify the cost on the third line, example: 5, 20, ...' - Cost_Invalid: '&cOnly specify the level number, example: 5, 20, ...' - Help: |- - &7When making an upgrade sign, use the following syntax: - &6[upgrade] &f- makes the plugin recognize the sign - &6<name> &f- the upgrade name - &6<level> &f- the price, in levels - Power: - Type_Invalid: '&cThe trigger type {type} does not exist!' - Help: |- - &7When making a power sign, use the following syntax: - &6[power] &f- makes the plugin recognize the sign - &6<type> &f- when the redstone should be powered? - &fPossible: lobby (when lobby starts) - &fstart (when arena starts) - &fphase (on a new phase) - &fend (when arena ends) - -# ------------------------------------------------------------------------------------------- -# Player-related messages. -# ------------------------------------------------------------------------------------------- -Player: - Never_Played: '&c{player} has never played on the server.' - Never_Played_Arena: '&c{player} has never played an arena.' - Not_Found: '&c{player} has not been found on the server.' - Not_Online: '&cPlayer named ''{player}'' is not online!' - Not_Playing: '&c{player} is not playing in any arena.' - -# ------------------------------------------------------------------------------------------- -# Class-related settings. -# ------------------------------------------------------------------------------------------- -Class: - Selected: '&7Class &b{class} &7has been selected.' - No_Permission: '&cYou lack permission to use {class}!' - Not_Available: '&cArena {arena} does not support classes.' - -# ------------------------------------------------------------------------------------------- -# World-related messages. -# ------------------------------------------------------------------------------------------- -World: - Not_Found: "&cWorld '{world}' doesn't exist!" - -# ------------------------------------------------------------------------------------------- -# Words that are changed depending of the context. -# - In English, only the singular and plural forms is available. -# - In flectic languages (e.g. Slovak), you may specify three cases: sekunda, sekundy, sekund -# ------------------------------------------------------------------------------------------- -Cases: - Player: player, players - Level: level, levels - Exp: exp, exp - Nugget: Nugget, Nuggets - Hour: hour, hours - Minute: minute, minutes - Second: second, seconds - Life: life, lifes - -# ------------------------------------------------------------------------------------------- -# Various short words used multiple times across the plugin. -# ------------------------------------------------------------------------------------------- -Parts: - Usage: '&cUsage: ' - Amount: amount - State: 'State: ' - Size: 'Size: &7' - Players: 'Players: &7' - None: none - Buy: Buy - Edit: Edit - Cost: Cost - Purchase: Purchase - Price: Price - -Edit: - Saved_Changes: '&2Your changes have been saved.' - Menu: - Edited: '&eYou are editing {mode}' - Switch_Pieces: Click to switch to editing prices. - Switch_Items: Click to switch to editing items. - -# ------------------------------------------------------------------------------------------- -# The auto updater messages -# ------------------------------------------------------------------------------------------- -Update: - Available: |- - &2A new version of &3CoreArena&2 is available. - &2Current version: &f{current}&2; New version: &f{new} - &2URL: &7https://www.spigotmc.org/resources/{resource_id}/. - -Data_Missing: '{name} lacks database information! Please only create {type} in-game! Skipping..' -No_Permission: '&cInsufficient permission ({permission}).' - -# Internal version number. Do not change! -Version: 1 - diff --git a/mineacademy-corearena/src/main/resources/plugin.yml b/mineacademy-corearena/src/main/resources/plugin.yml deleted file mode 100644 index 44297deb0fdf8dcdc41717039e244ef38b049adb..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/resources/plugin.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: CoreArena -main: org.mineacademy.corearena.CoreArenaPlugin -version: 2.9.4 -api-version: 1.13 -author: kangarko -softdepend: [AuthMe, Boss, BungeeChatAPI, DiscordSRV, Factions, Feudal, Essentials, LegacyFactions, LuckPerms, MVdWPlaceholderAPI, Multiverse-Core, Nicky, PlaceholderAPI, ProtocolLib, SimpleClans, Towny, TownyChat, Vault, WorldEdit] - -# -# The commands are built at runtime so you can change them easily within the settings. -# Do not change anything in here, you will break the plugin and get no support. -# -commands: -permissions: - confiscate.command.join: - default: true - confiscate.command.leave: - default: true - confiscate.command.list: - default: true - confiscate.command.rewards: - default: true \ No newline at end of file diff --git a/mineacademy-corearena/src/main/resources/prototype/arena.yml b/mineacademy-corearena/src/main/resources/prototype/arena.yml deleted file mode 100644 index 3a1d4eacbc57cfb01ce0480b6442a8cc1d93cf07..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/resources/prototype/arena.yml +++ /dev/null @@ -1,217 +0,0 @@ -# !-----------------------------------------------------------------------------------------! -# Welcome to the individual arena settings file. -# !-----------------------------------------------------------------------------------------! - -# How many times can player be killed before he gets kicked out of the arena? -# He will still receive the experience he got while playing. -Lifes: 3 - -# The minimum class tier that the player must have to play in this arena. -Required_Class_Tier: 1 - -# Allow players to join using their own equipment? -# This disables "Required_Class_Tier" and will deny players selecting classes. -Allow_Own_Equipment: false - -# Allow mobs to drop their natural drops such as equipment or bones for Skeletons? -Natural_Drops: false - -# Should we randomize where players appear after their death? If false, players -# will be spawned at the same spawnpoint as when the arena started. -Random_Respawn_Location: false - -# Should we open the class selection menu when joining this arena lobby? -Open_Class_Menu: true - -# Should we enable the procedural damage feature for this arena? -# You must first install WorldEdit and take initial/damaged snapshots with it using -# our /arena menu. -Procedural_Damage: true - -# Should explosive arrows damage players? -Explosive_Arrows_Damage_Players: true - -# When we should enter the next phase? -# Available: -# a) timer - next phase entered when the phase timer ends (see Duration.Phase) -# b) monsters - next phase entered when all monsters are killed -Next_Phase_Mode: timer - -# The warm-up period between switching phases -Next_Phase_Wait: 10 seconds - -# Radius around the mob spawner to spawn the mobs, so they aren't stacked up at once place. -Mob_Spread: 3 - -# Set to true to allow monsters to burn in sunlight like in vanilla gameplay. -# NB: Also controls if monsters can be set on fire by Fire Aspect enchant. -Mob_Burn_On_Sunlight: false - -# To prevent lag, limit the total amounts of mob within the arena region. -Mob_Limit: 100 - -# Spawn monsters only if at least one player is nearby in the radius around a monster spawner below: -Spawner_Activation_Radius: 40 - -# Configure player limits -Player_Limit: - - # The minimum amount of players required for this arena to start. - Minimum: 2 - - # The maximum amount of players that may play together. - Maximum: 8 - -# You can override the Experience.Amount section from settings here to make your arena give more/less exp. -# Disabled by default. uncomment to make it working. See settings.yml for documentation. -#Experience: -# Next_Phase: "5 + (5 * {phase})" -# Kill: -# Global: "10 + (5 * {phase})" -# Player: "30 + (6 * {phase})" -# CREEPER: "15 + (5 * {phase})" - -# Configure sounds during arena gameplay. Syntax: <name> <volume 0.0-1.0> <pitch 0.0-1.0> -# See https://mineacademy.org/sound for valid sound names. -Sound: - Player_Join: ARROW_HIT 1F 0.1F - Player_Leave: ENDERDRAGON_DEATH 0.9F 1F - Arena_Start: ENTITY_FIREWORK_LARGE_BLAST_FAR 1F 0.1F - -# Configure durations of arena parts (count-dows) -Duration: - - # How long to wait before launching the arena, after the first - # player joined the lobby? By default it's 30 seconds. - Lobby: 30 seconds - - # How long should one game last at maximum ? By default it's 5 minutes. - # The game may end sooner if there will be a winner. - Arena: 5 minutes - - # How long should a phase vary? - Phase: 30 seconds - -# Configure player interaction with the arena. -# -# For material names (for blocks), please see -# https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html -Interaction: - - # Should placing a TNT automatically ignite it? If false, TNTs cannot be placed unless in Allow_Placement list below. - Ignite_Tnts: true - - # Should right clicking with bones automaticall spawn wolves? - Spawn_Wolves: true - - # Should right clicking with fireballs ignite them? - Launch_Fireballs: true - - # List of blocks you wish the players may break. - Allow_Breaking: - - VINE - # In 1.13+, you need to specify all leave types manually like ACACIA_LEAVES, see https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html (search with CTRL+F) - - LEAVES - - LEAVES_2 - - # List of blocks you wish the players may place. - Allow_Placement: - - STONE_BUTTON - - WOOD_BUTTON - - # If Arena.Auto_Repair_Items is true in settings.yml, here you can specify items that will still take damage - Disallow_Auto_Repair: - - GOLD_SWORD - -# A phase is a single monster wave. Configure its settings here. -# Settings with number are activated when the arena enters a certain phase. -# Set to -1 to disable. -Phase: - - # This is the final phase. Arena ends when other conditions are met or the time is up. - Max_Phase: -1 - - # From which phase can players kill each other? - PvP: -1 - - # The initial snapshot also captures what's in your chests when the arena starts. - # You can set it up so the chests are refilled at certain phases, or each x-th phase. - # - # Usage: - # a) Refill only on certain phases: - # Chest_Refill: [10, 20, 30, 40, 50, 60, 70, 80, 90, 100] - # - # b) Refill each x-th phase. Here, chests are refilled each 5. phase. - # Chest_Refill: 5 - Chest_Refill: -1 - - # Automatically stop the arena when there is equals or less then the specified players. - # MAKE SURE you set the players amount here to be higher or at least equals as the minimum players in arena! - Players_End: -1 - - # You can specify the final phase (the last wave) after which the arena ends, here. - Arena_End: -1 - - # After this phase the arena will end immediatelly when all monsters are killed. - Arena_End_No_Monsters: -1 - -# Rewards to give on every nth wave or after a certain wave -# This is a list containing either items:amounts or commands -Rewards: - Every: - 5: - - "iron_ingot:16" - - "gold_ingot:8" - - "diamond:1" - At: - 10: - - "iron_sword" - - "iron_pickaxe" - - "iron_spade" - - # You can execute commands from the console, too - #20: - #- "/cc give physical dungeons 1 {player}" - -# Commands that are run automatically. -# The 'Player' section contains commands run separately as each player (with their permissions), -# and the 'Console' section contains commands run at once from the console. -# -# Useful information for sending commands as the player: -# > Use "@tell <message>" to send messages to the player. Example: -# Player: -# - "@tell Hello there, {player}, thank you for playing in {arena}!" -# -# > There is a special command "@connect <server>" that will send player to another server, -# if you have a BungeeCord network. Replace <server> with the target server. -Commands: - - # Commands run when the arena starts. - Start: - Player: [] - Console: [] - - # Command run when the first player has joined the lobby and started arena countdown - Lobby_Start: - Player: [] - Console: [] - - # Commands run when arena enters a new phase, {phase} (returns a number). - Phase: - Player: [] - Console: [] - - # Commands only run when the arena finishes gracefully (the lobby ended, game had started and then finished). - Finish: - Player: [] - Console: [] - - # Commands run when the arena ends for whatever reason (also run when the lobby ends due to last player disconnecting). - End: - Player: [] - Console: [] - - # Commands run when a player leaves for whatever reason: disconnect, run out of lives, etc. - Player_Leave: - Player: [] - Console: [] diff --git a/mineacademy-corearena/src/main/resources/prototype/class.yml b/mineacademy-corearena/src/main/resources/prototype/class.yml deleted file mode 100644 index 10c9d693d5d5739a46822c4146d3bb441264af88..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/resources/prototype/class.yml +++ /dev/null @@ -1,34 +0,0 @@ -# !-----------------------------------------------------------------------------------------! -# Welcome to the individual class settings file. -# !-----------------------------------------------------------------------------------------! - -# -# Uncomment to only allow players with the specified permission -# to access this class. -# -Permission: "{plugin_name}.class.{file_lowercase}" - -# -# You can configure advanced options for each tier of this class. -# -Tiers: - # - # In this case, we are setting specific option for the Tier II. - # - 2: - # - # Which potions shall the player obtain at the arena start? - # For potion names, ses https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/potion/PotionEffectType.html - # - # Format: <potion name> <level>: <duration> - # - Potions: - SPEED 2: 30 seconds - - # - # Which permission should be given to the player while he has this tier? - # For example, you can add permissions from other plugins. - # - Permissions: - - custom.permission - - another.random.permission \ No newline at end of file diff --git a/mineacademy-corearena/src/main/resources/prototype/upgrade.yml b/mineacademy-corearena/src/main/resources/prototype/upgrade.yml deleted file mode 100644 index fd9af3e071c2dff7af2ad01a3e3dfa304097e0b4..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/resources/prototype/upgrade.yml +++ /dev/null @@ -1,15 +0,0 @@ -# !-----------------------------------------------------------------------------------------! -# Welcome to the upgrade additional settings file. -# Here you can set additional parameters for this upgrade. -# !-----------------------------------------------------------------------------------------! - -# -# Uncomment to only allow players with the specified permission -# to access this class. -# -Permission: "{plugin_name}.class.{file_lowercase}" - -# -# From which phase is this upgrade available? -# -Available_From_Phase: 1 \ No newline at end of file diff --git a/mineacademy-corearena/src/main/resources/settings.yml b/mineacademy-corearena/src/main/resources/settings.yml deleted file mode 100644 index 7449013557bb0e411f516292637e72e326ba875c..0000000000000000000000000000000000000000 --- a/mineacademy-corearena/src/main/resources/settings.yml +++ /dev/null @@ -1,377 +0,0 @@ -# !-----------------------------------------------------------------------------------------! -# Welcome to ${project.name}'s main configuration -# -# This settings file holds all the major options that apply overall in your gameplay. -# -# 1) If you'd like to customize individual arena/class/upgrade/.. edit their appropriate -# file. -# -# 2) If you'd like to edit messages like 'Arena starts in ...', create a new folder -# named "localization" within ${project.name} folder and restart your server. -# Your localization will be copied there and be ready to be customized. -# -# !-----------------------------------------------------------------------------------------! - -# ------------------------------------------------------------------------------------------- -# Configure the global options for every arena. -# ------------------------------------------------------------------------------------------- -Arena: - - # Save player's inventory and give it back when they finish playing? If false, players will - # be required to have empty inventory before joining. - Store_Inventories: true - - # If the arena allows players to join with their own equipment (has "Allow_Own_Equipment" to true), - # should the equipment remain in players' inventory when they die? Otherwise it'll be dropped. - Keep_Own_Equipment_On_Death: true - - # If the player is found in any arena upon joining, teleport him to spawn (or to his previous location)? - Move_Forgotten_Players: true - - # Should people who did not select their class be tried to be given a random one they - # have the permission for? If this fails, then we will kick them. If you have this on false, - # we will kick them right away when the arena starts and they yet did not select a class manually. - Give_Random_Class_If_Not_Selected: true - - # If true, items such as swords or bows won't be destroyed and their durability will be - # unlimited while used in the arena. - Auto_Repair_Items: false - - # Show the arena phase in the boss bar? - Display_Phase_Bar: true - - # Show the mob's health in the action bar? - Display_Mob_Health_Bar: true - - # Do not show death messages in chat when the player dies in the arena? - Hide_Death_Messages: true - - # If true, the commands in "Commands.x.Console" in each arena .yml file will run for each player - # separately (with console privilegies). If false, they are only run once from the console. - # - # Set to true to enable player-related placeholders in that command list. - # Even if this is false, you can still use "Commands.x.Player" for each player. - Console_Commands_For_Each: false - - # Which commands can players run while playing in the arena? - Allowed_Commands: - - /arena - - /ma - - /tell - - /msg - - /r - - /ping - - /tps - - /lag - - /warn - - /kick - - /tempban - - /tempmute - - /chc ach # In case you have ChatControl, allow admin chat - - /chc g # In case you have ChatControl, allow global chat - - # Should ${project.name} put all players into a special chat room when they play? - Chat: - - # Enable per-arena chat here. - Enabled: true - - # Should we only allow other players within the same arena too see the message? - # If false, and you still want to send a message to all players, prepend it with an "!". - Ranged: true - - # Specify the arena chat outlook here. - # Variables: {arena} - arena, {player} - the player, {operatorColor} - red color when OP, {message} - the message - # Or use PlaceholderAPI for more variables. - Format: "&3{player} &8> {operatorColor}{message}" - - # Specify the global arena chat outlook here (see Global_Chat). For variables, see the comment above. - Global_Format: "&8[&3{arena}&8] {operatorColor}{player}: &f{message}" - - # Support for other plugins. - Integration: - - # Disallow players leveling up or getting mcMMO's exps while playing in an arena? - Block_McMMO_Experience: true - - # Prevent players leveling up in the Jobs plugin? - Block_Jobs_Level_Up: true - -# ------------------------------------------------------------------------------------------- -# Experience is the key essential to the arena experience. While playing in an arena, -# players receive experience points for killing monsters and lasting longer alive. -# -# After the arena is finished, gained experience levels are converted to Nuggets, -# that players may spend on rewards or class upgrades. -# ------------------------------------------------------------------------------------------- -Experience: - - # How much experience does one level consists of? - # The level here is the level that player obtains while playing in the arena. - # The experience is the bar above hotbar in your Minecraft just as normal XP. - Exp_Per_Level: 30 - - # How much is 1 Level obtained in arena worth in Nuggets? (Will be rounded.) - # By default it's 0.5, which means that 20 Levels = 10 Nuggets. - Level_To_Nugget_Conversion_Ratio: 0.5 - - # Give Nuggets to player who left by disconnecting, click a sign or a command? - Reward_On_Escape: true - - # When a monster or player is killed, an experience item is dropped next to them. - # Customize the item here. Use the format: <NAME>:<DATA> - # Set to 'none' to disable dropping items. - Item: INK_SACK:12 - Item_Label: "&b{amount} exp" - - # The Gold is a special item allowing you to convert from Nuggets directly - # into your economy money plugin such as iConomy. Vault required. - # Get it via /arena items - Gold: - - # How much is 1 piece of Gold worth in your economy plugin? - Conversion_Ratio: 100 - - # In case Vault returns an empty currency, you can specify its name here. - Currency_Backup_Name: "$" - - # How much and when should players receive experience? (This is only experience, but it will - # be split into levels if it exceeds Exp_Per_Level (see above)) - Amount: - - # A mathematical expression calculating the amount of experience given on each next phase. - # Default: give 5 + 5 exp multiplied by the phase (10 points on the second phase, ..) - Next_Phase: "5 + (5 * {phase})" - - # Experience for killing. - Kill: - - # The experience applied for all mobs if not specified below. - Global: "10 + (5 * {phase})" - - # Experience for killing players - Player: "30 + (6 * {phase})" - - # If you use Boss or MythicMobs, you can specify rewards for bosses you created there. - #"Elite Skeleton": "100 + 10 * {phase}" - - # You may specify custom experience for different mobs. For mob names, see - # https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/EntityType.html - # *USE CASE SENSITIVE NAMES!* - CREEPER: "15 + (5 * {phase})" - #ZOMBIE: "12 + 5 * {phase}" - #GHAST: "40 + 5 * {phase}" - -# ------------------------------------------------------------------------------------------- -# Configure the options for player rewards for Nuggets. -# ------------------------------------------------------------------------------------------- -Rewards: - - # If true, player can upgrade for example from Tier 1 to Tier 4 directly, instead of - # having to upgrade to Tier 2 and Tier 3 beforehand. - Allow_Skipping_Tier: false - - # Should the rewards menu display buttons to obtain blocks, items or packs? - # If false, the rewards menu jumps directly to class upgrade menu. - Enable_Material_Rewards: true - - # Change the materials for the tabs in the rewards menu here. - # - # If you want to change the labels "Items" etc. to something else, use localization file. - Menu_Items: - Items: EMERALD - Blocks: OAK_LOG - Packs: WITHER_SKELETON_SKULL - -# ------------------------------------------------------------------------------------------- -# Each arena can be dynamically damaged by parts, and then restored back to normal once -# the game finishes. To achieve this, you need to set up two snapshots of the arena: -# an initial and the last, damaged snapshot). Configure the damage here: -# ------------------------------------------------------------------------------------------- -Procedural_Damage: - - # Enable realistic block damage with gravitational force? - Enabled: true - - # Configure behaviour of the custom explosions created in the arena - Explosions: - - # What is the radius in the circle we scan around the block that was exploded, to make - # the neighbor blocks fall? Careful, high values (>10) may freeze the server! - Gravitation_Range: 1 - - # The power of various explosion. - Power: - - # By default, Creeper's explosion has the power of 3.0. - Creeper: 2.8 - - # By default, TnT's explosion power is 4.0. - TnT: 3.0 - - # Change how the exploded block hurts nearby entities. This is an extra damage alongside with default - # explosion damage, but for each block separately. - Damage: - - # How many blocks around the EXPLODED BLOCK (not the explosion center) we should search for mobs - # and players? - Radius: 2 - - # The extra damage given to mobs and players nearby (may kill them). - Damage: 2.2 - -# ------------------------------------------------------------------------------------------- -# Configure different special items found in an arena. -# ------------------------------------------------------------------------------------------- -Items: - - # Configure the Bow that shoots Explosive Arrows. Get it via "/ma items". - Explosive_Bow: - - # The power of the explosion created when an arrow lands. See Procedural_Damage.Explosions. - Damage: 2.1 - -# ------------------------------------------------------------------------------------------- -# Configure the behaviour of the arena setup process. -# ------------------------------------------------------------------------------------------- -Setup: - - # Allow monster eggs from (mostly) third party plugins (e.g. a custom boss plugin), - # otherwise you may get the error "Unrecognized spawner egg data". - Accept_Unsafe_Monster_Eggs: false - -# ------------------------------------------------------------------------------------------- -# Here you can configure the clickable signs you may create within this plugin. -# WARNING: Signs only support up to four (4) lines at maximum! -# ------------------------------------------------------------------------------------------- -Signs: - - # Allow creating the [classes] sign (write it on the top) that opens Class Selection Menu? - Allow_Classes_Sign: true - - # These settings allow you to change the name of the sign in brackets, []. - # Place the label in [] on the first line. - Label: - Class: "class" - Classes: "classes" - Upgrade: "upgrade" - Power: "power" - Leave: "leave" - Rewards: "rewards" - - # The sign that will automatically join player if the arena is not yet running. - Join_Sign_Format: |- - [&l{arena}&r] - {state} - &8{players}/{maxPlayers} - - # The sign that will automatically leave player if they play in the arena. - Leave_Sign_Format: |- - [&lLeave&r] - Click to leave - {arena} - - # The sign that will automatically give a class to the player (while waiting in lobby). - Class_Sign_Format: |- - [&lClass&r] - {class} - - # The sign that creates an upgrade shop within the arena (usable while players are playing). - Upgrades_Sign_Format: |- - [&4Upgrade&r] - {upgrade} - {price} - &7Click to buy. - -# ------------------------------------------------------------------------------------------- -# We rely on WorldEdit for restoring arena snapshots. The bigger your arena is, the longer -# it takes to restore a snapshot. Configure the settings according to your server hardware. -# ------------------------------------------------------------------------------------------- -WorldEdit: - - # To prevent server crashes, we split your map into parts each having the given amount - # of blocks. Each restore operation such as when players first join the arena is so split - # into parts each having the given amount of blocks. You can experiment with it to find - # what number reduces lags. The bigger your arenas the longer it takes to restore them so - # make sure your lobby wait duration is long enough! - Block_Bulk_Restore_Amount: 200_000 - - # How long to wait between restoring each portion of the map? See above. - Wait_Period: 15 ticks - - # If you are getting severe memory leaks, set it to true. - # If you are getting java.io.IOException: Stream Closed, to set this to false to solve this. - Close_Stream: false - -# ------------------------------------------------------------------------------------------- -# An external database allows you to share the same data over multiple servers. -# ------------------------------------------------------------------------------------------- -MySQL: - Enabled: false - - # Save each time Nuggets for a player change? Disabled for better performance. - Aggresive: false - - # If your MySQL database is out of sync between your bungee servers, - # set Debug to [mysql] and look for "Updating MySQL data for x took y ms" - # Adjust this key to the amount of milliseconds + around 300 ms (6 ticks) for reserve (1 tick = 50 ms). - # Example: If MySQL takes 83 ms to synchronize, that is under 2 ticks + 6 ticks for reserve is 8. - Delay_Ticks: 10 - - Host: 'localhost' - Database: 'minecraft' - Port: '3306' - User: '' - Password: '' - Table: '${project.name}' - - # For very advanced users, you may customize the connector syntax to MySQL here. - Connector_Advanced: "jdbc:mysql://{host}:{port}/{database}?autoReconnect=true" - -# ------------------------------------------------------------------------------------------- -# Aliases are alternative command names which trigger the same command as the main command. -# Separate them with a comma, e.g: aliases: [arena, match] -# * THE FIRST ALIAS IS THE MAIN LABEL, THAT MEANS AT LEAST ONE ALIAS MUST BE SPECIFIED. * -# ------------------------------------------------------------------------------------------- -Command_Aliases: [arena, ma, mobarena, corearena, ca] - -# ------------------------------------------------------------------------------------------- -# Almost each message begins with a prefix, customize it here or set to "" to disable. -# ------------------------------------------------------------------------------------------- -Prefix: "&5Arena //&7" - -# ------------------------------------------------------------------------------------------- -# Change the language of the messages in this plugin, or completelly customize them. -# Currently: en (English), cn (Chinese), ru (Russian), es (Spanish) and it (Italian) -# ------------------------------------------------------------------------------------------- -Locale: en - -# ------------------------------------------------------------------------------------------- -# Time of some plugin's operations is measured. Print a message to the console if they take -# over the specified amount of time in milliseconds. Set -1 to disable. -# ------------------------------------------------------------------------------------------- -Log_Lag_Over_Milis: 100 - -# ------------------------------------------------------------------------------------------- -# Check and notify for newer versions of ${project.name}? -# ------------------------------------------------------------------------------------------- -Notify_Updates: true - -# ------------------------------------------------------------------------------------------- -# Support the developer of this plugin to allow occasional promotional messages ? -# I promise to keep it low key and only display it once a day at maximum. -# ------------------------------------------------------------------------------------------- -Notify_Promotions: true - -# ------------------------------------------------------------------------------------------- -# Debugging allows you to understand the plugin. It will print more messages to the console. -# Specify sections to debug, or ["*"] to print all out, including some special messages. -# Available: ["mysql", "setup"] -# ------------------------------------------------------------------------------------------- -Debug: [] - -# Internal version check, please do not change! -Serialization: "" - -# Do not change -Version: 5 \ No newline at end of file diff --git a/mineacademy-foundation/.github/ISSUE_TEMPLATE/bug_report.md b/mineacademy-foundation/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index e02a514f33eeeffc8f7e6bc8a7edeccdf50a5407..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: Bug report -about: Report a problem, issue or a bug. -title: 'Minecraft Version: Issue Title' -labels: issue -assignees: '' - ---- - -<!--- -To report a problem or a bug with this library, please follow the three steps below: - -1) Put your Minecraft version in the title. -Example: 1.16.1: Getting NullPointerException error - -2) Be clear: What is your current situation, the desired situation, and your problem? -Example: I am calling a method X to do Y, but Z is the output. How can I achieve XYZ? - -3) If needed - upload any errors to pastebin.com. - -Thank you. Please remove this text and write your actual issue below. ---> diff --git a/mineacademy-foundation/.github/ISSUE_TEMPLATE/question.md b/mineacademy-foundation/.github/ISSUE_TEMPLATE/question.md deleted file mode 100644 index 0453261e792c4ce7c302920d215395717a17e0d2..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/.github/ISSUE_TEMPLATE/question.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: Question -about: Ask a question about the library. -title: 'Minecraft Version: Your Question Title' -labels: question -assignees: '' - ---- - -<!--- -To ask us anything, please follow these directions: - -1) Please include your Minecraft version in your title: -Example: 1.16.1: How to setup the menus? - -2) Try to keep it simple and clear, providing us all information necessary to answer your question. You can use imgur.com to upload images or pastebin.com to upload large text or error traces. - -Thank you. Please remove this text and write your actual question below. ---> diff --git a/mineacademy-foundation/.github/ISSUE_TEMPLATE/suggestion.md b/mineacademy-foundation/.github/ISSUE_TEMPLATE/suggestion.md deleted file mode 100644 index 8ca16426031c7d672441a0f90ae9ee7ae50a08f0..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/.github/ISSUE_TEMPLATE/suggestion.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -name: Improvement -about: Suggest a new idea or a feature. -title: 'Your Suggestion Title' -labels: improvement -assignees: '' - ---- - -<!--- -Notice: Some of the best ideas and features we added were thanks to your suggestions. However, as an extremely small team we're focusing on stability and performance of our software first before adding new features. As such, we're currently very limited to taking in new features. - -If you still believe your feature should be added, you're welcome to suggest it and answer those questions in your description: - -1) How it would benefit others? (Not just you, but 1,000s of others people using the same plugin.) - -2) What would happen if we won't implement this feature? How's your server being affected? - -3) If suggesting something new - Can the old system be modified/improved instead? - -Thank you. Please remove this text and write your actual suggestion below. ---> \ No newline at end of file diff --git a/mineacademy-foundation/.gitignore b/mineacademy-foundation/.gitignore deleted file mode 100644 index 02b0fce331f84fa92a0ac4d63f155cda32c79e83..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/.gitignore +++ /dev/null @@ -1,70 +0,0 @@ -################# -## IDEA -################# - -# User-specific stuff -.idea/ -.idea_modules/ -*.iml - -# IntelliJ -out/ - -target/ - -################# -## Eclipse -################# - -*.pydevproject -.project -.metadata -bin/ -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.classpath -.settings/ -.loadpath -.apt_generated/ -.apt_generated_tests/ - -# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored) -!/.mvn/wrapper/maven-wrapper.jar - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# CDT-specific -.cproject - -# PDT-specific -.buildpath - -# Builder -builder.xml -build.xml - -############# -## Windows detritus -############# - -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Mac crap -.DS_Store -REBASE.bat \ No newline at end of file diff --git a/mineacademy-foundation/CONTRIBUTING.md b/mineacademy-foundation/CONTRIBUTING.md deleted file mode 100644 index d0c93e5c40b57ae1ee71e5c1f1de99d7349b4566..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/CONTRIBUTING.md +++ /dev/null @@ -1,17 +0,0 @@ -We primarly use Eclipse with a couple of adjustments to code and service Foundation. You can use whatever IDE suits you as long as you follow our existing guideliness. - -**Not following our code style will result in your pull request being denied without question.** - -### Codestyle in Eclipse - -Following our codestyle in Eclipse is very easy, simply download and install our preferences, clean up profile and formatter profile from this link: - -https://github.com/kangarko/Foundation/blob/master/Eclipse%20Settings%20And%20Formatting.zip - -### Codestyle in IntelliJ - -IntellIj needs some adjustments, unfortunately at this time I am not able to compile a list but here is a great plugin that enables your code to look much the same like for Eclipse: - -https://plugins.jetbrains.com/plugin/6546-eclipse-code-formatter - -Also make sure that the imports do not contain "*" and single method return statements are not folded. diff --git a/mineacademy-foundation/Eclipse Settings And Formatting.zip b/mineacademy-foundation/Eclipse Settings And Formatting.zip deleted file mode 100644 index 6863779404163d5a0c94027f510551ddf6acbfe0..0000000000000000000000000000000000000000 Binary files a/mineacademy-foundation/Eclipse Settings And Formatting.zip and /dev/null differ diff --git a/mineacademy-foundation/README.md b/mineacademy-foundation/README.md deleted file mode 100644 index 46ca5ee98d6e9822254cadc8ade97846e0011ffd..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/README.md +++ /dev/null @@ -1,95 +0,0 @@ -<p align="center"> - Do you want to code using this library? - <a href="https://mineacademy.org/gh-join"> - <img src="https://i.imgur.com/SuIyaDV.png" /> - </a> -</p> - -### Foundation is a library for bootstrapping Minecraft plugins. -[![](https://jitpack.io/v/kangarko/Foundation.svg)](https://jitpack.io/#kangarko/Foundation) - -Thousands of servers are running on Foundation since 2013. It has been battle tested and proven in plugins ChatControl, Boss, CoreArena, Confiscate, AutoPlay, Puncher, Winter, AnimeX and others. - -Foundation has never been publicly released before MineAcademy. We decided to release its sources to the public and teach it to enable people develop plugins faster, saving boilerplate code and thus focus on what matters the most, putting their ideas out there. - -Check out https://mineacademy.org/plugins for our official list of plugins that use Foundation. - -### Sample usage - -Please see [this link](https://github.com/kangarko/plugintemplate) for a sample plugin demostrating different Foundation abilities. - -### Compatibility - -We aim to provide extreme compatibility layer enabling these Minecraft versions to work: - -- 1.2.5 (from 2012) - Of course, there are things that don't work due to lacking API, but it loads and you can build with Foundation! -- 1.3.2, 1.4.7, 1.5.2, 1.6.4 -- 1.7.10, 1.8.8 -- 1.9.x, 1.10.x, 1.11.x, 1.12.x -- 1.13.x, 1.14.x, 1.15.x, 1.16.x, 1.17.x -- We continously update for newer versions but sometimes forget to update this here, but it does not mean that the library is incompatible! - -### Compiling and using - -We use JitPack to automatically compile and host the latest release of Foundation for you. - -#### a) Alternative A: If you don't have Foundation on your computer: - -To install Foundation with Maven, open your pom.xml, locate the `<repositories>` section and place this repository within it: - -```xml -<repository> - <id>jitpack.io</id> - <url>https://jitpack.io</url> -</repository> -``` - -Then locate the `<dependencies>` section of your pom.xml and place the following inside of it. Replace the "REPLACE_WITH_LATEST_VERSION" string with the latest version from: https://github.com/kangarko/Foundation/releases - -```xml -<dependency> - <groupId>com.github.kangarko</groupId> - <artifactId>Foundation</artifactId> - <version>REPLACE_WITH_LATEST_VERSION</version> -</dependency> -``` - -For more information, including how to use Foundation with other tools than Maven, please visit: https://jitpack.io/#kangarko/Foundation/ - -#### b) Alternative B: If you have Foundation on your computer: - -If you downloaded Foundation to your disk, do not place any repository to your pom.xml file, instead, only place the following dependency. Notice the groupId is different. You can use the LATEST keyword to automatically synchronize changes you make to your local copy of Foundation with your plugin source code (now that's fast!). - -```xml -<dependency> - <groupId>org.mineacademy</groupId> - <artifactId>Foundation</artifactId> - <version>LATEST</version> -</dependency> -``` - -### Important Licencing Information - -2013 - 2020 © MineAcademy.org - -If you are a paying student of MineAcademy.org then you are granted full -unlimited licence to use, modify and reproduce Foundation both commercially -and non-commercially, for yourself, your team or network. You can also -modify the library however you like and include it in your plugins you publish -or sell without stating that you are using this library. - -If you are not a paying student of MineAcademy.org then you may -use this library for non-commercial purposes only. You are allowed -to make changes to this library however as long as those are only -minor changes you must clearly attribute that you are using Foundation -in your software. - -For both parties, do not sell or claim any part of this library as your own. -All infringements will be prosecuted. - -No guarantee - this software is provided AS IS, without any guarantee on its -functionality. We made our best efforts to make Foundation an enterprise-level -solution for anyone looking to accelerate their coding however we are not -taking any responsibility for the success or failure you achieve using it. - -**A tutorial on how to use this library is a part of our Project Orion training available now at https://mineacademy.org** diff --git a/mineacademy-foundation/build.gradle b/mineacademy-foundation/build.gradle deleted file mode 100644 index bfbd34f7a9c1d30f8dd1526cb813dc62a0248014..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/build.gradle +++ /dev/null @@ -1,112 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - */ - -plugins { - id 'java' - id 'maven-publish' - id 'java-library' -} - -repositories { - mavenLocal() - maven { - url = uri('https://bitbucket.org/kangarko/libraries/raw/master') - } - - maven { - url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots') - } - - maven { - url = uri('https://repo.maven.apache.org/maven2/') - } - - maven { - url = uri('http://massive.leigh-co.com/dist') - allowInsecureProtocol true - } -} - -dependencies { - implementation 'org.projectlombok:lombok:1.18.20' - annotationProcessor 'org.projectlombok:lombok:1.18.20' - compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT' - compileOnly 'org.mineacademy.plugin:AuthMe:5.6.0-SNAPSHOT-2459' - compileOnly 'org.mineacademy.plugin:CitizensAPI:2.0.28-b784' - compileOnly 'org.mineacademy.plugin:CMI-API:7.6.2.0' - compileOnly 'org.mineacademy.plugin:DiscordSRV:1.22.0' - compileOnly 'org.mineacademy.plugin:EssentialsX:2.19.0-SNAPSHOT-1148' - compileOnly 'org.mineacademy.plugin:Factions:3.3.2' - compileOnly 'org.mineacademy.plugin:FactionsUUID:1.6.9.5-U0.5.17-b237' - compileOnly 'org.mineacademy.plugin:Jobs:4.17.1' - compileOnly 'org.mineacademy.plugin:LandsAPI:5.4.12' - compileOnly 'org.mineacademy.plugin:LWC:2.2.7' - compileOnly 'org.mineacademy.plugin:MassiveCore:3.3.0' - compileOnly 'org.mineacademy.plugin:mcMMO:2.1.157' - // multiverse-core is a LEIGH&CO provided distribution - compileOnly 'leigh:onarandombox-multiverse-core:4.3.1-SNAPSHOT' - compileOnly 'org.mineacademy.plugin:NuVotifier:2.7.2' - compileOnly 'org.mineacademy.plugin:PlaceholderAPI:2.10.9' - compileOnly 'org.mineacademy.plugin:ProtocolLib:4.6.1-SNAPSHOT-b499' - compileOnly 'org.mineacademy.plugin:Residence:4.9.3.4' - compileOnly 'org.mineacademy.plugin:SimpleClans:2.15.1' - compileOnly 'org.mineacademy.plugin:StackMob:5.5.3' - compileOnly 'org.mineacademy.plugin:Towny:0.97.0.0' - compileOnly 'org.mineacademy.plugin:TownyChat:0.88' - compileOnly 'org.mineacademy.plugin:Vault:1.7.3' - compileOnly 'org.mineacademy.plugin:WorldEdit:7.3.0-SNAPSHOT-5758' - compileOnly 'org.mineacademy.plugin:WorldGuard:7.0.5-SNAPSHOT-2109' - compileOnly 'org.apache.logging.log4j:log4j-core:2.14.1' -} - -group = 'leigh' -version = '5.11.0' -description = 'mineacademy-foundation' -java.sourceCompatibility = JavaVersion.VERSION_1_8 - - -publishing { - publications { - mavenJava(MavenPublication) { - artifactId = 'mineacademy-foundation' - from components.java - versionMapping { - usage('java-api') { - fromResolutionOf('runtimeClasspath') - } - usage('java-runtime') { - fromResolutionResult() - } - } - pom { - name = 'org.mineacadameny Foundation' - description = 'org.mineacadameny Foundation Repackage' - url = 'http://leigh-co.com' - licenses { - license { - name = 'COMMERCIAL' - url = 'http://leigh-co.com' - } - } - developers { - developer { - id = 'aleigh' - name = 'Alex Leigh' - email = 'a@leigh-co.com' - } - } - } - } - } - repositories { - maven { - url = "$buildDir/repos/dist" - } - } -} - - -tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' -} diff --git a/mineacademy-foundation/gradle/wrapper/gradle-wrapper.jar b/mineacademy-foundation/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index e708b1c023ec8b20f512888fe07c5bd3ff77bb8f..0000000000000000000000000000000000000000 Binary files a/mineacademy-foundation/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/mineacademy-foundation/gradle/wrapper/gradle-wrapper.properties b/mineacademy-foundation/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 0f80bbf516ce01e19ca7d329ef8997f131030a91..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/mineacademy-foundation/gradlew b/mineacademy-foundation/gradlew deleted file mode 100755 index 4f906e0c811fc9e230eb44819f509cd0627f2600..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/gradlew +++ /dev/null @@ -1,185 +0,0 @@ -#!/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=`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/mineacademy-foundation/gradlew.bat b/mineacademy-foundation/gradlew.bat deleted file mode 100644 index 107acd32c4e687021ef32db511e8a206129b88ec..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@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/mineacademy-foundation/settings.gradle b/mineacademy-foundation/settings.gradle deleted file mode 100644 index a1adb03bf267749a7e606acbd37969323431289f..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/settings.gradle +++ /dev/null @@ -1,5 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - */ - -rootProject.name = 'Foundation' diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/ASCIIUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/ASCIIUtil.java deleted file mode 100644 index bea1a5941f77a529ead23992e12a3d30e72fc939..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/ASCIIUtil.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.mineacademy.fo; - -import java.awt.Color; -import java.awt.Font; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.image.BufferedImage; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import lombok.NonNull; - -/** - * Textual ASCII generator. - */ -public class ASCIIUtil { - - public static final int SMALL = 12; - public static final int MEDIUM = 18; - public static final int LARGE = 24; - - /** - * Prints ASCII art for the specified text using {@link #MEDIUM} size and the * symbol - * - * @param message - * @param textHeight - Use a predefined sizes from this class or a custom type - * @param letterSymbols - The symbols that will be used to draw the text, randomly mixed - * - * @return the list of text lines you can print in console or send to a player - */ - public static List<String> generate(String message) { - return generate(message, MEDIUM, Arrays.asList("*")); - } - - /** - * Prints ASCII art for the specified text using {@link #MEDIUM} size and the given symbols - * - * @param message - * @param textHeight - Use a predefined sizes from this class or a custom type - * @param letterSymbols - The symbols that will be used to draw the text, randomly mixed, split by | - * - * @return the list of text lines you can print in console or send to a player - */ - public static List<String> generate(String message, @NonNull String letterSymbols) { - return generate(message, MEDIUM, Arrays.asList(letterSymbols.split("\\|"))); - } - - /** - * Prints ASCII art for the specified text. For size, you can use predefined sizes or a custom size. - * - * @param message - * @param textHeight - Use a predefined sizes from this class or a custom type - * @param letterSymbols - The symbols that will be used to draw the text, randomly mixed - * - * @return the list of text lines you can print in console or send to a player - */ - public static List<String> generate(String message, int textHeight, @NonNull List<String> letterSymbols) { - final List<String> texts = new ArrayList<>(); - - final int imageWidth = findImageWidth(textHeight, message, "SansSerif"); - final BufferedImage bufferedImage = new BufferedImage(imageWidth, textHeight, BufferedImage.TYPE_INT_RGB); - final Graphics2D graphics = (Graphics2D) bufferedImage.getGraphics(); - final Font font = new Font("SansSerif", Font.BOLD, textHeight); - - graphics.setFont(font); - graphics.drawString(message, 0, getBaselinePosition(graphics, font)); - - for (int y = 0; y < textHeight; y++) { - final StringBuilder sb = new StringBuilder(); - - for (int x = 0; x < imageWidth; x++) - sb.append(bufferedImage.getRGB(x, y) == Color.WHITE.getRGB() ? RandomUtil.nextItem(letterSymbols) : " "); - - if (sb.toString().trim().isEmpty()) - continue; - - texts.add(sb.toString()); - } - - return texts; - } - - /* - * Using the Current font and current art text find the width of the full image - */ - private static int findImageWidth(int textHeight, String artText, String fontName) { - final BufferedImage bufferedImage = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB); - final Graphics graphics = bufferedImage.getGraphics(); - - graphics.setFont(new Font(fontName, Font.BOLD, textHeight)); - - return graphics.getFontMetrics().stringWidth(artText); - } - - /* - * Find where the text baseline should be drawn so that the characters are within image - */ - private static int getBaselinePosition(Graphics g, Font font) { - final FontMetrics metrics = g.getFontMetrics(font); - final int y = metrics.getAscent() - metrics.getDescent(); - - return y; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/BlockUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/BlockUtil.java deleted file mode 100644 index 7125b8719e2f7a4718e633472fd44eacc9366fb0..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/BlockUtil.java +++ /dev/null @@ -1,825 +0,0 @@ -package org.mineacademy.fo; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.function.Predicate; -import java.util.regex.Pattern; - -import org.bukkit.Chunk; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.FallingBlock; -import org.bukkit.util.Vector; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.Remain; - -import com.google.common.collect.Sets; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.NonNull; -import lombok.RequiredArgsConstructor; - -/** - * Utility class for block manipulation. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class BlockUtil { - - /** - * Matches all DOUBLE or STEP block names - */ - private static final Pattern SLAB_PATTERN = Pattern.compile("(?!DOUBLE).*STEP"); - - /** - * The block faces we use while searching for all parts of the given - * tree upwards - */ - private static final BlockFace[] TREE_TRUNK_FACES = { - BlockFace.UP, BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH, BlockFace.SOUTH - }; - - /** - * A list of safe blocks upon which a tree naturally grows - */ - private final static Set<String> TREE_GROUND_BLOCKS = Sets.newHashSet("GRASS_BLOCK", "COARSE_DIRT", "DIRT", "MYCELIUM", "PODZOL"); - - /** - * The vertical gaps when creating locations for a bounding box, - * see {@link #getBoundingBox(Location, Location)} - */ - public static double BOUNDING_VERTICAL_GAP = 1; - - /** - * The horizontal gaps when creating locations for a bounding box, - * see {@link #getBoundingBox(Location, Location)} - */ - public static double BOUNDING_HORIZONTAL_GAP = 1; - - // ------------------------------------------------------------------------------------------------------------ - // Cuboid region manipulation - // ------------------------------------------------------------------------------------------------------------ - - /** - * Returns true if the given location is within the two vector cuboid bounds - * - * @param location - * @param primary - * @param secondary - * @return - */ - public static boolean isWithinCuboid(final Location location, final Location primary, final Location secondary) { - final double locX = location.getX(); - final double locY = location.getY(); - final double locZ = location.getZ(); - - final int x = primary.getBlockX(); - final int y = primary.getBlockY(); - final int z = primary.getBlockZ(); - - final int x1 = secondary.getBlockX(); - final int y1 = secondary.getBlockY(); - final int z1 = secondary.getBlockZ(); - - if (locX >= x && locX <= x1 || locX <= x && locX >= x1) - if (locZ >= z && locZ <= z1 || locZ <= z && locZ >= z1) - if (locY >= y && locY <= y1 || locY <= y && locY >= y1) - return true; - - return false; - } - - /** - * Return locations representing the bounding box of a chunk, - * used when rendering particle effects for example. - * - * @param chunk - * @return - */ - public static Set<Location> getBoundingBox(@NonNull Chunk chunk) { - final int minX = chunk.getX() << 4; - final int minY = 0; - final int minZ = chunk.getZ() << 4; - - final int maxX = minX | 15; - final int maxY = chunk.getWorld().getMaxHeight(); - final int maxZ = minZ | 15; - - final Location primary = new Location(chunk.getWorld(), minX, minY, minZ); - final Location secondary = new Location(chunk.getWorld(), maxX, maxY, maxZ); - - return getBoundingBox(primary, secondary); - } - - /** - * Return locations representing the bounding box of a cuboid region, - * used when rendering particle effects - * - * @param primary - * @param secondary - * @return - */ - public static Set<Location> getBoundingBox(final Location primary, final Location secondary) { - final List<VectorHelper> shape = new ArrayList<>(); - - final VectorHelper min = getMinimumPoint(primary, secondary); - final VectorHelper max = getMaximumPoint(primary, secondary).add(1, 0, 1); - - final int height = getHeight(primary, secondary); - - final List<VectorHelper> bottomCorners = new ArrayList<>(); - - bottomCorners.add(new VectorHelper(min.getX(), min.getY(), min.getZ())); - bottomCorners.add(new VectorHelper(max.getX(), min.getY(), min.getZ())); - bottomCorners.add(new VectorHelper(max.getX(), min.getY(), max.getZ())); - bottomCorners.add(new VectorHelper(min.getX(), min.getY(), max.getZ())); - - for (int i = 0; i < bottomCorners.size(); i++) { - final VectorHelper p1 = bottomCorners.get(i); - final VectorHelper p2 = i + 1 < bottomCorners.size() ? (VectorHelper) bottomCorners.get(i + 1) : (VectorHelper) bottomCorners.get(0); - - final VectorHelper p3 = p1.add(0, height, 0); - final VectorHelper p4 = p2.add(0, height, 0); - shape.addAll(plotLine(p1, p2)); - shape.addAll(plotLine(p3, p4)); - shape.addAll(plotLine(p1, p3)); - - for (double offset = BOUNDING_VERTICAL_GAP; offset < height; offset += BOUNDING_VERTICAL_GAP) { - final VectorHelper p5 = p1.add(0.0D, offset, 0.0D); - final VectorHelper p6 = p2.add(0.0D, offset, 0.0D); - shape.addAll(plotLine(p5, p6)); - } - } - - final Set<Location> locations = new HashSet<>(); - - for (final VectorHelper vector : shape) - locations.add(new Location(primary.getWorld(), vector.getX(), vector.getY(), vector.getZ())); - - return locations; - } - - private static List<VectorHelper> plotLine(final VectorHelper p1, final VectorHelper p2) { - final List<VectorHelper> ShapeVectors = new ArrayList<>(); - - final int points = (int) (p1.distance(p2) / BOUNDING_HORIZONTAL_GAP) + 1; - final double length = p1.distance(p2); - final double gap = length / (points - 1); - - final VectorHelper gapShapeVector = p2.subtract(p1).normalize().multiply(gap); - - for (int i = 0; i < points; i++) { - final VectorHelper currentPoint = p1.add(gapShapeVector.multiply(i)); - - ShapeVectors.add(currentPoint); - } - - return ShapeVectors; - } - - // ------------------------------------------------------------------------------------------------------------ - // Spherical manipulation - // ------------------------------------------------------------------------------------------------------------ - - /** - * Get all locations within the given 3D spherical radius, hollow or not - * <p> - * NOTE: Calling this operation causes performance penaulty (>100ms for 30 radius!), be careful. - * - * @param location - * @param radius - * @param hollow - * @return - */ - public static Set<Location> getSphere(final Location location, final int radius, final boolean hollow) { - final Set<Location> blocks = new HashSet<>(); - final World world = location.getWorld(); - final int X = location.getBlockX(); - final int Y = location.getBlockY(); - final int Z = location.getBlockZ(); - final int radiusSquared = radius * radius; - - if (hollow) { - for (int x = X - radius; x <= X + radius; x++) - for (int y = Y - radius; y <= Y + radius; y++) - for (int z = Z - radius; z <= Z + radius; z++) - if ((X - x) * (X - x) + (Y - y) * (Y - y) + (Z - z) * (Z - z) <= radiusSquared) - blocks.add(new Location(world, x, y, z)); - - return makeHollow(blocks, true); - } - - for (int x = X - radius; x <= X + radius; x++) - for (int y = Y - radius; y <= Y + radius; y++) - for (int z = Z - radius; z <= Z + radius; z++) - if ((X - x) * (X - x) + (Y - y) * (Y - y) + (Z - z) * (Z - z) <= radiusSquared) - blocks.add(new Location(world, x, y, z)); - - return blocks; - } - - /** - * Get all locations within the given 2D circle radius, hollow or full circle - * <p> - * NOTE: Calling this operation causes performance penaulty (>100ms for 30 radius!), be careful. - * - * @param location - * @param radius - * @param hollow - * @return - */ - public static Set<Location> getCircle(final Location location, final int radius, final boolean hollow) { - final Set<Location> blocks = new HashSet<>(); - final World world = location.getWorld(); - - final int initialX = location.getBlockX(); - final int initialY = location.getBlockY(); - final int initialZ = location.getBlockZ(); - final int radiusSquared = radius * radius; - - if (hollow) { - for (int x = initialX - radius; x <= initialX + radius; x++) - for (int z = initialZ - radius; z <= initialZ + radius; z++) - if ((initialX - x) * (initialX - x) + (initialZ - z) * (initialZ - z) <= radiusSquared) - blocks.add(new Location(world, x, initialY, z)); - - return makeHollow(blocks, false); - } - - for (int x = initialX - radius; x <= initialX + radius; x++) - for (int z = initialZ - radius; z <= initialZ + radius; z++) - if ((initialX - x) * (initialX - x) + (initialZ - z) * (initialZ - z) <= radiusSquared) - blocks.add(new Location(world, x, initialY, z)); - - return blocks; - } - - /** - * Creates a new list of outer location points from all given points - * - * @param blocks - * @param sphere - * @return - */ - private static Set<Location> makeHollow(final Set<Location> blocks, final boolean sphere) { - final Set<Location> edge = new HashSet<>(); - - if (!sphere) { - for (final Location location : blocks) { - final World world = location.getWorld(); - final int x = location.getBlockX(); - final int y = location.getBlockY(); - final int z = location.getBlockZ(); - - final Location front = new Location(world, x + 1, y, z); - final Location back = new Location(world, x - 1, y, z); - final Location left = new Location(world, x, y, z + 1); - final Location right = new Location(world, x, y, z - 1); - - if (!(blocks.contains(front) && blocks.contains(back) && blocks.contains(left) && blocks.contains(right))) - edge.add(location); - - } - return edge; - } - - for (final Location location : blocks) { - final World world = location.getWorld(); - - final int x = location.getBlockX(); - final int y = location.getBlockY(); - final int z = location.getBlockZ(); - - final Location front = new Location(world, x + 1, y, z); - final Location back = new Location(world, x - 1, y, z); - final Location left = new Location(world, x, y, z + 1); - final Location right = new Location(world, x, y, z - 1); - final Location top = new Location(world, x, y + 1, z); - final Location bottom = new Location(world, x, y - 1, z); - - if (!(blocks.contains(front) && blocks.contains(back) && blocks.contains(left) && blocks.contains(right) && blocks.contains(top) && blocks.contains(bottom))) - edge.add(location); - } - - return edge; - - } - - // ------------------------------------------------------------------------------------------------------------ - // Getting blocks within a cuboid - // ------------------------------------------------------------------------------------------------------------ - - /** - * Returns all blocks within the two cuboid bounds (may take a while) - * - * @param primary - * @param secondary - * @return - */ - public static List<Block> getBlocks(final Location primary, final Location secondary) { - Valid.checkNotNull(primary, "Primary region point must be set!"); - Valid.checkNotNull(secondary, "Secondary region point must be set!"); - - final List<Block> blocks = new ArrayList<>(); - - final int topBlockX = primary.getBlockX() < secondary.getBlockX() ? secondary.getBlockX() : primary.getBlockX(); - final int bottomBlockX = primary.getBlockX() > secondary.getBlockX() ? secondary.getBlockX() : primary.getBlockX(); - - final int topBlockY = primary.getBlockY() < secondary.getBlockY() ? secondary.getBlockY() : primary.getBlockY(); - final int bottomBlockY = primary.getBlockY() > secondary.getBlockY() ? secondary.getBlockY() : primary.getBlockY(); - - final int topBlockZ = primary.getBlockZ() < secondary.getBlockZ() ? secondary.getBlockZ() : primary.getBlockZ(); - final int bottomBlockZ = primary.getBlockZ() > secondary.getBlockZ() ? secondary.getBlockZ() : primary.getBlockZ(); - - for (int x = bottomBlockX; x <= topBlockX; x++) - for (int z = bottomBlockZ; z <= topBlockZ; z++) - for (int y = bottomBlockY; y <= topBlockY; y++) { - final Block block = primary.getWorld().getBlockAt(x, y, z); - - if (block != null) - blocks.add(block); - } - - return blocks; - } - - /** - * Return all blocks in the given chunk - * - * @param chunk - * @return - */ - public static List<Block> getBlocks(@NonNull Chunk chunk) { - final List<Block> blocks = new ArrayList<>(); - - final int minX = chunk.getX() << 4; - final int minZ = chunk.getZ() << 4; - - final int maxX = minX | 15; - final int maxY = chunk.getWorld().getMaxHeight(); - final int maxZ = minZ | 15; - - for (int x = minX; x <= maxX; ++x) - for (int y = 0; y <= maxY; ++y) - for (int z = minZ; z <= maxZ; ++z) - blocks.add(chunk.getBlock(x, y, z)); - - return blocks; - } - - /** - * Get all the blocks in a specific area centered around the Location passed in - * - * @param loc Center of the search area - * @param height how many blocks up to check - * @param radius of the search (cubic search radius) - * @param type of Material to search for - * @return all the Block with the given Type in the specified radius - */ - public static List<Block> getBlocks(final Location loc, final int height, final int radius) { - final List<Block> blocks = new ArrayList<>(); - - for (int y = 0; y < height; y++) - for (int x = -radius; x <= radius; x++) - for (int z = -radius; z <= radius; z++) { - final Block checkBlock = loc.getBlock().getRelative(x, y, z); - - if (checkBlock != null && checkBlock.getType() != Material.AIR) - blocks.add(checkBlock); - } - return blocks; - } - - /** - * Return chunks around the given location - * - * @param location - * @param radius - * @return - */ - public static List<Chunk> getChunks(final Location location, final int radius) { - final HashSet<Chunk> addedChunks = new HashSet<>(); - final World world = location.getWorld(); - - final int chunkX = location.getBlockX() >> 4; - final int chunkZ = location.getBlockZ() >> 4; - - for (int x = chunkX - radius; x <= chunkX + radius; ++x) - for (int z = chunkZ - radius; z <= chunkZ + radius; ++z) - if (world.isChunkLoaded(x, z)) - addedChunks.add(world.getChunkAt(x, z)); - - return new ArrayList<>(addedChunks); - } - - /** - * Return all x-z locations within a chunk - * - * @param chunk - * @return - */ - public static List<Location> getXZLocations(Chunk chunk) { - final List<Location> found = new ArrayList<>(); - - final int chunkX = chunk.getX() << 4; - final int chunkZ = chunk.getZ() << 4; - - for (int x = chunkX; x < chunkX + 16; x++) - for (int z = chunkZ; z < chunkZ + 16; z++) - found.add(new Location(chunk.getWorld(), x, 0, z)); - - return found; - } - - /** - * Return all leaves/logs upwards connected to that given tree block - * <p> - * Parts are sorted according to their Y coordinate from lowest to highest - * - * @param block - * @param includeLeaves - * @return - */ - public static List<Block> getTreePartsUp(final Block treeBase) { - final Material baseMaterial = treeBase.getState().getType(); - - final String logType = MinecraftVersion.atLeast(V.v1_13) ? baseMaterial.toString() : "LOG"; - final String leaveType = MinecraftVersion.atLeast(V.v1_13) ? logType.replace("_LOG", "") + "_LEAVES" : "LEAVES"; - - final Set<Block> treeParts = new HashSet<>(); - final Set<Block> toSearch = new HashSet<>(); - final Set<Block> searched = new HashSet<>(); - - toSearch.add(treeBase.getRelative(BlockFace.UP)); - searched.add(treeBase); - - int cycle; - - for (cycle = 0; cycle < 1000 && !toSearch.isEmpty(); cycle++) { - final Block block = toSearch.iterator().next(); - - toSearch.remove(block); - searched.add(block); - - if (block.getType().toString().equals(logType) || block.getType().toString().equals(leaveType)) { - treeParts.add(block); - - for (final BlockFace face : TREE_TRUNK_FACES) { - final Block relative = block.getRelative(face); - - if (!searched.contains(relative)) - toSearch.add(relative); - - } - - } else if (!block.getType().isTransparent()) - return new ArrayList<>(); - } - - return new ArrayList<>(treeParts); - } - - // ------------------------------------------------------------------------------------------------------------ - // Block type checkers - // ------------------------------------------------------------------------------------------------------------ - - /** - * Returns true whether the given block is a "LOG" type and we perform a search - * down to the bottom most connected block to find if that stands onto {@link #TREE_GROUND_BLOCKS} - * - * @param treeBaseBlock - * @return if the bottom most connected block to the given block stays on {@link #TREE_GROUND_BLOCKS} - */ - public static boolean isLogOnGround(Block treeBaseBlock) { - - // Reach for the bottom most tree-like block - while (CompMaterial.isLog(treeBaseBlock.getType())) - treeBaseBlock = treeBaseBlock.getRelative(BlockFace.DOWN); - - return TREE_GROUND_BLOCKS.contains(CompMaterial.fromMaterial(treeBaseBlock.getType()).toString()); - } - - /** - * Will a FallingBlock which lands on this Material break and drop to the - * ground? - * - * @param material to check - * @return boolean - */ - public static boolean isBreakingFallingBlock(final Material material) { - return material.isTransparent() && - material != CompMaterial.NETHER_PORTAL.getMaterial() && - material != CompMaterial.END_PORTAL.getMaterial() || - material == CompMaterial.COBWEB.getMaterial() || - material == Material.DAYLIGHT_DETECTOR || - CompMaterial.isTrapDoor(material) || - material == CompMaterial.OAK_SIGN.getMaterial() || - CompMaterial.isWallSign(material) || - // Match all slabs besides double slab - SLAB_PATTERN.matcher(material.name()).matches(); - } - - /** - * Return true when the given material is a tool, e.g. doesn't stack - * - * @param material - * @return - */ - public static boolean isTool(final Material material) { - return material.name().endsWith("AXE") // axe & pickaxe - || material.name().endsWith("SPADE") - || material.name().endsWith("SWORD") - || material.name().endsWith("HOE") - || material.name().endsWith("BUCKET") // water, milk, lava,.. - || material == CompMaterial.BOW.getMaterial() - || material == CompMaterial.FISHING_ROD.getMaterial() - || material == CompMaterial.CLOCK.getMaterial() - || material == CompMaterial.COMPASS.getMaterial() - || material == CompMaterial.FLINT_AND_STEEL.getMaterial(); - } - - /** - * Return true if the material is an armor - * - * @param material - * @return - */ - public static boolean isArmor(final Material material) { - return material.name().endsWith("HELMET") - || material.name().endsWith("CHESTPLATE") - || material.name().endsWith("LEGGINGS") - || material.name().endsWith("BOOTS"); - } - - /** - * Returns true if block is safe to select - * - * @param material the material - * @return - */ - public static boolean isForBlockSelection(final Material material) { - if (!material.isBlock() || material == Material.AIR) - return false; - - try { - if (material.isInteractable()) // Ignore chests etc. - return false; - } catch (final Throwable t) { - } - - try { - if (material.hasGravity()) // Ignore falling blocks - return false; - } catch (final Throwable t) { - } - - return material.isSolid(); - } - - // ------------------------------------------------------------------------------------------------------------ - // Finding blocks and locations - // ------------------------------------------------------------------------------------------------------------ - - /** - * Scan the location from top to bottom to find the highest Y coordinate that is not air and not snow. - * This will return the free coordinate above the snow layer. - * - * @param location - * @return the y coordinate, or -1 if not found - */ - public static int findHighestBlockNoSnow(final Location location) { - return findHighestBlockNoSnow(location.getWorld(), location.getBlockX(), location.getBlockZ()); - } - - /** - * Scan the location from top to bottom to find the highest Y coordinate that is not air and not snow. - * This will return the free coordinate above the snow layer. - * - * @param world - * @param x - * @param z - * @return the y coordinate, or -1 if not found - */ - public static int findHighestBlockNoSnow(final World world, final int x, final int z) { - for (int y = world.getMaxHeight(); y > 0; y--) { - final Block block = world.getBlockAt(x, y, z); - - if (block != null && !CompMaterial.isAir(block) && block.getType() != CompMaterial.SNOW.getMaterial()) - return y + 1; - } - - return -1; - } - - /** - * Scans the location from top to bottom to find the highest Y non-air coordinate that matches - * the given predicate. - * - * @param world - * @param predicate - * @return the y coordinate, or -1 if not found - */ - public static int findHighestBlock(final Location location, final Predicate<Material> predicate) { - return findHighestBlock(location.getWorld(), location.getBlockX(), location.getBlockZ(), predicate); - } - - /** - * Scans the location from top to bottom to find the highest Y non-air coordinate that matches - * the given predicate. - * - * @param world - * @param x - * @param z - * @param predicate - * @return the y coordinate, or -1 if not found - */ - public static int findHighestBlock(final World world, final int x, final int z, final Predicate<Material> predicate) { - for (int y = world.getMaxHeight(); y > 0; y--) { - final Block block = world.getBlockAt(x, y, z); - - if (block != null && !CompMaterial.isAir(block) && predicate.test(block.getType())) - return y + 1; - } - - return -1; - - } - - /** - * Returns the closest location to the given one of the given locations - * - * @param location - * @param locations - * @return - */ - public static Location findClosestLocation(Location location, List<Location> locations) { - locations = new ArrayList<>(locations); - final Location playerLocation = location; - - Collections.sort(locations, (f, s) -> Double.compare(f.distance(playerLocation), s.distance(playerLocation))); - return locations.get(0); - } - - // ------------------------------------------------------------------------------------------------------------ - // Shooting blocks - // ------------------------------------------------------------------------------------------------------------ - - /** - * Shoot the given block to the sky with the given velocity (maybe your arrow velocity?) - * and can even make the block burn on impact. The shot block is set to air - * - * @param block - * @param velocity - * @return - */ - public static FallingBlock shootBlock(final Block block, final Vector velocity) { - return shootBlock(block, velocity, 0D); - } - - /** - * Shoot the given block to the sky with the given velocity (maybe your arrow velocity?) - * and can even make the block burn on impact. The shot block is set to air - * - * @param block - * @param velocity - * @param burnOnFallChance from 0.0 to 1.0 - * @return - */ - public static FallingBlock shootBlock(final Block block, final Vector velocity, final double burnOnFallChance) { - if (!canShootBlock(block)) - return null; - - final FallingBlock falling = Remain.spawnFallingBlock(block.getLocation(), block.getType()); - - { // Set velocity to reflect the given velocity but change a bit for more realism - final double x = MathUtil.range(velocity.getX(), -2, 2) * 0.5D; - final double y = Math.random(); - final double z = MathUtil.range(velocity.getZ(), -2, 2) * 0.5D; - - falling.setVelocity(new Vector(x, y, z)); - } - - if (RandomUtil.chanceD(burnOnFallChance) && block.getType().isBurnable()) - scheduleBurnOnFall(falling); - - // Prevent drop - falling.setDropItem(false); - - // Remove the block - block.setType(Material.AIR); - - return falling; - } - - /** - * Return the allowed material types to shoot this block - * - * @param block - * @return - */ - private static boolean canShootBlock(final Block block) { - final Material material = block.getType(); - - return !CompMaterial.isAir(material) && (material.toString().contains("STEP") || material.toString().contains("SLAB") || BlockUtil.isForBlockSelection(material)); - } - - /** - * Schedule to set the flying block on fire upon impact - * - * @param block - */ - private static void scheduleBurnOnFall(final FallingBlock block) { - EntityUtil.trackFalling(block, () -> { - final Block upperBlock = block.getLocation().getBlock().getRelative(BlockFace.UP); - - if (upperBlock.getType() == Material.AIR) - upperBlock.setType(Material.FIRE); - }); - } - - // ------------------------------------------------------------------------------------------------------------ - // Helper classes - // ------------------------------------------------------------------------------------------------------------ - - private static VectorHelper getMinimumPoint(final Location pos1, final Location pos2) { - return new VectorHelper(Math.min(pos1.getX(), pos2.getX()), Math.min(pos1.getY(), pos2.getY()), Math.min(pos1.getZ(), pos2.getZ())); - } - - private static VectorHelper getMaximumPoint(final Location pos1, final Location pos2) { - return new VectorHelper(Math.max(pos1.getX(), pos2.getX()), Math.max(pos1.getY(), pos2.getY()), Math.max(pos1.getZ(), pos2.getZ())); - } - - private static int getHeight(final Location pos1, final Location pos2) { - final VectorHelper min = getMinimumPoint(pos1, pos2); - final VectorHelper max = getMaximumPoint(pos1, pos2); - - return (int) (max.getY() - min.getY() + 1.0D); - } - - @RequiredArgsConstructor - private final static class VectorHelper { - - @Getter - protected final double x, y, z; - - public VectorHelper add(final VectorHelper other) { - return add(other.x, other.y, other.z); - } - - public VectorHelper add(final double x, final double y, final double z) { - return new VectorHelper(this.x + x, this.y + y, this.z + z); - } - - public VectorHelper subtract(final VectorHelper other) { - return subtract(other.x, other.y, other.z); - } - - public VectorHelper subtract(final double x, final double y, final double z) { - return new VectorHelper(this.x - x, this.y - y, this.z - z); - } - - public VectorHelper multiply(final double n) { - return new VectorHelper(this.x * n, this.y * n, this.z * n); - } - - public VectorHelper divide(final double n) { - return new VectorHelper(x / n, y / n, z / n); - } - - public double length() { - return Math.sqrt(x * x + y * y + z * z); - } - - public double distance(final VectorHelper other) { - return Math.sqrt(Math.pow(other.x - x, 2) + - Math.pow(other.y - y, 2) + - Math.pow(other.z - z, 2)); - } - - public VectorHelper normalize() { - return divide(length()); - } - - @Override - public boolean equals(final Object obj) { - if (!(obj instanceof VectorHelper)) - return false; - - final VectorHelper other = (VectorHelper) obj; - return other.x == this.x && other.y == this.y && other.z == this.z; - } - - @Override - public String toString() { - return "(" + x + ", " + y + ", " + z + ")"; - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/BungeeUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/BungeeUtil.java deleted file mode 100644 index 1b981e0a622a14d9107a26a56882fa7b2efd1462..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/BungeeUtil.java +++ /dev/null @@ -1,254 +0,0 @@ -package org.mineacademy.fo; - -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.util.UUID; - -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.plugin.messaging.MessageTooLargeException; -import org.mineacademy.fo.Common.Stringer; -import org.mineacademy.fo.bungee.BungeeAction; -import org.mineacademy.fo.bungee.SimpleBungee; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.Remain; - -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.NonNull; - -/** - * Utility class for sending messages to BungeeCord. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class BungeeUtil { - - /** - * See {@link #tellBungee(BungeeChannel, Player, Object...)} - * <p> - * NB: This one uses the default channel name specified in {@link SimplePlugin}. By - * default, nothing is specified there and so an exception will be thrown. - */ - @SafeVarargs - public static <T> void tellBungee(BungeeAction action, T... datas) { - final SimpleBungee bungee = SimplePlugin.getInstance().getBungeeCord(); - Valid.checkNotNull(bungee, SimplePlugin.getNamed() + " does not implement getBungeeCord()!"); - - tellBungee(bungee.getChannel(), action, datas); - } - - /** - * Sends message via a channel to the bungee network (upstreams). You need an - * implementation in bungee to handle it, otherwise nothing will happens. - * <p> - * OBS! The data written: - * <p> - * 1. This server name specified in {@link SimplePlugin#getServerName()} 2. The - * datas in the data parameter. - * - * @param channel the name of channel in an enum object - * @param datas the data - */ - @SafeVarargs - public static <T> void tellBungee(String channel, BungeeAction action, T... datas) { - Valid.checkBoolean(datas.length == action.getContent().length, "Data count != valid values count in " + action + "! Given data: " + datas.length + " vs needed: " + action.getContent().length); - Valid.checkBoolean(Remain.isServerNameChanged(), "Please configure your 'server-name' in server.properties according to mineacademy.org/server-properties first before using BungeeCord features"); - - Debugger.put("bungee", "Server '" + Remain.getServerName() + "' sent bungee message [" + channel + ", " + action + "]: "); - - final Player recipient = getThroughWhomSendMessage(); - - // This server is empty, do not send - if (recipient == null) { - Debugger.put("bungee", "Cannot send " + action + " bungee channel '" + channel + "' message because this server has no players"); - - return; - } - - final ByteArrayDataOutput out = ByteStreams.newDataOutput(); - - out.writeUTF(recipient.getUniqueId().toString()); - out.writeUTF(Remain.getServerName()); - out.writeUTF(action.toString()); - - int actionHead = 0; - - for (Object data : datas) { - try { - Valid.checkNotNull(data, "Bungee object in array is null! Array: " + Common.join(datas, ", ", (Stringer<T>) t -> t == null ? "null" : t.toString() + " (" + t.getClass().getSimpleName() + ")")); - - if (data instanceof CommandSender) - data = ((CommandSender) data).getName(); - - if (data instanceof Integer) { - Debugger.put("bungee", data.toString() + ", "); - - moveHead(actionHead, action, Integer.class, datas); - out.writeInt((Integer) data); - - } else if (data instanceof Double) { - Debugger.put("bungee", data.toString() + ", "); - - moveHead(actionHead, action, Double.class, datas); - out.writeDouble((Double) data); - - } else if (data instanceof Long) { - Debugger.put("bungee", data.toString() + ", "); - - moveHead(actionHead, action, Long.class, datas); - out.writeLong((Long) data); - - } else if (data instanceof Boolean) { - Debugger.put("bungee", data.toString() + ", "); - - moveHead(actionHead, action, Boolean.class, datas); - out.writeBoolean((Boolean) data); - - } else if (data instanceof String) { - Debugger.put("bungee", data.toString() + ", "); - - moveHead(actionHead, action, String.class, datas); - out.writeUTF(CompressUtil.compressB64((String) data)); - - } else if (data instanceof SerializedMap) { - Debugger.put("bungee", data.toString() + ", "); - - moveHead(actionHead, action, String.class, datas); - out.writeUTF(CompressUtil.compressB64(((SerializedMap) data).toJson())); - - } else if (data instanceof UUID) { - Debugger.put("bungee", data.toString() + ", "); - - moveHead(actionHead, action, UUID.class, datas); - out.writeUTF(((UUID) data).toString()); - - } else if (data instanceof Enum) { - Debugger.put("bungee", data.toString() + ", "); - - moveHead(actionHead, action, Enum.class, datas); - out.writeUTF(((Enum<?>) data).toString()); - - } else if (data instanceof byte[]) { - Debugger.put("bungee", data.toString() + ", "); - - moveHead(actionHead, action, String.class, datas); - out.write((byte[]) data); - - } else - throw new FoException("Unknown type of data: " + data + " (" + data.getClass().getSimpleName() + ")"); - - actionHead++; - - } catch (final Throwable t) { - t.printStackTrace(); - - return; - } - } - - Debugger.push("bungee"); - - final byte[] byteArray = out.toByteArray(); - - try { - recipient.sendPluginMessage(SimplePlugin.getInstance(), channel, byteArray); - - } catch (final MessageTooLargeException ex) { - Common.log("Outgoing bungee message '" + action + "' was oversized, not sending. Max length: 32766 bytes, got " + byteArray.length + " bytes."); - } - - actionHead = 0; - } - - /** - * Sends message via a channel to the bungee network (upstreams). You need an - * implementation in bungee to handle it, otherwise nothing will happens. - * <p> - * OBS! The data written: - * <p> - * 1. This server name specified in {@link SimplePlugin#getServerName()} 2. The - * datas in the data parameter. - * - * @param sender the player to send the message as - * @param datas the data - */ - public static void tellNative(Player sender, Object... datas) { - final ByteArrayDataOutput out = ByteStreams.newDataOutput(); - - for (final Object data : datas) { - Valid.checkNotNull(data, "Bungee object in array is null! Array: " + Common.join(datas, ", ", t -> t == null ? "null" : t.toString() + "(" + t.getClass().getSimpleName() + ")")); - - if (data instanceof Integer) - out.writeInt((Integer) data); - - else if (data instanceof Double) - out.writeDouble((Double) data); - - else if (data instanceof Boolean) - out.writeBoolean((Boolean) data); - - else if (data instanceof String) - out.writeUTF((String) data); - - else - throw new FoException("Unknown type of data: " + data + " (" + data.getClass().getSimpleName() + ")"); - } - - sender.sendPluginMessage(SimplePlugin.getInstance(), "BungeeCord", out.toByteArray()); - } - - /** - * Sends a plugin message that will re-connect the player to another server on Bungee - * - * @param player the living non-dead player - * @param serverName the server name as you have in config.yml of your BungeeCord - */ - public static void connect(@NonNull Player player, @NonNull String serverName) { - final ByteArrayOutputStream byteArray = new ByteArrayOutputStream(); - final DataOutputStream out = new DataOutputStream(byteArray); - - try { - out.writeUTF("Connect"); - out.writeUTF(serverName); - - } catch (final Throwable t) { - Common.error(t, - "Unable to connect " + player.getName() + " to server " + serverName, - "Error: %error"); - } - - player.sendPluginMessage(SimplePlugin.getInstance(), "BungeeCord", byteArray.toByteArray()); - } - - /** - * Return either the first online player or the server itself - * through which we send the bungee message as - * - * @return - */ - private static Player getThroughWhomSendMessage() { - return Remain.getOnlinePlayers().isEmpty() ? null : Remain.getOnlinePlayers().iterator().next(); - } - - /** - * Ensures we are reading in the correct order as the given {@link BungeeAction} - * specifies in its {@link BungeeAction#getContent()} getter. - * <p> - * This also ensures we are reading the correct data type (both primitives and wrappers - * are supported). - * - * @param typeOf - */ - private static void moveHead(int actionHead, BungeeAction action, Class<?> typeOf, Object[] datas) throws Throwable { - Valid.checkNotNull(action, "Action not set!"); - - final Class<?>[] content = action.getContent(); - Valid.checkBoolean(actionHead < content.length, "Head out of bounds! Max data size for " + action.name() + " is " + content.length + "! Set Debug to [bungee] in settings.yml and report. Data length: " + datas.length + " data: " + Common.join(datas)); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/ChatUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/ChatUtil.java deleted file mode 100644 index 62fe3eb902204b87723affcf3f1d2c937e6da771..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/ChatUtil.java +++ /dev/null @@ -1,722 +0,0 @@ -package org.mineacademy.fo; - -import java.awt.Color; -import java.text.Normalizer; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.regex.Matcher; - -import org.apache.commons.lang.StringUtils; -import org.bukkit.ChatColor; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.model.Whiteblacklist; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompChatColor; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; - -/** - * Utility class for managing in-game chat. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class ChatUtil { - - /** - * The default center padding - */ - public final static int CENTER_PX = 152; - - /** - * The vertical lines a player can see at once in his chat history - */ - public final static int VISIBLE_CHAT_LINES = 20; - - /** - * Centers a message automatically for padding {@link #CENTER_PX} - * - * @param message - * @return - */ - public static String center(final String message) { - return center(message, ' '); - } - - /** - * Centers a message for padding using the given center px - * - * @param message - * @param centerPx - * @return - */ - public static String center(final String message, final int centerPx) { - return center(message, ' ', centerPx); - } - - /** - * Centers a message for padding {@link #CENTER_PX} with the given space character - * colored by the given chat color, example: - * <p> - * ================= My Centered Message ================= (if the space is '=') - * - * @param message - * @param space - * @param spaceColor - * @return - */ - public static String center(final String message, final char space) { - return center(message, space, CENTER_PX); - } - - /** - * Centers a message according to the given space character, color and padding - * - * @param message - * @param space - * @param centerPx - * @return - */ - public static String center(final String message, final char space, final int centerPx) { - if (message == null || message.equals("")) - return ""; - - int messagePxSize = 0; - - boolean previousCode = false; - boolean isBold = false; - - for (final char c : message.toCharArray()) - - if (c == '&' || c == ChatColor.COLOR_CHAR) { - previousCode = true; - - continue; - - } else if (previousCode == true) { - previousCode = false; - - if (c == 'l' || c == 'L') { - isBold = true; - - continue; - - } - - isBold = false; - - } else { - final DefaultFontInfo defaultFont = DefaultFontInfo.getDefaultFontInfo(c); - - messagePxSize += isBold ? defaultFont.getBoldLength() : defaultFont.getLength(); - messagePxSize++; - } - - final StringBuilder builder = new StringBuilder(); - - final int halvedMessageSize = messagePxSize / 2; - final int toCompensate = centerPx - halvedMessageSize; - final int spaceLength = DefaultFontInfo.getDefaultFontInfo(space).getLength() + (isBold ? 2 : 1); - - int compensated = 0; - - while (compensated < toCompensate) { - builder.append(space); - - compensated += spaceLength; - } - - return builder.toString() + " " + message + " " + builder.toString(); - } - - /** - * Moves the given messages to the center of the chat screen - * - * @param messages - * @return - */ - public static String[] verticalCenter(final String... messages) { - return verticalCenter(Arrays.asList(messages)); - } - - /** - * Moves the given messages to the center of the chat screen - * - * @param messages - * @return - */ - public static String[] verticalCenter(final Collection<String> messages) { - final List<String> lines = new ArrayList<>(); - final long padding = MathUtil.ceiling((VISIBLE_CHAT_LINES - messages.size()) / 2); - - for (int i = 0; i < padding; i++) - lines.add(RandomUtil.nextColorOrDecoration()); - - for (final String message : messages) - lines.add(message); - - for (int i = 0; i < padding; i++) - lines.add(RandomUtil.nextColorOrDecoration()); - - return lines.toArray(new String[lines.size()]); - } - - /** - * Inserts dots '.' into the message. Ignores domains and numbers. - * - * @param message the message to be processed - * @return message with dots inserted - */ - public static String insertDot(String message) { - if (message.isEmpty()) - return ""; - - final String lastChar = message.substring(message.length() - 1); - final String[] words = message.split("\\s"); - final String lastWord = words[words.length - 1]; - - if (!isDomain(lastWord) && lastChar.matches("(?i)[a-z\u0400-\u04FF]")) - message = message + "."; - - return message; - } - - /** - * Makes first letters of sentences big. Ignores domains and detects multiple - * sentences. - * - * @param message the message to check - * @return capitalized message - */ - public static String capitalize(final String message) { - if (message.isEmpty()) - return ""; - - final String[] sentences = message.split("(?<=[!?\\.])\\s"); - String tempMessage = ""; - - for (String sentence : sentences) { - try { - final String word = message.split("\\s")[0]; - - if (!isDomain(word)) - sentence = sentence.substring(0, 1).toUpperCase() + sentence.substring(1); - - tempMessage = tempMessage + sentence + " "; - } catch (final ArrayIndexOutOfBoundsException ex) { - // Probably an exotic language, silence - } - } - - return tempMessage.trim(); - } - - /** - * Lowercases the second character in a sentence in the message. - * - * @param message - * @return - */ - public static String lowercaseSecondChar(final String message) { - if (message.isEmpty()) - return ""; - - final String[] sentences = message.split("(?<=[!?\\.])\\s"); - String tempMessage = ""; - - for (String sentence : sentences) - try { - if (sentence.length() > 2) - if (!isDomain(message.split("\\s")[0]) && sentence.length() > 2 && Character.isUpperCase(sentence.charAt(0)) && Character.isLowerCase(sentence.charAt(2))) - sentence = sentence.substring(0, 1) + sentence.substring(1, 2).toLowerCase() + sentence.substring(2); - - tempMessage = tempMessage + sentence + " "; - } catch (final NullPointerException ex) { - } - return tempMessage.trim(); - } - - /** - * An improved version of {@link Matcher#quoteReplacement(String)} - * where we quote additional letters such as ()+ - * - * @param message - * @return - */ - public static String quoteReplacement(String message) { - - final StringBuilder builder = new StringBuilder(); - - for (int index = 0; index < message.length(); index++) { - final char c = message.charAt(index); - - if (c == ' ' || c == '\\' || c == '$' || c == '(' || c == ')' || c == '+' || c == '.' || c == '-' || c == '_' || c == '^') - builder.append('\\'); - - builder.append(c); - } - - return builder.toString(); - } - - /** - * Attempts to remove all emojis from the given input - * - * @author https://stackoverflow.com/a/32101331 - * @param message - * @return - */ - public static String removeEmoji(String message) { - if (message == null) - return ""; - - final StringBuilder builder = new StringBuilder(); - - for (int i = 0; i < message.length(); i++) { - - // Emojis are two characters long in java, e.g. a rocket emoji is "\uD83D\uDE80"; - if (i < (message.length() - 1)) { - - if (Character.isSurrogatePair(message.charAt(i), message.charAt(i + 1))) { - // also skip the second character of the emoji - i += 1; - - continue; - } - } - - builder.append(message.charAt(i)); - } - - return builder.toString(); - } - - /** - * How much big letters the message has, in percentage. - * - * @param message the message to check - * - * @return how much percent of the message is big letters (from 0 to 100) - */ - public static double getCapsPercentage(final String message) { - if (message.isEmpty()) - return 0; - - final String[] sentences = Common.stripColors(message).split(" "); - String messageToCheck = ""; - double upperCount = 0; - - for (final String sentence : sentences) - if (!isDomain(sentence)) - messageToCheck += sentence + " "; - - for (final char ch : messageToCheck.toCharArray()) - if (Character.isUpperCase(ch)) - upperCount++; - - return upperCount / messageToCheck.length(); - } - - /** - * How many big letters the message has. - * - * @param message the message to check - * @param ignored the list of strings to ignore (whitelist) - * - * @return how many big letters are in message - */ - public static int getCapsInRow(final String message, final List<String> ignored) { - if (message.isEmpty()) - return 0; - - final int[] caps = splitCaps(Common.stripColors(message), ignored); - - int sum = 0; - int sumTemp = 0; - - for (final int i : caps) - if (i == 1) { - sumTemp++; - sum = Math.max(sum, sumTemp); - } else - sumTemp = 0; - - return sum; - } - - /** - * How many big letters the message has. - * - * @param message the message to check - * @param ignored the list of strings to ignore (whitelist) - * - * @return how many big letters are in message - */ - public static int getCapsInRow(final String message, final Whiteblacklist list) { - if (message.isEmpty()) - return 0; - - final int[] caps = splitCaps(Common.stripColors(message), list); - - int sum = 0; - int sumTemp = 0; - - for (final int i : caps) - if (i == 1) { - sumTemp++; - sum = Math.max(sum, sumTemp); - } else - sumTemp = 0; - - return sum; - } - - /** - * Calculates the similarity (a double within 0.00 and 1.00) between two strings. - * - * @param first - * @param second - * - * @return - */ - public static double getSimilarityPercentage(String first, String second) { - if (first.isEmpty() && second.isEmpty()) - return 1D; - - first = removeSimilarity(first); - second = removeSimilarity(second); - - String longer = first, shorter = second; - - if (first.length() < second.length()) { // longer should always have greater length - longer = second; - shorter = first; - } - - final int longerLength = longer.length(); - - if (longerLength == 0) - return 0; /* both strings are zero length */ - - return (longerLength - editDistance(longer, shorter)) / (double) longerLength; - } - - /* - * Remove any similarity traits of a message such as removing colors, - * lowercasing it, removing diacritic - */ - private static String removeSimilarity(String message) { - - if (SimplePlugin.getInstance().similarityStripAccents()) - message = replaceDiacritic(message); - - message = Common.stripColors(message); - message = message.toLowerCase(); - - return message; - } - - /** - * Return true if the given string is a http(s) and/or www domain - * - * @param message - * @return - */ - public static boolean isDomain(final String message) { - return Common.regExMatch("(https?:\\/\\/(?:www\\.|(?!www))[^\\s\\.]+\\.[^\\s]{2,}|www\\.[^\\s]+\\.[^\\s]{2,})", message); - } - - /** - * Replace special accented letters with their non-accented alternatives - * such as á is replaced by a - * - * @param message - * @return - */ - public static String replaceDiacritic(final String message) { - return Normalizer.normalize(message, Normalizer.Form.NFD).replaceAll("\\p{InCombiningDiacriticalMarks}+", ""); - } - - /** - * Return true if the given message contains [JSON] or any interactive part like {@literal <toast> or <actionbar>} - * @param msg - * @return - */ - public static boolean isInteractive(String msg) { - return msg.startsWith("[JSON]") || msg.startsWith("<toast>") || msg.startsWith("<title>") || msg.startsWith("<actionbar>") || msg.startsWith("<bossbar>"); - } - - /** - * Automatically add gradient for the given string using the two colors as start/ending colors - * - * @param message - * @param from - * @param to - * @return - */ - public static String generateGradient(String message, CompChatColor from, CompChatColor to) { - if (!MinecraftVersion.atLeast(V.v1_16)) - return message; - - final Color color1 = from.getColor(); - final Color color2 = to.getColor(); - - final char[] letters = message.toCharArray(); - String gradient = ""; - - ChatColor lastDecoration = null; - - for (int i = 0; i < letters.length; i++) { - final char letter = letters[i]; - - // Support color decoration and insert it manually after each character - if (letter == ChatColor.COLOR_CHAR && i + 1 < letters.length) { - final char decoration = letters[i + 1]; - - if (decoration == 'k') - lastDecoration = ChatColor.MAGIC; - - else if (decoration == 'l') - lastDecoration = ChatColor.BOLD; - - else if (decoration == 'm') - lastDecoration = ChatColor.STRIKETHROUGH; - - else if (decoration == 'n') - lastDecoration = ChatColor.UNDERLINE; - - else if (decoration == 'o') - lastDecoration = ChatColor.ITALIC; - - else if (decoration == 'r') - lastDecoration = null; - - i++; - continue; - } - - final float ratio = (float) i / (float) letters.length; - - final int red = (int) (color2.getRed() * ratio + color1.getRed() * (1 - ratio)); - final int green = (int) (color2.getGreen() * ratio + color1.getGreen() * (1 - ratio)); - final int blue = (int) (color2.getBlue() * ratio + color1.getBlue() * (1 - ratio)); - - final Color stepColor = new Color(red, green, blue); - - gradient += CompChatColor.of(stepColor).toString() + (lastDecoration == null ? "" : lastDecoration.toString()) + letters[i]; - } - - return gradient; - } - - // -------------------------------------------------------------------------------- - // Helpers - // -------------------------------------------------------------------------------- - - // Example implementation of the Levenshtein Edit Distance - // See http://rosettacode.org/wiki/Levenshtein_distance#Java - private static int editDistance(String first, String second) { - first = first.toLowerCase(); - second = second.toLowerCase(); - - final int[] costs = new int[second.length() + 1]; - for (int i = 0; i <= first.length(); i++) { - int lastValue = i; - for (int j = 0; j <= second.length(); j++) - if (i == 0) - costs[j] = j; - else if (j > 0) { - int newValue = costs[j - 1]; - if (first.charAt(i - 1) != second.charAt(j - 1)) - newValue = Math.min(Math.min(newValue, lastValue), costs[j]) + 1; - costs[j - 1] = lastValue; - lastValue = newValue; - } - if (i > 0) - costs[second.length()] = lastValue; - } - return costs[second.length()]; - } - - private static int[] splitCaps(final String message, final List<String> ignored) { - final int[] editedMsg = new int[message.length()]; - final String[] parts = message.split(" "); - - for (int i = 0; i < parts.length; i++) - for (final String whitelisted : ignored) - if (whitelisted.equalsIgnoreCase(parts[i])) - parts[i] = parts[i].toLowerCase(); - - for (int i = 0; i < parts.length; i++) - if (isDomain(parts[i])) - parts[i] = parts[i].toLowerCase(); - - final String msg = StringUtils.join(parts, " "); - - for (int i = 0; i < msg.length(); i++) - if (Character.isUpperCase(msg.charAt(i)) && Character.isLetter(msg.charAt(i))) - editedMsg[i] = 1; - else - editedMsg[i] = 0; - return editedMsg; - } - - private static int[] splitCaps(final String message, final Whiteblacklist list) { - final int[] editedMsg = new int[message.length()]; - final String[] parts = message.split(" "); - - for (int i = 0; i < parts.length; i++) - if (list.isInList(parts[i])) - parts[i] = parts[i].toLowerCase(); - - for (int i = 0; i < parts.length; i++) - if (isDomain(parts[i])) - parts[i] = parts[i].toLowerCase(); - - final String msg = StringUtils.join(parts, " "); - - for (int i = 0; i < msg.length(); i++) - if (Character.isUpperCase(msg.charAt(i)) && Character.isLetter(msg.charAt(i))) - editedMsg[i] = 1; - else - editedMsg[i] = 0; - return editedMsg; - } -} - -/** - * Contains information about all allowed Minecraft letters - * - * @deprecated new Minecraft versions support Unicode and a much broader range - * - */ -enum DefaultFontInfo { - - A('A', 5), - a('a', 5), - B('B', 5), - b('b', 5), - C('C', 5), - c('c', 5), - D('D', 5), - d('d', 5), - E('E', 5), - e('e', 5), - F('F', 5), - f('f', 4), - G('G', 5), - g('g', 5), - H('H', 5), - h('h', 5), - I('I', 3), - i('i', 1), - J('J', 5), - j('j', 5), - K('K', 5), - k('k', 4), - L('L', 5), - l('l', 1), - M('M', 5), - m('m', 5), - N('N', 5), - n('n', 5), - O('O', 5), - o('o', 5), - P('P', 5), - p('p', 5), - Q('Q', 5), - q('q', 5), - R('R', 5), - r('r', 5), - S('S', 5), - s('s', 5), - T('T', 5), - t('t', 4), - U('U', 5), - u('u', 5), - V('V', 5), - v('v', 5), - W('W', 5), - w('w', 5), - X('X', 5), - x('x', 5), - Y('Y', 5), - y('y', 5), - Z('Z', 5), - z('z', 5), - NUM_1('1', 5), - NUM_2('2', 5), - NUM_3('3', 5), - NUM_4('4', 5), - NUM_5('5', 5), - NUM_6('6', 5), - NUM_7('7', 5), - NUM_8('8', 5), - NUM_9('9', 5), - NUM_0('0', 5), - EXCLAMATION_POINT('!', 1), - AT_SYMBOL('@', 6), - NUM_SIGN('#', 5), - DOLLAR_SIGN('$', 5), - PERCENT('%', 5), - UP_ARROW('^', 5), - AMPERSAND('&', 5), - ASTERISK('*', 5), - LEFT_PARENTHESIS('(', 4), - RIGHT_PERENTHESIS(')', 4), - MINUS('-', 5), - UNDERSCORE('_', 5), - PLUS_SIGN('+', 5), - EQUALS_SIGN('=', 5), - LEFT_CURL_BRACE('{', 4), - RIGHT_CURL_BRACE('}', 4), - LEFT_BRACKET('[', 3), - RIGHT_BRACKET(']', 3), - COLON(':', 1), - SEMI_COLON(';', 1), - DOUBLE_QUOTE('"', 3), - SINGLE_QUOTE('\'', 1), - LEFT_ARROW('<', 4), - RIGHT_ARROW('>', 4), - QUESTION_MARK('?', 5), - SLASH('/', 5), - BACK_SLASH('\\', 5), - LINE('|', 1), - TILDE('~', 5), - TICK('`', 2), - PERIOD('.', 1), - COMMA(',', 1), - SPACE(' ', 3), - DEFAULT('a', 4); - - private final char character; - private final int length; - - DefaultFontInfo(final char character, final int length) { - this.character = character; - this.length = length; - } - - public char getCharacter() { - return this.character; - } - - public int getLength() { - return this.length; - } - - public int getBoldLength() { - if (this == DefaultFontInfo.SPACE) - return this.getLength(); - return this.length + 1; - } - - public static DefaultFontInfo getDefaultFontInfo(final char c) { - for (final DefaultFontInfo dFI : DefaultFontInfo.values()) - if (dFI.getCharacter() == c) - return dFI; - - return DefaultFontInfo.DEFAULT; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/Common.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/Common.java deleted file mode 100644 index 1bef135f9ccc1010064f4798255d1d8e38134cd7..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/Common.java +++ /dev/null @@ -1,2798 +0,0 @@ -package org.mineacademy.fo; - -import java.io.IOException; -import java.lang.reflect.Array; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.StringTokenizer; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; - -import org.apache.commons.lang.StringUtils; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.command.CommandSender; -import org.bukkit.configuration.MemorySection; -import org.bukkit.conversations.Conversable; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.Listener; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.scheduler.BukkitRunnable; -import org.bukkit.scheduler.BukkitScheduler; -import org.bukkit.scheduler.BukkitTask; -import org.bukkit.util.Vector; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.exception.RegexTimeoutException; -import org.mineacademy.fo.model.DiscordSender; -import org.mineacademy.fo.model.HookManager; -import org.mineacademy.fo.model.Replacer; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompChatColor; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.fo.settings.SimpleLocalization; -import org.mineacademy.fo.settings.SimpleSettings; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.NonNull; -import net.md_5.bungee.api.chat.TextComponent; - -/** - * Our main utility class hosting a large variety of different convenience functions - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class Common { - - // ------------------------------------------------------------------------------------------------------------ - // Constants - // ------------------------------------------------------------------------------------------------------------ - - /** - * Pattern used to match colors with & or {@link ChatColor#COLOR_CHAR} - */ - private static final Pattern COLOR_AND_DECORATION_REGEX = Pattern.compile("(&|" + ChatColor.COLOR_CHAR + ")[0-9a-fk-orA-FK-OR]"); - - /** - * Pattern used to match colors with #HEX code for MC 1.16+ - */ - public static final Pattern RGB_HEX_COLOR_REGEX = Pattern.compile("(?<!\\\\)(&|)#((?:[0-9a-fA-F]{3}){1,2})"); - - /** - * Pattern used to match colors with {#HEX} code for MC 1.16+ - */ - public static final Pattern RGB_HEX_BRACKET_COLOR_REGEX = Pattern.compile("\\{#((?:[0-9a-fA-F]{3}){1,2})\\}"); - - /** - * Pattern used to match colors with #HEX code for MC 1.16+ - */ - private static final Pattern RGB_X_COLOR_REGEX = Pattern.compile("(" + ChatColor.COLOR_CHAR + "x)(" + ChatColor.COLOR_CHAR + "[0-9a-fA-F]){6}"); - - /** - * We use this to send messages with colors to your console - */ - private static final CommandSender CONSOLE_SENDER = Bukkit.getServer() != null ? Bukkit.getServer().getConsoleSender() : null; - - /** - * Used to send messages to player without repetition, e.g. if they attempt to break a block - * in a restricted region, we will not spam their chat with "You cannot break this block here" 120x times, - * instead, we only send this message once per X seconds. This cache holds the last times when we - * sent that message so we know how long to wait before the next one. - */ - private static final Map<String, Long> TIMED_TELL_CACHE = new HashMap<>(); - - /** - * See {@link #TIMED_TELL_CACHE}, but this is for sending messages to your console - */ - private static final Map<String, Long> TIMED_LOG_CACHE = new HashMap<>(); - - // ------------------------------------------------------------------------------------------------------------ - // Tell prefix - // ------------------------------------------------------------------------------------------------------------ - - /** - * Should we add a prefix to the messages we send to players using tell() methods? - * <p> - * False by default - */ - public static boolean ADD_TELL_PREFIX = false; - - /** - * Should we add a prefix to the messages we send to the console? - * <p> - * True by default - */ - public static boolean ADD_LOG_PREFIX = true; - - /** - * The tell prefix applied on tell() methods - */ - @Getter - private static String tellPrefix = "[" + SimplePlugin.getNamed() + "]"; - - /** - * The log prefix applied on log() methods - */ - @Getter - private static String logPrefix = "[" + SimplePlugin.getNamed() + "]"; - - /** - * Set the tell prefix applied for messages to players from tell() methods - * <p> - * Colors with & letter are translated automatically. - * - * @param prefix - */ - public static void setTellPrefix(final String prefix) { - tellPrefix = colorize(prefix); - } - - /** - * Set the log prefix applied for messages in the console from log() methods. - * <p> - * Colors with & letter are translated automatically. - * - * @param prefix - */ - public static void setLogPrefix(final String prefix) { - logPrefix = colorize(prefix); - } - - // ------------------------------------------------------------------------------------------------------------ - // Broadcasting - // ------------------------------------------------------------------------------------------------------------ - - /** - * Broadcast the message as per {@link Replacer#replaceArray(String, Object...)} mechanics - * such as broadcastReplaced("Hello {world} from {player}", "world", "survival_world", "player", "kangarko") - * - * @param message - * @param replacements - */ - public static void broadcastReplaced(final String message, final Object... replacements) { - broadcast(Replacer.replaceArray(message, replacements)); - } - - /** - * Broadcast the message replacing {player} variable with the given command sender - * - * @param message - * @param sender - */ - public static void broadcast(final String message, final CommandSender sender) { - broadcast(message, resolveSenderName(sender)); - } - - /** - * Broadcast the message replacing {player} variable with the given player replacement - * - * @param message - * @param playerReplacement - */ - public static void broadcast(final String message, final String playerReplacement) { - broadcast(message.replace("{player}", playerReplacement)); - } - - /** - * Broadcast the message to everyone and logs it - * - * @param message - */ - public static void broadcast(final String... messages) { - if (!Valid.isNullOrEmpty(messages)) - for (final String message : messages) { - for (final Player online : Remain.getOnlinePlayers()) - tellJson(online, message); - - log(message); - } - } - - /** - * Sends messages to all recipients - * - * @param recipients - * @param messages - */ - public static void broadcastTo(final Iterable<? extends CommandSender> recipients, final String... messages) { - for (final CommandSender sender : recipients) - tell(sender, messages); - } - - /** - * Broadcast the message to everyone with permission - * - * @param showPermission - * @param message - * @param log - */ - public static void broadcastWithPerm(final String showPermission, final String message, final boolean log) { - if (message != null && !message.equals("none")) { - for (final Player online : Remain.getOnlinePlayers()) - if (PlayerUtil.hasPerm(online, showPermission)) - tellJson(online, message); - - if (log) - log(message); - } - } - - /** - * Broadcast the text component message to everyone with permission - * - * @param permission - * @param message - * @param log - */ - public static void broadcastWithPerm(final String permission, @NonNull final TextComponent message, final boolean log) { - final String legacy = message.toLegacyText(); - - if (!legacy.equals("none")) { - for (final Player online : Remain.getOnlinePlayers()) - if (PlayerUtil.hasPerm(online, permission)) - Remain.sendComponent(online, message); - - if (log) - log(legacy); - } - } - - // ------------------------------------------------------------------------------------------------------------ - // Messaging - // ------------------------------------------------------------------------------------------------------------ - - /** - * Sends a message to the player and saves the time when it was sent. - * The delay in seconds is the delay between which we won't send player the - * same message, in case you call this method again. - * <p> - * Does not prepend the message with {@link #getTellPrefix()} - * <p> - * See {@link #TIMED_TELL_CACHE} for more explanation. - * - * @param delaySeconds - * @param sender - * @param message - */ - public static void tellTimedNoPrefix(final int delaySeconds, final CommandSender sender, final String message) { - final boolean hadPrefix = ADD_TELL_PREFIX; - ADD_TELL_PREFIX = false; - - tellTimed(delaySeconds, sender, message); - - ADD_TELL_PREFIX = hadPrefix; - } - - /** - * Sends a message to the player and saves the time when it was sent. - * The delay in seconds is the delay between which we won't send player the - * same message, in case you call this method again. - * <p> - * See {@link #TIMED_TELL_CACHE} for more explanation. - * - * @param delaySeconds - * @param sender - * @param message - */ - public static void tellTimed(final int delaySeconds, final CommandSender sender, final String message) { - - // No previous message stored, just tell the player now - if (!TIMED_TELL_CACHE.containsKey(message)) { - tell(sender, message); - - TIMED_TELL_CACHE.put(message, TimeUtil.currentTimeSeconds()); - return; - } - - if (TimeUtil.currentTimeSeconds() - TIMED_TELL_CACHE.get(message) > delaySeconds) { - tell(sender, message); - - TIMED_TELL_CACHE.put(message, TimeUtil.currentTimeSeconds()); - } - } - - /** - * Sends the conversable a message later - * - * @param delayTicks - * @param conversable - * @param message - */ - public static void tellLaterConversing(final int delayTicks, final Conversable conversable, final String message) { - runLater(delayTicks, () -> tellConversing(conversable, message)); - } - - /** - * Sends the conversable player a colorized message - * - * @param conversable - * @param message - */ - public static void tellConversing(final Conversable conversable, final String message) { - conversable.sendRawMessage(colorize((ADD_TELL_PREFIX ? tellPrefix : "") + removeFirstSpaces(message)).trim()); - } - - /** - * Sends a message to the sender with a given delay, colors & are supported - * - * @param sender - * @param delayTicks - * @param messages - */ - public static void tellLater(final int delayTicks, final CommandSender sender, final String... messages) { - runLater(delayTicks, () -> { - if (sender instanceof Player && !((Player) sender).isOnline()) - return; - - tell(sender, messages); - }); - } - - /** - * Sends sender a message with {} variables replaced and colors supported - * without the {@link #getTellPrefix()} - * - * @param sender - * @param messages - */ - public static void tellNoPrefix(final CommandSender sender, final Replacer replacer) { - tellNoPrefix(sender, replacer.getReplacedMessage()); - } - - /** - * Sends the sender a bunch of messages, colors & are supported - * without {@link #getTellPrefix()} prefix - * - * @param sender - * @param messages - */ - public static void tellNoPrefix(final CommandSender sender, final String... messages) { - final boolean was = ADD_TELL_PREFIX; - - ADD_TELL_PREFIX = false; - tell(sender, messages); - ADD_TELL_PREFIX = was; - } - - /** - * Send the sender a bunch of messages, colors & are supported - * - * @param sender - * @param messages - */ - public static void tell(final CommandSender sender, final Collection<String> messages) { - tell(sender, toArray(messages)); - } - - /** - * Sends sender a bunch of messages, ignoring the ones that equal "none" or null, - * replacing & colors and {player} with his variable - * - * @param sender - * @param messages - */ - public static void tell(final CommandSender sender, final String... messages) { - for (final String message : messages) - if (message != null && !"none".equals(message)) - tellJson(sender, message); - } - - /** - * Sends a message to the player replacing the given associative array of placeholders in the given message - * - * @param recipient - * @param message - * @param replacements - */ - public static void tellReplaced(CommandSender recipient, String message, Object... replacements) { - tell(recipient, Replacer.replaceArray(message, replacements)); - } - - /* - * Tells the sender a basic message with & colors replaced and {player} with his variable replaced. - * <p> - * If the message starts with [JSON] than we remove the [JSON] prefix and handle the message - * as a valid JSON component. - * <p> - * Finally, a prefix to non-json messages is added, see {@link #getTellPrefix()} - */ - private static void tellJson(@NonNull final CommandSender sender, String message) { - if (message.isEmpty() || "none".equals(message)) - return; - - // Has prefix already? This is replaced when colorizing - final boolean hasPrefix = message.contains("{prefix}"); - final boolean hasJSON = message.startsWith("[JSON]"); - - // Replace player - message = message.replace("{player}", resolveSenderName(sender)); - - // Replace colors - if (!hasJSON) - message = colorize(message); - - // Used for matching - final String colorlessMessage = stripColors(message); - - // Send [JSON] prefixed messages as json component - if (hasJSON) { - final String stripped = message.substring(6).trim(); - - if (!stripped.isEmpty()) - Remain.sendJson(sender, stripped); - - } else if (colorlessMessage.startsWith("<actionbar>")) { - final String stripped = message.replace("<actionbar>", ""); - - if (!stripped.isEmpty()) - if (sender instanceof Player) - Remain.sendActionBar((Player) sender, stripped); - else - tellJson(sender, stripped); - - } else if (colorlessMessage.startsWith("<toast>")) { - final String stripped = message.replace("<toast>", ""); - - if (!stripped.isEmpty()) - if (sender instanceof Player) - Remain.sendToast((Player) sender, stripped); - else - tellJson(sender, stripped); - - } else if (colorlessMessage.startsWith("<title>")) { - final String stripped = message.replace("<title>", ""); - - if (!stripped.isEmpty()) { - final String[] split = stripped.split("\\|"); - final String title = split[0]; - final String subtitle = split.length > 1 ? Common.joinRange(1, split) : null; - - if (sender instanceof Player) - Remain.sendTitle((Player) sender, title, subtitle); - - else { - tellJson(sender, title); - - if (subtitle != null) - tellJson(sender, subtitle); - } - } - - } else if (colorlessMessage.startsWith("<bossbar>")) { - final String stripped = message.replace("<bossbar>", ""); - - if (!stripped.isEmpty()) { - if (sender instanceof Player) - // cannot provide time here so we show it for 10 seconds - Remain.sendBossbarTimed((Player) sender, stripped, 10); - else - tellJson(sender, stripped); - } - - } else - for (final String part : splitNewline(message)) { - final String prefixStripped = removeSurroundingSpaces(tellPrefix); - final String prefix = ADD_TELL_PREFIX && !hasPrefix && !prefixStripped.isEmpty() ? prefixStripped + " " : ""; - - String toSend; - - if (Common.stripColors(part).startsWith("<center>")) - toSend = ChatUtil.center(prefix + part.replace("<center>", "")); - else - toSend = prefix + part; - - if (MinecraftVersion.olderThan(V.v1_9) && toSend.length() + 1 >= Short.MAX_VALUE) { - toSend = toSend.substring(0, Short.MAX_VALUE / 2); - - Common.warning("Message to " + sender.getName() + " was too large, sending the first 16,000 letters: " + toSend); - } - - // Make player engaged in a server conversation still receive the message - if (sender instanceof Conversable && ((Conversable) sender).isConversing()) - ((Conversable) sender).sendRawMessage(toSend); - - else - sender.sendMessage(toSend); - } - } - - /** - * Return the sender's name if it's a player or discord sender, or simply {@link SimplePlugin#getConsoleName()} if it is a console - * - * @param sender - * @return - */ - public static String resolveSenderName(final CommandSender sender) { - return sender instanceof Player || sender instanceof DiscordSender ? sender.getName() : SimpleLocalization.CONSOLE_NAME; - } - - // Remove first spaces from the given message - private static String removeFirstSpaces(String message) { - message = getOrEmpty(message); - - while (message.startsWith(" ")) - message = message.substring(1); - - return message; - } - - // ------------------------------------------------------------------------------------------------------------ - // Colorizing messages - // ------------------------------------------------------------------------------------------------------------ - - /** - * Replaces & colors for every string in the list - * A new list is created only containing non-null list values - * - * @param list - * @return - */ - public static List<String> colorize(final List<String> list) { - final List<String> copy = new ArrayList<>(); - copy.addAll(list); - - for (int i = 0; i < copy.size(); i++) { - final String message = copy.get(i); - - if (message != null) - copy.set(i, colorize(message)); - } - - return copy; - } - - /** - * Replace the & letter with the {@link org.bukkit.CompChatColor.COLOR_CHAR} in the message. - * - * @param messages the messages to replace color codes with '&' - * @return the colored message - */ - public static String colorize(final String... messages) { - return colorize(StringUtils.join(messages, "\n")); - } - - /** - * Replace the & letter with the {@link org.bukkit.CompChatColor.COLOR_CHAR} in the message. - * - * @param messages the messages to replace color codes with '&' - * @return the colored message - */ - public static String[] colorizeArray(final String... messages) { - - for (int i = 0; i < messages.length; i++) - messages[i] = colorize(messages[i]); - - return messages; - } - - /** - * Replace the & letter with the {@link org.bukkit.CompChatColor.COLOR_CHAR} in the message. - * <p> - * Also replaces {prefix} with {@link #getTellPrefix()} and {server} with {@link SimplePlugin#getServerPrefix()} - * - * @param message the message to replace color codes with '&' - * @return the colored message - */ - public static String colorize(final String message) { - if (message == null || message.isEmpty()) - return ""; - - String result = ChatColor.translateAlternateColorCodes('&', message - .replace("{prefix}", message.startsWith(tellPrefix) ? "" : removeSurroundingSpaces(tellPrefix.trim())) - .replace("{server}", SimpleLocalization.SERVER_PREFIX) - .replace("{plugin_name}", SimplePlugin.getNamed()) - .replace("{plugin_version}", SimplePlugin.getVersion())); - - // RGB colors - if (MinecraftVersion.atLeast(MinecraftVersion.V.v1_16)) { - - // Preserve compatibility with former systems - Matcher match = RGB_HEX_BRACKET_COLOR_REGEX.matcher(result); - - while (match.find()) { - final String colorCode = match.group(1); - String replacement = ""; - - try { - replacement = CompChatColor.of("#" + colorCode).toString(); - - } catch (final IllegalArgumentException ex) { - } - - result = result.replaceAll("\\{#" + colorCode + "\\}", replacement); - } - - match = RGB_HEX_COLOR_REGEX.matcher(result); - - while (match.find()) { - final String colorCode = match.group(2); - String replacement = ""; - - try { - replacement = CompChatColor.of("#" + colorCode).toString(); - - } catch (final IllegalArgumentException ex) { - } - - result = result.replaceAll("(&|)#" + colorCode, replacement); - } - - result = result.replace("\\#", "#"); - } - - return result; - } - - // Remove first and last spaces from the given message - private static String removeSurroundingSpaces(String message) { - message = getOrEmpty(message); - - while (message.endsWith(" ")) - message = message.substring(0, message.length() - 1); - - return removeFirstSpaces(message); - } - - /** - * Replaces the {@link ChatColor#COLOR_CHAR} colors with & letters - * - * @param messages - * @return - */ - public static String[] revertColorizing(final String[] messages) { - for (int i = 0; i < messages.length; i++) - messages[i] = revertColorizing(messages[i]); - - return messages; - } - - /** - * Replaces the {@link ChatColor#COLOR_CHAR} colors with & letters - * - * @param message - * @return - */ - public static String revertColorizing(final String message) { - return message.replaceAll("(?i)" + ChatColor.COLOR_CHAR + "([0-9a-fk-or])", "&$1"); - } - - /** - * Remove all {@link ChatColor#COLOR_CHAR} as well as & letter colors from the message - * - * @param message - * @return - */ - public static String stripColors(String message) { - - if (message == null || message.isEmpty()) - return message; - - // Replace & color codes - Matcher matcher = COLOR_AND_DECORATION_REGEX.matcher(message); - - while (matcher.find()) - message = matcher.replaceAll(""); - - // Replace hex colors, both raw and parsed - if (Remain.hasHexColors()) { - matcher = RGB_HEX_COLOR_REGEX.matcher(message); - - while (matcher.find()) - message = matcher.replaceAll(""); - - matcher = RGB_X_COLOR_REGEX.matcher(message); - - while (matcher.find()) - message = matcher.replaceAll(""); - - message = message.replace(ChatColor.COLOR_CHAR + "x", ""); - } - - return message; - } - - /** - * Only remove the & colors from the message - * - * @param message - * @return - */ - public static String stripColorsLetter(final String message) { - return message == null ? "" : message.replaceAll("&([0-9a-fk-orA-F-K-OR])", ""); - } - - /** - * Returns if the message contains either {@link ChatColor#COLOR_CHAR} or & letter colors - * - * @param message - * @return - */ - public static boolean hasColors(final String message) { - return COLOR_AND_DECORATION_REGEX.matcher(message).find(); - } - - /** - * Returns the last color, either & or {@link ChatColor#COLOR_CHAR} from the given message - * - * @param message, or empty if none - * @return - */ - public static String lastColor(final String message) { - - // RGB colors - if (MinecraftVersion.atLeast(MinecraftVersion.V.v1_16)) { - final int c = message.lastIndexOf(ChatColor.COLOR_CHAR); - final Matcher match = RGB_X_COLOR_REGEX.matcher(message); - - String lastColor = null; - - while (match.find()) - lastColor = match.group(0); - - if (lastColor != null) - if (c == -1 || c < message.lastIndexOf(lastColor) + lastColor.length()) - return lastColor; - } - - final String andLetter = lastColorLetter(message); - final String colorChat = lastColorChar(message); - - return !andLetter.isEmpty() ? andLetter : !colorChat.isEmpty() ? colorChat : ""; - } - - /** - * Return last color & + the color letter from the message, or empty if not exist - * - * @param message - * @return - */ - public static String lastColorLetter(final String message) { - return lastColor(message, '&'); - } - - /** - * Return last {@link ChatColor#COLOR_CHAR} + the color letter from the message, or empty if not exist - * - * @param message - * @return - */ - public static String lastColorChar(final String message) { - return lastColor(message, ChatColor.COLOR_CHAR); - } - - private static String lastColor(final String msg, final char colorChar) { - final int c = msg.lastIndexOf(colorChar); - - // Contains our character - if (c != -1) { - - // Contains a character after color character - if (msg.length() > c + 1) - if (msg.substring(c + 1, c + 2).matches("([0-9a-fk-or])")) - return msg.substring(c, c + 2).trim(); - - // Search after colors before that invalid character - return lastColor(msg.substring(0, c), colorChar); - } - - return ""; - } - - // ------------------------------------------------------------------------------------------------------------ - // Aesthetics - // ------------------------------------------------------------------------------------------------------------ - - /** - * Returns a long ------ console line - * - * @return - */ - public static String consoleLine() { - return "!-----------------------------------------------------!"; - } - - /** - * Returns a long ______ console line - * - * @return - */ - public static String consoleLineSmooth() { - return "______________________________________________________________"; - } - - /** - * Returns a long -------- chat line - * - * @return - */ - public static String chatLine() { - return "*---------------------------------------------------*"; - } - - /** - * Returns a long &m----------- chat line with strike effect - * - * @return - */ - public static String chatLineSmooth() { - return "&m-----------------------------------------------------"; - } - - /** - * Returns a very long -------- config line - * - * @return - */ - public static String configLine() { - return "-------------------------------------------------------------------------------------------"; - } - - /** - * Returns a |------------| scoreboard line with given dashes amount - * - * @param length - * @return - */ - public static String scoreboardLine(final int length) { - String fill = ""; - - for (int i = 0; i < length; i++) - fill += "-"; - - return "&m|" + fill + "|"; - } - - /** - * If the count is 0 or over 1, adds an "s" to the given string - * - * @param count - * @param ofWhat - * @return - */ - public static String plural(final long count, final String ofWhat) { - final String exception = getException(count, ofWhat); - - return exception != null ? exception : count + " " + ofWhat + (count == 0 || count > 1 && !ofWhat.endsWith("s") ? "s" : ""); - } - - /** - * If the count is 0 or over 1, adds an "es" to the given string - * - * @param count - * @param ofWhat - * @return - */ - public static String pluralEs(final long count, final String ofWhat) { - final String exception = getException(count, ofWhat); - - return exception != null ? exception : count + " " + ofWhat + (count == 0 || count > 1 && !ofWhat.endsWith("es") ? "es" : ""); - } - - /** - * If the count is 0 or over 1, adds an "ies" to the given string - * - * @param count - * @param ofWhat - * @return - */ - public static String pluralIes(final long count, final String ofWhat) { - final String exception = getException(count, ofWhat); - - return exception != null ? exception : count + " " + (count == 0 || count > 1 && !ofWhat.endsWith("ies") ? ofWhat.substring(0, ofWhat.length() - 1) + "ies" : ofWhat); - } - - /** - * Return the plural word from the exception list or null if none - * - * @param count - * @param ofWhat - * @return - * @deprecated contains a very limited list of most common used English plural irregularities - */ - @Deprecated - private static String getException(final long count, final String ofWhat) { - final SerializedMap exceptions = SerializedMap.ofArray( - "life", "lives", - "class", "classes", - "wolf", "wolves", - "knife", "knives", - "wife", "wives", - "calf", "calves", - "leaf", "leaves", - "potato", "potatoes", - "tomato", "tomatoes", - "hero", "heroes", - "torpedo", "torpedoes", - "veto", "vetoes", - "foot", "feet", - "tooth", "teeth", - "goose", "geese", - "man", "men", - "woman", "women", - "mouse", "mice", - "die", "dice", - "ox", "oxen", - "child", "children", - "person", "people", - "penny", "pence", - "sheep", "sheep", - "fish", "fish", - "deer", "deer", - "moose", "moose", - "swine", "swine", - "buffalo", "buffalo", - "shrimp", "shrimp", - "trout", "trout", - "spacecraft", "spacecraft", - "cactus", "cacti", - "axis", "axes", - "analysis", "analyses", - "crisis", "crises", - "thesis", "theses", - "datum", "data", - "index", "indices", - "entry", "entries", - "boss", "bosses"); - - return exceptions.containsKey(ofWhat) ? count + " " + (count == 0 || count > 1 ? exceptions.getString(ofWhat) : ofWhat) : null; - } - - /** - * Prepends the given string with either "a" or "an" (does a dummy syllable check) - * - * @param ofWhat - * @return - * @deprecated only a dummy syllable check, e.g. returns a hour - */ - @Deprecated - public static String article(final String ofWhat) { - Valid.checkBoolean(ofWhat.length() > 0, "String cannot be empty"); - final List<String> syllables = Arrays.asList("a", "e", "i", "o", "u", "y"); - - return (syllables.contains(ofWhat.toLowerCase().trim().substring(0, 1)) ? "an" : "a") + " " + ofWhat; - } - - /** - * Generates a bar indicating progress. Example: - * <p> - * ##----- - * ###---- - * ####--- - * - * @param min the min progress - * @param minChar - * @param max the max prograss - * @param maxChar - * @param delimiterColor - * @return - */ - public static String fancyBar(final int min, final char minChar, final int max, final char maxChar, final ChatColor delimiterColor) { - String formatted = ""; - - for (int i = 0; i < min; i++) - formatted += minChar; - - formatted += delimiterColor; - - for (int i = 0; i < max - min; i++) - formatted += maxChar; - - return formatted; - } - - /** - * Formats the vector location to one digit decimal points - * - * @param vec - * @return - */ - public static String shortLocation(final Vector vec) { - return " [" + MathUtil.formatOneDigit(vec.getX()) + ", " + MathUtil.formatOneDigit(vec.getY()) + ", " + MathUtil.formatOneDigit(vec.getZ()) + "]"; - } - - /** - * Formats the given location to block points without decimals - * - * @param loc - * @return - */ - public static String shortLocation(final Location loc) { - if (loc == null) - return "Location(null)"; - - if (loc.equals(new Location(null, 0, 0, 0))) - return "Location(null, 0, 0, 0)"; - - Valid.checkNotNull(loc.getWorld(), "Cannot shorten a location with null world!"); - - return loc.getWorld().getName() + " [" + loc.getBlockX() + ", " + loc.getBlockY() + ", " + loc.getBlockZ() + "]"; - } - - /** - * A very simple helper for duplicating the given text the given amount of times. - * - * Example: duplicate("apple", 2) will produce "appleapple" - * - * @param text - * @param nTimes - * @return - */ - public static String duplicate(String text, int nTimes) { - if (nTimes == 0) - return ""; - - final String toDuplicate = new String(text); - - for (int i = 1; i < nTimes; i++) - text += toDuplicate; - - return text; - } - - /** - * Limits the string to the given length maximum - * appending "..." at the end when it is cut - * - * @param text - * @param maxLength - * @return - */ - public static String limit(String text, int maxLength) { - final int length = text.length(); - - return maxLength >= length ? text : text.substring(0, maxLength) + "..."; - } - - // ------------------------------------------------------------------------------------------------------------ - // Plugins management - // ------------------------------------------------------------------------------------------------------------ - - /** - * @see #doesPluginExist(String) - * - * @deprecated subject for removal, please use {@link #doesPluginExist(String)} because it now works the same - * - * @param pluginName - * @return - */ - @Deprecated - public static boolean doesPluginExistSilently(final String pluginName) { - return doesPluginExist(pluginName); - } - - /** - * Checks if a plugin is enabled. We also schedule an async task to make - * sure the plugin is loaded correctly when the server is done booting - * <p> - * Return true if it is loaded (this does not mean it works correctly) - * - * @param pluginName - * @return - */ - public static boolean doesPluginExist(final String pluginName) { - Plugin lookup = null; - - for (final Plugin otherPlugin : Bukkit.getPluginManager().getPlugins()) - if (otherPlugin.getName().equals(pluginName)) { - lookup = otherPlugin; - - break; - } - - final Plugin found = lookup; - - if (found == null) - return false; - - if (!found.isEnabled()) - runLaterAsync(0, () -> Valid.checkBoolean(found.isEnabled(), SimplePlugin.getNamed() + " could not hook into " + pluginName + " as the plugin is disabled! (DO NOT REPORT THIS TO " + SimplePlugin.getNamed() + ", look for errors above and contact support of '" + pluginName + "')")); - - return true; - } - - // ------------------------------------------------------------------------------------------------------------ - // Running commands - // ------------------------------------------------------------------------------------------------------------ - - /** - * Runs the given command (without /) as the console, replacing {player} with sender - * - * You can prefix the command with @(announce|warn|error|info|question|success) to send a formatted - * message to playerReplacement directly. - * - * @param playerReplacement - * @param command - */ - public static void dispatchCommand(final CommandSender playerReplacement, @NonNull String command) { - if (command.isEmpty() || command.equalsIgnoreCase("none")) - return; - - if (command.startsWith("@announce ")) - Messenger.announce(playerReplacement, command.replace("@announce ", "")); - - else if (command.startsWith("@warn ")) - Messenger.warn(playerReplacement, command.replace("@warn ", "")); - - else if (command.startsWith("@error ")) - Messenger.error(playerReplacement, command.replace("@error ", "")); - - else if (command.startsWith("@info ")) - Messenger.info(playerReplacement, command.replace("@info ", "")); - - else if (command.startsWith("@question ")) - Messenger.question(playerReplacement, command.replace("@question ", "")); - - else if (command.startsWith("@success ")) - Messenger.success(playerReplacement, command.replace("@success ", "")); - - else { - command = command.startsWith("/") ? command.substring(1) : command; - command = command.replace("{player}", playerReplacement == null ? "" : resolveSenderName(playerReplacement)); - - // Workaround for JSON in tellraw getting HEX colors replaced - if (!command.startsWith("tellraw")) - command = colorize(command); - - final String finalCommand = command; - - runLater(() -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), finalCommand)); - } - } - - /** - * Runs the given command (without /) as if the sender would type it, replacing {player} with his name - * - * @param playerSender - * @param command - */ - public static void dispatchCommandAsPlayer(@NonNull final Player playerSender, @NonNull String command) { - if (command.isEmpty() || command.equalsIgnoreCase("none")) - return; - - runLater(() -> playerSender.performCommand(colorize(command.replace("{player}", resolveSenderName(playerSender))))); - } - - // ------------------------------------------------------------------------------------------------------------ - // Logging and error handling - // ------------------------------------------------------------------------------------------------------------ - - /** - * Logs the message, and saves the time it was logged. If you call this method - * to log exactly the same message within the delay in seconds, it will not be logged. - * <p> - * Saves console spam. - * - * @param delaySec - * @param msg - */ - public static void logTimed(final int delaySec, final String msg) { - if (!TIMED_LOG_CACHE.containsKey(msg)) { - log(msg); - TIMED_LOG_CACHE.put(msg, TimeUtil.currentTimeSeconds()); - return; - } - - if (TimeUtil.currentTimeSeconds() - TIMED_LOG_CACHE.get(msg) > delaySec) { - log(msg); - TIMED_LOG_CACHE.put(msg, TimeUtil.currentTimeSeconds()); - } - } - - /** - * Works similarly to {@link String#format(String, Object...)} however - * all arguments are explored, so player names are properly given, location is shortened etc. - * - * @param format - * @param args - */ - public static void logF(final String format, @NonNull final Object... args) { - final String formatted = format(format, args); - - log(false, formatted); - } - - /** - * Replace boring CraftPlayer{name=noob} into a proper player name, - * works fine with entities, worlds, and locations - * <p> - * Example use: format("Hello %s from world %s", player, player.getWorld()) - * - * @param format - * @param args - * @return - */ - public static String format(final String format, @NonNull final Object... args) { - for (int i = 0; i < args.length; i++) { - final Object arg = args[i]; - - if (arg != null) - args[i] = simplify(arg); - } - - return String.format(format, args); - } - - /** - * A dummy helper method adding "&cWarning: &f" to the given message - * and logging it. - * - * @param message - */ - public static void warning(String message) { - log("&cWarning: &f" + message); - } - - /** - * Logs a bunch of messages to the console, & colors are supported - * - * @param messages - */ - public static void log(final List<String> messages) { - log(toArray(messages)); - } - - /** - * Logs a bunch of messages to the console, & colors are supported - * - * @param messages - */ - public static void log(final String... messages) { - log(true, messages); - } - - /** - * Logs a bunch of messages to the console, & colors are supported - * <p> - * Does not add {@link #getLogPrefix()} - * - * @param messages - */ - public static void logNoPrefix(final String... messages) { - log(false, messages); - } - - /* - * Logs a bunch of messages to the console, & colors are supported - */ - private static void log(final boolean addLogPrefix, final String... messages) { - if (messages == null) - return; - - for (String message : messages) { - if (message.equals("none")) - continue; - - if (stripColors(message).replace(" ", "").isEmpty()) { - if (CONSOLE_SENDER == null) - System.out.println(" "); - else - CONSOLE_SENDER.sendMessage(" "); - - continue; - } - - message = colorize(message); - - if (message.startsWith("[JSON]")) { - final String stripped = message.replaceFirst("\\[JSON\\]", "").trim(); - - if (!stripped.isEmpty()) - log(Remain.toLegacyText(stripped, false)); - - } else - for (final String part : splitNewline(message)) { - final String log = ((addLogPrefix && ADD_LOG_PREFIX ? removeSurroundingSpaces(logPrefix) + " " : "") + getOrEmpty(part).replace("\n", colorize("\n&r"))).trim(); - - if (CONSOLE_SENDER != null) - CONSOLE_SENDER.sendMessage(log); - else - System.out.println("[" + SimplePlugin.getNamed() + "] " + stripColors(log)); - } - } - } - - /** - * Logs a bunch of messages to the console in a {@link #consoleLine()} frame. - * - * @param messages - */ - public static void logFramed(final String... messages) { - logFramed(false, messages); - } - - /** - * Logs a bunch of messages to the console in a {@link #consoleLine()} frame. - * <p> - * Used when an error occurs, can also disable the plugin - * - * @param disablePlugin - * @param messages - */ - public static void logFramed(final boolean disablePlugin, final String... messages) { - if (messages != null && !Valid.isNullOrEmpty(messages)) { - log("&7" + consoleLine()); - for (final String msg : messages) - log(" &c" + msg); - - if (disablePlugin) - log(" &cPlugin is now disabled."); - - log("&7" + consoleLine()); - } - - if (disablePlugin) - Bukkit.getPluginManager().disablePlugin(SimplePlugin.getInstance()); - } - - /** - * Saves the error, prints the stack trace and logs it in frame. - * Possible to use %error variable - * - * @param t - * @param messages - */ - public static void error(final Throwable t, final String... messages) { - if (!(t instanceof FoException)) - Debugger.saveError(t, messages); - - Debugger.printStackTrace(t); - logFramed(replaceErrorVariable(t, messages)); - } - - /** - * Logs the messages in frame (if not null), - * saves the error to errors.log and then throws it - * <p> - * Possible to use %error variable - * - * @param t - * @param messages - */ - public static void throwError(Throwable t, final String... messages) { - - // Get to the root cause of this problem - while (t.getCause() != null) - t = t.getCause(); - - // Delegate to only print out the relevant stuff - if (t instanceof FoException) - throw (FoException) t; - - if (messages != null) - logFramed(false, replaceErrorVariable(t, messages)); - - Debugger.saveError(t, messages); - Remain.sneaky(t); - } - - /* - * Replace the %error variable with a smart error info, see above - */ - private static String[] replaceErrorVariable(Throwable throwable, final String... msgs) { - while (throwable.getCause() != null) - throwable = throwable.getCause(); - - final String throwableName = throwable == null ? "Unknown error." : throwable.getClass().getSimpleName(); - final String throwableMessage = throwable == null || throwable.getMessage() == null || throwable.getMessage().isEmpty() ? "" : ": " + throwable.getMessage(); - - for (int i = 0; i < msgs.length; i++) { - final String error = throwableName + throwableMessage; - - msgs[i] = msgs[i] - .replace("%error%", error) - .replace("%error", error); - } - - return msgs; - } - - // ------------------------------------------------------------------------------------------------------------ - // Regular expressions - // ------------------------------------------------------------------------------------------------------------ - - /** - * Returns true if the given regex matches the given message - * - * @param regex - * @param message - * @return - */ - public static boolean regExMatch(final String regex, final String message) { - return regExMatch(compilePattern(regex), message); - } - - /** - * Returns true if the given pattern matches the given message - * - * @param regex - * @param message - * @return - */ - public static boolean regExMatch(final Pattern regex, final String message) { - return regExMatch(compileMatcher(regex, message)); - } - - /** - * Returns true if the given matcher matches. We also evaluate - * how long the evaluation took and stop it in case it takes too long, - * see {@link SimplePlugin#getRegexTimeout()} - * - * @param matcher - * @return - */ - public static boolean regExMatch(final Matcher matcher) { - Valid.checkNotNull(matcher, "Cannot call regExMatch on null matcher"); - - try { - return matcher.find(); - - } catch (final RegexTimeoutException ex) { - handleRegexTimeoutException(ex, matcher.pattern()); - - return false; - } - } - - /** - * Compiles a matches for the given pattern and message. Colors are stripped. - * <p> - * We also evaluate how long the evaluation took and stop it in case it takes too long, - * see {@link SimplePlugin#getRegexTimeout()} - * - * @param pattern - * @param message - * @return - */ - public static Matcher compileMatcher(@NonNull final Pattern pattern, final String message) { - - try { - String strippedMessage = SimplePlugin.getInstance().regexStripColors() ? stripColors(message) : message; - strippedMessage = SimplePlugin.getInstance().regexStripAccents() ? ChatUtil.replaceDiacritic(strippedMessage) : strippedMessage; - - return pattern.matcher(TimedCharSequence.withSettingsLimit(strippedMessage)); - - } catch (final RegexTimeoutException ex) { - handleRegexTimeoutException(ex, pattern); - - return null; - } - } - - /** - * Compiles a matcher for the given regex and message - * - * @param regex - * @param message - * @return - */ - public static Matcher compileMatcher(final String regex, final String message) { - return compileMatcher(compilePattern(regex), message); - } - - /** - * Compiles a pattern from the given regex, stripping colors and making - * it case insensitive - * - * @param regex - * @return - */ - public static Pattern compilePattern(String regex) { - final SimplePlugin instance = SimplePlugin.getInstance(); - Pattern pattern = null; - - regex = SimplePlugin.getInstance().regexStripColors() ? stripColors(regex) : regex; - regex = SimplePlugin.getInstance().regexStripAccents() ? ChatUtil.replaceDiacritic(regex) : regex; - - try { - - if (instance.regexCaseInsensitive()) - pattern = Pattern.compile(regex, instance.regexUnicode() ? Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE : Pattern.CASE_INSENSITIVE); - - else - pattern = instance.regexUnicode() ? Pattern.compile(regex, Pattern.UNICODE_CASE) : Pattern.compile(regex); - - } catch (final PatternSyntaxException ex) { - throwError(ex, - "Your regular expression is malformed!", - "Expression: '" + regex + "'", - "", - "IF YOU CREATED IT YOURSELF, we unfortunately", - "can't provide support for custom expressions.", - "Use online services like regex101.com to put your", - "expression there (without '') and discover where", - "the syntax error lays and how to fix it."); - - return null; - } - - return pattern; - } - - /** - * A special call handling regex timeout exception, do not use - * - * @param ex - * @param pattern - */ - public static void handleRegexTimeoutException(RegexTimeoutException ex, Pattern pattern) { - final boolean caseInsensitive = SimplePlugin.getInstance().regexCaseInsensitive(); - - Common.error(ex, - "A regular expression took too long to process, and was", - "stopped to prevent freezing your server.", - " ", - "Limit " + SimpleSettings.REGEX_TIMEOUT + "ms ", - "Expression: '" + (pattern == null ? "unknown" : pattern.pattern()) + "'", - "Evaluated message: '" + ex.getCheckedMessage() + "'", - " ", - "IF YOU CREATED THAT RULE YOURSELF, we unfortunately", - "can't provide support for custom expressions.", - " ", - "Sometimes, all you need doing is increasing timeout", - "limit in your settings.yml", - " ", - "Use services like regex101.com to test and fix it.", - "Put the expression without '' and the message there.", - "Ensure to turn flags 'insensitive' and 'unicode' " + (caseInsensitive ? "on" : "off"), - "on there when testing: https://i.imgur.com/PRR5Rfn.png"); - } - - // ------------------------------------------------------------------------------------------------------------ - // Joining strings and lists - // ------------------------------------------------------------------------------------------------------------ - - /** - * Joins an array of lists together into one big list - * - * @param <T> - * @param arrays - * @return - */ - @SafeVarargs - public static <T> List<T> joinArrays(final Iterable<T>... arrays) { - final List<T> all = new ArrayList<>(); - - for (final Iterable<T> array : arrays) - for (final T element : array) - all.add(element); - - return all; - } - - /** - * A convenience method for converting array of command senders into array of their names - * except the given player - * - * @param <T> - * @param array - * @param nameToIgnore - * @return - */ - public static <T extends CommandSender> String joinPlayersExcept(final Iterable<T> array, final String nameToIgnore) { - final Iterator<T> it = array.iterator(); - String message = ""; - - while (it.hasNext()) { - final T next = it.next(); - - if (!next.getName().equals(nameToIgnore)) - message += next.getName() + (it.hasNext() ? ", " : ""); - } - - return message.endsWith(", ") ? message.substring(0, message.length() - 2) : message; - } - - /** - * Joins an array together using spaces from the given start index - * - * @param startIndex - * @param array - * @return - */ - public static String joinRange(final int startIndex, final String[] array) { - return joinRange(startIndex, array.length, array); - } - - /** - * Join an array together using spaces using the given range - * - * @param startIndex - * @param stopIndex - * @param array - * @return - */ - public static String joinRange(final int startIndex, final int stopIndex, final String[] array) { - return joinRange(startIndex, stopIndex, array, " "); - } - - /** - * Join an array together using the given deliminer - * - * @param start - * @param stop - * @param array - * @param delimiter - * @return - */ - public static String joinRange(final int start, final int stop, final String[] array, final String delimiter) { - String joined = ""; - - for (int i = start; i < MathUtil.range(stop, 0, array.length); i++) - joined += (joined.isEmpty() ? "" : delimiter) + array[i]; - - return joined; - } - - /** - * A convenience method for converting array of objects into array of strings - * We invoke "toString" for each object given it is not null, or return "" if it is - * - * @param <T> - * @param array - * @return - */ - public static <T> String join(final T[] array) { - return array == null ? "null" : join(Arrays.asList(array)); - } - - /** - * A convenience method for converting list of objects into array of strings - * We invoke "toString" for each object given it is not null, or return "" if it is - * - * @param <T> - * @param array - * @return - */ - public static <T> String join(final Iterable<T> array) { - return array == null ? "null" : join(array, ", "); - } - - /** - * A convenience method for converting list of objects into array of strings - * We invoke "toString" for each object given it is not null, or return "" if it is - * - * @param <T> - * @param array - * @param delimiter - * @return - */ - public static <T> String join(final Iterable<T> array, final String delimiter) { - return join(array, delimiter, object -> object == null ? "" : simplify(object)); - } - - /** - * Joins an array of a given type using the given delimiter and a helper interface - * to convert each element in the array into string - * - * @param <T> - * @param array - * @param delimiter - * @param stringer - * @return - */ - public static <T> String join(final T[] array, final String delimiter, final Stringer<T> stringer) { - Valid.checkNotNull(array, "Cannot join null array!"); - - return join(Arrays.asList(array), delimiter, stringer); - } - - /** - * Joins a list of a given type using the given delimiter and a helper interface - * to convert each element in the array into string - * - * @param <T> - * @param array - * @param delimiter - * @param stringer - * @return - */ - public static <T> String join(final Iterable<T> array, final String delimiter, final Stringer<T> stringer) { - final Iterator<T> it = array.iterator(); - String message = ""; - - while (it.hasNext()) { - final T next = it.next(); - - if (next != null) - message += stringer.toString(next) + (it.hasNext() ? delimiter : ""); - } - - return message; - } - - /** - * Replace some common classes such as entity to name automatically - * - * @param arg - * @return - */ - public static String simplify(Object arg) { - if (arg instanceof Entity) - return Remain.getName((Entity) arg); - - else if (arg instanceof CommandSender) - return ((CommandSender) arg).getName(); - - else if (arg instanceof World) - return ((World) arg).getName(); - - else if (arg instanceof Location) - return Common.shortLocation((Location) arg); - - else if (arg.getClass() == double.class || arg.getClass() == float.class) - return MathUtil.formatTwoDigits((double) arg); - - else if (arg instanceof Collection) - return Common.join((Collection<?>) arg, ", ", Common::simplify); - - else if (arg instanceof ChatColor) - return ((Enum<?>) arg).name().toLowerCase(); - - else if (arg instanceof CompChatColor) - return ((CompChatColor) arg).getName(); - - else if (arg instanceof Enum) - return ((Enum<?>) arg).toString().toLowerCase(); - - try { - if (arg instanceof net.md_5.bungee.api.ChatColor) - return ((net.md_5.bungee.api.ChatColor) arg).getName(); - } catch (final Exception e) { - // No MC compatible - } - - return arg.toString(); - } - - /** - * Dynamically populates pages, used for pagination in commands or menus - * - * @param allItems all items that will be split - * @return the map containing pages and their items - */ - public static <T> Map<Integer, List<T>> fillPages(int cellSize, Iterable<T> items) { - final List<T> allItems = Common.toList(items); - - final Map<Integer, List<T>> pages = new HashMap<>(); - final int pageCount = allItems.size() == cellSize ? 0 : allItems.size() / cellSize; - - for (int i = 0; i <= pageCount; i++) { - final List<T> pageItems = new ArrayList<>(); - - final int down = cellSize * i; - final int up = down + cellSize; - - for (int valueIndex = down; valueIndex < up; valueIndex++) - if (valueIndex < allItems.size()) { - final T page = allItems.get(valueIndex); - - pageItems.add(page); - } else - break; - - pages.put(i, pageItems); - } - - return pages; - } - - // ------------------------------------------------------------------------------------------------------------ - // Converting and retyping - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return the last key in the list or null if list is null or empty - * - * @param <T> - * @param list - * @return - */ - public static <T> T last(List<T> list) { - return list == null || list.isEmpty() ? null : list.get(list.size() - 1); - } - - /** - * Return the last key in the array or null if array is null or empty - * - * @param <T> - * @param array - * @return - */ - public static <T> T last(T[] array) { - return array == null || array.length == 0 ? null : array[array.length - 1]; - } - - /** - * Convenience method for getting a list of world names - * - * @return - */ - public static List<String> getWorldNames() { - final List<String> worlds = new ArrayList<>(); - - for (final World world : Bukkit.getWorlds()) - worlds.add(world.getName()); - - return worlds; - } - - /** - * Convenience method for getting a list of player names - * - * @return - */ - public static List<String> getPlayerNames() { - return getPlayerNames(true, null); - } - - /** - * Convenience method for getting a list of player names - * that optionally, are vanished - * - * @param includeVanished - * @return - */ - public static List<String> getPlayerNames(final boolean includeVanished) { - return getPlayerNames(includeVanished, null); - } - - /** - * Convenience method for getting a list of player names - * that optionally, the other player can see - * - * @param includeVanished - * @param otherPlayer - * - * @return - */ - public static List<String> getPlayerNames(final boolean includeVanished, Player otherPlayer) { - final List<String> found = new ArrayList<>(); - - for (final Player online : Remain.getOnlinePlayers()) { - if (PlayerUtil.isVanished(online, otherPlayer) && !includeVanished) - continue; - - found.add(online.getName()); - } - - return found; - } - - /** - * Return nicknames of online players - * - * @param includeVanished - * @return - */ - public static List<String> getPlayerNicknames(final boolean includeVanished) { - return getPlayerNicknames(includeVanished, null); - } - - /** - * Return nicknames of online players - * - * @param includeVanished - * @param otherPlayer - * @return - */ - public static List<String> getPlayerNicknames(final boolean includeVanished, Player otherPlayer) { - final List<String> found = new ArrayList<>(); - - for (final Player online : Remain.getOnlinePlayers()) { - if (PlayerUtil.isVanished(online, otherPlayer) && !includeVanished) - continue; - - found.add(HookManager.getNickColorless(online)); - } - - return found; - } - - /** - * Converts a list having one type object into another - * - * @param list the old list - * @param converter the converter; - * @return the new list - */ - public static <OLD, NEW> List<NEW> convert(final Iterable<OLD> list, final TypeConverter<OLD, NEW> converter) { - final List<NEW> copy = new ArrayList<>(); - - for (final OLD old : list) { - final NEW result = converter.convert(old); - if (result != null) - copy.add(converter.convert(old)); - } - - return copy; - } - - /** - * Converts a set having one type object into another - * - * @param list the old list - * @param converter the converter; - * @return the new list - */ - public static <OLD, NEW> Set<NEW> convertSet(final Iterable<OLD> list, final TypeConverter<OLD, NEW> converter) { - final Set<NEW> copy = new HashSet<>(); - - for (final OLD old : list) { - final NEW result = converter.convert(old); - if (result != null) - copy.add(converter.convert(old)); - } - - return copy; - } - - /** - * Converts a list having one type object into another - * - * @param list the old list - * @param converter the converter - * @return the new list - */ - public static <OLD, NEW> StrictList<NEW> convertStrict(final Iterable<OLD> list, final TypeConverter<OLD, NEW> converter) { - final StrictList<NEW> copy = new StrictList<>(); - - for (final OLD old : list) - copy.add(converter.convert(old)); - - return copy; - } - - /** - * Attempts to convert the given map into another map - * - * @param <OLD_KEY> - * @param <OLD_VALUE> - * @param <NEW_KEY> - * @param <NEW_VALUE> - * @param oldMap - * @param converter - * @return - */ - public static <OLD_KEY, OLD_VALUE, NEW_KEY, NEW_VALUE> Map<NEW_KEY, NEW_VALUE> convert(final Map<OLD_KEY, OLD_VALUE> oldMap, final MapToMapConverter<OLD_KEY, OLD_VALUE, NEW_KEY, NEW_VALUE> converter) { - final Map<NEW_KEY, NEW_VALUE> newMap = new HashMap<>(); - oldMap.entrySet().forEach(e -> newMap.put(converter.convertKey(e.getKey()), converter.convertValue(e.getValue()))); - - return newMap; - } - - /** - * Attempts to convert the given map into another map - * - * @param <OLD_KEY> - * @param <OLD_VALUE> - * @param <NEW_KEY> - * @param <NEW_VALUE> - * @param oldMap - * @param converter - * @return - */ - public static <OLD_KEY, OLD_VALUE, NEW_KEY, NEW_VALUE> StrictMap<NEW_KEY, NEW_VALUE> convertStrict(final Map<OLD_KEY, OLD_VALUE> oldMap, final MapToMapConverter<OLD_KEY, OLD_VALUE, NEW_KEY, NEW_VALUE> converter) { - final StrictMap<NEW_KEY, NEW_VALUE> newMap = new StrictMap<>(); - oldMap.entrySet().forEach(e -> newMap.put(converter.convertKey(e.getKey()), converter.convertValue(e.getValue()))); - - return newMap; - } - - /** - * Attempts to convert the gfiven map into a list - * - * @param <LIST_KEY> - * @param <OLD_KEY> - * @param <OLD_VALUE> - * @param map - * @param converter - * @return - */ - public static <LIST_KEY, OLD_KEY, OLD_VALUE> StrictList<LIST_KEY> convertToList(final Map<OLD_KEY, OLD_VALUE> map, final MapToListConverter<LIST_KEY, OLD_KEY, OLD_VALUE> converter) { - final StrictList<LIST_KEY> list = new StrictList<>(); - - for (final Entry<OLD_KEY, OLD_VALUE> e : map.entrySet()) - list.add(converter.convert(e.getKey(), e.getValue())); - - return list; - } - - /** - * Attempts to convert an array into a different type - * - * @param <OLD_TYPE> - * @param <NEW_TYPE> - * @param oldArray - * @param converter - * @return - */ - public static <OLD_TYPE, NEW_TYPE> List<NEW_TYPE> convert(final OLD_TYPE[] oldArray, final TypeConverter<OLD_TYPE, NEW_TYPE> converter) { - final List<NEW_TYPE> newList = new ArrayList<>(); - - for (final OLD_TYPE old : oldArray) - newList.add(converter.convert(old)); - - return newList; - } - - /** - * Attempts to split the message using the \n character. This is used in some plugins - * since some OS's have a different method for splitting so we just go letter by letter - * there and match \ and n and then split it. - * - * @param message - * @return - * @deprecated usage specific, also some operating systems seems to handle this poorly - */ - @Deprecated - public static String[] splitNewline(final String message) { - if (!SimplePlugin.getInstance().enforeNewLine()) - return message.split("\n"); - - final String delimiter = "KANGARKOJESUUPER"; - - final char[] chars = message.toCharArray(); - String parts = ""; - - for (int i = 0; i < chars.length; i++) { - final char c = chars[i]; - - if ('\\' == c) - if (i + 1 < chars.length) - if ('n' == chars[i + 1]) { - i++; - - parts += delimiter; - continue; - } - parts += c; - } - - return parts.split(delimiter); - } - - /** - * Split the given string into array of the given max line length - * - * @param input - * @param maxLineLength - * @return - */ - public static String[] split(String input, int maxLineLength) { - final StringTokenizer tok = new StringTokenizer(input, " "); - final StringBuilder output = new StringBuilder(input.length()); - - int lineLen = 0; - - while (tok.hasMoreTokens()) { - final String word = tok.nextToken(); - - if (lineLen + word.length() > maxLineLength) { - output.append("\n"); - - lineLen = 0; - } - - output.append(word); - lineLen += word.length(); - } - - return output.toString().split("\n"); - } - - // ------------------------------------------------------------------------------------------------------------ - // Misc message handling - // ------------------------------------------------------------------------------------------------------------ - - /** - * Creates a new list only containing non-null and not empty string elements - * - * @param <T> - * @param array - * @return - */ - public static <T> List<T> removeNullAndEmpty(final T[] array) { - return array != null ? removeNullAndEmpty(Arrays.asList(array)) : new ArrayList<>(); - } - - /** - * Creates a new list only containing non-null and not empty string elements - * - * @param <T> - * @param list - * @return - */ - public static <T> List<T> removeNullAndEmpty(final List<T> list) { - final List<T> copy = new ArrayList<>(); - - for (final T key : list) - if (key != null) - if (key instanceof String) { - if (!((String) key).isEmpty()) - copy.add(key); - } else - copy.add(key); - - return copy; - } - - /** - * REplaces all nulls with an empty string - * - * @param list - * @return - */ - public static String[] replaceNullWithEmpty(final String[] list) { - for (int i = 0; i < list.length; i++) - if (list[i] == null) - list[i] = ""; - - return list; - } - - /** - * Return a value at the given index or the default if the index does not exist in array - * - * @param <T> - * @param array - * @param index - * @param def - * @return - */ - public static <T> T getOrDefault(final T[] array, final int index, final T def) { - return index < array.length ? array[index] : def; - } - - /** - * Return an empty String if the String is null or equals to none. - * - * @param input - * @return - */ - public static String getOrEmpty(final String input) { - return input == null || "none".equalsIgnoreCase(input) ? "" : input; - } - - /** - * If the String equals to none or is empty, return null - * - * @param input - * @return - */ - public static String getOrNull(final String input) { - return input == null || "none".equalsIgnoreCase(input) || input.isEmpty() ? null : input; - } - - /** - * Returns the value or its default counterpart in case it is null - * - * @param value - * @param def - * - * @deprecated subject for removal, use {@link #getOrDefault(Object, Object)} - * as it works exactly the same now - * @return - */ - @Deprecated - public static String getOrSupply(String value, String def) { - return getOrDefault(value, def); - } - - /** - * Returns the value or its default counterpart in case it is null - * - * PSA: If values are strings, we return default if the value is empty or equals to "none" - * - * @param value the primary value - * @param def the default value - * @return the value, or default it the value is null - */ - public static <T> T getOrDefault(final T value, final T def) { - if (value instanceof String && ("none".equalsIgnoreCase((String) value) || "".equals(value))) - return def; - - return getOrDefaultStrict(value, def); - } - - /** - * Returns the value or its default counterpart in case it is null - * - * @param <T> - * @param value - * @param def - * @return - */ - public static <T> T getOrDefaultStrict(final T value, final T def) { - return value != null ? value : def; - } - - /** - * Get next element in the list increasing the index by 1 if forward is true, - * or decreasing it by 1 if it is false - * - * @param <T> - * @param given - * @param list - * @param forward - * @return - */ - public static <T> T getNext(final T given, final List<T> list, final boolean forward) { - if (given == null && list.isEmpty()) - return null; - - final T[] array = (T[]) Array.newInstance((given != null ? given : list.get(0)).getClass(), list.size()); - - for (int i = 0; i < list.size(); i++) - Array.set(array, i, list.get(i)); - - return getNext(given, array, forward); - } - - /** - * Get next element in the list increasing the index by 1 if forward is true, - * or decreasing it by 1 if it is false - * - * @param <T> - * @param given - * @param array - * @param forward - * @return - */ - public static <T> T getNext(final T given, final T[] array, final boolean forward) { - if (array.length == 0) - return null; - - int index = 0; - - for (int i = 0; i < array.length; i++) { - final T element = array[i]; - - if (element.equals(given)) { - index = i; - - break; - } - } - - if (index != -1) { - final int nextIndex = index + (forward ? 1 : -1); - - // Return the first slot if reached the end, or the last if vice versa - return nextIndex >= array.length ? array[0] : nextIndex < 0 ? array[array.length - 1] : array[nextIndex]; - } - - return null; - } - - /** - * Converts a list of string into a string array - * - * @param array - * @return - */ - public static String[] toArray(final Collection<String> array) { - return array == null ? new String[0] : array.toArray(new String[array.size()]); - } - - /** - * Creates a new modifiable array list from array - * - * @param array - * @return - */ - public static <T> ArrayList<T> toList(final T... array) { - return array == null ? new ArrayList<>() : new ArrayList<>(Arrays.asList(array)); - } - - /** - * Converts {@link Iterable} to {@link List} - * - * @param it the iterable - * @return the new list - */ - public static <T> List<T> toList(final Iterable<T> it) { - final List<T> list = new ArrayList<>(); - - if (it != null) - it.forEach(el -> { - if (el != null) - list.add(el); - }); - - return list; - } - - /** - * Reverses elements in the array - * - * @param <T> - * @param array - * @return - */ - public static <T> T[] reverse(final T[] array) { - if (array == null) - return null; - - int i = 0; - int j = array.length - 1; - - while (j > i) { - final T tmp = array[j]; - - array[j] = array[i]; - array[i] = tmp; - - j--; - i++; - } - - return array; - } - - /** - * Return a new hashmap having the given first key and value pair - * - * @param <A> - * @param <B> - * @param firstKey - * @param firstValue - * @return - */ - public static <A, B> Map<A, B> newHashMap(final A firstKey, final B firstValue) { - final Map<A, B> map = new HashMap<>(); - map.put(firstKey, firstValue); - - return map; - } - - /** - * Create a new hashset - * - * @param <T> - * @param keys - * @return - */ - public static <T> Set<T> newSet(final T... keys) { - return new HashSet<>(Arrays.asList(keys)); - } - - /** - * Create a new array list that is mutable - * - * @param <T> - * @param keys - * @return - */ - public static <T> List<T> newList(final T... keys) { - final List<T> list = new ArrayList<>(); - - for (final T key : keys) - list.add(key); - - return list; - } - - // ------------------------------------------------------------------------------------------------------------ - // Scheduling - // ------------------------------------------------------------------------------------------------------------ - - /** - * Runs the task if the plugin is enabled correctly - * - * @param task the task - * @return the task or null - */ - public static <T extends Runnable> BukkitTask runLater(final T task) { - return runLater(1, task); - } - - /** - * Runs the task even if the plugin is disabled for some reason. - * - * @param delayTicks - * @param task - * @return the task or null - */ - public static BukkitTask runLater(final int delayTicks, Runnable task) { - final BukkitScheduler scheduler = Bukkit.getScheduler(); - final JavaPlugin instance = SimplePlugin.getInstance(); - - try { - return runIfDisabled(task) ? null : delayTicks == 0 ? task instanceof BukkitRunnable ? ((BukkitRunnable) task).runTask(instance) : scheduler.runTask(instance, task) : task instanceof BukkitRunnable ? ((BukkitRunnable) task).runTaskLater(instance, delayTicks) : scheduler.runTaskLater(instance, task, delayTicks); - } catch (final NoSuchMethodError err) { - - return runIfDisabled(task) ? null - : delayTicks == 0 - ? task instanceof BukkitRunnable ? ((BukkitRunnable) task).runTask(instance) : getTaskFromId(scheduler.scheduleSyncDelayedTask(instance, task)) - : task instanceof BukkitRunnable ? ((BukkitRunnable) task).runTaskLater(instance, delayTicks) : getTaskFromId(scheduler.scheduleSyncDelayedTask(instance, task, delayTicks)); - } - } - - /** - * Runs the task async even if the plugin is disabled for some reason. - * <p> - * Schedules the run on the next tick. - * - * @param task - * @return - */ - public static BukkitTask runAsync(final Runnable task) { - return runLaterAsync(0, task); - } - - /** - * Runs the task async even if the plugin is disabled for some reason. - * <p> - * Schedules the run on the next tick. - * - * @param task - * @return - */ - public static BukkitTask runLaterAsync(final Runnable task) { - return runLaterAsync(0, task); - } - - // ------------------------------------------------------------------------------------------------------------ - // Bukkit scheduling - // ------------------------------------------------------------------------------------------------------------ - - /** - * Runs the task async even if the plugin is disabled for some reason. - * - * @param delayTicks - * @param task - * @return the task or null - */ - public static BukkitTask runLaterAsync(final int delayTicks, Runnable task) { - final BukkitScheduler scheduler = Bukkit.getScheduler(); - final JavaPlugin instance = SimplePlugin.getInstance(); - - try { - return runIfDisabled(task) ? null : delayTicks == 0 ? task instanceof BukkitRunnable ? ((BukkitRunnable) task).runTaskAsynchronously(instance) : scheduler.runTaskAsynchronously(instance, task) : task instanceof BukkitRunnable ? ((BukkitRunnable) task).runTaskLaterAsynchronously(instance, delayTicks) : scheduler.runTaskLaterAsynchronously(instance, task, delayTicks); - - } catch (final NoSuchMethodError err) { - return runIfDisabled(task) ? null - : delayTicks == 0 - ? getTaskFromId(scheduler.scheduleAsyncDelayedTask(instance, task)) - : getTaskFromId(scheduler.scheduleAsyncDelayedTask(instance, task, delayTicks)); - } - } - - /** - * Runs the task timer even if the plugin is disabled. - * - * @param repeatTicks the delay between each execution - * @param task the task - * @return the bukkit task or null - */ - public static BukkitTask runTimer(final int repeatTicks, final Runnable task) { - return runTimer(0, repeatTicks, task); - } - - /** - * Runs the task timer even if the plugin is disabled. - * - * @param delayTicks the delay before first run - * @param repeatTicks the delay between each run - * @param task the task - * @return the bukkit task or null if error - */ - public static BukkitTask runTimer(final int delayTicks, final int repeatTicks, Runnable task) { - - try { - return runIfDisabled(task) ? null : task instanceof BukkitRunnable ? ((BukkitRunnable) task).runTaskTimer(SimplePlugin.getInstance(), delayTicks, repeatTicks) : Bukkit.getScheduler().runTaskTimer(SimplePlugin.getInstance(), task, delayTicks, repeatTicks); - - } catch (final NoSuchMethodError err) { - return runIfDisabled(task) ? null - : getTaskFromId(Bukkit.getScheduler().scheduleSyncRepeatingTask(SimplePlugin.getInstance(), task, delayTicks, repeatTicks)); - } - } - - /** - * Runs the task timer async even if the plugin is disabled. - * - * @param repeatTicks - * @param task - * @return - */ - public static BukkitTask runTimerAsync(final int repeatTicks, final Runnable task) { - return runTimerAsync(0, repeatTicks, task); - } - - /** - * Runs the task timer async even if the plugin is disabled. - * - * @param delayTicks - * @param repeatTicks - * @param task - * @return - */ - public static BukkitTask runTimerAsync(final int delayTicks, final int repeatTicks, Runnable task) { - - try { - return runIfDisabled(task) ? null : task instanceof BukkitRunnable ? ((BukkitRunnable) task).runTaskTimerAsynchronously(SimplePlugin.getInstance(), delayTicks, repeatTicks) : Bukkit.getScheduler().runTaskTimerAsynchronously(SimplePlugin.getInstance(), task, delayTicks, repeatTicks); - - } catch (final NoSuchMethodError err) { - return runIfDisabled(task) ? null - : getTaskFromId(Bukkit.getScheduler().scheduleAsyncRepeatingTask(SimplePlugin.getInstance(), task, delayTicks, repeatTicks)); - } - } - - /* - * A compatibility method that converts the given task id into a bukkit task - */ - private static BukkitTask getTaskFromId(int taskId) { - - for (final BukkitTask task : Bukkit.getScheduler().getPendingTasks()) - if (task.getTaskId() == taskId) - return task; - - // TODO Fix for MC 1.2.5 - return null; - } - - // Check our plugin instance if it's enabled - // In case it is disabled, just runs the task and returns true - // Otherwise we return false and the task will be run correctly in Bukkit scheduler - // This is fail-safe to critical save-on-exit operations in case our plugin is improperly reloaded (PlugMan) or malfunctions - private static boolean runIfDisabled(final Runnable run) { - if (!SimplePlugin.getInstance().isEnabled()) { - run.run(); - - return true; - } - - return false; - } - - /** - * Call an event in Bukkit and return whether it was fired - * successfully through the pipeline (NOT cancelled) - * - * @param event the event - * @return true if the event was NOT cancelled - */ - public static boolean callEvent(final Event event) { - Bukkit.getPluginManager().callEvent(event); - - return event instanceof Cancellable ? !((Cancellable) event).isCancelled() : true; - } - - /** - * Convenience method for registering events as our instance - * - * @param listener - */ - public static void registerEvents(final Listener listener) { - Bukkit.getPluginManager().registerEvents(listener, SimplePlugin.getInstance()); - } - - // ------------------------------------------------------------------------------------------------------------ - // Misc - // ------------------------------------------------------------------------------------------------------------ - - /** - * Resolves the inner Map in a Bukkit's {@link MemorySection} - * - * @param mapOrSection - * @return - */ - public static Map<String, Object> getMapFromSection(@NonNull final Object mapOrSection) { - final Map<String, Object> map = mapOrSection instanceof Map ? (Map<String, Object>) mapOrSection : mapOrSection instanceof MemorySection ? ReflectionUtil.getFieldContent(mapOrSection, "map") : null; - Valid.checkNotNull(map, "Unexpected " + mapOrSection.getClass().getSimpleName() + " '" + mapOrSection + "'. Must be Map or MemorySection! (Do not just send config name here, but the actual section with get('section'))"); - - return map; - } - - /** - * Returns true if the domain is reachable. Method is blocking. - * - * @param url - * @param timeout - * @return - */ - public static boolean isDomainReachable(String url, final int timeout) { - url = url.replaceFirst("^https", "http"); - - try { - final HttpURLConnection c = (HttpURLConnection) new URL(url).openConnection(); - - c.setConnectTimeout(timeout); - c.setReadTimeout(timeout); - c.setRequestMethod("HEAD"); - - final int responseCode = c.getResponseCode(); - return 200 <= responseCode && responseCode <= 399; - - } catch (final IOException exception) { - return false; - } - } - - /** - * Checked sleep method from {@link Thread#sleep(long)} but without the try-catch need - * - * @param millis - */ - public static void sleep(final int millis) { - try { - Thread.sleep(millis); - - } catch (final InterruptedException e) { - e.printStackTrace(); - } - } - - // ------------------------------------------------------------------------------------------------------------ - // Classes - // ------------------------------------------------------------------------------------------------------------ - - /** - * A simple interface from converting objects into strings - * - * @param <T> - */ - public interface Stringer<T> { - - /** - * Convert the given object into a string - * - * @param object - * @return - */ - String toString(T object); - } - - /** - * A simple interface to convert between types - * - * @param <Old> the initial type to convert from - * @param <New> the final type to convert to - */ - public interface TypeConverter<Old, New> { - - /** - * Convert a type given from A to B - * - * @param value the old value type - * @return the new value type - */ - New convert(Old value); - } - - /** - * Convenience class for converting map to a list - * - * @param <O> - * @param <K> - * @param <V> - */ - @SuppressWarnings("hiding") - public interface MapToListConverter<O, K, V> { - - /** - * Converts the given map key-value pair into a new type stored in a list - * - * @param key - * @param value - * @return - */ - O convert(K key, V value); - } - - /** - * Convenience class for converting between maps - * - * @param <A> - * @param <B> - * @param <C> - * @param <D> - */ - public interface MapToMapConverter<A, B, C, D> { - - /** - * Converts the old key type to a new type - * - * @param key - * @return - */ - C convertKey(A key); - - /** - * Converts the old value into a new value type - * - * @param value - * @return - */ - D convertValue(B value); - } -} - -/** - * Represents a timed chat sequence, used when checking for - * regular expressions so we time how long it takes and - * stop the execution if takes too long - */ -final class TimedCharSequence implements CharSequence { - - /** - * The timed message - */ - private final CharSequence message; - - /** - * The timeout limit in millis - */ - private final long futureTimestampLimit; - - /* - * Create a new timed message for the given message with a timeout in millis - */ - private TimedCharSequence(@NonNull final CharSequence message, long futureTimestampLimit) { - this.message = message; - this.futureTimestampLimit = futureTimestampLimit; - } - - /** - * Gets a character at the given index, or throws an error if - * this is called too late after the constructor, see {@link #futureTimestampLimit} - */ - @Override - public char charAt(final int index) { - - // Temporarily disabled due to a rare condition upstream when we take this message - // and run it in a runnable, then this is still being evaluated past limit and it fails - // - //if (System.currentTimeMillis() > futureTimestampLimit) - // throw new RegexTimeoutException(message, futureTimestampLimit); - - return message.charAt(index); - } - - @Override - public int length() { - return message.length(); - } - - @Override - public CharSequence subSequence(final int start, final int end) { - return new TimedCharSequence(message.subSequence(start, end), futureTimestampLimit); - } - - @Override - public String toString() { - return message.toString(); - } - - /** - * Compile a new char sequence with limit from settings.yml - * - * @param message - * @return - */ - static TimedCharSequence withSettingsLimit(CharSequence message) { - return new TimedCharSequence(message, System.currentTimeMillis() + SimpleSettings.REGEX_TIMEOUT); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/CompressUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/CompressUtil.java deleted file mode 100644 index 209565b88257d47dfbb297dc59d0dfd4d1f667a0..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/CompressUtil.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.mineacademy.fo; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; -import java.util.zip.DeflaterOutputStream; -import java.util.zip.InflaterOutputStream; - -import lombok.SneakyThrows; - -/** - * A simple class to compress or decompress text - */ -public final class CompressUtil { - - /** - * Converts the text byte array into compressed data in base64 string format - * - * @param text - * @return - * @throws IOException - */ - @SneakyThrows - public static String compressB64(String text) { - return text; - - //return new String(Base64.getEncoder().encode(compress(text.replace(String.valueOf(ChatColor.COLOR_CHAR), "%CLRCHAR%"))), StandardCharsets.UTF_8); - } - - /** - * Converts the compressed data from base64 into uncompressed text - * - * @param b64Compressed - * @return - * @throws IOException - */ - @SneakyThrows - public static String decompressB64(String b64Compressed) { - return b64Compressed; - - //return decompress(Base64.getDecoder().decode(b64Compressed)).replace("%CLRCHAR%", String.valueOf(ChatColor.COLOR_CHAR)); - } - - /** - * Converts the text into compressed data - * - * @param text - * @return - * @throws IOException - */ - @SneakyThrows - public static byte[] compress(String text) { - return compress(text.getBytes()); - } - - /** - * Converts the text byte array into compressed data - * - * @param byteArray - * @return - * @throws IOException - */ - @SneakyThrows - public static byte[] compress(byte[] byteArray) { - final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - - try (DeflaterOutputStream deflater = new DeflaterOutputStream(stream)) { - deflater.write(byteArray); - } - - return stream.toByteArray(); - } - - /** - * Converts the given compressed data back into text - * - * @param compressedText - * @return - * @throws IOException - */ - @SneakyThrows - public static String decompress(byte[] compressedText) { - final ByteArrayOutputStream stream = new ByteArrayOutputStream(); - - try (OutputStream inflater = new InflaterOutputStream(stream)) { - inflater.write(compressedText); - } - - return new String(stream.toByteArray(), StandardCharsets.UTF_8); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/EntityUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/EntityUtil.java deleted file mode 100644 index 0541f681f08455173be200fc523db05ed5496296..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/EntityUtil.java +++ /dev/null @@ -1,306 +0,0 @@ -package org.mineacademy.fo; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; - -import org.bukkit.Location; -import org.bukkit.entity.Animals; -import org.bukkit.entity.Creature; -import org.bukkit.entity.Entity; -import org.bukkit.entity.ExperienceOrb; -import org.bukkit.entity.FallingBlock; -import org.bukkit.entity.Ghast; -import org.bukkit.entity.Item; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.entity.Slime; -import org.bukkit.entity.Wolf; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.scheduler.BukkitRunnable; -import org.mineacademy.fo.EntityUtil.HitListener; -import org.mineacademy.fo.collection.expiringmap.ExpiringMap; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.HookManager; -import org.mineacademy.fo.remain.Remain; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; - -/** - * Utility class for managing entities. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class EntityUtil { - - static { - Common.registerEvents(new HitTracking()); - } - - /** - * Returns the closest entity to the center location within the given 3-dimensional range - * that matches the given entity class, or null if not found. - * - * @param <T> - * @param center - * @param range3D - * @param entityClass - * @return - */ - public static <T extends LivingEntity> T findNearestEntity(Location center, double range3D, Class<T> entityClass) { - final List<T> found = new ArrayList<>(); - - for (final Entity nearby : center.getWorld().getNearbyEntities(center, range3D, range3D, range3D)) - if (nearby instanceof LivingEntity && entityClass.isAssignableFrom(nearby.getClass())) - found.add((T) nearby); - - Collections.sort(found, (first, second) -> Double.compare(first.getLocation().distance(center), second.getLocation().distance(center))); - - return found.isEmpty() ? null : found.get(0); - } - - /** - * Returns the entity target only if it is a player, or null - * - * @param entity - * @return - */ - public static Player getTargetPlayer(Entity entity) { - final LivingEntity target = getTarget(entity); - - return target instanceof Player && !HookManager.isNPC(target) ? (Player) target : null; - } - - /** - * Return the target for the given entity - * - * @param entity - * @return the target, or null if does not have / unsupported - */ - public static LivingEntity getTarget(Entity entity) { - return entity instanceof Creature ? ((Creature) entity).getTarget() : null; - } - - /** - * Return if this entity is creature and aggressive (not an animal) - * - * @param entity - * @return - */ - public static boolean isAggressive(Entity entity) { - if (entity instanceof Ghast || entity instanceof Slime) - return true; - - if (entity instanceof Wolf && ((Wolf) entity).isAngry()) - return true; - - if (entity instanceof Animals) - return false; - - return entity instanceof Creature; - } - - /** - * Return if this entity is a {@link Creature}, {@link Slime} or {@link Wolf} - * - * @param entity - * @return - */ - public static boolean isCreature(Entity entity) { - return entity instanceof Slime || - entity instanceof Wolf || - entity instanceof Creature; - } - - /** - * Return if this entity is suitable for removing (e.g. dropped items, - * falling blocks, arrows, projectiles) - * - * @param entity - * @return - */ - public static boolean canBeCleaned(Entity entity) { - return entity instanceof FallingBlock || - entity instanceof Item || - entity instanceof Projectile || - entity instanceof ExperienceOrb; - } - - // ---------------------------------------------------------------------------------------------------- - // Dropping - // ---------------------------------------------------------------------------------------------------- - - /** - * Attempts to drop the item allowing space for applying properties to the item - * before it is spawned - * - * @param location - * @param item - * @param modifier - * @return the item - */ - public static Item dropItem(Location location, ItemStack item, Consumer<Item> modifier) { - return Remain.spawnItem(location, item, modifier); - } - - // ---------------------------------------------------------------------------------------------------- - // Tracking - // ---------------------------------------------------------------------------------------------------- - - /** - * Runs a timer task with the tick period of 1 and will trigger your hit listener - * when the given entity isOnGround. If the entity gets removed before it hits - * the ground, nothing is called - * <p> - * If the entity still flies after 30 seconds, nothing is called - * - * @param entity - * @param hitGroundListener - */ - public static void trackFalling(Entity entity, Runnable hitGroundListener) { - track(entity, 30 * 20, null, hitGroundListener); - } - - /** - * Runs a timer task with the tick period of 1 and will trigger your fly listener - * each tick until entity is either removed or isOnGround - * <p> - * If the entity still flies after 30 seconds, nothing is called - * - * @param entity - * @param flyListener - */ - public static void trackFlying(Entity entity, Runnable flyListener) { - track(entity, 30 * 20, flyListener, null); - } - - /** - * Runs a timer task with the tick period of 1 and will trigger your hit listener - * when the given entity isOnGround. If the entity gets removed before it hits - * the ground, nothing is called - * <p> - * The fly listener is called every tick - * - * @param entity - * @param timeoutTicks - * @param flyListener - * @param hitGroundListener - */ - public static void track(Entity entity, int timeoutTicks, Runnable flyListener, Runnable hitGroundListener) { - if (flyListener == null && hitGroundListener == null) - throw new FoException("Cannot track entity with fly and hit listeners on null!"); - - Common.runTimer(1, new BukkitRunnable() { - - private int elapsedTicks = 0; - - @Override - public void run() { - - // Cancel after the given timeout to save performance - if (elapsedTicks++ > timeoutTicks) { - cancel(); - - return; - } - - // Cancel when invalid - if (entity == null || entity.isDead() || !entity.isValid()) { - if (entity instanceof FallingBlock && hitGroundListener != null) - hitGroundListener.run(); - - cancel(); - return; - } - - // Run the hit listener - if (entity.isOnGround()) { - if (hitGroundListener != null) - hitGroundListener.run(); - - cancel(); - - } else if (flyListener != null) - flyListener.run(); - } - }); - } - - /** - * (No timer task) Starts tracking a projectile's impact and executes the hit - * task when it hits something. After 30 seconds of flight we stop tracking - * to save performance - * - * @param projectile - * @param hitTask - */ - public static void trackHit(Projectile projectile, HitListener hitTask) { - HitTracking.addFlyingProjectile(projectile, hitTask); - } - - /** - * The class responsible for tracking projectile's impact - */ - public interface HitListener { - - /** - * What should happen when the projectile hits something? - * - * @param event - */ - void onHit(ProjectileHitEvent event); - } -} - -/** - * Class responsible for tracking connection between projectile launch and projectile hit event - */ -class HitTracking implements Listener { - - /** - * List of flying projectiles with code to run on impact, - * stop tracking after 30 seconds to prevent overloading the map - */ - private static volatile ExpiringMap<UUID, List<HitListener>> flyingProjectiles = ExpiringMap.builder().expiration(30, TimeUnit.SECONDS).build(); - - /** - * Invoke the hit listener when the registered projectile hits something - * - * @param event - */ - @EventHandler(priority = EventPriority.HIGHEST) - public void onHit(ProjectileHitEvent event) { - - synchronized (flyingProjectiles) { - final List<HitListener> hitListeners = flyingProjectiles.remove(event.getEntity().getUniqueId()); - - if (hitListeners != null) - for (final HitListener listener : hitListeners) - listener.onHit(event); - } - } - - /** - * Add a new flying projectile that will be pending and execute code when collide - * - * @param projectile - * @param hitTask - */ - static void addFlyingProjectile(Projectile projectile, HitListener hitTask) { - synchronized (flyingProjectiles) { - final UUID uniqueId = projectile.getUniqueId(); - final List<HitListener> listeners = flyingProjectiles.getOrDefault(uniqueId, new ArrayList<>()); - - listeners.add(hitTask); - flyingProjectiles.put(uniqueId, listeners); - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/FileUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/FileUtil.java deleted file mode 100644 index 0ba6668179adb9b66030fe52f80fa6857290ba87..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/FileUtil.java +++ /dev/null @@ -1,692 +0,0 @@ -package org.mineacademy.fo; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileFilter; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.channels.ClosedByInterruptException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; -import java.nio.file.StandardOpenOption; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Enumeration; -import java.util.List; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -import org.bukkit.Bukkit; -import org.bukkit.configuration.InvalidConfigurationException; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.Tuple; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.fo.settings.SimpleYaml; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.NonNull; - -/** - * Utility class for managing files. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class FileUtil { - - /** - * Return the name of the file from the given path, stripping - * any extension and folders. - * <p> - * Example: classes/Archer.yml will only return Archer - * - * @param path - * @return - */ - public static String getFileName(File file) { - return getFileName(file.getName()); - } - - /** - * Return the name of the file from the given path, stripping - * any extension and folders. - * <p> - * Example: classes/Archer.yml will only return Archer - * - * @param path - * @return - */ - public static String getFileName(String path) { - Valid.checkBoolean(path != null && !path.isEmpty(), "The given path must not be empty!"); - - int pos = path.lastIndexOf("/"); - - if (pos > 0) - path = path.substring(pos + 1, path.length()); - - pos = path.lastIndexOf("."); - - if (pos > 0) - path = path.substring(0, pos); - - return path; - } - - // ---------------------------------------------------------------------------------------------------- - // Getting files - // ---------------------------------------------------------------------------------------------------- - - /** - * Returns a file from the given path inside our plugin folder, creating - * the file if it does not exist - * - * @param path - * @return - */ - public static File getOrMakeFile(String path) { - final File file = getFile(path); - - return file.exists() ? file : createIfNotExists(path); - } - - /** - * Checks if the file exists and creates a new one if it does not - * - * @param file - * @return - */ - public static File createIfNotExists(File file) { - if (!file.exists()) - try { - file.createNewFile(); - } catch (final Throwable t) { - Common.throwError(t, "Could not create new " + file + " due to " + t); - } - - return file; - } - - /** - * Create a new file in our plugin folder, supporting multiple directory paths - * <p> - * Example: logs/admin/console.log or worlds/nether.yml are all valid paths - * - * @param path - * @return - */ - public static File createIfNotExists(String path) { - final File datafolder = SimplePlugin.getInstance().getDataFolder(); - final int lastIndex = path.lastIndexOf('/'); - final File directory = new File(datafolder, path.substring(0, lastIndex >= 0 ? lastIndex : 0)); - - directory.mkdirs(); - - final File destination = new File(datafolder, path); - - try { - destination.createNewFile(); - - } catch (final IOException ex) { - Bukkit.getLogger().severe("Failed to create a new file " + path); - - ex.printStackTrace(); - } - - return destination; - } - - /** - * Return a file in a path in our plugin folder, file may not exist - * - * @param path - * @return - */ - public static File getFile(String path) { - return new File(SimplePlugin.getInstance().getDataFolder(), path); - } - - /** - * Return all files in our plugin directory within a given path, ending with the given extension - * - * @param directory - * @param extension - * @return - */ - public static File[] getFiles(@NonNull String directory, @NonNull String extension) { - - // Remove initial dot, if any - if (extension.startsWith(".")) - extension = extension.substring(1); - - final File dataFolder = new File(SimplePlugin.getData(), directory); - - if (!dataFolder.exists()) - dataFolder.mkdirs(); - - final String finalExtension = extension; - - return dataFolder.listFiles((FileFilter) file -> !file.isDirectory() && file.getName().endsWith("." + finalExtension)); - } - - // ---------------------------------------------------------------------------------------------------- - // Reading - // ---------------------------------------------------------------------------------------------------- - - /** - * Return all lines in the file, failing if the file does not exists - * - * @param file - * @return - */ - public static List<String> readLines(File file) { - Valid.checkNotNull(file, "File cannot be null"); - Valid.checkBoolean(file.exists(), "File: " + file + " does not exists!"); - - // Older method, missing libraries - try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) { - final List<String> lines = new ArrayList<>(); - String line; - - while ((line = br.readLine()) != null) - lines.add(line); - - return lines; - - } catch (final IOException ee) { - throw new FoException(ee, "Could not read lines from " + file.getName()); - } - } - - /** - * Attempts to load a yaml configuration from the given path inside of your plugin's JAR - * - * @param internalFileName - * @return - */ - public static SimpleYaml loadInternalConfiguration(String internalFileName) { - final InputStream is = getInternalResource(internalFileName); - Valid.checkNotNull(is, "Failed getting internal configuration from " + internalFileName); - - return Remain.loadConfiguration(is); - } - - /** - * Loads YAML configuration from file, failing if anything happens or the file does not exist - * - * FIX FOR PROJECT ORION STUDENTS IN ARENA MANAGER, SIMPLY RENAME YamlConfiguration TO FileConfiguration - * - * @param file - * @return - * @throws RuntimeException - */ - public static SimpleYaml loadConfigurationStrict(File file) throws RuntimeException { - Valid.checkNotNull(file, "File is null!"); - Valid.checkBoolean(file.exists(), "File " + file.getName() + " does not exists"); - - final SimpleYaml conf = new SimpleYaml(); - - try { - if (file.exists()) - checkFileForKnownErrors(file); - - conf.load(file); - - } catch (final FileNotFoundException ex) { - throw new IllegalArgumentException("Configuration file missing: " + file.getName(), ex); - - } catch (final IOException ex) { - throw new IllegalArgumentException("IO exception opening " + file.getName(), ex); - - } catch (final InvalidConfigurationException ex) { - throw new IllegalArgumentException("Malformed YAML file " + file.getName() + " - use services like yaml-online-parser.appspot.com to check and fix it", ex); - - } catch (final Throwable t) { - throw new IllegalArgumentException("Error reading YAML file " + file.getName(), t); - } - - return conf; - } - - /* - * Check file for known errors - */ - private static void checkFileForKnownErrors(File file) throws IllegalArgumentException { - for (final String line : readLines(file)) - if (line.contains("[*]")) - throw new IllegalArgumentException("Found [*] in your .yml file " + file + ". Please replace it with ['*'] instead."); - } - - // ---------------------------------------------------------------------------------------------------- - // Writing - // ---------------------------------------------------------------------------------------------------- - - /** - * Write a line to file - * <p> - * The line will be as follows: [date] msg - * - * @param to - * @param prefix - * @param message - */ - public static void writeFormatted(String to, String message) { - writeFormatted(to, null, message); - } - - /** - * Write a line to file with optional prefix which can be null. - * <p> - * The line will be as follows: [date] prefix msg - * - * @param to path to the file inside the plugin folder - * @param prefix optional prefix, can be null - * @param message line, is split by \n - */ - public static void writeFormatted(String to, String prefix, String message) { - message = Common.stripColors(message).trim(); - - if (!message.equalsIgnoreCase("none") && !message.isEmpty()) - for (final String line : Common.splitNewline(message)) - if (!line.isEmpty()) - write(to, "[" + TimeUtil.getFormattedDate() + "] " + (prefix != null ? prefix + ": " : "") + line); - } - - /** - * Write lines to a file path in our plugin directory, - * creating the file if it does not exist, appending lines at the end - * - * @param to - * @param lines - */ - public static void write(String to, String... lines) { - write(to, Arrays.asList(lines)); - } - - /** - * Write lines to a file, creating the file if not exist appending lines at the end - * - * @param to - * @param lines - */ - public static void write(File to, String... lines) { - write(createIfNotExists(to), Arrays.asList(lines), StandardOpenOption.APPEND); - } - - /** - * Write lines to a file path in our plugin directory, - * creating the file if it does not exist, appending lines at the end - * - * @param to - * @param lines - */ - public static void write(String to, Collection<String> lines) { - write(getOrMakeFile(to), lines, StandardOpenOption.APPEND); - } - - /** - * Write the given lines to file - * - * @param to - * @param lines - * @param options - */ - public static void write(File to, Collection<String> lines, StandardOpenOption... options) { - try { - final Path path = Paths.get(to.toURI()); - - try { - if (!to.exists()) - createIfNotExists(to); - - Files.write(path, lines, StandardCharsets.UTF_8, options); - - } catch (final ClosedByInterruptException ex) { - try (BufferedWriter bw = new BufferedWriter(new FileWriter(to, true))) { - for (final String line : lines) - bw.append(System.lineSeparator() + line); - - } catch (final IOException e) { - e.printStackTrace(); - } - } - - } catch (final Exception ex) { - Bukkit.getLogger().severe("Failed to write to " + to); - - ex.printStackTrace(); // do not throw our exception since it would cause an infinite loop if there is a problem due to error writing - } - } - - // ---------------------------------------------------------------------------------------------------- - // Extracting from our plugin .jar file - // ---------------------------------------------------------------------------------------------------- - - /** - * Copy file from our plugin jar to destination. - * No action is done if the file already exists. - * - * @param path the path to the file inside the plugin - * @return the extracted file - */ - public static File extract(String path) { - return extract(path, path); - } - - /** - * Copy file from our plugin jar to destination - customizable destination file - * name. - * - * @param override always extract file even if already exists? - * @param from the path to the file inside the plugin - * @param to the path where the file will be copyed inside the plugin - * folder - * @return the extracted file - */ - public static File extract(String from, String to) { - File file = new File(SimplePlugin.getInstance().getDataFolder(), to); - - final InputStream is = FileUtil.getInternalResource("/" + from); - Valid.checkNotNull(is, "Inbuilt file not found: " + from); - - if (file.exists()) - return file; - - file = createIfNotExists(to); - - try { - - final List<String> lines = new ArrayList<>(); - final String fileName = getFileName(file); - - // Load lines from internal file and replace them - try (final BufferedReader br = new BufferedReader(new InputStreamReader(is))) { - String line; - - while ((line = br.readLine()) != null) - lines.add(replaceVariables(line, fileName)); - } - - Files.write(file.toPath(), lines, StandardOpenOption.TRUNCATE_EXISTING); - - } catch (final IOException ex) { - Common.error(ex, - "Failed to extract " + from + " to " + to, - "Error: %error"); - } - - return file; - } - - /** - * Similar to {@link #extract(String, String)} but intended - * for non-text file types such as images etc. - * - * @param from - * @param to - * @return - */ - public static File extractRaw(String path) { - File file = new File(SimplePlugin.getInstance().getDataFolder(), path); - - final InputStream is = FileUtil.getInternalResource("/" + path); - Valid.checkNotNull(is, "Inbuilt file not found: " + path); - - if (file.exists()) - return file; - - file = createIfNotExists(path); - - try { - Files.copy(is, file.toPath(), StandardCopyOption.REPLACE_EXISTING); - - } catch (final IOException ex) { - Common.error(ex, - "Failed to extract " + path, - "Error: %error"); - } - - return file; - } - - /* - * A helper method to replace variables in files we are extracting. - * - * Saves us time so that we can distribute the same file across multiple - * plugins each having its own unique plugin name and file name. - */ - private static String replaceVariables(String line, String fileName) { - return line - .replace("{plugin_name}", SimplePlugin.getNamed().toLowerCase()) - .replace("{file}", fileName) - .replace("{file_lowercase}", fileName); - } - - /** - * Extracts the folder and all of its content from the JAR file to - * the given path in your plugin folder - * - * @param folder the source folder in your JAR plugin file - * @param destination the destination folder name in your plugin folder - */ - public static void extractFolderFromJar(String folder, final String destination) { - Valid.checkBoolean(folder.endsWith("/"), "Folder must end with '/'! Given: " + folder); - Valid.checkBoolean(!folder.startsWith("/"), "Folder must not start with '/'! Given: " + folder); - - if (getFile(folder).exists()) - return; - - try (JarFile jarFile = new JarFile(SimplePlugin.getSource())) { - for (final Enumeration<JarEntry> it = jarFile.entries(); it.hasMoreElements();) { - final JarEntry jarEntry = it.nextElement(); - final String entryName = jarEntry.getName(); - - // Copy each individual file manually - if (entryName.startsWith(folder) && !entryName.equals(folder)) - extract(entryName); - } - - } catch (final Throwable t) { - Common.throwError(t, "Failed to copy folder " + folder + " to " + destination); - } - } - - /** - * Return an internal resource within our plugin's jar file - * - * @param path - * @return the resource input stream, or null if not found - */ - public static InputStream getInternalResource(@NonNull String path) { - // First attempt - InputStream is = SimplePlugin.getInstance().getClass().getResourceAsStream(path); - - // Try using Bukkit - if (is == null) - is = SimplePlugin.getInstance().getResource(path); - - // The hard way - go in the jar file - if (is == null) - try (JarFile jarFile = new JarFile(SimplePlugin.getSource())) { - final JarEntry jarEntry = jarFile.getJarEntry(path); - - if (jarEntry != null) - is = jarFile.getInputStream(jarEntry); - - } catch (final IOException ex) { - ex.printStackTrace(); - } - - return is; - } - - /** - * Remove the given file with all subfolders - * - * @param file - */ - public static void deleteRecursivelly(File file) { - if (file.isDirectory()) - for (final File subfolder : file.listFiles()) - deleteRecursivelly(subfolder); - - if (file.exists()) - Valid.checkBoolean(file.delete(), "Failed to delete file: " + file); - } - - // ---------------------------------------------------------------------------------------------------- - // Archiving - // ---------------------------------------------------------------------------------------------------- - - /** - * Attempt to compress the given file into a byte array of the following structure: - * - * A list of all lines from the file + the file path up to your server root folder such as plugins/ChatControl/localization/ if - * the file is in the localization/ folder in your plugin folder appended at the end of the list. - * - * THE FILE MUST BE SOMEWHERE IN YOUR ROOT SERVER FOLDER (does not matter how many directories deep) - * AND YOUR WORKING DIRECTORY MUST BE SET TO YOUR ROOT SERVER FOLDER. - * - * @param file - * @return filepath from server root with the byte compressed file content array - */ - public static Tuple<String, byte[]> compress(@NonNull File file) { - Valid.checkBoolean(!file.isDirectory(), "Cannot compress a directory: " + file.getPath()); - final List<String> lines = new ArrayList<>(readLines(file)); // ensure modifiable - - // Add all parent directories until we reach the plugin's folder - final List<File> parentDirs = new ArrayList<>(); - - File parent = file.getParentFile(); - - while (parent != null) { - parentDirs.add(parent); - - parent = parent.getParentFile(); - } - - Collections.reverse(parentDirs); - - final String filePath = Common.join(parentDirs, "/", File::getName) + "/" + file.getName(); - - lines.add(filePath); - - // Join using our custom deliminer - final String joinedLines = String.join("%CMPRSDBF%", lines); - - return new Tuple<>(filePath, CompressUtil.compress(joinedLines)); - } - - /** - * Decompresses and writes all content to the file from the data array - * - * see {@link #compress(File)} - * - * @param data - * - * @return - */ - public static File decompressAndWrite(@NonNull byte[] data) { - return decompressAndWrite(null, data); - } - - /** - * Decompresses and writes all content to the file, - * - * see {@link #compress(File)} - * - * @param destination - * @param data - * - * @return - */ - public static File decompressAndWrite(File destination, @NonNull byte[] data) { - final Tuple<File, List<String>> tuple = decompress(data); - - if (destination == null) - destination = tuple.getKey(); - - final List<String> lines = tuple.getValue(); - - try { - FileUtil.createIfNotExists(destination); - - Files.write(destination.toPath(), lines, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); - - } catch (final IOException e) { - Common.throwError(e, "Failed to write " + lines.size() + " lines into " + destination); - } - - return destination; - } - - /** - * Decompresses the given data array into a file-lines tuple, - * see {@link #compress(File)} - * - * @param data - * @return - */ - public static Tuple<File, List<String>> decompress(@NonNull byte[] data) { - final String decompressed = CompressUtil.decompress(data); - final String[] linesRaw = decompressed.split("%CMPRSDBF%"); - Valid.checkBoolean(linesRaw.length > 0, "Received empty lines to decompress into a file!"); - - final List<String> lines = new ArrayList<>(); - - // Load lines - for (int i = 0; i < linesRaw.length - 1; i++) - lines.add(linesRaw[i]); - - // The final line is the file - final File file = new File(linesRaw[linesRaw.length - 1]); - - return new Tuple<>(file, lines); - } - - /** - * Creates a ZIP archive from the given source directory (inside our plugin folder) - * to the given full path (in our plugin folder) - please do not specify any extension, just the dir & file name - * - * @param sourceDirectory - * @param to - * @throws IOException - */ - public static void zip(String sourceDirectory, String to) throws IOException { - final File parent = SimplePlugin.getInstance().getDataFolder().getParentFile().getParentFile(); - final File toFile = new File(parent, to + ".zip"); - - if (toFile.exists()) - Valid.checkBoolean(toFile.delete(), "Failed to delete old file " + toFile); - - final Path pathTo = Files.createFile(Paths.get(toFile.toURI())); - - try (ZipOutputStream zs = new ZipOutputStream(Files.newOutputStream(pathTo))) { - final Path pathFrom = Paths.get(new File(parent, sourceDirectory).toURI()); - - Files.walk(pathFrom).filter(path -> !Files.isDirectory(path)).forEach(path -> { - final ZipEntry zipEntry = new ZipEntry(pathFrom.relativize(path).toString()); - - try { - zs.putNextEntry(zipEntry); - - Files.copy(path, zs); - zs.closeEntry(); - } catch (final IOException ex) { - ex.printStackTrace(); - } - }); - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/GeoAPI.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/GeoAPI.java deleted file mode 100644 index c8930dd4a7d1ac1649e5f9b093d217327a1f36f6..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/GeoAPI.java +++ /dev/null @@ -1,88 +0,0 @@ -package org.mineacademy.fo; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.InetSocketAddress; -import java.net.NoRouteToHostException; -import java.net.SocketTimeoutException; -import java.net.URL; -import java.net.URLConnection; - -import org.mineacademy.fo.collection.StrictMap; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.RequiredArgsConstructor; - -/** - * Utility class for resolving geographical information about players. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class GeoAPI { - - /** - * The cached responses per IP addresses - */ - private static final StrictMap<String, GeoResponse> cache = new StrictMap<>(); - - /** - * Returns a {@link GeoResponse} with geographic data for the given IP address - * - * @param ip - * @return - */ - public static GeoResponse getCountry(InetSocketAddress ip) { - GeoResponse response = new GeoResponse("", "", "", ""); - - if (ip == null) - return response; - - if (ip.getHostString().equals("127.0.0.1") || ip.getHostString().equals("0.0.0.0")) - return new GeoResponse("local", "-", "local", "-"); - - if (cache.contains(ip.toString()) || cache.containsValue(response)) - return cache.get(ip.toString()); - - try { - final URL url = new URL("http://ip-api.com/json/" + ip.getHostName()); - final URLConnection con = url.openConnection(); - con.setConnectTimeout(3000); - con.setReadTimeout(3000); - - try (final BufferedReader r = new BufferedReader(new InputStreamReader(con.getInputStream()))) { - String page = ""; - String input; - - while ((input = r.readLine()) != null) - page += input; - - response = new GeoResponse(getJson(page, "country"), getJson(page, "countryCode"), getJson(page, "regionName"), getJson(page, "isp")); - cache.put(ip.toString(), response); - } - - } catch (final NoRouteToHostException ex) { - // Firewall or internet access denied - - } catch (final SocketTimeoutException ex) { // hide - } catch (final IOException ex) { - ex.printStackTrace(); - } - - return response; - } - - private static String getJson(String page, String element) { - return page.contains("\"" + element + "\":\"") ? page.split("\"" + element + "\":\"")[1].split("\",")[0] : ""; - } - - /** - * The response we get from an external server, cached since the country does not change for the IP does it? :) - */ - @RequiredArgsConstructor - @Getter - public static final class GeoResponse { - private final String countryName, countryCode, regionName, isp; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/HealthBarUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/HealthBarUtil.java deleted file mode 100644 index 0cb8356d098542654318d235b8ada4aceafa23b1..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/HealthBarUtil.java +++ /dev/null @@ -1,97 +0,0 @@ -package org.mineacademy.fo; - -import org.bukkit.ChatColor; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.mineacademy.fo.remain.Remain; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Utility class for displaying health bar above mobs. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class HealthBarUtil { - - /** - * The default prefix and suffix - */ - @Setter - private static String prefix = "&8[", suffix = "&8]"; - - /** - * The default health bar colors - */ - @Setter - private static ChatColor remainingColor = ChatColor.DARK_RED, totalColor = ChatColor.GRAY, deadColor = ChatColor.BLACK; - - /** - * Formats and displays the health bar as action bar. - * - * @param displayTo the player to whom to display - * @param displayAbout the entity from which to measure - * @param damage the damage from {@link EntityDamageByEntityEvent} event, - * or just set 0 to not subtract anything from health. - */ - public static void display(final Player displayTo, final LivingEntity displayAbout, final double damage) { - final int maxHealth = Remain.getMaxHealth(displayAbout); - final int health = Remain.getHealth(displayAbout); - - final String name = Common.getOrEmpty(displayAbout.getCustomName()); - final String formatted = (name.isEmpty() ? ItemUtil.bountifyCapitalized(displayAbout.getType()) : name) + " - " + getHealthMessage(health, maxHealth, (int) damage); - - Remain.sendActionBar(displayTo, formatted); - } - - /* Creates a new health component */ - private static String getHealthMessage(final int health, final int maxHealth, final int damage) { - final int remainingHealth = health - damage; - - return remainingHealth > 0 ? formatHealth(remainingHealth, maxHealth) : formatDeath(maxHealth); - } - - /* Fills up the graphics of health indicator */ - private static String formatHealth(final int remainingHealth, final int maxHealth) { - - if (maxHealth > 30) - return formatMuchHealth(remainingHealth, maxHealth); - - // Fill the remaining health - String left = ""; - { - for (int i = 0; i < remainingHealth; i++) - left += "|"; - } - - // Fill max health - remaining - String max = ""; - { - for (int i = 0; i < maxHealth - left.length(); i++) - max += "|"; - } - - return prefix + remainingColor + left + totalColor + max + suffix; - } - - /* Fills up the graphics if the health is too high */ - private static String formatMuchHealth(final int remaining, final int max) { - return prefix + remainingColor + remaining + " &8/ " + totalColor + max + suffix; - } - - /* Fills up the graphic if the health is 0 */ - private static String formatDeath(final int maxHealth) { - String max = ""; - - if (maxHealth > 30) - max = "-0-"; - - else - for (int i = 0; i < maxHealth; i++) - max += "|"; - - return prefix + deadColor + max + suffix; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/ItemUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/ItemUtil.java deleted file mode 100644 index ec9ec0ad46ce79cfa49387ce7a33e69a5d711936..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/ItemUtil.java +++ /dev/null @@ -1,328 +0,0 @@ -package org.mineacademy.fo; - -import java.util.ArrayList; - -import org.apache.commons.lang.WordUtils; -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompChatColor; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.nbt.NBTItem; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.RequiredArgsConstructor; - -/** - * Utility class for managing items. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class ItemUtil { - - // Is Minecraft older than 1.13? Storing here for best performance. - private static final boolean LEGACY_MATERIALS = MinecraftVersion.olderThan(V.v1_13); - - // ---------------------------------------------------------------------------------------------------- - // Converting strings into Bukkit item-related classes - // ---------------------------------------------------------------------------------------------------- - - /** - * Looks up a {@link PotionEffect} from the given name, - * failing if not found - * - * @param name - * @return - */ - public static PotionEffectType findPotion(String name) { - name = PotionWrapper.getBukkitName(name); - - final PotionEffectType potion = PotionEffectType.getByName(name); - Valid.checkNotNull(potion, "Invalid potion '" + name + "'! For valid names, see: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/potion/PotionEffectType.html"); - - return potion; - } - - /** - * Looks up an {@link Enchantment} from the given name, - * failing if not found - * - * @param name - * @return - */ - public static Enchantment findEnchantment(String name) { - Enchantment enchant = Enchantment.getByName(name); - - if (enchant == null) - enchant = Enchantment.getByName(name.toLowerCase()); - - if (enchant == null) { - name = EnchantmentWrapper.toBukkit(name); - enchant = Enchantment.getByName(name.toLowerCase()); - - if (enchant == null) - enchant = Enchantment.getByName(name); - } - - Valid.checkNotNull(enchant, "Invalid enchantment '" + name + "'! For valid names, see: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/enchantments/Enchantment.html"); - - return enchant; - } - - // ---------------------------------------------------------------------------------------------------- - // Enumeration - fancy names - // ---------------------------------------------------------------------------------------------------- - - /** - * See {@link #bountifyCapitalized(CompChatColor)} - * - * @param color - * @return - */ - public static String bountifyCapitalized(CompChatColor color) { - return bountifyCapitalized(color.getName()); - } - - /** - * Removes _ from the enum, lowercases everything and finally capitalizes it - * - * @param enumeration - * @return - */ - public static String bountifyCapitalized(Enum<?> enumeration) { - return WordUtils.capitalizeFully(bountify(enumeration.toString().toLowerCase())); - } - - /** - * Removes _ from the name, lowercases everything and finally capitalizes it - * - * @param name - * @return - */ - public static String bountifyCapitalized(String name) { - return WordUtils.capitalizeFully(bountify(name)); - } - - /** - * Lowercases the given enum and replaces _ with spaces - * - * @param enumeration - * @return - */ - public static String bountify(Enum<?> enumeration) { - return bountify(enumeration.toString()); - } - - /** - * Lowercases the given name and replaces _ with spaces - * - * @param name - * @return - */ - public static String bountify(String name) { - return name.toLowerCase().replace("_", " "); - } - - /** - * Returns a human readable fancy potion effect type - * - * @param enumeration - * @return - */ - public static String bountify(PotionEffectType enumeration) { - return PotionWrapper.getLocalizedName(enumeration.getName()); - } - - /** - * Returns a fancy enchantment name - * - * @param enchant - * @return - */ - public static String bountify(Enchantment enchant) { - return EnchantmentWrapper.toMinecraft(enchant.getName()); - } - - // ---------------------------------------------------------------------------------------------------- - // Comparing items - // ---------------------------------------------------------------------------------------------------- - - /** - * Compares two items. Returns true if they are similar. - * <p> - * Two items are similar if both are not null and if their type, data, name and lore equals. - * The damage, quantity, item flags enchants and other properties are ignored. - * - * @param first - * @param second - * @return true if items are similar (see above) - */ - public static boolean isSimilar(ItemStack first, ItemStack second) { - if (first == null || second == null) - return false; - - final boolean firstAir = CompMaterial.isAir(first.getType()); - final boolean secondAir = CompMaterial.isAir(second.getType()); - - if ((firstAir && !secondAir) || (!firstAir && secondAir)) - return false; - - if (firstAir && secondAir) - return true; - - final boolean idMatch = first.getType() == second.getType(); - - final boolean isSkull = CompMaterial.isSkull(first.getType()) && CompMaterial.isSkull(second.getType()); - boolean dataMatch = !LEGACY_MATERIALS || isSkull || first.getData().getData() == second.getData().getData(); - final boolean metaMatch = first.hasItemMeta() == second.hasItemMeta(); - - if (!idMatch || !metaMatch || !(dataMatch || (dataMatch = first.getType() == Material.BOW))) - return false; - - // ItemMeta - { - final ItemMeta f = first.getItemMeta(); - final ItemMeta s = second.getItemMeta(); - - if ((f == null && s != null) || (s == null && f != null)) - return false; - - final String fName = f == null ? "" : Common.stripColors(Common.getOrEmpty(f.getDisplayName())); - final String sName = s == null ? "" : Common.stripColors(Common.getOrEmpty(s.getDisplayName())); - - if ((fName != null && !fName.equalsIgnoreCase(sName)) || !Valid.listEquals(f == null ? new ArrayList<>() : f.getLore(), s == null ? new ArrayList<>() : s.getLore())) - return false; - } - - if (MinecraftVersion.atLeast(V.v1_7)) { - final NBTItem firstNbt = new NBTItem(first); - final NBTItem secondNbt = new NBTItem(second); - - return matchNbt(SimplePlugin.getNamed(), firstNbt, secondNbt) && matchNbt(SimplePlugin.getNamed() + "_Item", firstNbt, secondNbt); - } - - return true; - } - - // Compares the NBT string tag of two items - private static boolean matchNbt(String key, NBTItem firstNbt, NBTItem secondNbt) { - final boolean firstHas = firstNbt.hasKey(key); - final boolean secondHas = secondNbt.hasKey(key); - - if (!firstHas && !secondHas) - return true; // nothing has, essentially same - - else if (firstHas && !secondHas || !firstHas && secondHas) - return false; // one has but another hasn't, cannot be same - - return firstNbt.getString(key).equals(secondNbt.getString(key)); - } -} - -/** - * A simple class holding some of the potion names - */ -@RequiredArgsConstructor -enum PotionWrapper { - - SLOW("SLOW", "Slowness"), - STRENGTH("INCREASE_DAMAGE"), - JUMP_BOOST("JUMP"), - INSTANT_HEAL("INSTANT_HEALTH"), - REGEN("REGENERATION"); - - private final String bukkitName; - private final String minecraftName; - - private PotionWrapper(String bukkitName) { - this(bukkitName, null); - } - - protected static String getLocalizedName(String name) { - String localizedName = name; - - for (final PotionWrapper e : values()) - if (name.toUpperCase().replace(" ", "_").equals(e.bukkitName)) { - localizedName = e.getMinecraftName(); - - break; - } - - return WordUtils.capitalizeFully(localizedName.replace("_", " ")); - } - - protected static String getBukkitName(String name) { - name = name.toUpperCase().replace(" ", "_"); - - for (final PotionWrapper e : values()) - if (e.toString().equalsIgnoreCase(name) || e.minecraftName != null && e.minecraftName.equalsIgnoreCase(name)) - return e.bukkitName; - - return name; - } - - public String getMinecraftName() { - return Common.getOrDefault(minecraftName, bukkitName); - } -} - -/** - * A simple class holding some of the enchantments names - */ -@RequiredArgsConstructor -enum EnchantmentWrapper { - PROTECTION("PROTECTION_ENVIRONMENTAL"), - FIRE_PROTECTION("PROTECTION_FIRE"), - FEATHER_FALLING("PROTECTION_FALL"), - BLAST_PROTECTION("PROTECTION_EXPLOSIONS"), - PROJECTILE_PROTECTION("PROTECTION_PROJECTILE"), - RESPIRATION("OXYGEN"), - AQUA_AFFINITY("WATER_WORKER"), - THORN("THORNS"), - CURSE_OF_VANISHING("VANISHING_CURSE"), - CURSE_OF_BINDING("BINDING_CURSE"), - SHARPNESS("DAMAGE_ALL"), - SMITE("DAMAGE_UNDEAD"), - BANE_OF_ARTHROPODS("DAMAGE_ARTHROPODS"), - LOOTING("LOOT_BONUS_MOBS"), - SWEEPING_EDGE("SWEEPING"), - EFFICIENCY("DIG_SPEED"), - UNBREAKING("DURABILITY"), - FORTUNE("LOOT_BONUS_BLOCKS"), - POWER("ARROW_DAMAGE"), - PUNCH("ARROW_KNOCKBACK"), - FLAME("ARROW_FIRE"), - INFINITY("ARROW_INFINITE"), - LUCK_OF_THE_SEA("LUCK"); - - private final String bukkitName; - - protected static String toBukkit(String name) { - name = name.toUpperCase().replace(" ", "_"); - - for (final EnchantmentWrapper e : values()) - if (e.toString().equals(name)) - return e.bukkitName; - - return name; - } - - protected static String toMinecraft(String name) { - name = name.toUpperCase().replace(" ", "_"); - - for (final EnchantmentWrapper e : values()) - if (name.equals(e.bukkitName)) - return ItemUtil.bountifyCapitalized(e); - - return WordUtils.capitalizeFully(name); - } - - public String getBukkitName() { - return bukkitName != null ? bukkitName : name(); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/MathUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/MathUtil.java deleted file mode 100644 index 1443a6e26b17752a51b32e79acb8b40cdc930893..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/MathUtil.java +++ /dev/null @@ -1,514 +0,0 @@ -package org.mineacademy.fo; - -import java.text.DecimalFormat; -import java.util.Arrays; -import java.util.Collection; -import java.util.NavigableMap; -import java.util.TreeMap; - -import org.bukkit.util.Vector; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; - -/** - * Utility class for mathematical operations. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class MathUtil { - - /** - * Formatter that transforms whole numbers into whole decimals with 1 decimal point - */ - private final static DecimalFormat oneDigitFormat = new DecimalFormat("#.#"); - - /** - * Formatter that transforms whole numbers into whole decimals with 2 decimal points - */ - private final static DecimalFormat twoDigitsFormat = new DecimalFormat("#.##"); - - /** - * Formatter that transforms whole numbers into whole decimals with 3 decimal points - */ - private final static DecimalFormat threeDigitsFormat = new DecimalFormat("#.###"); - - /** - * Formatter that transforms whole numbers into whole decimals with 5 decimal points - */ - private final static DecimalFormat fiveDigitsFormat = new DecimalFormat("#.#####"); - - /** - * Holds all valid roman numbers - */ - private final static NavigableMap<Integer, String> romanNumbers = new TreeMap<>(); - - // Load the roman numbers - static { - romanNumbers.put(1000, "M"); - romanNumbers.put(900, "CM"); - romanNumbers.put(500, "D"); - romanNumbers.put(400, "CD"); - romanNumbers.put(100, "C"); - romanNumbers.put(90, "XC"); - romanNumbers.put(50, "L"); - romanNumbers.put(40, "XL"); - romanNumbers.put(10, "X"); - romanNumbers.put(9, "IX"); - romanNumbers.put(5, "V"); - romanNumbers.put(4, "IV"); - romanNumbers.put(1, "I"); - } - - // ---------------------------------------------------------------------------------------------------- - // Number manipulation - // ---------------------------------------------------------------------------------------------------- - - /** - * Return a roman number representation of the given number - * - * @param number - * @return - */ - public static String toRoman(final int number) { - if (number == 0) - return "0"; // Actually, Romans did not know zero lol - - final int literal = romanNumbers.floorKey(number); - - if (number == literal) - return romanNumbers.get(number); - - return romanNumbers.get(literal) + toRoman(number - literal); - } - - /** - * Return the highest integer in the given number array - * - * @param numbers - * @return - */ - public static int max(int... numbers) { - return Arrays.stream(numbers).max().getAsInt(); - } - - /** - * See {@link Math#floor(double)} - * - * @param d1 - * @return - */ - public static long floor(final double d1) { - final long i = (long) d1; - - return d1 >= i ? i : i - 1; - } - - /** - * See {@link Math#ceil(double)} - * - * @param f1 - * @return - */ - public static long ceiling(final double f1) { - final long i = (long) f1; - - return f1 >= i ? i : i - 1; - } - - /** - * See {@link #range(int, int, int)} - * - * @param value the real value - * @param min the min limit - * @param max the max limit - * @return the value in range - */ - public static double range(final double value, final double min, final double max) { - return Math.min(Math.max(value, min), max); - } - - /** - * Get a value in range. If the value is < min, returns min, if it is > max, returns max. - * - * @param value the real value - * @param min the min limit - * @param max the max limit - * @return the value in range - */ - public static int range(final int value, final int min, final int max) { - return Math.min(Math.max(value, min), max); - } - - /** - * Return the given value if above min, or min - * - * @param value - * @param min - * @return - */ - public static double atLeast(final double value, final double min) { - return value > min ? value : min; - } - - /** - * Return the given value if above min, or min - * - * @param value - * @param min - * @return - */ - public static int atLeast(final int value, final int min) { - return value > min ? value : min; - } - - /** - * Increase the given number by given percents (from 0 to 100) - * - * @param number - * @param percent - * @return - */ - public static int increase(final int number, final double percent) { - final double myNumber = number; - final double percentage = myNumber / 100 * percent; - - return (int) Math.round(myNumber + percentage); - } - - /** - * Increase the given number by given percents (from 0 to 100) - * - * @param number - * @param percent - * @return - */ - public static double increase(final double number, final double percent) { - final double percentage = number / 100 * percent; - - return number + percentage; - } - - /** - * Calculates the percentage (completion) of the given number from the maximum - * in 0 till 100 - * - * @param number - * @param maximum - * @return 0 to 100 of the given number portion of the maximum - */ - public static int percent(final double number, final double maximum) { - return (int) (number / maximum * 100); - } - - /** - * Return the average double of the given values - * - * @param values - * @return - */ - public static double average(final Collection<Double> values) { - return average(values.toArray(new Double[values.size()])); - } - - /** - * Return the average double of the given values - * - * @param values - * @return - */ - public static double average(final Double... values) { - Valid.checkBoolean(values.length > 0, "No values given!"); - - double sum = 0; - - for (final double val : values) - sum += val; - - return formatTwoDigitsD(sum / values.length); - } - - // ---------------------------------------------------------------------------------------------------- - // Vectors - // ---------------------------------------------------------------------------------------------------- - - /** - * Rotates the given vector by the given amount of angles (in degrees) - * Implementing a cache or precalculating this is recommended for best performance. - * - * @param vector - * @param angle - */ - public static Vector rotateAroundAxisX(Vector v, double angle) { - angle = Math.toRadians(angle); - - final double cos = Math.cos(angle); - final double sin = Math.sin(angle); - final double y = v.getY() * cos - v.getZ() * sin; - final double z = v.getY() * sin + v.getZ() * cos; - - return v.setY(y).setZ(z); - } - - /** - * Rotates the given vector by the given amount of angles (in degrees) - * Implementing a cache or precalculating this is recommended for best performance. - * - * @param v - * @param angle - * @return - */ - public static Vector rotateAroundAxisY(Vector v, double angle) { - angle = -angle; - angle = Math.toRadians(angle); - - final double cos = Math.cos(angle); - final double sin = Math.sin(angle); - final double x = v.getX() * cos + v.getZ() * sin; - final double z = v.getX() * -sin + v.getZ() * cos; - - return v.setX(x).setZ(z); - } - - /** - * Rotates the given vector by the given amount of angles (in degrees) - * Implementing a cache or precalculating this is recommended for best performance. - * - * @param v - * @param angle - * @return - */ - public static Vector rotateAroundAxisZ(Vector v, double angle) { - angle = Math.toRadians(angle); - - final double cos = Math.cos(angle); - final double sin = Math.sin(angle); - final double x = v.getX() * cos - v.getY() * sin; - final double y = v.getX() * sin + v.getY() * cos; - - return v.setX(x).setY(y); - } - - // ---------------------------------------------------------------------------------------------------- - // Formatting - // ---------------------------------------------------------------------------------------------------- - - /** - * Formats the given number into one digit - * - * @param value - * @return - */ - public static String formatOneDigit(final double value) { - return oneDigitFormat.format(value).replace(",", "."); - } - - /** - * Formats the given number into one digit - * - * @param value - * @return - */ - public static double formatOneDigitD(final double value) { - Valid.checkBoolean(!Double.isNaN(value), "Value must not be NaN"); - - return Double.parseDouble(oneDigitFormat.format(value).replace(",", ".")); - } - - /** - * Formats the given number into two digits - * - * @param value - * @return - */ - public static String formatTwoDigits(final double value) { - return twoDigitsFormat.format(value).replace(",", "."); - } - - /** - * Formats the given number into two digits - * - * @param value - * @return - */ - public static double formatTwoDigitsD(final double value) { - Valid.checkBoolean(!Double.isNaN(value), "Value must not be NaN"); - - return Double.parseDouble(twoDigitsFormat.format(value).replace(",", ".")); - } - - /** - * Formats the given number into three digits - * - * @param value - * @return - */ - public static String formatThreeDigits(final double value) { - return threeDigitsFormat.format(value).replace(",", "."); - } - - /** - * Formats the given number into three digits - * - * @param value - * @return - */ - public static double formatThreeDigitsD(final double value) { - Valid.checkBoolean(!Double.isNaN(value), "Value must not be NaN"); - - return Double.parseDouble(threeDigitsFormat.format(value).replace(",", ".")); - } - - /** - * Formats the given number into five digits - * - * @param value - * @return - */ - public static String formatFiveDigits(final double value) { - return fiveDigitsFormat.format(value).replace(",", "."); - } - - /** - * Formats the given number into five digits - * - * @param value - * @return - */ - public static double formatFiveDigitsD(final double value) { - Valid.checkBoolean(!Double.isNaN(value), "Value must not be NaN"); - - return Double.parseDouble(fiveDigitsFormat.format(value).replace(",", ".")); - } - - // ---------------------------------------------------------------------------------------------------- - // Calculating - // ---------------------------------------------------------------------------------------------------- - - /** - * Evaluate the given expression, e.g. 5*(4-2) returns... let me check! - * - * @param expression - * @return - */ - public static double calculate(final String expression) { - class Parser { - int pos = -1, c; - - void eatChar() { - c = ++pos < expression.length() ? expression.charAt(pos) : -1; - } - - void eatSpace() { - while (Character.isWhitespace(c)) - eatChar(); - } - - double parse() { - eatChar(); - - final double v = parseExpression(); - - if (c != -1) - throw new CalculatorException("Unexpected: " + (char) c); - - return v; - } - - // Grammar: - // expression = term | expression `+` term | expression `-` term - // term = factor | term `*` factor | term `/` factor | term brackets - // factor = brackets | number | factor `^` factor - // brackets = `(` expression `)` - - double parseExpression() { - double v = parseTerm(); - - for (;;) { - eatSpace(); - - if (c == '+') { // addition - eatChar(); - v += parseTerm(); - } else if (c == '-') { // subtraction - eatChar(); - v -= parseTerm(); - } else - return v; - - } - } - - double parseTerm() { - double v = parseFactor(); - - for (;;) { - eatSpace(); - - if (c == '/') { // division - eatChar(); - v /= parseFactor(); - } else if (c == '*' || c == '(') { // multiplication - if (c == '*') - eatChar(); - v *= parseFactor(); - } else - return v; - } - } - - double parseFactor() { - double v; - boolean negate = false; - - eatSpace(); - - if (c == '+' || c == '-') { // unary plus & minus - negate = c == '-'; - eatChar(); - eatSpace(); - } - - if (c == '(') { // brackets - eatChar(); - v = parseExpression(); - if (c == ')') - eatChar(); - } else { // numbers - final StringBuilder sb = new StringBuilder(); - - while (c >= '0' && c <= '9' || c == '.') { - sb.append((char) c); - eatChar(); - } - - if (sb.length() == 0) - throw new CalculatorException("Unexpected: " + (char) c); - - v = Double.parseDouble(sb.toString()); - } - eatSpace(); - if (c == '^') { // exponentiation - eatChar(); - v = Math.pow(v, parseFactor()); - } - if (negate) - v = -v; // unary minus is applied after exponentiation; e.g. -3^2=-9 - return v; - } - } - return new Parser().parse(); - } - - /** - * An exception thrown when calculating wrong numbers (i.e. 0 division) - * <p> - * See {@link MathUtil#calculate(String)} - */ - public static final class CalculatorException extends RuntimeException { - private static final long serialVersionUID = 1L; - - public CalculatorException(final String message) { - super(message); - } - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/Messenger.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/Messenger.java deleted file mode 100644 index 17464f2b4759a808260d0a71b8f6221e7e78e551..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/Messenger.java +++ /dev/null @@ -1,214 +0,0 @@ -package org.mineacademy.fo; - -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.mineacademy.fo.remain.Remain; - -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.UtilityClass; - -/** - * Streamlines the process of sending themed messages to players - */ -@UtilityClass -public class Messenger { - - /** - * Should we use messenger globally such as in commands & listeners? - */ - public static boolean ENABLED = true; - - /** - * The prefix send while sending info message - */ - @Setter - @Getter - private String infoPrefix = "&8&l[&9&li&8&l]&7 "; - - /** - * The prefix send while sending success message - */ - @Setter - @Getter - private String successPrefix = "&8&l[&2&l\u2714&8&l]&7 "; - - /** - * The prefix send while sending warning message - */ - @Setter - @Getter - private String warnPrefix = "&8&l[&6&l!&8&l]&6 "; - - /** - * The prefix send while sending error message - */ - @Setter - @Getter - private String errorPrefix = "&8&l[&4&l\u2715&8&l]&c "; - - /** - * The prefix send while sending questions - */ - @Setter - @Getter - private String questionPrefix = "&8&l[&a&l?&l&8]&7 "; - - /** - * The prefix send while sending announcements - */ - @Setter - @Getter - private String announcePrefix = "&8&l[&5&l!&l&8]&d "; - - /** - * Send a message prepended with the {@link #infoPrefix} - * - * @param message - */ - public void broadcastInfo(final String message) { - for (final Player online : Remain.getOnlinePlayers()) - tell(online, infoPrefix, message); - } - - /** - * Send a message prepended with the {@link #successPrefix} - * - * @param message - */ - public void broadcastSuccess(final String message) { - for (final Player online : Remain.getOnlinePlayers()) - tell(online, successPrefix, message); - } - - /** - * Send a message prepended with the {@link #warnPrefix} - * - * @param message - */ - public void broadcastWarn(final String message) { - for (final Player online : Remain.getOnlinePlayers()) - tell(online, warnPrefix, message); - } - - /** - * Send a message prepended with the {@link #errorPrefix} - * - * @param message - */ - public void broadcastError(final String message) { - for (final Player online : Remain.getOnlinePlayers()) - tell(online, errorPrefix, message); - } - - /** - * Send a message prepended with the {@link #questionPrefix} - * - * @param message - */ - public void broadcastQuestion(final String message) { - for (final Player online : Remain.getOnlinePlayers()) - tell(online, questionPrefix, message); - } - - /** - * Send a message prepended with the {@link #announcePrefix} - * - * @param message - */ - public void broadcastAnnounce(final String message) { - for (final Player online : Remain.getOnlinePlayers()) - tell(online, announcePrefix, message); - } - - /** - * Send a message prepended with the {@link #infoPrefix} - * - * @param player - * @param message - */ - public void info(final CommandSender player, final String message) { - tell(player, infoPrefix, message); - } - - /** - * Send a message prepended with the {@link #successPrefix} - * - * @param player - * @param message - */ - public void success(final CommandSender player, final String message) { - tell(player, successPrefix, message); - } - - /** - * Send a message prepended with the {@link #warnPrefix} - * - * @param player - * @param message - */ - public void warn(final CommandSender player, final String message) { - tell(player, warnPrefix, message); - } - - /** - * Send messages prepended with the {@link #errorPrefix} - * - * @param player - * @param messages - */ - public void error(final CommandSender player, final String... messages) { - for (final String message : messages) - error(player, message); - } - - /** - * Send a message prepended with the {@link #errorPrefix} - * - * @param player - * @param message - */ - public void error(final CommandSender player, final String message) { - tell(player, errorPrefix, message); - } - - /** - * Send a message prepended with the {@link #questionPrefix} - * - * @param player - * @param message - */ - public void question(final CommandSender player, final String message) { - tell(player, questionPrefix, message); - } - - /** - * Send a message prepended with the {@link #announcePrefix} - * - * @param player - * @param message - */ - public void announce(final CommandSender player, final String message) { - tell(player, announcePrefix, message); - } - - /* - * Internal method to perform the sending - */ - private void tell(final CommandSender player, final String prefix, String message) { - - // Support localization being none or empty - if (message.isEmpty() || "none".equals(message)) - return; - - final String colorless = Common.stripColors(message); - final boolean foundElements = ChatUtil.isInteractive(colorless); - - // Special case: Send the prefix for actionbar - if (colorless.startsWith("<actionbar>")) - message = message.replace("<actionbar>", "<actionbar>" + prefix); - - // Only insert prefix if the message is sent through the normal chat - Common.tellNoPrefix(player, (foundElements ? "" : prefix) + message); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/MinecraftVersion.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/MinecraftVersion.java deleted file mode 100644 index 2c5256b5b7db5293e61c73c5e42c9975766256bd..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/MinecraftVersion.java +++ /dev/null @@ -1,200 +0,0 @@ -package org.mineacademy.fo; - -import org.bukkit.Bukkit; -import org.mineacademy.fo.exception.FoException; - -import lombok.Getter; - -/** - * Represents the current Minecraft version the plugin loaded on - */ -public final class MinecraftVersion { - - /** - * The string representation of the version, for example V1_13 - */ - private static String serverVersion; - - /** - * The wrapper representation of the version - */ - @Getter - private static V current; - - /** - * The version wrapper - */ - public enum V { - v1_18(18, false), - v1_17(17), - v1_16(16), - v1_15(15), - v1_14(14), - v1_13(13), - v1_12(12), - v1_11(11), - v1_10(10), - v1_9(9), - v1_8(8), - v1_7(7), - v1_6(6), - v1_5(5), - v1_4(4), - v1_3_AND_BELOW(3); - - /** - * The numeric version (the second part of the 1.x number) - */ - private final int minorVersionNumber; - - /** - * Is this library tested with this Minecraft version? - */ - @Getter - private final boolean tested; - - /** - * Creates new enum for a MC version that is tested - * - * @param version - */ - V(int version) { - this(version, true); - } - - /** - * Creates new enum for a MC version - * - * @param version - * @param tested - */ - V(int version, boolean tested) { - this.minorVersionNumber = version; - this.tested = tested; - } - - /** - * Attempts to get the version from number - * - * @param number - * @return - * @throws RuntimeException if number not found - */ - protected static V parse(int number) { - for (final V v : values()) - if (v.minorVersionNumber == number) - return v; - - throw new FoException("Invalid version number: " + number); - } - - /** - * @see java.lang.Enum#toString() - */ - @Override - public String toString() { - return "1." + this.minorVersionNumber; - } - } - - /** - * Does the current Minecraft version equal the given version? - * - * @param version - * @return - */ - public static boolean equals(V version) { - return compareWith(version) == 0; - } - - /** - * Is the current Minecraft version older than the given version? - * - * @param version - * @return - */ - public static boolean olderThan(V version) { - return compareWith(version) < 0; - } - - /** - * Is the current Minecraft version newer than the given version? - * - * @param version - * @return - */ - public static boolean newerThan(V version) { - return compareWith(version) > 0; - } - - /** - * Is the current Minecraft version at equals or newer than the given version? - * - * @param version - * @return - */ - public static boolean atLeast(V version) { - return equals(version) || newerThan(version); - } - - // Compares two versions by the number - private static int compareWith(V version) { - try { - return getCurrent().minorVersionNumber - version.minorVersionNumber; - - } catch (final Throwable t) { - t.printStackTrace(); - - return 0; - } - } - - /** - * Return the class versioning such as v1_14_R1 - * - * @return - */ - public static String getServerVersion() { - return serverVersion.equals("craftbukkit") ? "" : serverVersion; - } - - // Initialize the version - static { - try { - - final String packageName = Bukkit.getServer() == null ? "" : Bukkit.getServer().getClass().getPackage().getName(); - final String curr = packageName.substring(packageName.lastIndexOf('.') + 1); - final boolean hasGatekeeper = !"craftbukkit".equals(curr) && !"".equals(packageName); - - serverVersion = curr; - - if (hasGatekeeper) { - int pos = 0; - - for (final char ch : curr.toCharArray()) { - pos++; - - if (pos > 2 && ch == 'R') - break; - } - - final String numericVersion = curr.substring(1, pos - 2).replace("_", "."); - - int found = 0; - - for (final char ch : numericVersion.toCharArray()) - if (ch == '.') - found++; - - Valid.checkBoolean(found == 1, "Minecraft Version checker malfunction. Could not detect your server version. Detected: " + numericVersion + " Current: " + curr); - - current = V.parse(Integer.parseInt(numericVersion.split("\\.")[1])); - - } else - current = V.v1_3_AND_BELOW; - - } catch (final Throwable t) { - Common.error(t, "Error detecting your Minecraft version. Check your server compatibility."); - } - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/PacketUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/PacketUtil.java deleted file mode 100644 index 49034afb6c6fb16f0b993d012d376933ed3e2f1f..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/PacketUtil.java +++ /dev/null @@ -1,426 +0,0 @@ -package org.mineacademy.fo; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.function.Consumer; - -import org.bukkit.entity.Player; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.exception.EventHandledException; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.exception.RegexTimeoutException; -import org.mineacademy.fo.model.HookManager; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.Remain; - -import com.comphenix.protocol.PacketType; -import com.comphenix.protocol.events.ListenerPriority; -import com.comphenix.protocol.events.PacketAdapter; -import com.comphenix.protocol.events.PacketEvent; -import com.comphenix.protocol.reflect.StructureModifier; -import com.comphenix.protocol.wrappers.EnumWrappers.ChatType; -import com.comphenix.protocol.wrappers.WrappedChatComponent; -import com.comphenix.protocol.wrappers.WrappedGameProfile; -import com.comphenix.protocol.wrappers.WrappedServerPing; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; -import net.md_5.bungee.api.chat.BaseComponent; - -/** - * Represents packet handling using ProtocolLib - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class PacketUtil { - - /** - * A convenience shortcut to add packet listener - * - * @param adapter - */ - public static void addPacketListener(final SimpleAdapter adapter) { - Valid.checkBoolean(HookManager.isVaultLoaded(), "ProtocolLib integration requires Vault to be installed. Please install that plugin before continuing."); - - HookManager.addPacketListener(adapter); - } - - // ------------------------------------------------------------------------------------------------------------ - // Receiving - // ------------------------------------------------------------------------------------------------------------ - - /** - * A convenience method for listening to Client>Server packets of the given type. - * - * @param type - * @param consumer - */ - public static void addReceivingListener(final PacketType type, final Consumer<PacketEvent> consumer) { - addReceivingListener(ListenerPriority.NORMAL, type, consumer); - } - - /** - * A convenience method for listening to Client>Server packets of the given type and priority. - * - * @param priority - * @param type - * @param consumer - */ - public static void addReceivingListener(final ListenerPriority priority, final PacketType type, final Consumer<PacketEvent> consumer) { - addPacketListener(new SimpleAdapter(priority, type) { - - /** - * @see com.comphenix.protocol.events.PacketAdapter#onPacketReceiving(com.comphenix.protocol.events.PacketEvent) - */ - @Override - public void onPacketReceiving(final PacketEvent event) { - - if (event.getPlayer() != null) - consumer.accept(event); - } - }); - } - - // ------------------------------------------------------------------------------------------------------------ - // Sending - // ------------------------------------------------------------------------------------------------------------ - - /** - * A convenience method for listening to Server>Client packets of the given type. - * - * @param type - * @param consumer - */ - public static void addSendingListener(final PacketType type, final Consumer<PacketEvent> consumer) { - addSendingListener(ListenerPriority.NORMAL, type, consumer); - } - - /** - * A convenience method for listening to Server>Client packets of the given type and priority. - * - * @param priority - * @param type - * @param consumer - */ - public static void addSendingListener(final ListenerPriority priority, final PacketType type, final Consumer<PacketEvent> consumer) { - addPacketListener(new SimpleAdapter(priority, type) { - - /** - * @see com.comphenix.protocol.events.PacketAdapter#onPacketReceiving(com.comphenix.protocol.events.PacketEvent) - */ - @Override - public void onPacketSending(final PacketEvent event) { - - if (event.getPlayer() != null) - consumer.accept(event); - } - }); - } - - /** - * Sets the hoverable text in the server's menu - * To use this, create a new addSendingListener for PacketType.Status.Server.SERVER_INFO - * and get the {@link WrappedServerPing} from event.getPacket().getServerPings().read(0) - * then finallly call WrappedServerPing#setPlayers method - * - * @param hoverTexts - */ - public static List<WrappedGameProfile> compileHoverText(final String... hoverTexts) { - final List<WrappedGameProfile> profiles = new ArrayList<>(); - - int count = 0; - for (final String hoverText : hoverTexts) - profiles.add(new WrappedGameProfile(String.valueOf(count++), Common.colorize(hoverText))); - - return profiles; - } - - // ------------------------------------------------------------------------------------------------------------ - // Classes - // ------------------------------------------------------------------------------------------------------------ - - /** - * A convenience adapter for handling chat packets doing most of the heavy work for you. - */ - public static abstract class SimpleChatAdapter extends SimpleAdapter { - - /** - * Players being processed RIGHT NOW inside the method. Prevents dead loop. - */ - private final Set<String> processedPlayers = new HashSet<>(); - - /** - * The event field for convenient calling in the overridable methods - */ - @Getter - private PacketEvent event; - - /** - * The player field you can use below - */ - @Getter - private Player player; - - /** - * The currently filtered json message - */ - private String jsonMessage; - - /** - * Support md_5 BaseComponent API - */ - private boolean isBaseComponent = false; - - /** - * Support Adventure PaperSpigot library - */ - private boolean adventure = false; - - /** - * @param params - */ - public SimpleChatAdapter() { - super(ListenerPriority.HIGHEST, PacketType.Play.Server.CHAT); - } - - @Override - public void onPacketSending(final PacketEvent event) { - if (event.getPlayer() == null) - return; - - this.event = event; - this.player = event.getPlayer(); - - final String playerName = event.getPlayer().getName(); - - // Ignore temporary players - try { - this.player.getUniqueId(); - - } catch (final UnsupportedOperationException ex) { - return; - } - - // Ignore dummy instances and rare reload case - if (!this.player.isOnline() || SimplePlugin.isReloading()) - return; - - // Prevent deadlock - if (this.processedPlayers.contains(playerName)) - return; - - // Lock processing to one instance only to prevent another packet filtering - // in a filtering - try { - this.processedPlayers.add(playerName); - - final String legacyText = this.compileChatMessage(event); - String parsedText = legacyText; - - try { - Debugger.debug("packet", "Chat packet parsed message: '" + Common.stripColors(parsedText) + "'"); - - parsedText = this.onMessage(parsedText); - - } catch (final RegexTimeoutException ex) { - // Such errors mean the parsed message took too long to process. - // Only show such errors every 30 minutes to prevent console spam - Common.logTimed(1800, "&cWarning: &fPacket message '" + Common.limit(jsonMessage, 500) - + "' (possibly longer) took too long time to edit received message and was ignored." - + " This message only shows once per 30 minutes when that happens. For most cases, this can be ignored."); - - return; - - } catch (final EventHandledException ex) { - event.setCancelled(true); - - return; - } - - if (this.jsonMessage != null && !this.jsonMessage.isEmpty()) - this.onJsonMessage(jsonMessage); - - if (!Common.stripColors(legacyText).equals(Common.stripColors(parsedText))) - this.writeEditedMessage(parsedText, event); - - } finally { - this.processedPlayers.remove(this.player.getName()); - } - } - - /* - * Read the chat message in unpacked format from the event - */ - private String compileChatMessage(PacketEvent event) { - - // Reset - jsonMessage = null; - - // No components for this MC version - if (MinecraftVersion.atLeast(V.v1_7)) { - - final StructureModifier<Object> packet = event.getPacket().getModifier(); - final StructureModifier<WrappedChatComponent> chat = event.getPacket().getChatComponents(); - final WrappedChatComponent component = chat.read(0); - - try { - final ChatType chatType = event.getPacket().getChatTypes().readSafely(0); - - if (chatType == ChatType.GAME_INFO) - return ""; - - } catch (final NoSuchMethodError t) { - // Silence on legacy MC - } - - if (component != null) - jsonMessage = component.getJson(); - - // Md_5 way of dealing with packets - else if (packet.size() > 1) { - Object secondField = packet.readSafely(1); - - // Support "Adventure" library in PaperSpigot - if (secondField == null) { - secondField = packet.readSafely(2); - - if (secondField != null) - adventure = true; - } - - if (secondField instanceof BaseComponent[]) { - jsonMessage = Remain.toJson((BaseComponent[]) secondField); - - isBaseComponent = true; - } - } - } - - else - jsonMessage = event.getPacket().getStrings().read(0); - - if (jsonMessage != null && !jsonMessage.isEmpty()) { - - // Only check valid messages, skipping those over 50k since it would cause rules - // to take too long and overflow. 99% packets are below this size, it may even be - // that such oversized packets are maliciously sent so we protect the server from freeze - if (jsonMessage.length() < 50_000) { - final String legacyText; - - // Catch errors from other plugins and silence them - try { - legacyText = Remain.toLegacyText(jsonMessage, false); - - } catch (final Throwable t) { - return ""; - } - - return legacyText; - } - } - - return ""; - } - - /* - * Writes the edited message as JSON format from the event - */ - private void writeEditedMessage(String message, PacketEvent event) { - final StructureModifier<Object> packet = event.getPacket().getModifier(); - - jsonMessage = Remain.toJson(message); - - if (isBaseComponent) - packet.writeSafely(adventure ? 2 : 1, Remain.toComponent(jsonMessage)); - - else { - if (MinecraftVersion.atLeast(V.v1_7)) - event.getPacket().getChatComponents().writeSafely(0, WrappedChatComponent.fromJson(jsonMessage)); - - else - event.getPacket().getStrings().writeSafely(0, SerializedMap.of("text", jsonMessage.substring(1, jsonMessage.length() - 1)).toJson()); - } - } - - /** - * Called automatically when we receive and decipher a chat message packet. - * <p> - * You can use {@link #getEvent()} and {@link #getPlayer()} here. - * The preferred way of cancelling the packet is throwing an {@link EventHandledException} - * <p> - * If you edit the message we automatically set it. - * - * @param message - * @return - */ - protected abstract String onMessage(String message); - - /** - * Called automatically when we receive the chat message and decipher it into plain json. - * You can use {@link #getEvent()} and {@link #getPlayer()} here. - * <p> - * If you edit the jsonMessage we do NOT set it back. - * - * @param jsonMessage - */ - protected void onJsonMessage(final String jsonMessage) { - } - } - - /** - * A convenience class so that you don't have to specify which plugin is the owner of the packet adapter - */ - public static class SimpleAdapter extends PacketAdapter { - - /** - * The packet we're listening for - */ - @Getter - private final PacketType type; - - /** - * Create a new packet adapter for the given packet type - * - * @param type - */ - public SimpleAdapter(final PacketType type) { - this(ListenerPriority.NORMAL, type); - } - - /** - * Create a new packet adapter for the given packet type with the given priority - * - * @param priority - * @param type - */ - public SimpleAdapter(final ListenerPriority priority, final PacketType type) { - super(SimplePlugin.getInstance(), priority, type); - - this.type = type; - } - - /** - * This method is automatically fired when the client sends the {@link #type} to the server. - * - * @param event - */ - @Override - public void onPacketReceiving(final PacketEvent event) { - throw new FoException("Override onPacketReceiving to handle receiving client>server packet type " + this.type); - } - - /** - * This method is automatically fired when the server wants to send the {@link #type} to the client. - * - * @param event - */ - @Override - public void onPacketSending(final PacketEvent event) { - throw new FoException("Override onPacketReceiving to handle sending server>client packet type " + this.type); - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/PlayerUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/PlayerUtil.java deleted file mode 100644 index 5990b3ba5961cb3c453a54c7f7cd9017bc541cbc..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/PlayerUtil.java +++ /dev/null @@ -1,868 +0,0 @@ -package org.mineacademy.fo; - -import java.io.File; -import java.io.FileReader; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.TreeMap; -import java.util.UUID; -import java.util.concurrent.ConcurrentHashMap; -import java.util.function.Consumer; - -import org.apache.commons.lang.ArrayUtils; -import org.bukkit.Bukkit; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.OfflinePlayer; -import org.bukkit.Statistic; -import org.bukkit.Statistic.Type; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; -import org.bukkit.metadata.MetadataValue; -import org.bukkit.permissions.Permissible; -import org.bukkit.plugin.Plugin; -import org.bukkit.potion.PotionEffect; -import org.bukkit.scheduler.BukkitTask; -import org.bukkit.util.Vector; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.jsonsimple.JSONObject; -import org.mineacademy.fo.jsonsimple.JSONParser; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.model.HookManager; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompAttribute; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.CompProperty; -import org.mineacademy.fo.remain.Remain; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; - -/** - * Utility class for managing players. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class PlayerUtil { - - /** - * Spigot 1.9, for whatever reason, decided to merge the armor and main player inventories without providing a way - * to access the main inventory. There's lots of ugly code in here to work around that. - */ - public static final int USABLE_PLAYER_INV_SIZE = 36; - - /** - * Stores a list of currently pending title animation tasks to restore the tile to its original one - */ - private static final Map<UUID, BukkitTask> titleRestoreTasks = new ConcurrentHashMap<>(); - - // ------------------------------------------------------------------------------------------------------------ - // Misc - // ------------------------------------------------------------------------------------------------------------ - - /** - * Kicks the player on the main thread with a colorized message - * - * @param player - * @param message - */ - public static void kick(final Player player, final String... message) { - Common.runLater(() -> player.kickPlayer(Common.colorize(message))); - } - - /** - * Return the player's connection delay, ping, in milliseconds - * - * @param player - * @return - */ - public static int getPing(final Player player) { - final Object entityPlayer = Remain.getHandleEntity(player); - - return (int) ReflectionUtil.getFieldContent(entityPlayer, "ping"); - } - - /** - * Return statistics of ALL offline players ever played - * - * @param statistic - * @return - */ - public static TreeMap<Long, OfflinePlayer> getStatistics(final Statistic statistic) { - return getStatistics(statistic, null, null); - } - - /** - * Return statistics of ALL offline players ever played - * - * @param statistic - * @param material - * @return - */ - public static TreeMap<Long, OfflinePlayer> getStatistics(final Statistic statistic, final Material material) { - return getStatistics(statistic, material, null); - } - - /** - * Return statistics of ALL offline players ever played - * - * @param statistic - * @param entityType - * @return - */ - public static TreeMap<Long, OfflinePlayer> getStatistics(final Statistic statistic, final EntityType entityType) { - return getStatistics(statistic, null, entityType); - } - - /** - * Return statistics of ALL offline players ever played - * - * @param statistic - * @param material - * @param entityType - * @return - */ - public static TreeMap<Long, OfflinePlayer> getStatistics(final Statistic statistic, final Material material, final EntityType entityType) { - final TreeMap<Long, OfflinePlayer> statistics = new TreeMap<>(Collections.reverseOrder()); - - for (final OfflinePlayer offline : Bukkit.getOfflinePlayers()) { - final long time = getStatistic(offline, statistic, material, entityType); - - statistics.put(time, offline); - } - - return statistics; - } - - /** - * Return a statistic of an online player - * - * @param player - * @param statistic - * @return - */ - public static long getStatistic(final OfflinePlayer player, final Statistic statistic) { - return getStatistic(player, statistic, null, null); - } - - /** - * Return a statistic of an online player - * - * @param player - * @param statistic - * @param material - * @return - */ - public static long getStatistic(final OfflinePlayer player, final Statistic statistic, final Material material) { - return getStatistic(player, statistic, material, null); - } - - /** - * Return a statistic of an online player - * - * @param player - * @param statistic - * @param entityType - * @return - */ - public static long getStatistic(final OfflinePlayer player, final Statistic statistic, final EntityType entityType) { - return getStatistic(player, statistic, null, entityType); - } - - /** - * Return a statistic of an online player - * - * @param player - * @param statistic - * @return - */ - private static long getStatistic(final OfflinePlayer player, final Statistic statistic, final Material material, final EntityType entityType) { - // Return live statistic for up to date data and best performance if possible - if (player.isOnline()) { - final Player online = player.getPlayer(); - - if (statistic.getType() == Type.UNTYPED) - return online.getStatistic(statistic); - - else if (statistic.getType() == Type.ENTITY) - return online.getStatistic(statistic, entityType); - - return online.getStatistic(statistic, material); - } - - // Otherwise read his stats file - return getStatisticFile(player, statistic, material, entityType); - } - - // Read json file for the statistic - private static long getStatisticFile(final OfflinePlayer player, final Statistic statistic, final Material material, final EntityType entityType) { - final File worldFolder = new File(Bukkit.getServer().getWorlds().get(0).getWorldFolder(), "stats"); - final File statFile = new File(worldFolder, player.getUniqueId().toString() + ".json"); - - if (statFile.exists()) - try { - final JSONObject json = (JSONObject) JSONParser.getInstance().parse(new FileReader(statFile)); - final String name = Remain.getNMSStatisticName(statistic, material, entityType); - - JSONObject section = json.getObject("stats"); - long result = 0; - - for (String part : name.split("\\:")) { - part = part.replace(".", ":"); - - if (section != null) { - final JSONObject nextSection = section.getObject(part); - - if (nextSection == null) { - result = Long.parseLong(section.containsKey(part) ? section.get(part).toString() : "0"); - break; - } - - section = nextSection; - } - } - - return result; - - } catch (final Throwable t) { - throw new FoException(t); - } - - return 0; - } - - // ------------------------------------------------------------------------------------------------------------ - // Permissions - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return if the given sender has a certain permission - * - * @param sender - * @param permission - * @return - */ - public static boolean hasPerm(final Permissible sender, String permission) { - Valid.checkNotNull(sender, "cannot call hasPerm for null sender!"); - - if (permission == null) { - Common.log("THIS IS NOT AN ACTUAL ERROR, YOUR PLUGIN WILL WORK FINE"); - Common.log("Internal check got null permission as input, this is no longer allowed."); - Common.log("We'll return true to prevent errors. Contact developers of " + SimplePlugin.getNamed()); - Common.log("to get it solved and include the fake error below:"); - - new Throwable().printStackTrace(); - - return true; - } - - Valid.checkBoolean(!permission.contains("{plugin_name}") && !permission.contains("{plugin_name_lower}"), - "Found {plugin_name} variable calling hasPerm(" + sender + ", " + permission + ")." + "This is now disallowed, contact plugin authors to put " + SimplePlugin.getNamed().toLowerCase() + " in their permission."); - - return sender.hasPermission(permission); - } - - // ------------------------------------------------------------------------------------------------------------ - // Inventory - // ------------------------------------------------------------------------------------------------------------ - - /** - * Sets pretty much every flag the player can have such as - * flying etc, back to normal - * <p> - * Also sets gamemode to survival - * <p> - * Typical usage: Minigame plugins - call this before joining the player to an arena - * <p> - * Even disables Essentials god mode and removes vanish (most vanish plugins are supported). - * - * @param player - * @param cleanInventory - */ - public static void normalize(final Player player, final boolean cleanInventory) { - normalize(player, cleanInventory, true); - } - - /** - * Sets pretty much every flag the player can have such as - * flying etc, back to normal - * <p> - * Also sets gamemode to survival - * <p> - * Typical usage: Minigame plugins - call this before joining the player to an arena - * <p> - * Even disables Essentials god mode. - * - * @param player - * @param cleanInventory - * @param removeVanish should we remove vanish from players? most vanish plugins are supported - */ - public static void normalize(final Player player, final boolean cleanInventory, final boolean removeVanish) { - synchronized (titleRestoreTasks) { - HookManager.setGodMode(player, false); - - player.setGameMode(GameMode.SURVIVAL); - - if (cleanInventory) { - cleanInventoryAndFood(player); - - player.resetMaxHealth(); - - try { - player.setHealth(20); - - } catch (final Throwable t) { - // Try attribute way - - try { - final double maxHealthAttr = CompAttribute.GENERIC_MAX_HEALTH.get(player); - - player.setHealth(maxHealthAttr); - - } catch (final Throwable tt) { - // silence if a third party plugin is controlling health - } - } - - player.setHealthScaled(false); - - for (final PotionEffect potion : player.getActivePotionEffects()) - player.removePotionEffect(potion.getType()); - } - - player.setTotalExperience(0); - player.setLevel(0); - player.setExp(0F); - - player.resetPlayerTime(); - player.resetPlayerWeather(); - - player.setFallDistance(0); - - CompProperty.INVULNERABLE.apply(player, false); - - try { - player.setGlowing(false); - player.setSilent(false); - } catch (final NoSuchMethodError err) { - } - - player.setAllowFlight(false); - player.setFlying(false); - - player.setFlySpeed(0.2F); - player.setWalkSpeed(0.2F); - - player.setCanPickupItems(true); - - player.setVelocity(new Vector(0, 0, 0)); - player.eject(); - - if (player.isInsideVehicle()) - player.getVehicle().remove(); - - try { - for (final Entity passenger : player.getPassengers()) - player.removePassenger(passenger); - } catch (final NoSuchMethodError err) { - /* old MC */ - } - - if (removeVanish) - try { - if (player.hasMetadata("vanished")) { - final Plugin plugin = player.getMetadata("vanished").get(0).getOwningPlugin(); - - player.removeMetadata("vanished", plugin); - } - - for (final Player other : Remain.getOnlinePlayers()) - if (!other.getName().equals(player.getName()) && !other.canSee(player)) - other.showPlayer(player); - - } catch (final NoSuchMethodError err) { - /* old MC */ - - } catch (final Exception ex) { - ex.printStackTrace(); - } - } - } - - /* - * Cleans players inventory and restores food levels - */ - private static void cleanInventoryAndFood(final Player player) { - player.getInventory().setArmorContents(null); - player.getInventory().setContents(new ItemStack[player.getInventory().getContents().length]); - try { - player.getInventory().setExtraContents(new ItemStack[player.getInventory().getExtraContents().length]); - } catch (final NoSuchMethodError err) { - /* old MC */ - } - - player.setFireTicks(0); - player.setFoodLevel(20); - player.setExhaustion(0); - player.setSaturation(10); - - player.setVelocity(new Vector(0, 0, 0)); - } - - /** - * Returns true if the player has empty both normal and armor inventory - * - * @param player - * @return - */ - public static boolean hasEmptyInventory(final Player player) { - final ItemStack[] inv = player.getInventory().getContents(); - final ItemStack[] armor = player.getInventory().getArmorContents(); - - final ItemStack[] everything = (ItemStack[]) ArrayUtils.addAll(inv, armor); - - for (final ItemStack i : everything) - if (i != null && i.getType() != Material.AIR) - return false; - - return true; - } - - // ------------------------------------------------------------------------------------------------------------ - // Vanish - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return if the player is vanished, see {@link #isVanished(Player)} or if the other player can see him - * - * @param player - * @param otherPlayer - * @return - */ - public static boolean isVanished(final Player player, final Player otherPlayer) { - if (otherPlayer != null && !otherPlayer.canSee(player)) - return true; - - return isVanished(player); - } - - /** - * Return true if the player is vanished. We check for Essentials and CMI vanish and also "vanished" - * metadata value which is supported by most plugins - * - * @param player - * @return - */ - public static boolean isVanished(final Player player) { - if (HookManager.isVanished(player)) - return true; - - if (player.hasMetadata("vanished")) - for (final MetadataValue meta : player.getMetadata("vanished")) - if (meta.asBoolean()) - return true; - - return false; - } - - // ------------------------------------------------------------------------------------------------------------ - // Nicks - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return the player that matches the given nick name and is not vanished - * - * @param name - * @return - */ - public static Player getPlayerByNickNoVanish(final String name) { - return getPlayerByNick(name, false); - } - - /** - * Return the player for the given name or nickname - * - * @param name - * @param ignoreVanished - * @return - */ - public static Player getPlayerByNick(final String name, final boolean ignoreVanished) { - final Player found = lookupNickedPlayer0(name); - - if (ignoreVanished && found != null && PlayerUtil.isVanished(found)) - return null; - - return found; - } - - private static Player lookupNickedPlayer0(final String name) { - Player found = null; - int delta = Integer.MAX_VALUE; - - for (final Player player : Remain.getOnlinePlayers()) { - - if (player.getName().equalsIgnoreCase(name)) - return player; - - final String nick = HookManager.getNickColorless(player); - - if (nick.toLowerCase().startsWith(name.toLowerCase())) { - final int curDelta = Math.abs(nick.length() - name.length()); - - if (curDelta < delta) { - found = player; - delta = curDelta; - } - - if (curDelta == 0) - break; - } - } - - return found; - } - - /** - * Performs an async player lookup then runs the action in a sync runnable - * - * @param name - * @param syncCallback - */ - public static void lookupOfflinePlayerAsync(String name, Consumer<OfflinePlayer> syncCallback) { - Common.runAsync(() -> { - // If the given name is a nick, try to get the real name - final String parsedName = HookManager.getNameFromNick(name); - final OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(parsedName); - - Common.runLater(() -> syncCallback.accept(offlinePlayer)); - }); - } - - // ---------------------------------------------------------------------------------------------------- - // Animation - // ---------------------------------------------------------------------------------------------------- - - /** - * Sends an animated title to player. Colors are replaced. - * - * @param menu the menu - * @param player the player - * @param temporaryTitle the animated title - * @param oldTitle the old title to revert to - * @param duration the duration in ticks - */ - public static void updateInventoryTitle(final Menu menu, final Player player, final String temporaryTitle, final String oldTitle, final int duration) { - Valid.checkNotNull(menu, "Menu == null"); - Valid.checkNotNull(player, "Player == null"); - Valid.checkNotNull(temporaryTitle, "Title == null"); - Valid.checkNotNull(oldTitle, "Old Title == null"); - - // Send the packet - updateInventoryTitle(player, MinecraftVersion.atLeast(V.v1_13) ? temporaryTitle.replace("%", "%%") : temporaryTitle); - - // Prevent flashing titles - BukkitTask pending = titleRestoreTasks.get(player.getUniqueId()); - - if (pending != null) - pending.cancel(); - - pending = Common.runLater(duration, () -> { - final Menu futureMenu = Menu.getMenu(player); - - if (futureMenu != null && futureMenu.getClass().getName().equals(menu.getClass().getName())) - updateInventoryTitle(player, oldTitle); - }); - - final UUID uid = player.getUniqueId(); - - titleRestoreTasks.put(uid, pending); - - // Prevent overloading the map so remove the key afterwards - Common.runLater(duration + 1, () -> { - if (titleRestoreTasks.containsKey(uid)) - titleRestoreTasks.remove(uid); - }); - } - - /** - * Update the player's inventory title without closing the window - * - * @param player the player - * @param title the new title - */ - public static void updateInventoryTitle(final Player player, final String title) { - Remain.updateInventoryTitle(player, title); - } - - // ---------------------------------------------------------------------------------------------------- - // Inventory manipulation - // ---------------------------------------------------------------------------------------------------- - - /** - * Attempts to retrieve the first item that is similar (See {@link ItemUtil#isSimilar(ItemStack, ItemStack)}) - * to the given item. - * - * @param player - * @param item the found item or null if none - * @return - */ - public static ItemStack getFirstItem(final Player player, final ItemStack item) { - for (final ItemStack otherItem : player.getInventory().getContents()) - if (otherItem != null && ItemUtil.isSimilar(otherItem, item)) - return otherItem; - - return null; - } - - /** - * Take the given material in the given size, return true if the player - * had enough to be taken from him (otherwise no action is done) - * - * @param player - * @param material - * @param amount - * @return - */ - public static boolean take(Player player, CompMaterial material, int amount) { - if (!containsAtLeast(player, amount, material)) - return false; - - for (int i = 0; i < amount; i++) - takeFirstOnePiece(player, material); - - return true; - } - - /** - * Scans the inventory and removes one piece of the first found item - * matching the given material - * - * @param player - * @param material - */ - public static boolean takeFirstOnePiece(final Player player, final CompMaterial material) { - for (final ItemStack item : player.getInventory().getContents()) - if (item != null && CompMaterial.fromLegacy(item.getType().toString(), item.getData().getData()) == material) { - takeOnePiece(player, item); - - return true; - } - - return false; - } - - /** - * Removes one piece of the given item stack, setting the slot to air - * if the item is only 1 amount - * <p> - * THIS SETS THE AMOUNT OF THE GIVEN ITEMSTACK TO -1 OF ITS CURRENT AMOUNT - * AND DOES NOT AUTOMATICALLY REMOVE ITEMS - * - * @param player - * @param item - */ - public static void takeOnePiece(final Player player, final ItemStack item) { - Remain.takeItemOnePiece(player, item); - } - - /** - * Return if the player has enough of the given material - * - * @param player - * @param atLeastSize - * @param material - * @return - */ - public static boolean containsAtLeast(Player player, int atLeastSize, CompMaterial material) { - int foundSize = 0; - - for (final ItemStack item : player.getInventory().getContents()) - if (item != null && item.getType() == material.getMaterial()) - foundSize += item.getAmount(); - - return foundSize >= atLeastSize; - } - - /** - * Attempts to search and replace the first similar itemstack with the new one - * - * @param inv - * @param search - * @param replaceWith - * @return true if the replace was successful - */ - public static boolean updateInvSlot(final Inventory inv, final ItemStack search, final ItemStack replaceWith) { - Valid.checkNotNull(inv, "Inv = null"); - - for (int i = 0; i < inv.getSize(); i++) { - final ItemStack slot = inv.getItem(i); - - if (slot != null && ItemUtil.isSimilar(slot, search)) { - inv.setItem(i, replaceWith); - - return true; - } - } - - return false; - } - - /** - * Attempts to add items into the inventory, - * returning what it couldn't store - * - * @param inventory - * @param items - * @return - */ - public static Map<Integer, ItemStack> addItems(final Inventory inventory, final ItemStack... items) { - return addItems(inventory, 0, items); - } - - /** - * Attempts to add items into the inventory, - * returning what it couldn't store - * <p> - * Set oversizedStack to below normal stack size to disable oversized stacks - * - * @param inventory - * @param oversizedStacks - * @param items - * @return - */ - private static Map<Integer, ItemStack> addItems(final Inventory inventory, final int oversizedStacks, final ItemStack... items) { - if (isCombinedInv(inventory)) { - final Inventory fakeInventory = makeTruncatedInv((PlayerInventory) inventory); - final Map<Integer, ItemStack> overflow = addItems(fakeInventory, oversizedStacks, items); - for (int i = 0; i < fakeInventory.getContents().length; i++) - inventory.setItem(i, fakeInventory.getContents()[i]); - return overflow; - } - - final Map<Integer, ItemStack> left = new HashMap<>(); - - // combine items - final ItemStack[] combined = new ItemStack[items.length]; - for (final ItemStack item : items) { - if (item == null || item.getAmount() < 1) - continue; - for (int j = 0; j < combined.length; j++) { - if (combined[j] == null) { - combined[j] = item.clone(); - break; - } - if (combined[j].isSimilar(item)) { - combined[j].setAmount(combined[j].getAmount() + item.getAmount()); - break; - } - } - } - - for (int i = 0; i < combined.length; i++) { - final ItemStack item = combined[i]; - if (item == null || item.getType() == Material.AIR) - continue; - - while (true) { - // Do we already have a stack of it? - final int maxAmount = oversizedStacks > item.getType().getMaxStackSize() ? oversizedStacks : item.getType().getMaxStackSize(); - final int firstPartial = firstPartial(inventory, item, maxAmount); - - // Drat! no partial stack - if (firstPartial == -1) { - // Find a free spot! - final int firstFree = inventory.firstEmpty(); - - if (firstFree == -1) { - // No space at all! - left.put(i, item); - break; - } - - // More than a single stack! - if (item.getAmount() > maxAmount) { - final ItemStack stack = item.clone(); - stack.setAmount(maxAmount); - inventory.setItem(firstFree, stack); - item.setAmount(item.getAmount() - maxAmount); - } else { - // Just store it - inventory.setItem(firstFree, item); - break; - } - - } else { - // So, apparently it might only partially fit, well lets do just that - final ItemStack partialItem = inventory.getItem(firstPartial); - - final int amount = item.getAmount(); - final int partialAmount = partialItem.getAmount(); - - // Check if it fully fits - if (amount + partialAmount <= maxAmount) { - partialItem.setAmount(amount + partialAmount); - break; - } - - // It fits partially - partialItem.setAmount(maxAmount); - item.setAmount(amount + partialAmount - maxAmount); - } - } - } - return left; - } - - // ---------------------------------------------------------------------------------------------------- - // Utility - // ---------------------------------------------------------------------------------------------------- - - /** - * Return the first similar itemstack - * - * @param inventory - * @param item - * @param maxAmount - * @return - */ - private static int firstPartial(final Inventory inventory, final ItemStack item, final int maxAmount) { - if (item == null) - return -1; - final ItemStack[] stacks = inventory.getContents(); - for (int i = 0; i < stacks.length; i++) { - final ItemStack cItem = stacks[i]; - if (cItem != null && cItem.getAmount() < maxAmount && cItem.isSimilar(item)) - return i; - } - return -1; - } - - /** - * Creates a new inventory of {@link #USABLE_PLAYER_INV_SIZE} size - * - * @param playerInventory - * @return - */ - private static Inventory makeTruncatedInv(final PlayerInventory playerInventory) { - final Inventory fake = Bukkit.createInventory(null, USABLE_PLAYER_INV_SIZE); - fake.setContents(Arrays.copyOf(playerInventory.getContents(), fake.getSize())); - - return fake; - } - - /** - * Return true if the inventory is combined player inventory - * - * @param inventory - * @return - */ - private static boolean isCombinedInv(final Inventory inventory) { - return inventory instanceof PlayerInventory && inventory.getContents().length > USABLE_PLAYER_INV_SIZE; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/RandomUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/RandomUtil.java deleted file mode 100644 index 8da33ab599eb29da99045ea1c2e77abfa4009986..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/RandomUtil.java +++ /dev/null @@ -1,265 +0,0 @@ -package org.mineacademy.fo; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Random; -import java.util.function.Predicate; - -import org.bukkit.ChatColor; -import org.bukkit.Chunk; -import org.bukkit.DyeColor; -import org.bukkit.Location; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; - -/** - * Utility class for generating random numbers. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class RandomUtil { - - /** - * The random instance for this class - */ - private static final Random random = new Random(); - - /** - * Symbols for chat colors using the & character including decorations like bold italics etc - */ - private static final char[] COLORS_AND_DECORATION = new char[] { - '0', '1', '2', '3', '4', - '5', '6', '7', '8', '9', - 'a', 'b', 'c', 'd', 'e', - 'f', 'k', 'l', 'n', 'o' - }; - - /** - * Only valid chat colors without decorations - */ - private static final char[] CHAT_COLORS = new char[] { - '0', '1', '2', '3', '4', - '5', '6', '7', '8', '9', - 'a', 'b', 'c', 'd', 'e', - 'f' - }; - - /** - * English alphabet letters - */ - private static final char[] LETTERS = new char[] { - 'a', 'b', 'c', 'd', 'e', - 'f', 'g', 'h', 'i', 'j', - 'k', 'l', 'm', 'n', 'o', - 'p', 'q', 'r', 's', 't', - 'u', 'v', 'w', 'y', 'z', - 'ó' // ó mighty MineAcademy - }; - - /** - * Return the random instance - * - * @return - */ - public static Random getRandom() { - return random; - } - - /** - * Return true if the given percent was matched - * - * @param percent the percent, from 0 to 100 - * @return - */ - public static boolean chance(final long percent) { - return chance((int) percent); - } - - /** - * Return true if the given percent was matched - * - * @param percent the percent, from 0 to 100 - * @return - */ - public static boolean chance(final int percent) { - return random.nextDouble() * 100D < percent; - } - - /** - * Return true if the given percent was matched - * - * @param percent the percent, from 0.00 to 1.00 - * @return - */ - public static boolean chanceD(final double percent) { - return random.nextDouble() < percent; - } - - /** - * Returns a random dye color - * - * @return - */ - public static DyeColor nextDyeColor() { - return DyeColor.values()[random.nextInt(DyeColor.values().length)]; - } - - /** - * Returns a random chat color in this format: & + the color character - * Example: &e for yellow - * <p> - * Will also return decorations - * - * @return - */ - public static String nextColorOrDecoration() { - return "&" + COLORS_AND_DECORATION[nextInt(COLORS_AND_DECORATION.length)]; - } - - /** - * Generates random text, like lorem ipsum but completely - * different. - * - * @param length - * @return - */ - public static String nextString(int length) { - String text = ""; - - for (int i = 0; i < length; i++) - text += LETTERS[nextInt(LETTERS.length)]; - - return text; - } - - /** - * Return a random chat color - * - * @return - */ - public static ChatColor nextChatColor() { - final char letter = CHAT_COLORS[nextInt(CHAT_COLORS.length)]; - - return ChatColor.getByChar(letter); - } - - /** - * Returns a random integer in bounds - * - * @param min - * @param max - * @return - */ - public static int nextBetween(final int min, final int max) { - Valid.checkBoolean(min <= max, "Min !< max"); - - return min + nextInt(max - min + 1); - } - - /** - * Returns a random integer, see {@link Random#nextInt(int)} - * - * @param boundExclusive - * @return - */ - public static int nextInt(final int boundExclusive) { - Valid.checkBoolean(boundExclusive > 0, "Getting a random number must have the bound above 0, got: " + boundExclusive); - - return random.nextInt(boundExclusive); - } - - /** - * Returns a random true/false by 50% chance - * - * @return - */ - public static boolean nextBoolean() { - return random.nextBoolean(); - } - - /** - * Return a random item in array - * - * @param <T> - * @param items - * @return - */ - public static <T> T nextItem(final T... items) { - return items[nextInt(items.length)]; - } - - /** - * Return a random item in list - * - * @param <T> - * @param items - * @return - */ - public static <T> T nextItem(final Iterable<T> items) { - return nextItem(items, null); - } - - /** - * Return a random item in list only among those that match the given condition - * - * @param <T> - * @param items - * @param condition the condition applying when selecting - * @return - */ - public static <T> T nextItem(final Iterable<T> items, final Predicate<T> condition) { - final List<T> list = items instanceof List ? new ArrayList<>((List<T>) items) : Common.toList(items); - - // Remove values failing the condition - if (condition != null) - for (final Iterator<T> it = list.iterator(); it.hasNext();) { - final T item = it.next(); - - if (!condition.test(item)) - it.remove(); - } - - return list.get(nextInt(list.size())); - } - - /** - * Returns a random location - * - * @param origin - * @param radius - * @param is3D, true for sphere, false for cylinder search - * @return - */ - public static Location nextLocation(final Location origin, final double radius, final boolean is3D) { - final double randomRadius = random.nextDouble() * radius; - final double theta = Math.toRadians(random.nextDouble() * 360); - final double phi = Math.toRadians(random.nextDouble() * 180 - 90); - - final double x = randomRadius * Math.cos(theta) * Math.sin(phi); - final double z = randomRadius * Math.cos(phi); - final Location newLoc = origin.clone().add(x, is3D ? randomRadius * Math.sin(theta) * Math.cos(phi) : 0, z); - - return newLoc; - } - - /** - * Return a random x location within that chunk - * - * @param chunk - * @return - */ - public static int nextChunkX(final Chunk chunk) { - return RandomUtil.nextInt(16) + (chunk.getX() << 4) - 16; - } - - /** - * Return a random z location within that chunk - * - * @param chunk - * @return - */ - public static int nextChunkZ(final Chunk chunk) { - return RandomUtil.nextInt(16) + (chunk.getZ() << 4) - 16; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/ReflectionUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/ReflectionUtil.java deleted file mode 100644 index 21daa4b3fb40a7920a4ec872e76276697af566e4..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/ReflectionUtil.java +++ /dev/null @@ -1,1139 +0,0 @@ -package org.mineacademy.fo; - -import java.io.File; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Comparator; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.TreeSet; -import java.util.concurrent.ConcurrentHashMap; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -import org.apache.commons.lang.ClassUtils; -import org.apache.commons.lang.StringUtils; -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.java.JavaPlugin; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompMaterial; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.NonNull; -import lombok.SneakyThrows; - -/** - * Utility class for various reflection methods - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class ReflectionUtil { - - /** - * The full package name for NMS - */ - public static final String NMS = "net.minecraft.server"; - - /** - * The package name for Craftbukkit - */ - public static final String CRAFTBUKKIT = "org.bukkit.craftbukkit"; - - /** - * Compatible {@link EntityType} classes that fail gracefully so that - * plugin loads even on old MC versions where those types are non existent - * but are present in plugin's default configuration files - */ - private static final Map<String, V> legacyEntityTypes; - - /** - * Reflection utilizes a simple cache for fastest performance - */ - private static final Map<String, Class<?>> classCache = new ConcurrentHashMap<>(); - private static final Map<Class<?>, ReflectionData<?>> reflectionDataCache = new ConcurrentHashMap<>(); - private static final Collection<String> classNameGuard = ConcurrentHashMap.newKeySet(); - - /** - * Find a class automatically for older MC version (such as type EntityPlayer for oldName - * and we automatically find the proper NMS import) or if MC 1.17+ is used then type - * the full class path such as net.minecraft.server.level.EntityPlayer and we use that instead. - * - * @param oldName - * @param fullName1_17 - * @return - */ - public static Class<?> getNMSClass(String oldName, String fullName1_17) { - return MinecraftVersion.atLeast(V.v1_17) ? lookupClass(fullName1_17) : getNMSClass(oldName); - } - - /** - * Find a class in net.minecraft.server package, adding the version - * automatically - * - * @deprecated Minecraft 1.17 has a different path name, - * use {@link #getNMSClass(String, String)} instead - * - * @param name - * @return - */ - @Deprecated - public static Class<?> getNMSClass(final String name) { - String version = MinecraftVersion.getServerVersion(); - - if (!version.isEmpty()) - version += "."; - - return ReflectionUtil.lookupClass(NMS + "." + version + name); - } - - /** - * Find a class in org.bukkit.craftbukkit package, adding the version - * automatically - * - * @param name - * @return - */ - public static Class<?> getOBCClass(final String name) { - String version = MinecraftVersion.getServerVersion(); - - if (!version.isEmpty()) - version += "."; - - return ReflectionUtil.lookupClass(CRAFTBUKKIT + "." + version + name); - } - - /** - * Return a constructor for the given NMS class name (such as EntityZombie) - * - * @param nmsClassPath - * @param params - * @return - */ - public static Constructor<?> getConstructorNMS(@NonNull final String nmsClassPath, final Class<?>... params) { - return getConstructor(getNMSClass(nmsClassPath), params); - } - - /** - * Return a constructor for the given fully qualified class path such as - * org.mineacademy.boss.BossPlugin - * - * @param classPath - * @param params - * @return - */ - public static Constructor<?> getConstructor(@NonNull final String classPath, final Class<?>... params) { - final Class<?> clazz = lookupClass(classPath); - - return getConstructor(clazz, params); - } - - /** - * Return a constructor for the given class - * - */ - public static Constructor<?> getConstructor(@NonNull final Class<?> clazz, final Class<?>... params) { - try { - if (reflectionDataCache.containsKey(clazz)) - return reflectionDataCache.get(clazz).getConstructor(params); - - final Constructor<?> constructor = clazz.getConstructor(params); - constructor.setAccessible(true); - - return constructor; - - } catch (final ReflectiveOperationException ex) { - throw new FoException(ex, "Could not get constructor of " + clazz + " with parameters " + Common.join(params)); - } - } - - /** - * Get the field content - * - * @param instance - * @param field - * @return - */ - public static <T> T getFieldContent(final Object instance, final String field) { - return getFieldContent(instance.getClass(), field, instance); - } - - /** - * Get the field content - * - * @param <T> - * @param clazz - * @param field - * @param instance - * @return - */ - public static <T> T getFieldContent(Class<?> clazz, final String field, final Object instance) { - final String originalClassName = clazz.getSimpleName(); - - do - // note: getDeclaredFields() fails if any of the fields are classes that cannot be loaded - for (final Field f : clazz.getDeclaredFields()) - if (f.getName().equals(field)) - return (T) getFieldContent(f, instance); - - while (!(clazz = clazz.getSuperclass()).isAssignableFrom(Object.class)); - - throw new ReflectionException("No such field " + field + " in " + originalClassName + " or its superclasses"); - } - - /** - * Get the field content - * - * @param field - * @param instance - * @return - */ - public static Object getFieldContent(final Field field, final Object instance) { - try { - field.setAccessible(true); - - return field.get(instance); - - } catch (final ReflectiveOperationException e) { - throw new ReflectionException("Could not get field " + field.getName() + " in instance " + (instance != null ? instance : field).getClass().getSimpleName()); - } - } - - /** - * Get all fields from the class and its super classes - * - * @param clazz - * @return - */ - public static Field[] getAllFields(@NonNull Class<?> clazz) { - final List<Field> list = new ArrayList<>(); - - try { - do - list.addAll(Arrays.asList(clazz.getDeclaredFields())); - - while (!(clazz = clazz.getSuperclass()).isAssignableFrom(Object.class)); - - } catch (final NullPointerException ex) { - // Pass through - such as interfaces or object itself throw this - } - - return list.toArray(new Field[0]); - } - - /** - * Gets the declared field in class by its name - * - */ - public static Field getDeclaredField(final Class<?> clazz, final String fieldName) { - try { - - if (reflectionDataCache.containsKey(clazz)) - return reflectionDataCache.get(clazz).getDeclaredField(fieldName); - - final Field field = clazz.getDeclaredField(fieldName); - field.setAccessible(true); - - return field; - - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return null; - } - - /** - * Set a declared field to the given value - * - * @param instance - * @param fieldName - * @param fieldValue - */ - public static void setDeclaredField(@NonNull final Object instance, final String fieldName, final Object fieldValue) { - final Field field = getDeclaredField(instance.getClass(), fieldName); - - try { - field.set(instance, fieldValue); - - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - } - - /** - * Convenience method for getting a static field content. - * - * @param <T> - * @param clazz - * @param field - * @return - */ - public static <T> T getStaticFieldContent(@NonNull final Class<?> clazz, final String field) { - return getFieldContent(clazz, field, null); - } - - /** - * Set the static field to the given value - * - * @param clazz - * @param fieldName - * @param fieldValue - */ - public static void setStaticField(@NonNull final Class<?> clazz, final String fieldName, final Object fieldValue) { - try { - final Field field = getDeclaredField(clazz, fieldName); - - field.set(null, fieldValue); - - } catch (final Throwable t) { - throw new FoException(t, "Could not set " + fieldName + " in " + clazz + " to " + fieldValue); - } - } - - /** - * Gets a class method - * - * @param clazz - * @param methodName - * @param args - * @return - */ - public static Method getMethod(final Class<?> clazz, final String methodName, final Class<?>... args) { - for (final Method method : clazz.getMethods()) - if (method.getName().equals(methodName) && isClassListEqual(args, method.getParameterTypes())) { - method.setAccessible(true); - - return method; - } - - return null; - } - - // Compares class lists - private static boolean isClassListEqual(final Class<?>[] first, final Class<?>[] second) { - if (first.length != second.length) - return false; - - for (int i = 0; i < first.length; i++) - if (first[i] != second[i]) - return false; - - return true; - } - - /** - * Gets a class method - * - * @param clazz - * @param methodName - * @return - */ - public static Method getMethod(final Class<?> clazz, final String methodName) { - for (final Method method : clazz.getMethods()) - if (method.getName().equals(methodName)) { - method.setAccessible(true); - - return method; - } - - return null; - } - - /** - * Get a declared class method - * - */ - public static Method getDeclaredMethod(Class<?> clazz, final String methodName, Class<?>... args) { - final Class<?> originalClass = clazz; - - while (!clazz.equals(Object.class)) { - - try { - final Method method = clazz.getDeclaredMethod(methodName, args); - method.setAccessible(true); - - return method; - - } catch (final NoSuchMethodException ex) { - clazz = clazz.getSuperclass(); - - } catch (final Throwable t) { - throw new ReflectionException(t, "Error lookup up method " + methodName + " in class " + originalClass + " and her subclasses"); - } - } - - throw new ReflectionException("Unable to find method " + methodName + " with params " + Common.join(args) + " in class " + originalClass + " and her subclasses"); - } - - /** - * Invoke a static method - * - * @param <T> - * @param methodName - * @param params - * @return - */ - public static <T> T invokeStatic(final Class<?> cl, final String methodName, final Object... params) { - return invokeStatic(getMethod(cl, methodName), params); - } - - /** - * Invoke a static method - * - * @param <T> - * @param method - * @param params - * @return - */ - public static <T> T invokeStatic(final Method method, final Object... params) { - try { - return (T) method.invoke(null, params); - - } catch (final ReflectiveOperationException ex) { - throw new ReflectionException(ex, "Could not invoke static method " + method + " with params " + StringUtils.join(params)); - } - } - - /** - * Invoke a non static method - * - * @param <T> - * @param methodName - * @param instance - * @param params - * @return - */ - public static <T> T invoke(final String methodName, final Object instance, final Object... params) { - return invoke(getMethod(instance.getClass(), methodName), instance, params); - } - - /** - * Invoke a non static method - * - * @param <T> - * @param method - * @param instance - * @param params - * @return - */ - public static <T> T invoke(final Method method, final Object instance, final Object... params) { - Valid.checkNotNull(method, "Method cannot be null for " + instance); - - try { - return (T) method.invoke(instance, params); - - } catch (final ReflectiveOperationException ex) { - throw new ReflectionException(ex, "Could not invoke method " + method + " on instance " + instance + " with params " + StringUtils.join(params)); - } - } - - /** - * Makes a new instance of a class - * - * @param clazz - * @return - */ - public static <T> T instantiate(final Class<T> clazz) { - try { - final Constructor<T> constructor; - - if (reflectionDataCache.containsKey(clazz)) - constructor = ((ReflectionData<T>) reflectionDataCache.get(clazz)).getDeclaredConstructor(); - - else - constructor = clazz.getDeclaredConstructor(); - - constructor.setAccessible(true); - - return constructor.newInstance(); - - } catch (final ReflectiveOperationException ex) { - throw new ReflectionException(ex, "Could not make instance of: " + clazz); - } - } - - /** - * Makes a new instanceo of the given NMS class with arguments, - * NB: Does not work on Minecraft 1.17+ - * - * @param nmsPath - * @param params - * @return - */ - public static <T> T instantiateNMS(final String nmsPath, final Object... params) { - return (T) instantiate(getNMSClass(nmsPath), params); - } - - /** - * Makes a new instance of a class with arguments. - * - * @param clazz - * @param params - * @return - */ - public static <T> T instantiate(final Class<T> clazz, final Object... params) { - try { - final List<Class<?>> classes = new ArrayList<>(); - - for (final Object param : params) { - Valid.checkNotNull(param, "Argument cannot be null when instatiating " + clazz); - final Class<?> paramClass = param.getClass(); - - classes.add(paramClass.isPrimitive() ? ClassUtils.wrapperToPrimitive(paramClass) : paramClass); - } - - final Class<?>[] paramArr = classes.toArray(new Class<?>[0]); - final Constructor<T> constructor; - - if (reflectionDataCache.containsKey(clazz)) - constructor = ((ReflectionData<T>) reflectionDataCache.get(clazz)).getDeclaredConstructor(paramArr); - - else { - classCache.put(clazz.getCanonicalName(), clazz); - - constructor = (Constructor<T>) reflectionDataCache.computeIfAbsent(clazz, ReflectionData::new).getDeclaredConstructor(paramArr); - } - - constructor.setAccessible(true); - - return constructor.newInstance(params); - - } catch (final ReflectiveOperationException ex) { - throw new ReflectionException(ex, "Could not make instance of: " + clazz); - } - } - - /** - * Attempts to create a new instance from the given constructor and parameters - * - * @param <T> - * @param constructor - * @param params - * @return - */ - public static <T> T instantiate(final Constructor<T> constructor, final Object... params) { - try { - return constructor.newInstance(params); - - } catch (final ReflectiveOperationException ex) { - throw new FoException(ex, "Could not make new instance of " + constructor + " with params: " + Common.join(params)); - } - } - - /** - * Return true if the given absolute class path is available, - * useful for checking for older MC versions for classes such as org.bukkit.entity.Phantom - * - * @param path - * @return - */ - public static boolean isClassAvailable(final String path) { - try { - if (classCache.containsKey(path)) - return true; - - Class.forName(path); - - return true; - - } catch (final Throwable t) { - return false; - } - } - - /** - * Wrapper for Class.forName - * @param <T> - * - * @return - */ - public static <T> Class<T> lookupClass(final String path) { - if (classCache.containsKey(path)) - return (Class<T>) classCache.get(path); - - if (classNameGuard.contains(path)) { - while (classNameGuard.contains(path)) { - // Wait for other thread - } - - return lookupClass(path); // Re run method to see if the cached value now exists. - } - - try { - classNameGuard.add(path); - - final Class<?> clazz = Class.forName(path); - - classCache.put(path, clazz); - reflectionDataCache.computeIfAbsent(clazz, ReflectionData::new); - - return (Class<T>) clazz; - - } catch (final ClassNotFoundException ex) { - throw new ReflectionException("Could not find class: " + path); - - } finally { - classNameGuard.remove(path); - } - } - - /** - * Attempts to find an enum, throwing formatted error showing all available - * values if not found - * - * The field name is uppercased, spaces are replaced with underscores and even - * plural S is added in attempts to detect the correct enum - * - * If the field is a type that is known not to be exist in current - * MC version, we simply return null instead of {@link MissingEnumException} error - * - * @param <E> - * @param enumType - * @param name - * @return - */ - public static <E extends Enum<E>> E lookupEnumCompat(final Class<E> enumType, final String name) { - try { - if (enumType == CompMaterial.class) - return (E) CompMaterial.fromStringCompat(name); - - return lookupEnum(enumType, name); - - } catch (final MissingEnumException ex) { - if (enumType == EntityType.class) { - final V since = legacyEntityTypes.get(name.toUpperCase().replace(" ", "_")); - - if (since != null && MinecraftVersion.olderThan(since)) - return null; - } - - throw ex; - } - } - - /** - * Attempts to find an enum, throwing formatted error showing all available - * values if not found - * - * The field name is uppercased, spaces are replaced with underscores and even - * plural S is added in attempts to detect the correct enum - * - * @param enumType - * @param name - * @return the enum or error - */ - public static <E extends Enum<E>> E lookupEnum(final Class<E> enumType, final String name) { - return lookupEnum(enumType, name, "The enum '" + enumType.getSimpleName() + "' does not contain '" + name + "' on MC " + MinecraftVersion.getServerVersion() + "! Available values: {available}"); - } - - /** - * Attempts to find an enum, throwing formatted error showing all available - * values if not found Use {available} in errMessage to get all enum values. - * <p> - * The field name is uppercased, spaces are replaced with underscores and even - * plural S is added in attempts to detect the correct enum - * - * @param enumType - * @param name - * @param errMessage - * @return - */ - public static <E extends Enum<E>> E lookupEnum(final Class<E> enumType, String name, final String errMessage) { - Valid.checkNotNull(enumType, "Type missing for " + name); - Valid.checkNotNull(name, "Name missing for " + enumType); - - final String rawName = name.toUpperCase().replace(" ", "_"); - - // Some compatibility workaround for ChatControl, Boss, CoreArena and other plugins - // having these values in their default config. This prevents - // malfunction on plugin's first load, in case it is loaded on an older MC version. - { - if (enumType == org.bukkit.block.Biome.class) { - if (MinecraftVersion.atLeast(V.v1_13)) - if (rawName.equalsIgnoreCase("ICE_MOUNTAINS")) - name = "SNOWY_TAIGA"; - } - - if (enumType == EntityType.class) { - if (MinecraftVersion.atLeast(V.v1_16)) - if (rawName.equals("PIG_ZOMBIE")) - name = "ZOMBIFIED_PIGLIN"; - - if (MinecraftVersion.atLeast(V.v1_14)) - if (rawName.equals("TIPPED_ARROW")) - name = "ARROW"; - - if (MinecraftVersion.olderThan(V.v1_16)) - if (rawName.equals("ZOMBIFIED_PIGLIN")) - name = "PIG_ZOMBIE"; - - if (MinecraftVersion.olderThan(V.v1_9)) - if (rawName.equals("TRIDENT")) - name = "ARROW"; - - else if (rawName.equals("DRAGON_FIREBALL")) - name = "FIREBALL"; - - if (MinecraftVersion.olderThan(V.v1_13)) - if (rawName.equals("DROWNED")) - name = "ZOMBIE"; - - else if (rawName.equals("ZOMBIE_VILLAGER")) - name = "ZOMBIE"; - } - - if (enumType == DamageCause.class) { - if (MinecraftVersion.olderThan(V.v1_13)) - if (rawName.equals("DRYOUT")) - name = "CUSTOM"; - - if (MinecraftVersion.olderThan(V.v1_11)) - if (rawName.equals("ENTITY_SWEEP_ATTACK")) - name = "ENTITY_ATTACK"; - - else if (rawName.equals("CRAMMING")) - name = "CUSTOM"; - - if (MinecraftVersion.olderThan(V.v1_9)) - if (rawName.equals("FLY_INTO_WALL")) - name = "SUFFOCATION"; - - else if (rawName.equals("HOT_FLOOR")) - name = "LAVA"; - - if (rawName.equals("DRAGON_BREATH")) - try { - DamageCause.valueOf("DRAGON_BREATH"); - } catch (final Throwable t) { - name = "ENTITY_ATTACK"; - } - } - } - - final String oldName = name; - - E result = lookupEnumSilent(enumType, name); - - // Try making the enum uppercased - if (result == null) { - name = name.toUpperCase(); - - result = lookupEnumSilent(enumType, name); - } - - // Try replacing spaces with underscores - if (result == null) { - name = name.replace(" ", "_"); - - result = lookupEnumSilent(enumType, name); - } - - // Try crunching all underscores (were spaces) all together - if (result == null) - result = lookupEnumSilent(enumType, name.replace("_", "")); - - // Before giving up, see if we can translate legacy material names - if (result == null && enumType == Material.class) { - final CompMaterial compMaterial = CompMaterial.fromString(name); - - if (compMaterial != null) - return (E) compMaterial.getMaterial(); - } - - if (result == null) - throw new MissingEnumException(oldName, errMessage.replace("{available}", StringUtils.join(enumType.getEnumConstants(), ", "))); - - return result; - } - - /** - * Wrapper for Enum.valueOf without throwing an exception - * - * @param enumType - * @param name - * @return the enum, or null if not exists - */ - public static <E extends Enum<E>> E lookupEnumSilent(final Class<E> enumType, final String name) { - try { - - // Since we obfuscate our plugins, enum names are changed. - // Therefore we look up a special fromKey method in some of our enums - boolean hasKey = false; - Method method = null; - - try { - method = enumType.getDeclaredMethod("fromKey", String.class); - - if (Modifier.isPublic(method.getModifiers()) && Modifier.isStatic(method.getModifiers())) - hasKey = true; - - } catch (final Throwable t) { - } - - // Only invoke fromName from non-Bukkit API since this gives unexpected results - if (method == null && !enumType.getName().contains("org.bukkit")) - try { - method = enumType.getDeclaredMethod("fromName", String.class); - - if (Modifier.isPublic(method.getModifiers()) && Modifier.isStatic(method.getModifiers())) - hasKey = true; - - } catch (final Throwable t) { - } - - if (hasKey) - return (E) method.invoke(null, name); - - // Resort to enum name - return Enum.valueOf(enumType, name); - - } catch (final IllegalArgumentException ex) { - return null; - - } catch (final ReflectiveOperationException ex) { - return null; - } - } - - /** - * Gets the caller stack trace methods if you call this method Useful for - * debugging - * - * @param skipMethods - * @param count - * @return - */ - public static String getCallerMethods(final int skipMethods, final int count) { - final StackTraceElement[] elements = Thread.currentThread().getStackTrace(); - - final StringBuilder methods = new StringBuilder(); - int counted = 0; - - for (int i = 2 + skipMethods; i < elements.length && counted < count; i++) { - final StackTraceElement el = elements[i]; - - if (!el.getMethodName().equals("getCallerMethods") && el.getClassName().indexOf("java.lang.Thread") != 0) { - final String[] clazz = el.getClassName().split("\\."); - - methods.append(clazz[clazz.length == 0 ? 0 : clazz.length - 1]).append("#").append(el.getLineNumber()).append("-").append(el.getMethodName()).append("()").append(i + 1 == elements.length ? "" : "."); - counted++; - } - } - - return methods.toString(); - } - - // ------------------------------------------------------------------------------------------ - // JavaPlugin related methods - // ------------------------------------------------------------------------------------------ - - /** - * Return a tree set of classes from the plugin that extend the given class - * - * @param <T> - * @param <T> - * @param plugin - * @param extendingClass - * @return - */ - public static List<Class<?>> getClasses(final Plugin plugin) { - final List<Class<?>> found = new ArrayList<>(); - - for (final Class<?> clazz : getClasses(plugin, null)) - found.add(clazz); - - return found; - } - - /** - * Get all classes in the java plugin - * - * @param plugin - * @return - */ - @SneakyThrows - public static <T> TreeSet<Class<T>> getClasses(final Plugin plugin, Class<T> extendingClass) { - Valid.checkNotNull(plugin, "Plugin is null!"); - Valid.checkBoolean(JavaPlugin.class.isAssignableFrom(plugin.getClass()), "Plugin must be a JavaPlugin"); - - // Get the plugin .jar - final Method getFileMethod = JavaPlugin.class.getDeclaredMethod("getFile"); - getFileMethod.setAccessible(true); - - final File pluginFile = (File) getFileMethod.invoke(plugin); - - final TreeSet<Class<T>> classes = new TreeSet<>(Comparator.comparing(Class::toString)); - - try (final JarFile jarFile = new JarFile(pluginFile)) { - final Enumeration<JarEntry> entries = jarFile.entries(); - - while (entries.hasMoreElements()) { - String name = entries.nextElement().getName(); - - if (name.endsWith(".class")) { - name = name.replace("/", ".").replaceFirst(".class", ""); - - Class<?> clazz = null; - - try { - clazz = Class.forName(name, false, SimplePlugin.class.getClassLoader()); - - if (extendingClass == null || (extendingClass.isAssignableFrom(clazz) && clazz != extendingClass)) - classes.add((Class<T>) clazz); - - } catch (final Throwable throwable) { - - if (extendingClass != null && (clazz != null && extendingClass.isAssignableFrom(clazz)) && clazz != extendingClass) - Common.log("Unable to load class '" + name + "' due to error: " + throwable); - - continue; - } - } - } - } - - return classes; - } - - static { - final Map<String, V> map = new HashMap<>(); - - map.put("TIPPED_ARROW", V.v1_9); - map.put("SPECTRAL_ARROW", V.v1_9); - map.put("SHULKER_BULLET", V.v1_9); - map.put("DRAGON_FIREBALL", V.v1_9); - map.put("SHULKER", V.v1_9); - map.put("AREA_EFFECT_CLOUD", V.v1_9); - map.put("LINGERING_POTION", V.v1_9); - map.put("POLAR_BEAR", V.v1_10); - map.put("HUSK", V.v1_10); - map.put("ELDER_GUARDIAN", V.v1_11); - map.put("WITHER_SKELETON", V.v1_11); - map.put("STRAY", V.v1_11); - map.put("DONKEY", V.v1_11); - map.put("MULE", V.v1_11); - map.put("EVOKER_FANGS", V.v1_11); - map.put("EVOKER", V.v1_11); - map.put("VEX", V.v1_11); - map.put("VINDICATOR", V.v1_11); - map.put("ILLUSIONER", V.v1_12); - map.put("PARROT", V.v1_12); - map.put("TURTLE", V.v1_13); - map.put("PHANTOM", V.v1_13); - map.put("TRIDENT", V.v1_13); - map.put("COD", V.v1_13); - map.put("SALMON", V.v1_13); - map.put("PUFFERFISH", V.v1_13); - map.put("TROPICAL_FISH", V.v1_13); - map.put("DROWNED", V.v1_13); - map.put("DOLPHIN", V.v1_13); - map.put("CAT", V.v1_14); - map.put("PANDA", V.v1_14); - map.put("PILLAGER", V.v1_14); - map.put("RAVAGER", V.v1_14); - map.put("TRADER_LLAMA", V.v1_14); - map.put("WANDERING_TRADER", V.v1_14); - map.put("FOX", V.v1_14); - map.put("BEE", V.v1_15); - map.put("HOGLIN", V.v1_16); - map.put("PIGLIN", V.v1_16); - map.put("STRIDER", V.v1_16); - map.put("ZOGLIN", V.v1_16); - map.put("PIGLIN_BRUTE", V.v1_16); - map.put("AXOLOTL", V.v1_17); - map.put("GLOW_ITEM_FRAME", V.v1_17); - map.put("GLOW_SQUID", V.v1_17); - map.put("GOAT", V.v1_17); - map.put("MARKER", V.v1_17); - - legacyEntityTypes = map; - } - - /* ------------------------------------------------------------------------------- */ - /* Classes */ - /* ------------------------------------------------------------------------------- */ - - private static final class ReflectionData<T> { - private final Class<T> clazz; - - ReflectionData(final Class<T> clazz) { - this.clazz = clazz; - } - - //private final Map<String, Collection<Method>> methodCache = new ConcurrentHashMap<>(); - private final Map<Integer, Constructor<?>> constructorCache = new ConcurrentHashMap<>(); - private final Map<String, Field> fieldCache = new ConcurrentHashMap<>(); - private final Collection<String> fieldGuard = ConcurrentHashMap.newKeySet(); - private final Collection<Integer> constructorGuard = ConcurrentHashMap.newKeySet(); - - public void cacheConstructor(final Constructor<T> constructor) { - final List<Class<?>> classes = new ArrayList<>(); - - for (final Class<?> param : constructor.getParameterTypes()) { - Valid.checkNotNull(param, "Argument cannot be null when instatiating " + clazz); - - classes.add(param); - } - - constructorCache.put(Arrays.hashCode(classes.toArray(new Class<?>[0])), constructor); - } - - public Constructor<T> getDeclaredConstructor(final Class<?>... paramTypes) throws NoSuchMethodException { - final Integer hashCode = Arrays.hashCode(paramTypes); - - if (constructorCache.containsKey(hashCode)) - return (Constructor<T>) constructorCache.get(hashCode); - - if (constructorGuard.contains(hashCode)) { - while (constructorGuard.contains(hashCode)) { - - } // Wait for other thread; - return getDeclaredConstructor(paramTypes); - } - - constructorGuard.add(hashCode); - - try { - final Constructor<T> constructor = clazz.getDeclaredConstructor(paramTypes); - - cacheConstructor(constructor); - - return constructor; - - } finally { - constructorGuard.remove(hashCode); - } - } - - public Constructor<T> getConstructor(final Class<?>... paramTypes) throws NoSuchMethodException { - final Integer hashCode = Arrays.hashCode(paramTypes); - - if (constructorCache.containsKey(hashCode)) - return (Constructor<T>) constructorCache.get(hashCode); - - if (constructorGuard.contains(hashCode)) { - while (constructorGuard.contains(hashCode)) { - // Wait for other thread; - } - - return getConstructor(paramTypes); - } - - constructorGuard.add(hashCode); - - try { - final Constructor<T> constructor = clazz.getConstructor(paramTypes); - - cacheConstructor(constructor); - - return constructor; - - } finally { - constructorGuard.remove(hashCode); - } - } - - /*public void cacheMethod(final Method method) { - methodCache.computeIfAbsent(method.getName(), unused -> ConcurrentHashMap.newKeySet()).add(method); - }*/ - - /*public Method getDeclaredMethod(final String name, final Class<?>... paramTypes) throws NoSuchMethodException { - if (methodCache.containsKey(name)) { - final Collection<Method> methods = methodCache.get(name); - - for (final Method method : methods) - if (Arrays.equals(paramTypes, method.getParameterTypes())) - return method; - } - - final Method method = clazz.getDeclaredMethod(name, paramTypes); - - cacheMethod(method); - - return method; - }*/ - - public void cacheField(final Field field) { - fieldCache.put(field.getName(), field); - } - - public Field getDeclaredField(final String name) throws NoSuchFieldException { - - if (fieldCache.containsKey(name)) - return fieldCache.get(name); - - if (fieldGuard.contains(name)) { - while (fieldGuard.contains(name)) { - } - - return getDeclaredField(name); - } - - fieldGuard.add(name); - - try { - final Field field = clazz.getDeclaredField(name); - - cacheField(field); - - return field; - - } finally { - fieldGuard.remove(name); - } - } - } - - /** - * Represents an exception during reflection operation - */ - public static final class ReflectionException extends FoException { - private static final long serialVersionUID = 1L; - - public ReflectionException(final String message) { - super(message); - } - - public ReflectionException(final Throwable ex, final String message) { - super(ex, message); - } - } - - /** - * Represents a failure to get the enum from {@link #lookupEnum(Class, String)} - * and {@link #lookupEnum(Class, String, String)} methods - */ - public static final class MissingEnumException extends RuntimeException { - private static final long serialVersionUID = 1L; - - private final String enumName; - - public MissingEnumException(final String enumName, final String msg) { - super(msg); - - this.enumName = enumName; - } - - public MissingEnumException(final String enumName, final String msg, final Exception ex) { - super(msg, ex); - - this.enumName = enumName; - } - - public String getEnumName() { - return enumName; - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/SerializeUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/SerializeUtil.java deleted file mode 100644 index f213ad6f338a004eac94e8a84974491b926455f4..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/SerializeUtil.java +++ /dev/null @@ -1,612 +0,0 @@ -package org.mineacademy.fo; - -import java.awt.Color; -import java.lang.reflect.Array; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.function.Function; -import java.util.regex.Pattern; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.command.CommandSender; -import org.bukkit.configuration.MemorySection; -import org.bukkit.configuration.serialization.ConfigurationSerializable; -import org.bukkit.inventory.ItemStack; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.ReflectionUtil.ReflectionException; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.collection.StrictCollection; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.exception.InvalidWorldException; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.model.ConfigSerializable; -import org.mineacademy.fo.model.IsInList; -import org.mineacademy.fo.model.SimpleSound; -import org.mineacademy.fo.model.SimpleTime; -import org.mineacademy.fo.remain.CompChatColor; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.fo.settings.YamlConfig; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.NonNull; -import net.md_5.bungee.api.chat.BaseComponent; -import net.md_5.bungee.api.chat.ClickEvent; -import net.md_5.bungee.api.chat.HoverEvent; - -/** - * Utility class for serializing objects to writeable YAML data and back. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class SerializeUtil { - - /** - * A list of custom serializers - */ - private static Map<Class<Object>, Function<Object, String>> serializers = new HashMap<>(); - - /** - * Add a custom serializer to the list - * - * @param <T> - * @param fromClass - * @param serializer - */ - public static <T> void addSerializer(Class<T> fromClass, Function<T, String> serializer) { - serializers.put((Class<Object>) fromClass, (Function<Object, String>) serializer); - } - - // ------------------------------------------------------------------------------------------------------------ - // Converting objects into strings so you can save them in your files - // ------------------------------------------------------------------------------------------------------------ - - /** - * Converts the given object into something you can safely save in file as a string - * - * @param obj - * @return - */ - public static Object serialize(final Object obj) { - if (obj == null) - return null; - - if (serializers.containsKey(obj.getClass())) - return serializers.get(obj.getClass()).apply(obj); - - if (obj instanceof ConfigSerializable) - return serialize(((ConfigSerializable) obj).serialize().serialize()); - - else if (obj instanceof StrictCollection) - return serialize(((StrictCollection) obj).serialize()); - - else if (obj instanceof ChatColor) - return ((ChatColor) obj).name(); - - else if (obj instanceof CompChatColor) - return ((CompChatColor) obj).getName(); - - else if (obj instanceof net.md_5.bungee.api.ChatColor) { - final net.md_5.bungee.api.ChatColor color = ((net.md_5.bungee.api.ChatColor) obj); - - return MinecraftVersion.atLeast(V.v1_16) ? color.toString() : color.name(); - } - - else if (obj instanceof CompMaterial) - return obj.toString(); - - else if (obj instanceof Location) - return serializeLoc((Location) obj); - - else if (obj instanceof UUID) - return obj.toString(); - - else if (obj instanceof Enum<?>) - return obj.toString(); - - else if (obj instanceof CommandSender) - return ((CommandSender) obj).getName(); - - else if (obj instanceof World) - return ((World) obj).getName(); - - else if (obj instanceof PotionEffect) - return serializePotionEffect((PotionEffect) obj); - - else if (obj instanceof ItemCreator.ItemCreatorBuilder) - return ((ItemCreator.ItemCreatorBuilder) obj).build().make(); - - else if (obj instanceof ItemCreator) - return ((ItemCreator) obj).make(); - - else if (obj instanceof SimpleTime) - return ((SimpleTime) obj).getRaw(); - - else if (obj instanceof SimpleSound) - return ((SimpleSound) obj).toString(); - - else if (obj instanceof Color) - return "#" + ((Color) obj).getRGB(); - - else if (obj instanceof BaseComponent) - return Remain.toJson((BaseComponent) obj); - - else if (obj instanceof BaseComponent[]) - return Remain.toJson((BaseComponent[]) obj); - - else if (obj instanceof HoverEvent) { - final HoverEvent event = (HoverEvent) obj; - - return SerializedMap.ofArray("Action", event.getAction(), "Value", event.getValue()).serialize(); - } - - else if (obj instanceof ClickEvent) { - final ClickEvent event = (ClickEvent) obj; - - return SerializedMap.ofArray("Action", event.getAction(), "Value", event.getValue()).serialize(); - } - - else if (obj instanceof Path) - throw new FoException("Cannot serialize Path " + obj + ", did you mean to convert it into a name?"); - - else if (obj instanceof Iterable || obj.getClass().isArray() || obj instanceof IsInList) { - final List<Object> serialized = new ArrayList<>(); - - if (obj instanceof Iterable || obj instanceof IsInList) - for (final Object element : obj instanceof IsInList ? ((IsInList<?>) obj).getList() : (Iterable<?>) obj) - serialized.add(serialize(element)); - - else - for (final Object element : (Object[]) obj) - serialized.add(serialize(element)); - - return serialized; - - } else if (obj instanceof StrictMap) { - final StrictMap<Object, Object> oldMap = (StrictMap<Object, Object>) obj; - final StrictMap<Object, Object> newMap = new StrictMap<>(); - - for (final Map.Entry<Object, Object> entry : oldMap.entrySet()) - newMap.put(serialize(entry.getKey()), serialize(entry.getValue())); - - return newMap; - - } else if (obj instanceof Map) { - final Map<Object, Object> oldMap = (Map<Object, Object>) obj; - final Map<Object, Object> newMap = new LinkedHashMap<>(); - - for (final Map.Entry<Object, Object> entry : oldMap.entrySet()) - newMap.put(serialize(entry.getKey()), serialize(entry.getValue())); - - return newMap; - - } else if (obj instanceof YamlConfig) - throw new SerializeFailedException("Called serialize for YamlConfig's '" + obj.getClass().getSimpleName() - + "' but failed, if you're trying to save it make it implement ConfigSerializable!"); - - else if (obj instanceof Integer || obj instanceof Double || obj instanceof Float || obj instanceof Long || obj instanceof Short - || obj instanceof String || obj instanceof Boolean || obj instanceof Map - || obj instanceof ItemStack - || obj instanceof MemorySection - || obj instanceof Pattern) - return obj; - - else if (obj instanceof ConfigurationSerializable) - return ((ConfigurationSerializable) obj).serialize(); - - throw new SerializeFailedException("Does not know how to serialize " + obj.getClass().getSimpleName() + "! Does it extends ConfigSerializable? Data: " + obj); - } - - /** - * Converts a {@link Location} into "world x y z yaw pitch" string - * Decimals not supported, use {@link #deserializeLocationD(Object)} for them - * - * @param loc - * @return - */ - public static String serializeLoc(final Location loc) { - return loc.getWorld().getName() + " " + loc.getBlockX() + " " + loc.getBlockY() + " " + loc.getBlockZ() + (loc.getPitch() != 0F || loc.getYaw() != 0F ? " " + Math.round(loc.getYaw()) + " " + Math.round(loc.getPitch()) : ""); - } - - /** - * Converts a {@link Location} into "world x y z yaw pitch" string with decimal support - * Unused, you have to call this in your save() method otherwise we remove decimals and use the above method - * - * @param loc - * @return - */ - public static String serializeLocD(final Location loc) { - return loc.getWorld().getName() + " " + loc.getX() + " " + loc.getY() + " " + loc.getZ() + (loc.getPitch() != 0F || loc.getYaw() != 0F ? " " + loc.getYaw() + " " + loc.getPitch() : ""); - } - - /** - * Converts a {@link PotionEffect} into a "type duration amplifier" string - * - * @param effect - * @return - */ - private static String serializePotionEffect(final PotionEffect effect) { - return effect.getType().getName() + " " + effect.getDuration() + " " + effect.getAmplifier(); - } - - // ------------------------------------------------------------------------------------------------------------ - // Converting stored strings from your files back into classes - // ------------------------------------------------------------------------------------------------------------ - - /** - * Attempts to convert the given object into a class - * <p> - * Example: Call deserialize(Location.class, "worldName 5 -1 47") to convert that into a Bukkit location object - * - * @param <T> - * @param classOf - * @param object - * @return - */ - public static <T> T deserialize(@NonNull final Class<T> classOf, @NonNull final Object object) { - return deserialize(classOf, object, (Object[]) null); - } - - /** - * Please see {@link #deserialize(Class, Object)}, plus that this method - * allows you to parse through more arguments to the static deserialize method - * - * @param <T> - * @param classOf - * @param object - * @param deserializeParameters, use more variables in the deserialize method - * @return - */ - @SuppressWarnings("rawtypes") - public static <T> T deserialize(@NonNull final Class<T> classOf, @NonNull Object object, final Object... deserializeParameters) { - final SerializedMap map = SerializedMap.of(object); - - // Step 1 - Search for basic deserialize(SerializedMap) method - Method deserializeMethod = ReflectionUtil.getMethod(classOf, "deserialize", SerializedMap.class); - - if (deserializeMethod != null) { - try { - return ReflectionUtil.invokeStatic(deserializeMethod, map); - - } catch (final ReflectionException ex) { - Common.throwError(ex, "Could not deserialize " + classOf + " from data: " + map); - } - } - - // Step 2 - Search for our deserialize(Params[], SerializedMap) method - if (deserializeParameters != null) { - final List<Class<?>> joinedClasses = new ArrayList<>(); - - { // Build parameters - joinedClasses.add(SerializedMap.class); - - for (final Object param : deserializeParameters) - joinedClasses.add(param.getClass()); - } - - deserializeMethod = ReflectionUtil.getMethod(classOf, "deserialize", joinedClasses.toArray(new Class[joinedClasses.size()])); - - final List<Object> joinedParams = new ArrayList<>(); - - { // Build parameter instances - joinedParams.add(map); - - for (final Object param : deserializeParameters) - joinedParams.add(param); - } - - if (deserializeMethod != null) { - Valid.checkBoolean(joinedClasses.size() == joinedParams.size(), "static deserialize method arguments length " + joinedClasses.size() + " != given params " + joinedParams.size()); - - return ReflectionUtil.invokeStatic(deserializeMethod, joinedParams.toArray()); - } - } - - // Step 3 - Search for "getByName" method used by us or some Bukkit classes such as Enchantment - if (deserializeMethod == null && object instanceof String) { - deserializeMethod = ReflectionUtil.getMethod(classOf, "getByName", String.class); - - if (deserializeMethod != null) - return ReflectionUtil.invokeStatic(deserializeMethod, object); - } - - // Step 4 - If there is no deserialize method, just deserialize the given object - if (object != null) - - if (classOf == String.class) - object = object.toString(); - - else if (classOf == Integer.class) - object = Double.valueOf(object.toString()).intValue(); - - else if (classOf == Long.class) - object = Double.valueOf(object.toString()).longValue(); - - else if (classOf == Double.class) - object = Double.valueOf(object.toString()); - - else if (classOf == Float.class) - object = Float.valueOf(object.toString()); - - else if (classOf == Boolean.class) - object = Boolean.valueOf(object.toString()); - - else if (classOf == SerializedMap.class) - object = SerializedMap.of(object); - - else if (classOf == Location.class) - object = deserializeLocation(object); - - else if (classOf == PotionEffect.class) - object = deserializePotionEffect(object); - - else if (classOf == CompMaterial.class) - object = CompMaterial.fromString(object.toString()); - - else if (classOf == SimpleTime.class) - object = SimpleTime.from(object.toString()); - - else if (classOf == SimpleSound.class) - object = new SimpleSound(object.toString()); - - else if (classOf == net.md_5.bungee.api.ChatColor.class) - throw new FoException("Instead of net.md_5.bungee.api.ChatColor, use our CompChatColor"); - - else if (classOf == CompChatColor.class) - object = CompChatColor.of(object.toString()); - - else if (classOf == UUID.class) - object = UUID.fromString(object.toString()); - - else if (classOf == BaseComponent.class) { - final BaseComponent[] deserialized = Remain.toComponent(object.toString()); - Valid.checkBoolean(deserialized.length == 1, "Failed to deserialize into singular BaseComponent: " + object); - - object = deserialized[0]; - - } else if (classOf == BaseComponent[].class) - object = Remain.toComponent(object.toString()); - - else if (classOf == HoverEvent.class) { - final SerializedMap serialized = SerializedMap.of(object); - final HoverEvent.Action action = serialized.get("Action", HoverEvent.Action.class); - final BaseComponent[] value = serialized.get("Value", BaseComponent[].class); - - object = new HoverEvent(action, value); - } - - else if (classOf == ClickEvent.class) { - final SerializedMap serialized = SerializedMap.of(object); - - final ClickEvent.Action action = serialized.get("Action", ClickEvent.Action.class); - final String value = serialized.getString("Value"); - - object = new ClickEvent(action, value); - } - - else if (Enum.class.isAssignableFrom(classOf)) - object = ReflectionUtil.lookupEnum((Class<Enum>) classOf, object.toString()); - - else if (Color.class.isAssignableFrom(classOf)) { - object = CompChatColor.of(object.toString()).getColor(); - - } else if (List.class.isAssignableFrom(classOf) && object instanceof List) { - // Good - - } else if (Map.class.isAssignableFrom(classOf) && object instanceof Map) { - // Good - - } else if (ConfigurationSerializable.class.isAssignableFrom(classOf) && object instanceof ConfigurationSerializable) { - // Good - - } else if (classOf.isArray()) { - final Class<?> arrayType = classOf.getComponentType(); - T[] array; - - if (object instanceof List) { - final List<?> rawList = (List<?>) object; - array = (T[]) Array.newInstance(classOf.getComponentType(), rawList.size()); - - for (int i = 0; i < rawList.size(); i++) { - final Object element = rawList.get(i); - - array[i] = element == null ? null : (T) deserialize(arrayType, element, (Object[]) null); - } - } - - else { - final Object[] rawArray = (Object[]) object; - array = (T[]) Array.newInstance(classOf.getComponentType(), rawArray.length); - - for (int i = 0; i < array.length; i++) - array[i] = rawArray[i] == null ? null : (T) deserialize(classOf.getComponentType(), rawArray[i], (Object[]) null); - } - - return (T) array; - - } else if (classOf == Object.class) { - // pass through - - } else - throw new SerializeFailedException("Unable to deserialize " + classOf.getSimpleName() + ", lacking static deserialize method! Data: " + object); - - return (T) object; - - } - - /** - * Converts a string into location, see {@link #deserializeLocation(Object)} for how strings are saved - * Decimals not supported, use {@link #deserializeLocationD(Object)} to use them - * - * @param raw - * @return - */ - public static Location deserializeLocation(Object raw) { - if (raw == null) - return null; - - if (raw instanceof Location) - return (Location) raw; - - raw = raw.toString().replace("\"", ""); - - final String[] parts = raw.toString().contains(", ") ? raw.toString().split(", ") : raw.toString().split(" "); - Valid.checkBoolean(parts.length == 4 || parts.length == 6, "Expected location (String) but got " + raw.getClass().getSimpleName() + ": " + raw); - - final String world = parts[0]; - final World bukkitWorld = Bukkit.getWorld(world); - if (bukkitWorld == null) - throw new InvalidWorldException("Location with invalid world '" + world + "': " + raw + " (Doesn't exist)", world); - - final int x = Integer.parseInt(parts[1]), y = Integer.parseInt(parts[2]), z = Integer.parseInt(parts[3]); - final float yaw = Float.parseFloat(parts.length == 6 ? parts[4] : "0"), pitch = Float.parseFloat(parts.length == 6 ? parts[5] : "0"); - - return new Location(bukkitWorld, x, y, z, yaw, pitch); - } - - /** - * Converts a string into a location with decimal support - * Unused but you can use this for your own parser storing exact decimals - * - * @param raw - * @return - */ - public static Location deserializeLocationD(Object raw) { - if (raw == null) - return null; - - if (raw instanceof Location) - return (Location) raw; - - raw = raw.toString().replace("\"", ""); - - final String[] parts = raw.toString().contains(", ") ? raw.toString().split(", ") : raw.toString().split(" "); - Valid.checkBoolean(parts.length == 4 || parts.length == 6, "Expected location (String) but got " + raw.getClass().getSimpleName() + ": " + raw); - - final String world = parts[0]; - final World bukkitWorld = Bukkit.getWorld(world); - - if (bukkitWorld == null) - throw new InvalidWorldException("Location with invalid world '" + world + "': " + raw + " (Doesn't exist)", world); - - final double x = Double.parseDouble(parts[1]), y = Double.parseDouble(parts[2]), z = Double.parseDouble(parts[3]); - final float yaw = Float.parseFloat(parts.length == 6 ? parts[4] : "0"), pitch = Float.parseFloat(parts.length == 6 ? parts[5] : "0"); - - return new Location(bukkitWorld, x, y, z, yaw, pitch); - } - - /** - * Convert a raw object back to {@link PotionEffect} - * - * @param raw - * @return - */ - private static PotionEffect deserializePotionEffect(final Object raw) { - if (raw == null) - return null; - - if (raw instanceof PotionEffect) - return (PotionEffect) raw; - - final String[] parts = raw.toString().split(" "); - Valid.checkBoolean(parts.length == 3, "Expected PotionEffect (String) but got " + raw.getClass().getSimpleName() + ": " + raw); - - final String typeRaw = parts[0]; - final PotionEffectType type = PotionEffectType.getByName(typeRaw); - - final int duration = Integer.parseInt(parts[1]); - final int amplifier = Integer.parseInt(parts[2]); - - return new PotionEffect(type, duration, amplifier); - } - - /** - * Deserializes a list containing maps - * - * @param <T> - * @param listOfObjects - * @param asWhat - * @return - */ - @Deprecated - public static <T extends ConfigSerializable> List<T> deserializeMapList(final Object listOfObjects, final Class<T> asWhat) { - if (listOfObjects == null) - return null; - - Valid.checkBoolean(listOfObjects instanceof ArrayList, "Only deserialize a list of maps, nie " + listOfObjects.getClass()); - final List<T> loaded = new ArrayList<>(); - - for (final Object part : (ArrayList<?>) listOfObjects) { - final T deserialized = deserializeMap(part, asWhat); - - if (deserialized != null) - loaded.add(deserialized); - } - - return loaded; - } - - /** - * Deserializes a map - * - * @param <T> - * @param rawMap - * @param asWhat - * @return - */ - public static <T extends ConfigSerializable> T deserializeMap(final Object rawMap, final Class<T> asWhat) { - if (rawMap == null) - return null; - - Valid.checkBoolean(rawMap instanceof Map, "The object to deserialize must be map, but got: " + rawMap.getClass()); - - final Map<String, Object> map = (Map<String, Object>) rawMap; - final Method deserialize; - - try { - deserialize = asWhat.getMethod("deserialize", SerializedMap.class); - Valid.checkBoolean(Modifier.isPublic(deserialize.getModifiers()) && Modifier.isStatic(deserialize.getModifiers()), asWhat + " is missing public 'public static T deserialize()' method"); - - } catch (final NoSuchMethodException ex) { - Common.throwError(ex, "Class lacks a final method deserialize(SerializedMap) metoda. Tried: " + asWhat.getSimpleName()); - return null; - } - - final Object invoked; - - try { - invoked = deserialize.invoke(null, SerializedMap.of(map)); - } catch (final ReflectiveOperationException e) { - Common.throwError(e, "Error calling " + deserialize.getName() + " as " + asWhat.getSimpleName() + " with data " + map); - return null; - } - - Valid.checkBoolean(invoked.getClass().isAssignableFrom(asWhat), invoked.getClass().getSimpleName() + " != " + asWhat.getSimpleName()); - return (T) invoked; - } - - /** - * Thrown when cannot serialize an object because it failed to determine its type - */ - public static class SerializeFailedException extends RuntimeException { - - private static final long serialVersionUID = 1L; - - public SerializeFailedException(String reason) { - super(reason); - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/TabUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/TabUtil.java deleted file mode 100644 index 984c451eefaf82722694945776a74effcedc1a70..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/TabUtil.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.mineacademy.fo; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; - -/** - * Utility class for tab completion. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class TabUtil { - - /** - * Return a list of tab completions for the given array, - * we attempt to resolve what type of the array it is, - * supports for chat colors, command senders, enumerations etc. - * - * @param <T> - * @param partialName - * @param all - * @return - */ - @SafeVarargs - public static <T> List<String> complete(String partialName, T... all) { - final List<String> clone = new ArrayList<>(); - - if (all != null) - for (final T s : all) - if (s != null) { - if (s instanceof Iterable) - for (final Object iterable : (Iterable<?>) s) - clone.add(iterable instanceof Enum ? iterable.toString().toLowerCase() : SerializeUtil.serialize(iterable).toString()); - - // Trick: Automatically parse enum constants - else if (s instanceof Enum[]) - for (final Object iterable : ((Enum[]) s)[0].getClass().getEnumConstants()) - clone.add(iterable.toString().toLowerCase()); - - else { - final boolean lowercase = s instanceof Enum; - final String parsed = SerializeUtil.serialize(s).toString(); - - if (!"".equals(parsed)) - clone.add(lowercase ? parsed.toLowerCase() : parsed); - } - } - - return complete(partialName, clone); - } - - /** - * Returns valid tab completions for the given collection - * - * @param partialName - * @param all - * @return - */ - public static List<String> complete(String partialName, Iterable<String> all) { - final ArrayList<String> tab = new ArrayList<>(); - - for (final String s : all) - tab.add(s); - - partialName = partialName.toLowerCase(); - - for (final Iterator<String> iterator = tab.iterator(); iterator.hasNext();) { - final String val = iterator.next(); - - if (!val.toLowerCase().startsWith(partialName)) - iterator.remove(); - } - - Collections.sort(tab); - - return tab; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/TimeUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/TimeUtil.java deleted file mode 100644 index 0a7ddd4226df2c4ff44c18b35a2752f3994052ce..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/TimeUtil.java +++ /dev/null @@ -1,374 +0,0 @@ -package org.mineacademy.fo; - -import java.sql.Timestamp; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; - -/** - * Utility class for calculating time from ticks and back. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class TimeUtil { - - /** - * The date format in dd.MM.yyy HH:mm:ss - */ - private static final DateFormat DATE_FORMAT = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); - - /** - * The date format in dd.MM.yyy HH:mm - */ - private static final DateFormat DATE_FORMAT_SHORT = new SimpleDateFormat("dd.MM.yyyy HH:mm"); - - /** - * The date format in dd.MM HH:mm - */ - private static final DateFormat DATE_FORMAT_MONTH = new SimpleDateFormat("dd.MM HH:mm"); - - /** - * The pattern recognizing 1d1h1s type of dates - */ - private static final Pattern TOKEN_PATTERN = Pattern.compile("(?:([0-9]+)\\s*y[a-z]*[,\\s]*)?" - // Months - + "(?:([0-9]+)\\s*mo[a-z]*[,\\s]*)?" - - // Weeks - + "(?:([0-9]+)\\s*w[a-z]*[,\\s]*)?" - - // Days - + "(?:([0-9]+)\\s*d[a-z]*[,\\s]*)?" - - // Hours - + "(?:([0-9]+)\\s*h[a-z]*[,\\s]*)?" - - // Minutes - + "(?:([0-9]+)\\s*m[a-z]*[,\\s]*)?" - - // Seconds (the "s" may be left out) - + "(?:([0-9]+)\\s*(?:s[a-z]*)?)?", - - Pattern.CASE_INSENSITIVE); - - // ------------------------------------------------------------------------------------------------------------ - // Current time - // ------------------------------------------------------------------------------------------------------------ - - /** - * Seconds elapsed since January the 1st, 1970 - * - * @return System.currentTimeMillis / 1000 - */ - public static long currentTimeSeconds() { - return System.currentTimeMillis() / 1000; - } - - /** - * Ticks elapsed since January the 1st, 1970 - * - * @return System.currentTimeMillis / 50 - */ - public static long currentTimeTicks() { - return System.currentTimeMillis() / 50; - } - - // ------------------------------------------------------------------------------------------------------------ - // Formatting - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return the current date formatted as DAY.MONTH.YEAR HOUR:MINUTES:SECONDS - * - * @return - */ - public static String getFormattedDate() { - return getFormattedDate(System.currentTimeMillis()); - } - - /** - * Return the given date in millis formatted as - * DAY.MONTH.YEAR HOUR:MINUTES:SECONDS - * - * @param time - * @return - */ - public static String getFormattedDate(final long time) { - return DATE_FORMAT.format(time); - } - - /** - * Return the current date formatted as DAY.MONTH.YEAR HOUR:MINUTES - * - * @return - */ - public static String getFormattedDateShort() { - return DATE_FORMAT_SHORT.format(System.currentTimeMillis()); - } - - /** - * Return the given date in millis formatted as - * DAY.MONTH.YEAR HOUR:MINUTES - * - * @param time - * @return - */ - public static String getFormattedDateShort(final long time) { - return DATE_FORMAT_SHORT.format(time); - } - - /** - * Return the given date in millis formatted as - * dd.MM HH:mm - * - * @param time - * @return - */ - public static String getFormattedDateMonth(final long time) { - return DATE_FORMAT_MONTH.format(time); - } - - // ------------------------------------------------------------------------------------------------------------ - // Converting - // ------------------------------------------------------------------------------------------------------------ - - /** - * Converts the time from a human readable format like "10 minutes" - * to seconds. - * - * @param humanReadableTime the human readable time format: {time} {period} - * example: 5 seconds, 10 ticks, 7 minutes, 12 hours etc.. - * @return the converted human time to seconds - */ - public static long toTicks(final String humanReadableTime) { - Valid.checkNotNull(humanReadableTime, "Time is null"); - - long seconds = 0L; - - final String[] split = humanReadableTime.split(" "); - Valid.checkBoolean(split.length > 1, "Expected human readable time like '1 second', got '" + humanReadableTime + "' instead"); - - for (int i = 1; i < split.length; i++) { - final String sub = split[i].toLowerCase(); - int multiplier = 0; // e.g 2 hours = 2 - long unit = 0; // e.g hours = 3600 - boolean isTicks = false; - - try { - multiplier = Integer.parseInt(split[i - 1]); - } catch (final NumberFormatException e) { - continue; - } - - // attempt to match the unit time - if (sub.startsWith("tick")) - isTicks = true; - - else if (sub.startsWith("second")) - unit = 1; - - else if (sub.startsWith("minute")) - unit = 60; - - else if (sub.startsWith("hour")) - unit = 3600; - - else if (sub.startsWith("day")) - unit = 86400; - - else if (sub.startsWith("week")) - unit = 604800; - - else if (sub.startsWith("month")) - unit = 2629743; - - else if (sub.startsWith("year")) - unit = 31556926; - - else if (sub.startsWith("potato")) - unit = 1337; - - else - throw new IllegalArgumentException("Must define date type! Example: '1 second' (Got '" + sub + "')"); - - seconds += multiplier * (isTicks ? 1 : unit * 20); - } - - return seconds; - } - - /** - * Formats the given time from seconds into the following format: - * <p> - * "1 hour 50 minutes 10 seconds" or similar, or less - * - * @param seconds - * @return - */ - public static String formatTimeGeneric(final long seconds) { - final long second = seconds % 60; - long minute = seconds / 60; - String hourMsg = ""; - - if (minute >= 60) { - final long hour = seconds / 60 / 60; - minute %= 60; - - hourMsg = hour + (hour == 1 ? " hour" : " hours") + " "; - } - - return hourMsg + (minute != 0 ? minute : "") + (minute > 0 ? (minute == 1 ? " minute" : " minutes") + " " : "") + Long.parseLong(String.valueOf(second)) + (Long.parseLong(String.valueOf(second)) == 1 ? " second" : " seconds"); - - } - - /** - * Format time in "X days Y hours Z minutes Å seconds" - * - * @param seconds - * @return - */ - public static String formatTimeDays(final long seconds) { - final long minutes = seconds / 60; - final long hours = minutes / 60; - final long days = hours / 24; - - return days + " days " + hours % 24 + " hours " + minutes % 60 + " minutes " + seconds % 60 + " seconds"; - } - - /** - * Format the time in seconds, for example: 10d 5h 10m 20s or just 5m 10s - * If the seconds are zero, an output 0s is given - * - * @param seconds - * @return - */ - public static String formatTimeShort(long seconds) { - long minutes = seconds / 60; - long hours = minutes / 60; - final long days = hours / 24; - - hours = hours % 24; - minutes = minutes % 60; - seconds = seconds % 60; - - return (days > 0 ? days + "d " : "") + (hours > 0 ? hours + "h " : "") + (minutes > 0 ? minutes + "m " : "") + seconds + "s"; - } - - /** - * Convert the given string token into milliseconds - * - * Example: 1y, 1mo, 1w, 1d, 1h, 1m, 1s and these can all be combined together - * - * @param text - * @return - */ - public static long parseToken(String text) { - final Matcher matcher = TOKEN_PATTERN.matcher(text); - - long years = 0, months = 0, weeks = 0, days = 0, hours = 0, minutes = 0, seconds = 0; - boolean found = false; - - while (matcher.find()) { - - if (matcher.group() == null || matcher.group().isEmpty()) - continue; - - for (int i = 0; i < matcher.groupCount(); i++) - if (matcher.group(i) != null && !matcher.group(i).isEmpty()) { - found = true; - - break; - } - - if (found) { - for (int i = 1; i < 8; i++) - if (matcher.group(i) != null && !matcher.group(i).isEmpty()) { - final long output = Long.parseLong(matcher.group(i)); - - if (i == 1) { - checkLimit("years", output, 10); - - years = output; - } - - else if (i == 2) { - checkLimit("months", output, 12 * 100); - - months = output; - } - - else if (i == 3) { - checkLimit("weeks", output, 4 * 100); - - weeks = output; - } - - else if (i == 4) { - checkLimit("days", output, 31 * 100); - - days = output; - } - - else if (i == 5) { - checkLimit("hours", output, 24 * 100); - - hours = output; - } - - else if (i == 6) { - checkLimit("minutes", output, 60 * 100); - - minutes = output; - } - - else if (i == 7) { - checkLimit("seconds", output, 60 * 100); - - seconds = output; - } - } - - break; - } - } - - if (!found) - throw new NumberFormatException("Date not found from: " + text); - - return (seconds + (minutes * 60) + (hours * 3600) + (days * 86400) + (weeks * 7 * 86400) + (months * 30 * 86400) + (years * 365 * 86400)) * 1000; - } - - /* - * Check value over limit - */ - private static void checkLimit(String type, long value, int maxLimit) { - if (value > maxLimit) - throw new IllegalArgumentException("Value type " + type + " is out of bounds! Max limit: " + maxLimit + ", given: " + value); - } - - /** - * Convert the given long timestamp into one that is recognized by MySQL - * - * @param timestamp - * @return - */ - public static String toSQLTimestamp(long timestamp) { - final java.util.Date date = new Date(timestamp); - - return new Timestamp(date.getTime()).toString(); - } - - /** - * Convert the given MySQL timestamp into a long - * - * @param timestamp - * @return - */ - public static long fromSQLTimestamp(String timestamp) { - return Timestamp.valueOf(timestamp).getTime(); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/Valid.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/Valid.java deleted file mode 100644 index 8f851b576ff45fde22275c3aea8bbdf153b79073..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/Valid.java +++ /dev/null @@ -1,559 +0,0 @@ -package org.mineacademy.fo; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.regex.Pattern; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.command.CommandSender; -import org.bukkit.util.Vector; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.RangedValue; -import org.mineacademy.fo.settings.SimpleLocalization; - -import lombok.experimental.UtilityClass; - -/** - * Utility class for checking conditions and throwing our safe exception that is - * logged into file. - */ -@UtilityClass -public final class Valid { - - /** - * Matching valid integers - */ - private final Pattern PATTERN_INTEGER = Pattern.compile("-?\\d+"); - - /** - * Matching valid whole numbers - */ - private final Pattern PATTERN_DECIMAL = Pattern.compile("-?\\d+.\\d+"); - - // ------------------------------------------------------------------------------------------------------------ - // Checking for validity and throwing errors if false or null - // ------------------------------------------------------------------------------------------------------------ - - /** - * Throw an error if the given object is null - * - * @param toCheck - */ - public void checkNotNull(final Object toCheck) { - if (toCheck == null) - throw new FoException(); - } - - /** - * Throw an error with a custom message if the given object is null - * - * @param toCheck - * @param falseMessage - */ - public void checkNotNull(final Object toCheck, final String falseMessage) { - if (toCheck == null) - throw new FoException(falseMessage); - } - - /** - * Throw an error if the given expression is false - * - * @param expression - */ - public void checkBoolean(final boolean expression) { - if (!expression) - throw new FoException(); - } - - /** - * Throw an error with a custom message if the given expression is false - * - * @param expression - * @param falseMessage - */ - public void checkBoolean(final boolean expression, final String falseMessage, final Object... replacements) { - if (!expression) - throw new FoException(String.format(falseMessage, replacements)); - } - - /** - * Throw an error with a custom message if the given toCheck string is not a number! - * - * @param toCheck - * @param falseMessage - */ - public void checkInteger(final String toCheck, final String falseMessage, final Object... replacements) { - if (!Valid.isInteger(toCheck)) - throw new FoException(String.format(falseMessage, replacements)); - } - - /** - * Throw an error with a custom message if the given collection is null or empty - * - * @param collection - * @param message - */ - public void checkNotEmpty(final Collection<?> collection, final String message) { - if (collection == null || collection.size() == 0) - throw new IllegalArgumentException(message); - } - - /** - * Throw an error if the given message is empty or null - * - * @param message - * @param message - */ - public void checkNotEmpty(final String message, final String emptyMessage) { - if (message == null || message.length() == 0) - throw new IllegalArgumentException(emptyMessage); - } - - /** - * Check if the player has the given permission, if false we send him {@link SimpleLocalization#NO_PERMISSION} - * message and return false, otherwise no message is sent and we return true - * - * @param sender - * @param permission - * @return - */ - public boolean checkPermission(final CommandSender sender, final String permission) { - if (!PlayerUtil.hasPerm(sender, permission)) { - Common.tell(sender, SimpleLocalization.NO_PERMISSION.replace("{permission}", permission)); - - return false; - } - - return true; - } - - /** - * Check if the code calling this method is run from the main thread, - * failing with the error message if otherwise - * - * @param asyncErrorMessage - */ - public void checkSync(final String asyncErrorMessage) { - Valid.checkBoolean(Bukkit.isPrimaryThread(), asyncErrorMessage); - } - - /** - * Check if the code calling this method is run from a different than main thread, - * failing with the error message if otherwise - * - * @param syncErrorMessage - */ - public void checkAsync(final String syncErrorMessage) { - Valid.checkBoolean(!Bukkit.isPrimaryThread(), syncErrorMessage); - } - - // ------------------------------------------------------------------------------------------------------------ - // Checking for true without throwing errors - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return true if the given string is a valid integer - * - * @param raw - * @return - */ - public boolean isInteger(final String raw) { - Valid.checkNotNull(raw, "Cannot check if null is an integer!"); - - return Valid.PATTERN_INTEGER.matcher(raw).find(); - } - - /** - * Return true if the given string is a valid whole number - * - * @param raw - * @return - */ - public boolean isDecimal(final String raw) { - Valid.checkNotNull(raw, "Cannot check if null is a decimal!"); - - return Valid.PATTERN_DECIMAL.matcher(raw).find(); - } - - /** - * Return true if the array consists of null or empty string values only - * - * @param array - * @return - */ - public boolean isNullOrEmpty(final Collection<?> array) { - return array == null || Valid.isNullOrEmpty(array.toArray()); - } - - /** - * Return true if the map is null or only contains null values - * - * @param map - * @return - */ - public boolean isNullOrEmptyValues(SerializedMap map) { - return isNullOrEmptyValues(map == null ? null : map.asMap()); - } - - /** - * Return true if the map is null or only contains null values - * - * @param map - * @return - */ - public boolean isNullOrEmptyValues(final Map<?, ?> map) { - - if (map == null) - return true; - - for (final Object value : map.values()) - if (value != null) - return false; - - return true; - } - - /** - * Return true if the array consists of null or empty string values only - * - * @param array - * @return - */ - public boolean isNullOrEmpty(final Object[] array) { - if (array != null) - for (final Object object : array) - if (object instanceof String) { - if (!((String) object).isEmpty()) - return false; - - } else if (object != null) - return false; - - return true; - } - - /** - * Return true if the given message is null or empty - * - * @param message - * @return - */ - public boolean isNullOrEmpty(final String message) { - return message == null || message.isEmpty(); - } - - /** - * Return true if all x-y-z coordinates of the given vector are finite valid numbers - * (see {@link Double#isFinite(double)}) - * - * @param vector - * @return - */ - public boolean isFinite(final Vector vector) { - return Double.isFinite(vector.getX()) && Double.isFinite(vector.getY()) && Double.isFinite(vector.getZ()); - } - - /** - * Return true if the given value is between bounds - * - * @param value - * @param ranged - * @return - */ - public boolean isInRange(final long value, final RangedValue ranged) { - return value >= ranged.getMinLong() && value <= ranged.getMaxLong(); - } - - /** - * Return true if the given value is between bounds - * - * @param value - * @param min - * @param max - * @return - */ - public boolean isInRange(final double value, final double min, final double max) { - return value >= min && value <= max; - } - - /** - * Return true if the given value is between bounds - * - * @param value - * @param min - * @param max - * @return - */ - public boolean isInRange(final long value, final long min, final long max) { - return value >= min && value <= max; - } - - /** - * Return true if the given object is a {@link UUID} - * - * @param object - * @return - */ - public boolean isUUID(Object object) { - if (object instanceof String) { - final String[] components = object.toString().split("-"); - - return components.length == 5; - } - - return object instanceof UUID; - } - - // ------------------------------------------------------------------------------------------------------------ - // Equality checks - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return true if the two locations has same world and block positions - * - * @param first - * @param sec - * @return - */ - public boolean locationEquals(final Location first, final Location sec) { - if (!first.getWorld().getName().equals(sec.getWorld().getName())) - return false; - - return first.getBlockX() == sec.getBlockX() && first.getBlockY() == sec.getBlockY() && first.getBlockZ() == sec.getBlockZ(); - } - - /** - * Compare two lists. Two lists are considered equal if they are same length and all values are the same. - * Exception: Strings are stripped of colors before comparation. - * - * @param first, first list to compare - * @param second, second list to compare with - * @return true if lists are equal - */ - public <T> boolean listEquals(final List<T> first, final List<T> second) { - if (first == null && second == null) - return true; - - if (first == null) - return false; - - if (second == null) - return false; - - if (first.size() != second.size()) - return false; - - for (int i = 0; i < first.size(); i++) { - final T f = first.get(i); - final T s = second.get(i); - - if (f == null && s != null) - return false; - - if (f != null && s == null) - return false; - - if (f != null && !f.equals(s)) - if (!Common.stripColors(f.toString()).equalsIgnoreCase(Common.stripColors(s.toString()))) - return false; - } - - return true; - } - - /** - * Return true if two strings are equal regardless of their colors - * - * @param first - * @param second - * @return - */ - public boolean colorlessEquals(final String first, final String second) { - return Common.stripColors(first).equalsIgnoreCase(Common.stripColors(second)); - } - - /** - * Return true if two string lists are equal regardless of their colors - * - * @param first - * @param second - * @return - */ - public boolean colorlessEquals(final List<String> first, final List<String> second) { - return colorlessEquals(Common.toArray(first), Common.toArray(second)); - } - - /** - * Return true if two string arrays are equal regardless of their colors - * - * @param firstArray - * @param secondArray - * @return - */ - public boolean colorlessEquals(final String[] firstArray, final String[] secondArray) { - for (int i = 0; i < firstArray.length; i++) { - final String first = Common.stripColors(firstArray[i]); - final String second = i < secondArray.length ? Common.stripColors(secondArray[i]) : ""; - - if (!first.equalsIgnoreCase(second)) - return false; - } - - return true; - } - - /** - * Return true if the given list contains all strings equal - * - * @param values - * @return - */ - public boolean valuesEqual(Collection<String> values) { - final List<String> copy = new ArrayList<>(values); - String lastValue = null; - - for (int i = 0; i < copy.size(); i++) { - final String value = copy.get(i); - - if (lastValue == null) - lastValue = value; - - if (!lastValue.equals(value)) - return false; - - lastValue = value; - } - - return true; - } - - // ------------------------------------------------------------------------------------------------------------ - // Matching in lists - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return true if the given is in the given list, depending on the mode - * - * If isBlacklist mode is enabled, we return true when element is NOT in the list, - * if it is false, we return true if element is in the list. - * - * @param element - * @param isBlacklist - * @param list - * @return - */ - public boolean isInList(final String element, final boolean isBlacklist, final Iterable<String> list) { - return isBlacklist == Valid.isInList(element, list); - } - - /** - * Return true if any element in the given list equals (case ignored) to your given element - * - * @param element - * @param list - * @return - */ - public boolean isInList(final String element, final Iterable<String> list) { - try { - for (final String matched : list) - if (removeSlash(element).equalsIgnoreCase(removeSlash(matched))) - return true; - - } catch (final ClassCastException ex) { // for example when YAML translates "yes" to "true" to boolean (!) (#wontfix) - } - - return false; - } - - /** - * Return true if any element in the given list starts with (case ignored) your given element - * - * @param element - * @param list - * @return - */ - public boolean isInListStartsWith(final String element, final Iterable<String> list) { - try { - for (final String matched : list) - if (removeSlash(element).toLowerCase().startsWith(removeSlash(matched).toLowerCase())) - return true; - - } catch (final ClassCastException ex) { // for example when YAML translates "yes" to "true" to boolean (!) (#wontfix) - } - - return false; - } - - /** - * Return true if any element in the given list contains (case ignored) your given element - * - * @param element - * @param list - * @return - * - * @deprecated can lead to unwanted matches such as when /time is in list, /t will also get caught - */ - @Deprecated - public boolean isInListContains(final String element, final Iterable<String> list) { - try { - for (final String matched : list) - if (removeSlash(element).toLowerCase().contains(removeSlash(matched).toLowerCase())) - return true; - - } catch (final ClassCastException ex) { // for example when YAML translates "yes" to "true" to boolean (!) (#wontfix) - } - - return false; - } - - /** - * Return true if any element in the given list matches your given element. - * - * A regular expression is compiled from that list element. - * - * @param element - * @param list - * @return - */ - public boolean isInListRegex(final String element, final Iterable<String> list) { - try { - for (final String regex : list) - if (Common.regExMatch(regex, element)) - return true; - - } catch (final ClassCastException ex) { // for example when YAML translates "yes" to "true" to boolean (!) (#wontfix) - } - - return false; - } - - /** - * Return true if the given enum contains the given element, by {@link Enum#name()} (case insensitive) - * - * @param element - * @param enumeration - * @return - */ - public boolean isInListEnum(final String element, final Enum<?>[] enumeration) { - for (final Enum<?> constant : enumeration) - if (constant.name().equalsIgnoreCase(element)) - return true; - - return false; - } - - /** - * Prepare the message for isInList comparation - lowercases it and removes the initial slash / - * - * @param message - * @return - */ - private String removeSlash(String message) { - return message.startsWith("/") ? message.substring(1) : message; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/BungeeAction.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/BungeeAction.java deleted file mode 100644 index dbcd1f8c01e29339617d9d71f9e12a5178f0e4d2..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/BungeeAction.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.mineacademy.fo.bungee; - -import org.mineacademy.fo.plugin.SimplePlugin; - -/** - * Represents an action sent over BungeeCord containing - * a set of data. We recommend you create an enum that implements this. - */ -public interface BungeeAction { - - /** - * Stores all valid values in this action in the order of which they - * are being sent. Only primitive types and String are supported. - */ - Class<?>[] getContent(); - - /** - * The name of this action - * - * @return - */ - String name(); - - /** - * Retrieve BungeeAction by its name - * - * @param name - * @return - */ - static BungeeAction getByName(String name) { - final BungeeAction[] actions = SimplePlugin.getInstance().getBungeeCord().getActions(); - - for (final BungeeAction action : actions) - if (action.name().equals(name)) - return action; - - return null; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/BungeeListener.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/BungeeListener.java deleted file mode 100644 index 71e9dbc009026214c980008c422dd2c2c1021b0a..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/BungeeListener.java +++ /dev/null @@ -1,53 +0,0 @@ -package org.mineacademy.fo.bungee; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.Listener; -import org.bukkit.plugin.messaging.PluginMessageListener; -import org.mineacademy.fo.bungee.message.IncomingMessage; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.plugin.SimplePlugin; - -/** - * Represents a BungeeCord listener using a {@link BungeeChannel} channel - * on which you can listen to receiving messages - * <p> - * This class is also a Listener for Bukkit events for your convenience - */ -public abstract class BungeeListener implements Listener, PluginMessageListener { - - /** - * Create a new bungee listener - * - * @param channel - */ - protected BungeeListener() { - } - - /** - * Handle the received message automatically if it matches our tag - */ - @Override - public final void onPluginMessageReceived(String tag, Player player, byte[] data) { - - // Cauldron/Thermos is unsupported for bungee - if (Bukkit.getName().contains("Cauldron")) - return; - - if (tag.equals(SimplePlugin.getInstance().getBungeeCord().getChannel())) { - final IncomingMessage message = new IncomingMessage(data); - - Debugger.debug("bungee", "Channel " + message.getChannel() + " received " + message.getAction() + " message from " + message.getServerName() + " server."); - onMessageReceived(player, message); - } - } - - /** - * Called automatically when you receive a plugin message from Bungeecord, - * see https://spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel - * - * @param player - * @param message - */ - public abstract void onMessageReceived(Player player, IncomingMessage message); -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/FoBungeeAction.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/FoBungeeAction.java deleted file mode 100644 index ee2f3e11328bbe1fe05aed7133e6250856aa3a8a..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/FoBungeeAction.java +++ /dev/null @@ -1,133 +0,0 @@ -package org.mineacademy.fo.bungee; - -import lombok.Getter; - -/** - * Proprietary implementation of BungeeAction for some of our - * premium plugins handled by BungeeControl - * - * The BungeeCord protocol always begins with - * - * 1) The sender server name - * 2) The {@link BungeeAction} - * - * and the rest is the actual data within this enum - * - * @deprecated subject for REMOVAL - */ -public enum FoBungeeAction implements BungeeAction { - - // ---------------------------------------------------------------------------------------------------- - // Stay on BungeeCord using BungeeControl plugin - // ---------------------------------------------------------------------------------------------------- - - /** - * Execute a command on bungee - * - * Parameters: command - */ - BUNGEE_COMMAND(String.class), - - /** - * Sends the player a simple colorized message - * - * Parameters: player, message - */ - TELL_PLAYER(String.class, String.class), - - // ---------------------------------------------------------------------------------------------------- - // Forward to Bukkit servers - // ---------------------------------------------------------------------------------------------------- - - /** - * Mute the chat. - * - * Parameters: message - */ - CHAT_MUTE(String.class), - - /** - * Wipe the chat. - * - * Parameters: message - */ - CHAT_CLEAR(String.class), - - /** - * Broadcast a message in a channel. - * - * Parameters: sender, channel name, message, has mute bypass permission, has ignore bypass permission - */ - CHANNEL(String.class, String.class, String.class, Boolean.class, Boolean.class), - - /** - * Sends an announcement message to everyone, and plays a nice sound - * - * Parameters: console message, chat message to announce - */ - ANNOUNCEMENT(String.class, String.class), - - /** - * Broadcast a json message to every player with permission as a sender. - * - * Parameters: sender, show permission, json message, has sender ignore bypass permission? - */ - BROADCAST_JSON_WITH_PERMISSION_AS(String.class, String.class, String.class, Boolean.class), - - /** - * Forwards a spy message to players with permissions - * - * Parameters: message - */ - SPY(String.class), - - /** - * Attempts to find a private message recipient, reports back to bungee - * whether we found him or not - * - * Parameters: sender, recipient, sender message, recipient message, has bypass permission, has toggle PM bypass permission, has PM vanished bypass permission - */ - PM_LOOKUP(String.class, String.class, String.class, String.class, Boolean.class, Boolean.class, Boolean.class), - - /** - * This message is forwarded after PM_LOOKUP to the sender server - * to tell him that the recipient was not found - * - * Parameters: sender, recipient - */ - PM_PLAYER_NOT_FOUND(String.class, String.class), - - /** - * Forwarded after PM_LOOKUP is done to deliver the private message - * to the recipient - * - * Parameters: sender, recipient, message - */ - PM_PLAYER_FOUND(String.class, String.class, String.class), - - ; - - /** - * Stores all valid values, the names of them are only used - * in the error message when the length of data does not match - */ - @Getter - private final Class<?>[] content; - - /** - * Constructs a new bungee action - * - * @param validValues - */ - FoBungeeAction(final Object... validValues) { - final Class<?>[] classes = new Class<?>[validValues.length]; - - for (int i = 0; i < classes.length; i++) { - final Object value = validValues[i]; - - classes[i] = value.getClass(); - } - - content = classes; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/SimpleBungee.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/SimpleBungee.java deleted file mode 100644 index 35b54d2db4796ceae9b4176f2c2dd997aa1529a3..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/SimpleBungee.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.mineacademy.fo.bungee; - -import java.lang.reflect.Constructor; - -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; - -import lombok.Getter; - -/** - * A unified way of combining Bungee channel, listener and action - */ -@Getter -public final class SimpleBungee { - - /** - * The channel - */ - private final String channel; - - /** - * The listener - */ - private final BungeeListener listener; - - /** - * The actions - */ - private final BungeeAction[] actions; - - /** - * Create a new simple bungee suite with the given channel, the given listener class and the given action as enum - * - * @param channel - * @param listenerClass - * @param actionEnum - */ - public SimpleBungee(String channel, Class<? extends BungeeListener> listenerClass, Class<? extends BungeeAction> actionEnum) { - this(channel, toListener(listenerClass), toAction(actionEnum)); - } - - private static BungeeListener toListener(Class<? extends BungeeListener> listenerClass) { - Valid.checkNotNull(listenerClass); - - try { - final Constructor<?> con = listenerClass.getConstructor(); - con.setAccessible(true); - - return (BungeeListener) con.newInstance(); - } catch (final ReflectiveOperationException ex) { - Common.log("Unable to create new instance of " + listenerClass + ", ensure constructor is public without parameters!"); - ex.printStackTrace(); - - return null; - } - } - - private static BungeeAction[] toAction(Class<? extends BungeeAction> actionEnum) { - Valid.checkNotNull(actionEnum); - Valid.checkBoolean(actionEnum.isEnum(), "Enum expected, given: " + actionEnum); - - try { - return (BungeeAction[]) actionEnum.getMethod("values").invoke(null); - - } catch (final ReflectiveOperationException ex) { - Common.log("Unable to get values() of " + actionEnum + ", ensure it is an enum!"); - ex.printStackTrace(); - - return null; - } - } - - /** - * Create a new bungee suite with the given params - * - * @param channel - * @param listener - * @param actions - */ - public SimpleBungee(String channel, BungeeListener listener, BungeeAction... actions) { - Valid.checkNotNull(channel, "Channel cannot be null!"); - - this.channel = channel; - this.listener = listener; - - Valid.checkNotNull(actions, "Actions cannot be null!"); - this.actions = actions; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/message/IncomingMessage.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/message/IncomingMessage.java deleted file mode 100644 index 7097332a9062962110c46ee8ccb74de3200efb86..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/message/IncomingMessage.java +++ /dev/null @@ -1,227 +0,0 @@ -package org.mineacademy.fo.bungee.message; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.util.UUID; - -import org.bukkit.entity.Player; -import org.mineacademy.fo.CompressUtil; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.bungee.BungeeAction; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.plugin.SimplePlugin; - -import com.google.common.io.ByteArrayDataInput; -import com.google.common.io.ByteStreams; - -import lombok.Getter; - -/** - * Represents an incoming plugin message. - * <p> - * NB: This uses the standardized Foundation model where the first - * string is the server name and the second string is the - * {@link BungeeAction} by its name *read automatically*. - */ -public final class IncomingMessage extends Message { - - /** - * The raw byte array to read from - */ - @Getter - private final byte[] data; - - /** - * The input we use to read our data array - */ - private final ByteArrayDataInput input; - - /** - * The internal stream - */ - private final ByteArrayInputStream stream; - - /** - * Create a new incoming message from the given array - * <p> - * NB: This uses the standardized Foundation model where the first - * string is the server name and the second string is the - * {@link BungeeAction} by its name *read automatically*. - * - * @param data - */ - public IncomingMessage(byte[] data) { - this.data = data; - this.stream = new ByteArrayInputStream(data); - this.input = ByteStreams.newDataInput(stream); - - // ----------------------------------------------------------------- - // We are automatically reading the first two strings assuming the - // first is the senders server name and the second is the action - // ----------------------------------------------------------------- - - // Read senders UUID - setSenderUid(input.readUTF()); - - // Read server name - setServerName(input.readUTF()); - - // Read action - setAction(input.readUTF()); - } - - /** - * Read a string from the data - * - * @return - */ - public String readString() { - moveHead(String.class); - - return CompressUtil.decompressB64(input.readUTF()); - } - - /** - * Read a UUID from the string data - * - * @return - */ - public UUID readUUID() { - moveHead(UUID.class); - - return UUID.fromString(input.readUTF()); - } - - /** - * Read a map from the string data if json - * - * @return - */ - public SerializedMap readMap() { - moveHead(String.class); - - return SerializedMap.fromJson(CompressUtil.decompressB64(input.readUTF())); - } - - /** - * Read an enumerator from the given string data - * - * @param <T> - * @param typeOf - * @return - */ - public <T extends Enum<T>> T readEnum(Class<T> typeOf) { - moveHead(typeOf); - - return ReflectionUtil.lookupEnum(typeOf, input.readUTF()); - } - - /** - * Read a boolean from the data - * - * @return - */ - public boolean readBoolean() { - moveHead(Boolean.class); - - return input.readBoolean(); - } - - /** - * Read a byte from the data - * - * @return - */ - public byte readByte() { - moveHead(Byte.class); - - return input.readByte(); - } - - /** - * Reads the rest of the bytes - * - * @return - */ - public byte[] readBytes() { - moveHead(byte[].class); - - final byte[] array = new byte[stream.available()]; - - try { - stream.read(array); - - } catch (final IOException e) { - e.printStackTrace(); - } - - return array; - } - - /** - * Read a double from the data - * - * @return - */ - public double readDouble() { - moveHead(Double.class); - - return input.readDouble(); - } - - /** - * Read a float from the data - * - * @return - */ - public float readFloat() { - moveHead(Float.class); - - return input.readFloat(); - } - - /** - * Read an integer from the data - * - * @return - */ - public int writeInt() { - moveHead(Integer.class); - - return input.readInt(); - } - - /** - * Read a long from the data - * - * @return - */ - public long readLong() { - moveHead(Long.class); - - return input.readLong(); - } - - /** - * Read a short from the data - * - * @return - */ - public short readShort() { - moveHead(Short.class); - - return input.readShort(); - } - - /** - * Forwards this message to a player - * - * @param connection - */ - public void forward(Player player) { - player.sendPluginMessage(SimplePlugin.getInstance(), getChannel(), data); - - Debugger.debug("bungee", "Forwarding data on " + getChannel() + " channel from " + getAction() + " as " + player.getName() + " player to BungeeCord."); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/message/Message.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/message/Message.java deleted file mode 100644 index 02e8ad5f396db5d4e6d19993cff312d6de12bee6..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/message/Message.java +++ /dev/null @@ -1,135 +0,0 @@ -package org.mineacademy.fo.bungee.message; - -import java.util.UUID; - -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.bungee.BungeeAction; -import org.mineacademy.fo.plugin.SimplePlugin; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * Represents a in/out message with a given action and server name - * and a safety check for writing/reading the data - * based on the action's content. - */ -@RequiredArgsConstructor(access = AccessLevel.PROTECTED) -abstract class Message { - - /** - * The UUID of the sender who initiated the packet, can be null - */ - @Getter - private UUID senderUid; - - /** - * The server name - */ - @Getter - private String serverName; - - /** - * The action - */ - private BungeeAction action; - - /** - * The current position of writing the data based on the - * {@link BungeeAction#getContent()} - */ - private int actionHead = 0; - - /** - * Set the sender UUID - * - * @param raw - */ - protected final void setSenderUid(String raw) { - if (raw != null) - try { - this.senderUid = UUID.fromString(raw); - } catch (final IllegalArgumentException ex) { - throw new IllegalArgumentException("Expected UUID, got " + raw + " for packet " + this.action + " from server " + this.serverName); - } - } - - /** - * Set the server name for this message, reason it is here: - * cannot read in the constructor in {@link OutgoingMessage} - * - * @param serverName - */ - protected final void setServerName(String serverName) { - Valid.checkBoolean(this.serverName == null, "Server name already set"); - Valid.checkNotNull(serverName, "Server name cannot be null!"); - - this.serverName = serverName; - } - - /** - * Set the action head for this message, reason it is here: - * static access in {@link OutgoingMessage} - * - * @param action - */ - protected final void setAction(String actionName) { - final BungeeAction action = BungeeAction.getByName(actionName); - - Valid.checkNotNull(action, "Unknown action named: " + actionName + ". Available: " + Common.join(SimplePlugin.getInstance().getBungeeCord().getActions())); - setAction(action); - } - - /** - * Set the action head for this message, reason it is here: - * static access in {@link OutgoingMessage} - * - * @param action - */ - protected final void setAction(BungeeAction action) { - Valid.checkBoolean(this.action == null, "Action already set"); - - this.action = action; - } - - /** - * Return the bungee action - * - * @param <T> - * @return - */ - public <T extends BungeeAction> T getAction() { - return (T) action; - } - - /** - * Ensures we are reading in the correct order as the given {@link BungeeAction} - * specifies in its {@link BungeeAction#getContent()} getter. - * <p> - * This also ensures we are reading the correct data type (both primitives and wrappers - * are supported). - * - * @param typeOf - */ - protected final void moveHead(Class<?> typeOf) { - Valid.checkNotNull(serverName, "Server name not set!"); - Valid.checkNotNull(action, "Action not set!"); - - final Class<?>[] content = action.getContent(); - Valid.checkBoolean(actionHead < content.length, "Head out of bounds! Max data size for " + action.name() + " is " + content.length); - - actionHead++; - } - - /** - * Return the bungee channel, always returns - * {@link SimplePlugin#getBungee()#getChannel()} - * - * @return - */ - public final String getChannel() { - return SimplePlugin.getInstance().getBungeeCord().getChannel(); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/message/OutgoingMessage.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/message/OutgoingMessage.java deleted file mode 100644 index f6c61883a47c6200ba17a8608a5042f11e8e164b..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/bungee/message/OutgoingMessage.java +++ /dev/null @@ -1,198 +0,0 @@ -package org.mineacademy.fo.bungee.message; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - -import org.bukkit.entity.Player; -import org.mineacademy.fo.CompressUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.bungee.BungeeAction; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.Remain; - -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; - -/** - * NB: This uses the standardized Foundation model where the first - * String is the server name and the second String is the - * {@link BungeeAction} by its name *written automatically*. - */ -public final class OutgoingMessage extends Message { - - /** - * The pending queue to write the message - */ - private final List<Object> queue = new ArrayList<>(); - - public OutgoingMessage(UUID senderUid, BungeeAction action) { - setSenderUid(senderUid.toString()); - setServerName(Remain.getServerName()); - setAction(action); - - // ----------------------------------------------------------------- - // We are automatically writing the first two strings assuming the - // first is the senders server name and the second is the action - // ----------------------------------------------------------------- - - queue.add(senderUid); - queue.add(getServerName()); - queue.add(getAction()); - } - - /** - * Write the given strings into the message - * - * @param messages - */ - public void writeString(String... messages) { - for (final String message : messages) - write(CompressUtil.compressB64(message), String.class); - } - - /** - * Write a boolean into the message - * - * @param bool - */ - public void writeBoolean(boolean bool) { - write(bool, Boolean.class); - } - - /** - * Write a byte into the message - * - * @param number - */ - public void writeByte(byte number) { - write(number, Byte.class); - } - - /** - * Write a double into the message - * - * @param number - */ - public void writeDouble(double number) { - write(number, Double.class); - } - - /** - * Write a float into the message - * - * @param number - */ - public void writeFloat(float number) { - write(number, Float.class); - } - - /** - * Write an integer into the message - * - * @param number - */ - public void writeInt(int number) { - write(number, Integer.class); - } - - /** - * Write a float into the message - * - * @param number - */ - public void writeLong(long number) { - write(number, Long.class); - } - - /** - * Write a short into the message - * - * @param number - */ - public void writeShort(short number) { - write(number, Short.class); - } - - /** - * Write an uuid into the message - * - * @param uuid - */ - public void writeUUID(UUID uuid) { - write(uuid, UUID.class); - } - - /** - * Write an object of the given type into the message - * <p> - * We move the head and ensure writing safety in accordance - * to the {@link BungeeAction#getContent()} length and - * data type at the given position - * - * @param object - * @param typeOf - */ - private void write(Object object, Class<?> typeOf) { - Valid.checkNotNull(object, "Added object must not be null!"); - - moveHead(typeOf); - queue.add(object); - } - - /** - * Send this message with the current data for the given player! - * - * @param connection - */ - public void send(Player player) { - player.sendPluginMessage(SimplePlugin.getInstance(), getChannel(), compileData()); - - Debugger.debug("bungee", "Sending data on " + getChannel() + " channel from " + getAction() + " as " + player.getName() + " player to BungeeCord."); - } - - /** - * Delegate write methods for the byte array data output - * based on the queue - * - * @return - */ - private byte[] compileData() { - final ByteArrayDataOutput out = ByteStreams.newDataOutput(); - - for (final Object object : queue) - if (object instanceof String) - out.writeUTF((String) object); - - else if (object instanceof Boolean) - out.writeBoolean((Boolean) object); - - else if (object instanceof Byte) - out.writeByte((Byte) object); - - else if (object instanceof Double) - out.writeDouble((Double) object); - - else if (object instanceof Float) - out.writeFloat((Float) object); - - else if (object instanceof Integer) - out.writeInt((Integer) object); - - else if (object instanceof Long) - out.writeLong((Long) object); - - else if (object instanceof Short) - out.writeShort((Short) object); - - else if (object instanceof byte[]) - out.write((byte[]) object); - - else - throw new FoException("Unsupported write of " + object.getClass().getSimpleName() + " to channel " + getChannel() + " with action " + getAction().toString()); - - return out.toByteArray(); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/SerializedMap.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/SerializedMap.java deleted file mode 100644 index bd17823a752fc446b6ea6ee10bc87e88dadb0958..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/SerializedMap.java +++ /dev/null @@ -1,1135 +0,0 @@ -package org.mineacademy.fo.collection; - -import java.lang.reflect.Constructor; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.UUID; -import java.util.function.BiConsumer; -import java.util.function.Function; - -import org.bukkit.Location; -import org.bukkit.configuration.MemorySection; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.inventory.ItemFlag; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.SerializeUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.Tuple; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompMaterial; - -import com.google.gson.Gson; - -import lombok.NonNull; - -/** - * Serialized map enables you to save and retain values from your - * configuration easily, such as locations, other maps or lists and - * much more. - */ -public final class SerializedMap extends StrictCollection { - - /** - * The Google Json instance - */ - private final static Gson gson = new Gson(); - - /** - * The internal map with values - */ - private final StrictMap<String, Object> map = new StrictMap<>(); - - /** - * Should we remove entries on get for this map instance, - */ - private boolean removeOnGet = false; - - /** - * Creates a new serialized map with the given first key-value pair - * - * @param key - * @param value - */ - private SerializedMap(final String key, final Object value) { - this(); - - put(key, value); - } - - public SerializedMap() { - super("Cannot remove '%s' as it is not in the map!", "Value '%s' is already in the map!"); - } - - /** - * Put key-value pairs from another map into this map - * <p> - * If the key already exist, it is ignored - * - * @param anotherMap - */ - public void mergeFrom(final SerializedMap anotherMap) { - for (final Map.Entry<String, Object> entry : anotherMap.entrySet()) { - final String key = entry.getKey(); - final Object value = entry.getValue(); - - if (key != null && value != null && !this.map.contains(key)) - this.map.put(key, value); - } - } - - /** - * @see Map#containsKey(Object) - */ - public boolean containsKey(final String key) { - return map.contains(key); - } - - /** - * Puts a key:value pair into the map only if the values are not null - * - * @param associativeArray - */ - public SerializedMap putArray(final Object... associativeArray) { - boolean string = true; - String lastKey = null; - - for (final Object obj : associativeArray) { - if (string) { - Valid.checkBoolean(obj instanceof String, "Expected String at " + obj + ", got " + obj.getClass().getSimpleName()); - - lastKey = (String) obj; - - } else - map.override(lastKey, obj); - - string = !string; - } - - return this; - } - - /** - * Add another map to this map - * - * @param anotherMap - */ - public SerializedMap put(@NonNull SerializedMap anotherMap) { - map.putAll(anotherMap.asMap()); - - return this; - } - - /** - * Puts the key-value pair into the map if the value is true - * - * @param key - * @param value - */ - public void putIfTrue(final String key, final boolean value) { - if (value) - put(key, value); - } - - /** - * Puts the key-value pair into the map if the value is not null - * - * @param key - * @param value - */ - public void putIfExist(final String key, final Object value) { - if (value != null) - put(key, value); - } - - /** - * Puts the map into this map if not null and not empty - * - * This will put a NULL value into the map if the value is null - * - * @param key - * @param value - */ - public void putIf(final String key, final Map<?, ?> value) { - if (value != null && !value.isEmpty()) - put(key, value); - - // This value is undesirable to save if null, so if YamlConfig is used - // it will remove it from the config - else - map.getSource().put(key, null); - } - - /** - * Puts the collection into map if not null and not empty - * - * This will put a NULL value into the map if the value is null - * - * @param key - * @param value - */ - public void putIf(final String key, final Collection<?> value) { - if (value != null && !value.isEmpty()) - put(key, value); - - // This value is undesirable to save if null, so if YamlConfig is used - // it will remove it from the config - else - map.getSource().put(key, null); - } - - /** - * Puts the boolean into map if true - * - * This will put a NULL value into the map if the value is null - * - * @param key - * @param value - */ - public void putIf(final String key, final boolean value) { - if (value) - put(key, value); - - // This value is undesirable to save if null, so if YamlConfig is used - // it will remove it from the config - else - map.getSource().put(key, null); - } - - /** - * Puts the value into map if not null - * - * This will put a NULL value into the map if the value is null - * - * @param key - * @param value - */ - public void putIf(final String key, final Object value) { - if (value != null) - put(key, value); - - // This value is undesirable to save if null, so if YamlConfig is used - // it will remove it from the config - else - map.getSource().put(key, null); - } - - /** - * Puts a new key-value pair in the map, failing if the value is null - * or if the old key exists - * - * @param key - * @param value - */ - public void put(final String key, final Object value) { - Valid.checkNotNull(value, "Value with key '" + key + "' is null!"); - - map.put(key, value); - } - - /** - * Puts a new key-value pair in the map, failing if key is null - * and replacing the old key if exist - * - * @param key - * @param value - */ - public void override(final String key, final Object value) { - Valid.checkNotNull(value, "Value with key '" + key + "' is null!"); - - map.override(key, value); - } - - /** - * Overrides all map values - * - * @param map - */ - public void overrideAll(SerializedMap map) { - map.forEach((key, value) -> override(key, value)); - } - - /** - * Remove the given key, returning null if not set - * - * @param key - * @return - */ - public Object removeWeak(final String key) { - return map.removeWeak(key); - } - - /** - * Remove the given key, throwing error if not set - * - * @param key - * @return - */ - public Object remove(final String key) { - return map.remove(key); - } - - /** - * Remove a given key by value - * - * @param value - */ - public void removeByValue(final Object value) { - map.removeByValue(value); - } - - /** - * Returns a string from the map, or null if does not exist - * - * @param key - * @return - */ - public String getString(final String key) { - return getString(key, null); - } - - /** - * Returns a string from the map, with an optional default - * - * @param key - * @param def - * @return - */ - public String getString(final String key, final String def) { - return get(key, String.class, def); - } - - /** - * Returns a UUID from the map, or null if does not exist - * - * @param key - * @return - */ - public UUID getUUID(final String key) { - return getUUID(key, null); - } - - /** - * Returns a UUID from the map, with an optional default - * - * @param key - * @param def - * @return - */ - public UUID getUUID(final String key, final UUID def) { - return get(key, UUID.class, def); - } - - /** - * Returns a location from the map, or null if does not exist - * - * @param key - * @return - */ - public Location getLocation(final String key) { - return get(key, org.bukkit.Location.class, null); - } - - /** - * Returns a long from the map, or null if does not exist - * - * @param key - * @return - */ - public Long getLong(final String key) { - return getLong(key, null); - } - - /** - * Return the long value or default - * - * @param key - * @param def - * @return - */ - public Long getLong(final String key, final Long def) { - final Number n = get(key, Long.class, def); - - return n != null ? n.longValue() : null; - } - - /** - * Returns an integer from the map, or null if does not exist - * - * @param key - * @return - */ - public Integer getInteger(final String key) { - return getInteger(key, null); - } - - /** - * Return the integer key or default - * - * @param key - * @param def - * @return - */ - public Integer getInteger(final String key, final Integer def) { - return get(key, Integer.class, def); - } - - /** - * Returns a double from the map, or null if does not exist - * - * @param key - * @return - */ - public Double getDouble(final String key) { - return getDouble(key, null); - } - - /** - * Return the double key or default - * - * @param key - * @param def - * @return - */ - public Double getDouble(final String key, final Double def) { - return get(key, Double.class, def); - } - - /** - * Returns a float from the map, or null if does not exist - * - * @param key - * @return - */ - public Float getFloat(final String key) { - return getFloat(key, null); - } - - /** - * Return the float key or default - * - * @param key - * @param def - * @return - */ - public Float getFloat(final String key, final Float def) { - return get(key, Float.class, def); - } - - /** - * Returns a boolean from the map, or null if does not exist - * - * @param key - * @return - */ - public Boolean getBoolean(final String key) { - return getBoolean(key, null); - } - - /** - * Return the boolean key or default - * - * @param key - * @param def - * @return - */ - public Boolean getBoolean(final String key, final Boolean def) { - return get(key, Boolean.class, def); - } - - /** - * Returns a material from the map, or null if does not exist - * - * @param key - * @return - */ - public CompMaterial getMaterial(final String key) { - return getMaterial(key, null); - } - - /** - * Return a material from the map or the default given - * - * @param key - * @param def - * @return - */ - public CompMaterial getMaterial(final String key, final CompMaterial def) { - final String raw = getString(key); - - return raw != null ? CompMaterial.fromString(raw) : def; - } - - /** - * Returns an itemstack from the map, or null if does not exist - * - * @param key - * @return - */ - public ItemStack getItem(final String key) { - return getItem(key, null); - } - - /** - * Return an itemstack at the key position or default - * - * @param key - * @param def - * @return - */ - public ItemStack getItem(final String key, final ItemStack def) { - final Object obj = get(key, Object.class, null); - - if (obj == null) - return def; - - if (obj instanceof ItemStack) - return (ItemStack) obj; - - final Map<String, Object> map = (Map<String, Object>) obj; - final ItemStack item = ItemStack.deserialize(map); - - final Object raw = map.get("meta"); - - if (raw != null) - if (raw instanceof ItemMeta) - item.setItemMeta((ItemMeta) raw); - - else if (raw instanceof Map) { - final Map<String, Object> meta = (Map<String, Object>) raw; - - try { - final Class<?> cl = ReflectionUtil.getOBCClass("inventory." + (meta.containsKey("spawnedType") ? "CraftMetaSpawnEgg" : "CraftMetaItem")); - final Constructor<?> c = cl.getDeclaredConstructor(Map.class); - c.setAccessible(true); - - final Object craftMeta = c.newInstance((Map<String, ?>) raw); - - if (craftMeta instanceof ItemMeta) - item.setItemMeta((ItemMeta) craftMeta); - - } catch (final Throwable t) { - - // We have to manually deserialize metadata :( - final ItemMeta itemMeta = item.getItemMeta(); - - final String display = meta.containsKey("display-name") ? (String) meta.get("display-name") : null; - - if (display != null) - itemMeta.setDisplayName(display); - - final List<String> lore = meta.containsKey("lore") ? (List<String>) meta.get("lore") : null; - - if (lore != null) - itemMeta.setLore(lore); - - final SerializedMap enchants = meta.containsKey("enchants") ? SerializedMap.of(meta.get("enchants")) : null; - - if (enchants != null) - for (final Map.Entry<String, Object> entry : enchants.entrySet()) { - final Enchantment enchantment = Enchantment.getByName(entry.getKey()); - final int level = (int) entry.getValue(); - - itemMeta.addEnchant(enchantment, level, true); - } - - final List<String> itemFlags = meta.containsKey("ItemFlags") ? (List<String>) meta.get("ItemFlags") : null; - - if (itemFlags != null) - for (final String flag : itemFlags) - try { - itemMeta.addItemFlags(ItemFlag.valueOf(flag)); - } catch (final Exception ex) { - // Likely not MC compatible, ignore - } - - Common.log( - "**************** NOTICE ****************", - SimplePlugin.getNamed() + " manually deserialized your item.", - "Item: " + item, - "This is ONLY supported for basic items, items having", - "special flags like monster eggs will NOT function."); - - item.setItemMeta(itemMeta); - } - } - - return item; - } - - /** - * Return a tuple - * - * @param <K> - * @param <V> - * @param key - * @return - */ - public <K, V> Tuple<K, V> getTuple(final String key) { - return getTuple(key, null); - } - - /** - * Return a tuple or default - * - * @param key - * @param def - * @return - */ - public <K, V> Tuple<K, V> getTuple(final String key, final Tuple<K, V> def) { - return get(key, Tuple.class, def); - } - - /** - * Returns a string list from the map, or null if does not exist - * - * @param key - * @return - */ - public List<String> getStringList(final String key) { - return getStringList(key, null); - } - - /** - * Return string list or default - * - * @param key - * @param def - * @return - */ - public List<String> getStringList(final String key, final List<String> def) { - final List<String> list = getList(key, String.class); - - return list == null ? def : list; - } - - /** - * Return a list of serialized maps or null if not set - * - * @param key - * @return - */ - public List<SerializedMap> getMapList(final String key) { - return getList(key, SerializedMap.class); - } - - /** - * @param <T> - * @param key - * @param type - * @return - * @see #getList(String, Class), except that this method - * never returns null, instead, if the key is not present, - * we return an empty list instead of null - */ - public <T> List<T> getListSafe(final String key, final Class<T> type) { - final List<T> list = getList(key, type); - - return Common.getOrDefault(list, new ArrayList<>()); - } - - /** - * @param <T> - * @param key - * @param type - * @return - * @see #getList(String, Class), except that this method - * never returns null, instead, if the key is not present, - * we return an empty set instead of null - */ - public <T> Set<T> getSetSafe(final String key, final Class<T> type) { - final Set<T> list = getSet(key, type); - - return Common.getOrDefault(list, new HashSet<>()); - } - - /** - * @param <T> - * @param key - * @param type - * @return - * @see #getList(String, Class) - */ - public <T> Set<T> getSet(final String key, final Class<T> type) { - final List<T> list = getList(key, type); - - return list == null ? null : new HashSet<>(list); - } - - /** - * Return a list of objects of the given type - * <p> - * If the type is your own class make sure to put public static deserialize(SerializedMap) - * method into it that returns the class object from the map! - * - * @param <T> - * @param key - * @param type - * @return - */ - public <T> List<T> getList(final String key, final Class<T> type) { - final List<T> list = new ArrayList<>(); - - if (!map.contains(key)) - return list; - - final Object rawList = this.removeOnGet ? map.removeWeak(key) : map.get(key); - - // Forgive if string used instead of string list - if (type == String.class && rawList instanceof String) { - list.add((T) rawList); - - } else { - Valid.checkBoolean(rawList instanceof List, "Key '" + key + "' expected to have a list, got " + rawList.getClass().getSimpleName() + " instead! Try putting '' quotes around the message!"); - - for (final Object object : (List<Object>) rawList) - list.add(object == null ? null : SerializeUtil.deserialize(type, object)); - } - - return list; - } - - /** - * Returns a serialized map (String-Object pairs) from the map, or null if does not exist - * - * @param key - * @return - */ - public SerializedMap getMap(final String key) { - final Object raw = get(key, Object.class); - - return raw != null ? SerializedMap.of(Common.getMapFromSection(raw)) : new SerializedMap(); - } - - /** - * Load a map with preserved order from the given path. Each key in the map - * must match the given key/value type and will be deserialized - * <p> - * We will add defaults if applicable - * - * @param <Key> - * @param <Value> - * @param path - * @param keyType - * @param valueType - * @param valueParameter - * @return - */ - public <Key, Value> LinkedHashMap<Key, Value> getMap(@NonNull String path, final Class<Key> keyType, final Class<Value> valueType) { - // The map we are creating, preserve order - final LinkedHashMap<Key, Value> map = new LinkedHashMap<>(); - final Object raw = this.map.get(path); - - if (raw != null) { - Valid.checkBoolean(raw instanceof Map || raw instanceof MemorySection, "Expected Map<" + keyType.getSimpleName() + ", " + valueType.getSimpleName() + "> at " + path + ", got " + raw.getClass()); - - for (final Entry<?, ?> entry : Common.getMapFromSection(raw).entrySet()) { - final Key key = SerializeUtil.deserialize(keyType, entry.getKey()); - final Value value = SerializeUtil.deserialize(valueType, entry.getValue()); - - // Ensure the pair values are valid for the given paramenters - checkAssignable(path, key, keyType); - checkAssignable(path, value, valueType); - - map.put(key, value); - } - } - - return map; - } - - /** - * Load a map having a Set as value with the given parameters - * - * @param <Key> - * @param <Value> - * @param path - * @param keyType - * @param setType - * @return - */ - public <Key, Value> LinkedHashMap<Key, Set<Value>> getMapSet(@NonNull String path, final Class<Key> keyType, final Class<Value> setType) { - // The map we are creating, preserve order - final LinkedHashMap<Key, Set<Value>> map = new LinkedHashMap<>(); - Object raw = this.map.get(path); - - if (raw != null) { - - if (raw instanceof MemorySection) - raw = Common.getMapFromSection(raw); - - Valid.checkBoolean(raw instanceof Map, "Expected Map<" + keyType.getSimpleName() + ", Set<" + setType.getSimpleName() + ">> at " + path + ", got " + raw.getClass()); - - for (final Entry<?, ?> entry : ((Map<?, ?>) raw).entrySet()) { - final Key key = SerializeUtil.deserialize(keyType, entry.getKey()); - final List<Value> value = SerializeUtil.deserialize(List.class, entry.getValue()); - - // Ensure the pair values are valid for the given paramenters - checkAssignable(path, key, keyType); - - if (!value.isEmpty()) - for (final Value item : value) - checkAssignable(path, item, setType); - - map.put(key, new HashSet<>(value)); - } - } - - return map; - } - - /* - * Checks if the clazz parameter can be assigned to the given value - */ - private void checkAssignable(final String path, final Object value, final Class<?> clazz) { - if (!clazz.isAssignableFrom(value.getClass()) && !clazz.getSimpleName().equals(value.getClass().getSimpleName())) - throw new FoException("Malformed map! Key '" + path + "' in the map must be " + clazz.getSimpleName() + " but got " + value.getClass().getSimpleName() + ": '" + value + "'"); - } - - /** - * Return an object at the given location - * - * @param key - * @return - */ - public Object getObject(final String key) { - return get(key, Object.class); - } - - /** - * Return an object at the given location, or default if it does not exist - * - * @param key - * @param def - * @return - */ - public Object getObject(final String key, final Object def) { - return get(key, Object.class, def); - } - - /** - * Returns a key and attempts to deserialize it as the given type - * - * @param <T> - * @param key - * @param type - * @return - */ - public <T> T get(final String key, final Class<T> type) { - return get(key, type, null); - } - - /** - * Returns the key and attempts to deserialize it as the given type, with a default value - * - * @param <T> - * @param key - * @param type - * @param def - * @return - */ - public <T> T get(final String key, final Class<T> type, final T def) { - Object raw = removeOnGet ? map.removeWeak(key) : map.get(key); - - // Try to get the value by key with ignoring case - if (raw == null) - raw = getValueIgnoreCase(key); - - // Assume empty means default for enumerations - if ("".equals(raw) && Enum.class.isAssignableFrom(type)) - return def; - - return raw == null ? def : SerializeUtil.deserialize(type, raw, key); - } - - /** - * Looks up a value by the string key, case ignored - * - * @param key - * @return - */ - public Object getValueIgnoreCase(final String key) { - for (final Entry<String, Object> e : map.entrySet()) - if (e.getKey().equalsIgnoreCase(key)) - return e.getValue(); - - return null; - } - - /** - * @see Map#forEach(BiConsumer) - */ - public void forEach(final BiConsumer<String, Object> consumer) { - for (final Entry<String, Object> e : map.entrySet()) - consumer.accept(e.getKey(), e.getValue()); - } - - /** - * Return the first entry or null if map is empty - * - * @return - */ - public Map.Entry<String, Object> firstEntry() { - return isEmpty() ? null : map.getSource().entrySet().iterator().next(); - } - - /** - * @see Map#keySet() - */ - public Set<String> keySet() { - return map.keySet(); - } - - /** - * @see Map#values() - */ - public Collection<Object> values() { - return map.values(); - } - - /** - * @see Map#entrySet() - */ - public Set<Entry<String, Object>> entrySet() { - return map.entrySet(); - } - - /** - * @see Map#size() - */ - public int size() { - return map.size(); - } - - /** - * Get the Java map representation - * - * @return - */ - public Map<String, Object> asMap() { - return map.getSource(); - } - - /** - * Convert this map into a serialized one (again, but iterating through each pair as well) - */ - @Override - public Object serialize() { - return map.serialize(); - } - - /** - * Converts this map into a JSON string - * - * @return - */ - public String toJson() { - final Object map = serialize(); - - try { - return gson.toJson(map); - - } catch (final Throwable t) { - Common.error(t, "Failed to serialize to json, data: " + map); - - return "{}"; - } - } - - /** - * @see Map#isEmpty() - */ - public boolean isEmpty() { - return map.isEmpty(); - } - - /** - * Automatically convert a section within this map from one type to another - * - * @param <O> - * @param <N> - * @param path - * @param from - * @param to - * @param converter - */ - public <O, N> void convert(final String path, final Class<O> from, final Class<N> to, final Function<O, N> converter) { - final Object old = getObject(path); - - if (old != null) - // If the old is a collection check if the first value is old, assume the rest is old as well - if (old instanceof Collection) { - final Collection<?> collection = (Collection<?>) old; - - if (collection.isEmpty() || !from.isAssignableFrom(collection.iterator().next().getClass())) - return; - - final List<N> newCollection = new ArrayList<>(); - - for (final O oldItem : (Collection<O>) collection) - newCollection.add(converter.apply(oldItem)); - - override(path, newCollection); - - Common.logNoPrefix("[" + SimplePlugin.getNamed() + "] Converted '" + path + "' from " + from.getSimpleName() + "[] to " + to.getSimpleName() + "[]"); - - } else if (from.isAssignableFrom(old.getClass())) { - override(path, converter.apply((O) old)); - - Common.logNoPrefix("[" + SimplePlugin.getNamed() + "] Converted '" + path + "' from '" + from.getSimpleName() + "' to '" + to.getSimpleName() + "'"); - } - } - - /** - * Convert the key pairs into formatted string such as { - * "key" = "value" - * "another" = "value2" - * ... - * } - * - * @return - */ - public String toStringFormatted() { - final Map<?, ?> map = (Map<?, ?>) serialize(); - final List<String> lines = new ArrayList<>(); - - lines.add("{"); - - for (final Map.Entry<?, ?> entry : map.entrySet()) { - final Object value = entry.getValue(); - - if (value != null && !value.toString().equals("[]") && !value.toString().equals("{}") && !value.toString().isEmpty() && !value.toString().equals("0.0") && !value.toString().equals("false")) - lines.add("\t'" + entry.getKey() + "' = '" + entry.getValue() + "'"); - } - - lines.add("}"); - - return String.join("\n", lines); - } - - /** - * @param removeOnGet the removeOnGet to set - */ - public void setRemoveOnGet(boolean removeOnGet) { - this.removeOnGet = removeOnGet; - } - - @Override - public String toString() { - return serialize().toString(); - } - - // ---------------------------------------------------------------------------------------------------- - // Static - // ---------------------------------------------------------------------------------------------------- - - /** - * Create a new map with the first key-value pair - * - * @param key - * @param value - * @return - */ - public static SerializedMap of(final String key, final Object value) { - return new SerializedMap(key, value); - } - - /** - * Create new serialized map from key-value pairs like you would in PHP: - * <p> - * array( - * "name" => value, - * "name2" => value2, - * ) - * <p> - * Except now you just use commas instead of =>'s - * - * @param array - * @return - */ - public static SerializedMap ofArray(final Object... array) { - - // If the first argument is a map already, treat as such - if (array != null && array.length == 1) { - final Object firstArgument = array[0]; - - if (firstArgument instanceof SerializedMap) - return (SerializedMap) firstArgument; - - if (firstArgument instanceof Map) - return SerializedMap.of((Map<String, Object>) firstArgument); - - if (firstArgument instanceof StrictMap) - return SerializedMap.of(((StrictMap<String, Object>) firstArgument).getSource()); - } - - final SerializedMap map = new SerializedMap(); - map.putArray(array); - - return map; - } - - /** - * Parses the given object into Serialized map - * - * @param object - * @return the serialized map, or an empty map if object could not be parsed - */ - public static SerializedMap of(final Object object) { - if (object instanceof SerializedMap) - return (SerializedMap) object; - - if (object instanceof Map || object instanceof MemorySection) - return of(Common.getMapFromSection(object)); - - return new SerializedMap(); - } - - /** - * Converts the given Map into a serializable map - * - * @param map - * @return - */ - public static SerializedMap of(final Map<String, Object> map) { - final SerializedMap serialized = new SerializedMap(); - - serialized.map.clear(); - serialized.map.putAll(map); - - return serialized; - } - - /** - * Attempts to parse the given JSON into a serialized map - * <p> - * Values are not deserialized right away, they are converted - * when you call get() functions - * - * @param json - * @return - */ - public static SerializedMap fromJson(final String json) { - final SerializedMap serializedMap = new SerializedMap(); - - try { - final Map<String, Object> map = gson.fromJson(json, Map.class); - - serializedMap.map.putAll(map); - - } catch (final Throwable t) { - Common.throwError(t, "Failed to parse JSON from " + json); - } - - return serializedMap; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/StrictCollection.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/StrictCollection.java deleted file mode 100644 index 598b686e315bb321e8898b3eaa530cc663489ad2..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/StrictCollection.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.mineacademy.fo.collection; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * Strict collection does not allow adding duplicate elements, - * and throw an error when you attempt to remove a non-existing element from - * list/map. - */ -@Getter(value = AccessLevel.PROTECTED) -@RequiredArgsConstructor -public abstract class StrictCollection { - - /** - * The error message when removing non-existing keys - */ - private final String cannotRemoveMessage; - - /** - * The error message when adding duplicate keys - */ - private final String cannotAddMessage; - - /** - * Convert this object into something that can be safely stored in a settings file - * - * @return - */ - public abstract Object serialize(); -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/StrictList.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/StrictList.java deleted file mode 100644 index d375482427476b1ba77ac592b4db1b27e7cbf916..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/StrictList.java +++ /dev/null @@ -1,334 +0,0 @@ -package org.mineacademy.fo.collection; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.lang.StringUtils; -import org.mineacademy.fo.SerializeUtil; -import org.mineacademy.fo.Valid; - -/** - * Strict list that only allows to remove elements that are contained within, or add elements that are not. - * <p> - * Failing to do so results in an error, with optional error message. - */ -public final class StrictList<E> extends StrictCollection implements Iterable<E> { - - /** - * The internal list - */ - private final List<E> list = new ArrayList<>(); - - /** - * Create a new list of the given elements - * - * @param elements - */ - @SafeVarargs - public StrictList(E... elements) { - this(); - - addAll(Arrays.asList(elements)); - } - - /** - * Create a new list of the given elements - * - * @param oldList - */ - public StrictList(Iterable<E> oldList) { - this(); - - addAll(oldList); - } - - /** - * Create a new empty list - */ - public StrictList() { - super("Cannot remove '%s' as it is not in the list!", "Value '%s' is already in the list!"); - } - - /** - * Return the default Java {@link ArrayList} - * - * @return - */ - public List<E> getSource() { - return list; - } - - // ------------------------------------------------------------------------------------------------------------ - // Methods below trigger strict checks - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return value at the given index and remove it immediatelly - * - * @param index - * @return - */ - public E getAndRemove(int index) { - final E e = list.get(index); - remove(index); - - return e; - } - - /** - * Remove the given key - * - * @param key - */ - public void remove(E key) { - final boolean removed = removeWeak(key); - - Valid.checkBoolean(removed, String.format(getCannotRemoveMessage(), key)); - } - - /** - * Remove the key at the given index - * - * @param index - * @return - */ - public E remove(int index) { - final E removed = list.remove(index); - - Valid.checkNotNull(removed, String.format(getCannotRemoveMessage(), "index: " + index)); - return removed; - } - - /** - * Add the given elements - * - * @param elements - */ - public void addAll(Iterable<E> elements) { - for (final E key : elements) - add(key); - } - - /** - * Add the element if it does not exist - * - * @param key - */ - public void addIfNotExist(E key) { - if (!contains(key)) - add(key); - } - - /** - * Add the element to the list - * - * @param key - */ - public void add(E key) { - Valid.checkNotNull(key, "Cannot add null values"); - Valid.checkBoolean(!list.contains(key), String.format(getCannotAddMessage(), key)); - - addWeak(key); - } - - /** - * Creates a copy of the list from the starting index - * - * @param startIndex - * @return - */ - public StrictList<E> range(int startIndex) { - Valid.checkBoolean(startIndex <= list.size(), "Start index out of range " + startIndex + " vs. list size " + list.size()); - final StrictList<E> ranged = new StrictList<>(); - - for (int i = startIndex; i < list.size(); i++) - ranged.add(list.get(i)); - - return ranged; - } - - // ------------------------------------------------------------------------------------------------------------ - // Methods without throwing errors below - // ------------------------------------------------------------------------------------------------------------ - - /** - * Remove the given key without throwing error if it does note exist - * - * @param value - * @return - */ - public boolean removeWeak(E value) { - Valid.checkNotNull(value, "Cannot remove null values"); - - return list.remove(value); - } - - /** - * Add all keys even if they exist - * - * @param keys - */ - public void addWeakAll(Iterable<E> keys) { - for (final E key : keys) - addWeak(key); - } - - /** - * Add the given key at the end of the list regardless if it already exist - * - * @param key - */ - public void addWeak(E key) { - list.add(key); - } - - /** - * Set a key to the certain index - * - * @param index - * @param key - */ - public void set(int index, E key) { - list.set(index, key); - } - - /** - * Return the value or the default - * - * @param index - * @param def - * @return - */ - public E getOrDefault(int index, E def) { - return index < list.size() ? list.get(index) : def; - } - - /** - * Return the value at given index - * - * @param index - * @return - */ - public E get(int index) { - return list.get(index); - } - - /** - * Return true if the list contains the key - * - * If the key is string we return true if it contains ignore case - * - * @param key - * @return - */ - public boolean contains(E key) { - for (final E other : list) { - if (other instanceof String && key instanceof String) - if (((String) other).equalsIgnoreCase((String) key)) - return true; - - if (other.equals(key)) - return true; - } - - return false; - } - - /** - * Returns a view of the portion of this list between the specified fromIndex, - * inclusive, and toIndex, exclusive. (If fromIndex and toIndex are equal, - * the returned list is empty.) The returned list is backed by this list, - * so non-structural changes in the returned list are reflected in this list, - * and vice-versa.The returned list supports all of the optional list operations - * supported by this list. - * - * @param fromIndex - * @param toIndex - * @return - */ - public List<E> subList(int fromIndex, int toIndex) { - return list.subList(fromIndex, toIndex); - } - - /** - * Remove every single piece of that list! - */ - public void clear() { - list.clear(); - } - - /** - * Return true if the list is empty - * - * @return - */ - public boolean isEmpty() { - return list.isEmpty(); - } - - /** - * Get the list size - * - * @return - */ - public int size() { - return list.size(); - } - - /** - * Return all list values together split by the given separator - * - * @param separator - * @return - */ - public String join(String separator) { - return StringUtils.join(list, separator); - } - - /** - * See {@link List#toArray()} - * - * @param e - * @return - */ - public E[] toArray(E[] e) { - return list.toArray(e); - } - - /** - * Return {@link List#toArray()} - * - * @return - */ - public Object[] toArray() { - return list.toArray(); - } - - /** - * See {@link List#iterator()} - */ - @Override - public Iterator<E> iterator() { - return list.iterator(); - } - - /** - * Serializes every value in the list so you can store it in your settings - */ - @Override - public Object serialize() { - return SerializeUtil.serialize(list); - } - - /** - * Returns string representation of this list - * <p> - * NB: For saving in files call {@link #serialize()} - */ - @Override - public String toString() { - return list.toString(); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/StrictMap.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/StrictMap.java deleted file mode 100644 index 85a15869298c1a061f37b05cdd6bff354ee0c8d2..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/StrictMap.java +++ /dev/null @@ -1,332 +0,0 @@ -package org.mineacademy.fo.collection; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.function.BiConsumer; - -import org.mineacademy.fo.SerializeUtil; -import org.mineacademy.fo.Valid; - -/** - * Strict map that only allows to remove elements that are contained within, or add elements that are not. - * <p> - * Failing to do so results in an error, with optional error message. - */ -public final class StrictMap<E, T> extends StrictCollection { - - /** - * The internal map holding value-key pairs - */ - private final Map<E, T> map = new LinkedHashMap<>(); - - /** - * Create a new strict map - */ - public StrictMap() { - super("Cannot remove '%s' as it is not in the map!", "Key '%s' is already in the map --> '%s'"); - } - - /** - * Create a new strict map with custom already exist/not exists error messages - * - * @param removeMessage - * @param addMessage - */ - public StrictMap(String removeMessage, String addMessage) { - super(removeMessage, addMessage); - } - - /** - * Create a new strict map from the given old map - * - * @param copyOf - */ - public StrictMap(Map<E, T> copyOf) { - this(); - - putAll(copyOf); - } - - // ------------------------------------------------------------------------------------------------------------ - // Methods below trigger strict checks - // ------------------------------------------------------------------------------------------------------------ - - /** - * Remove the first given element from map from value, failing if not exists - * - * @param value - */ - public void removeByValue(T value) { - for (final Entry<E, T> e : map.entrySet()) - if (e.getValue().equals(value)) { - map.remove(e.getKey()); - return; - } - - throw new NullPointerException(String.format(getCannotRemoveMessage(), value)); - } - - /** - * Remove all keys failing if one or more are not contained - * - * @param keys - * @return - */ - public Object[] removeAll(Collection<E> keys) { - final List<T> removedKeys = new ArrayList<>(); - - for (final E key : keys) - removedKeys.add(remove(key)); - - return removedKeys.toArray(); - } - - /** - * Remove the given element from map from key, failing if not exists - * - * @param key - * @return - */ - public T remove(E key) { - final T removed = removeWeak(key); - Valid.checkNotNull(removed, String.format(getCannotRemoveMessage(), key)); - - return removed; - } - - /** - * Put a new pair in the map, failing if key already exists - * - * @param key - * @param value - */ - public void put(E key, T value) { - Valid.checkBoolean(!map.containsKey(key), String.format(getCannotAddMessage(), key, map.get(key))); - - override(key, value); - } - - /** - * Put the given map into this one, failing if a key already exists - * - * @param m - */ - public void putAll(Map<? extends E, ? extends T> m) { - for (final Map.Entry<? extends E, ? extends T> e : m.entrySet()) - Valid.checkBoolean(!map.containsKey(e.getKey()), String.format(getCannotAddMessage(), e.getKey(), map.get(e.getKey()))); - - override(m); - } - - // ------------------------------------------------------------------------------------------------------------ - // Methods without throwing errors below - // ------------------------------------------------------------------------------------------------------------ - - /** - * Remove the given value, or do nothing if not contained - * - * @param value - * @return - */ - public T removeWeak(E value) { - return map.remove(value); - } - - /** - * Put a new pair into the map, overriding old one - * - * @param key - * @param value - */ - public void override(E key, T value) { - map.put(key, value); - } - - /** - * Put new pairs into the map, overriding old one - * - * @param m - */ - public void override(Map<? extends E, ? extends T> m) { - map.putAll(m); - } - - /** - * Return the key as normal if exists or put it there and return it. - * - * @param key - * @param defaultToPut - * @return - */ - public T getOrPut(E key, T defaultToPut) { - if (contains(key)) - return get(key); - - put(key, defaultToPut); - return defaultToPut; - } - - /** - * Return the first key by value or null if not found - * - * @param value - * @return - */ - public E getKeyFromValue(T value) { - for (final Entry<E, T> e : map.entrySet()) - if (e.getValue().equals(value)) - return e.getKey(); - - return null; - } - - /** - * Get the first key or null if none - * - * @return - */ - public E getFirstKey() { - return map.isEmpty() ? null : map.keySet().iterator().next(); - } - - /** - * Return the key from the map, or null if not set - */ - public T get(E key) { - return map.get(key); - } - - /** - * Return the key from the map or the default param if not set - * - * @param key - * @param def - * @return - */ - public T getOrDefault(E key, T def) { - return map.getOrDefault(key, def); - } - - /** - * Return true if key is not null and contained - * - * @param key - * @return - */ - public boolean contains(E key) { - return key == null ? false : map.containsKey(key); - } - - /** - * Return true if value is not null and contained - * - * @param value - * @return - */ - public boolean containsValue(T value) { - return value == null ? false : map.containsValue(value); - } - - /** - * Do the given action for each pair - * - * @param consumer - */ - public void forEachIterate(BiConsumer<E, T> consumer) { - for (final Iterator<Map.Entry<E, T>> it = entrySet().iterator(); it.hasNext();) { - final Map.Entry<E, T> entry = it.next(); - - consumer.accept(entry.getKey(), entry.getValue()); - } - } - - /** - * Get the map entries - * - * @return - */ - public Set<Entry<E, T>> entrySet() { - return map.entrySet(); - } - - /** - * Get map keys - * - * @return - */ - public Set<E> keySet() { - return map.keySet(); - } - - /** - * Get map values - * - * @return - */ - public Collection<T> values() { - return map.values(); - } - - /** - * Clear the map - */ - public void clear() { - map.clear(); - } - - /** - * Return true if map is empty - * - * @return - */ - public boolean isEmpty() { - return map.isEmpty(); - } - - /** - * Return the original Java map - * - * @return - */ - public Map<E, T> getSource() { - return map; - } - - /** - * Return the map size - * - * @return - */ - public int size() { - return map.size(); - } - - @Override - public Object serialize() { - if (!map.isEmpty()) { - final Map<Object, Object> copy = new LinkedHashMap<>(); - - for (final Entry<E, T> entry : entrySet()) { - final T val = entry.getValue(); - - if (val != null) - copy.put(SerializeUtil.serialize(entry.getKey()), SerializeUtil.serialize(val)); - } - - return copy; - } - - return getSource(); - } - - @Override - public String toString() { - return map.toString(); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/StrictSet.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/StrictSet.java deleted file mode 100644 index 12ea697822e63179733aea576d507b106abb77e7..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/StrictSet.java +++ /dev/null @@ -1,223 +0,0 @@ -package org.mineacademy.fo.collection; - -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; - -import org.apache.commons.lang.StringUtils; -import org.mineacademy.fo.SerializeUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.exception.FoException; - -/** - * Strict set that only allows to remove elements that are contained within, or add elements that are not. - * <p> - * Failing to do so results in an error, with optional error message. - */ -public final class StrictSet<E> extends StrictCollection implements Iterable<E> { - - /** - * The internal set - */ - private final Set<E> set = new HashSet<>(); - - /** - * Create a new set from the given elements - * - * @param elements - */ - @SafeVarargs - public StrictSet(E... elements) { - this(); - - addAll(Arrays.asList(elements)); - } - - /** - * Create a new set from the given elements - * - * @param oldList - */ - public StrictSet(Collection<E> oldList) { - this(); - - addAll(oldList); - } - - /** - * Create a new strict set - */ - public StrictSet() { - super("Cannot remove '%s' as it is not in the set!", "Value '%s' is already in the set!"); - } - - // ------------------------------------------------------------------------------------------------------------ - // Methods below trigger strict checks - // ------------------------------------------------------------------------------------------------------------ - - /** - * Remove the given element from the set - * failing if it is null or not within the set - * - * @param value - */ - public void remove(E value) { - Valid.checkNotNull(value, "Cannot remove null values"); - final boolean removed = set.remove(value); - - Valid.checkBoolean(removed, String.format(getCannotRemoveMessage(), value)); - } - - /** - * Remove the given element from the set - * - * @param value - */ - public void removeWeak(E value) { - set.remove(value); - } - - /** - * Add all elements to the set - * - * @param collection - */ - public void addAll(Collection<E> collection) { - for (final E val : collection) - add(val); - } - - /** - * Add the given element to the set - * failing if it is null or already within the set - * - * @param key - */ - public void add(E key) { - Valid.checkNotNull(key, "Cannot add null values"); - Valid.checkBoolean(!set.contains(key), String.format(getCannotAddMessage(), key)); - - set.add(key); - } - - /** - * Add the given element to the set - * - * @param key - */ - public void override(E key) { - set.add(key); - } - - /** - * Return the element at the given index - * - * @param index - * @return - */ - public E getAt(int index) { - int i = 0; - - final Iterator<E> it = set.iterator(); - - while (it.hasNext()) { - final E e = it.next(); - - if (i++ == index) - return e; - } - - throw new FoException("Index (" + index + ") + out of size (" + set.size() + ")"); - } - - // ------------------------------------------------------------------------------------------------------------ - // Methods without throwing errors below - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return true if the set contains the given element - * - * @param key - * @return - */ - public boolean contains(E key) { - return set.contains(key); - } - - /** - * Clear the set - */ - public void clear() { - set.clear(); - } - - /** - * Return true if the set is empty - * - * @return - */ - public boolean isEmpty() { - return set.isEmpty(); - } - - /** - * Return the sets size - * - * @return - */ - public int size() { - return set.size(); - } - - /** - * Return the original Java implementation of the set - * - * @return - */ - public Set<E> getSource() { - return set; - } - - /** - * Return all set values together split by the given separator - * - * @param separator - * @return - */ - public String join(String separator) { - return StringUtils.join(set, separator); - } - - /** - * Return this set as array - * - * @param e - * @return - */ - public E[] toArray(E[] e) { - return set.toArray(e); - } - - /** - * Return the sets iterator - */ - @Override - public Iterator<E> iterator() { - return set.iterator(); - } - - /** - * Return this set as list of serialized objects - */ - @Override - public Object serialize() { - return SerializeUtil.serialize(set); - } - - @Override - public String toString() { - return "StrictSet{\n" + StringUtils.join(set, "\n") + "}"; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/EntryLoader.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/EntryLoader.java deleted file mode 100644 index e5f24fb618302f01b70f7352db41ad99e05d5298..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/EntryLoader.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.mineacademy.fo.collection.expiringmap; - -/** - * Loads entries on demand. - * - * @param <K> Key type - * @param <V> Value type - */ -public interface EntryLoader<K, V> { - /** - * Called to load a new value for the {@code key} into an expiring map. - * - * @param key to load a value for - * @return new value to load - */ - V load(K key); -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/ExpirationPolicy.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/ExpirationPolicy.java deleted file mode 100644 index bae16aecb09b6d63c9eee636b4adc3bf108160e9..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/ExpirationPolicy.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.mineacademy.fo.collection.expiringmap; - -/** - * Determines how ExpiringMap entries should be expired. - */ -public enum ExpirationPolicy { - /** - * Expires entries based on when they were last accessed - */ - ACCESSED, - /** - * Expires entries based on when they were created - */ - CREATED; -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/ExpiringEntryLoader.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/ExpiringEntryLoader.java deleted file mode 100644 index 499f0730e2408cb83d3ebf65c6b0fb04208e3b11..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/ExpiringEntryLoader.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.mineacademy.fo.collection.expiringmap; - -/** - * Loads entries on demand, with control over each value's expiry duration (i.e. variable expiration). - * - * @param <K> Key type - * @param <V> Value type - */ -public interface ExpiringEntryLoader<K, V> { - /** - * Called to load a new value for the {@code key} into an expiring map. - * - * @param key to load a value for - * @return contains new value to load along with its expiry duration - */ - ExpiringValue<V> load(K key); -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/ExpiringMap.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/ExpiringMap.java deleted file mode 100644 index b3972ab1b2e870003647bafdfd53fd383a8a1af9..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/ExpiringMap.java +++ /dev/null @@ -1,1621 +0,0 @@ -/* - * - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - */ -package org.mineacademy.fo.collection.expiringmap; - -import java.lang.ref.WeakReference; -import java.util.AbstractCollection; -import java.util.AbstractSet; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Set; -import java.util.SortedSet; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.ConcurrentSkipListSet; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicLong; -import java.util.concurrent.atomic.AtomicReference; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import org.mineacademy.fo.Valid; - -import lombok.NonNull; - -/** - * A thread-safe map that expires entries. Optional features include expiration - * policies, variable entry expiration, lazy entry loading, and expiration - * listeners. - * - * <p> - * Entries are tracked by expiration time and expired by a single thread. - * - * <p> - * Expiration listeners are called synchronously as entries are expired and - * block write operations to the map until they completed. Asynchronous - * expiration listeners are called on a separate thread pool and do not block - * map operations. - * - * <p> - * When variable expiration is disabled (default), put/remove operations have a - * time complexity <i>O(1)</i>. When variable expiration is enabled, put/remove - * operations have time complexity of <i>O(log n)</i>. - * - * <p> - * Example usages: - * - * <pre> - * { - * @code - * Map<String, Integer> map = ExpiringMap.create(); - * Map<String, Integer> map = ExpiringMap.builder().expiration(30, TimeUnit.SECONDS).build(); - * Map<String, Connection> map = ExpiringMap.builder() - * .expiration(10, TimeUnit.MINUTES) - * .entryLoader(new EntryLoader<String, Connection>() { - * public Connection load(String address) { - * return new Connection(address); - * } - * }) - * .expirationListener(new ExpirationListener<String, Connection>() { - * public void expired(String key, Connection connection) { - * connection.close(); - * } - * }) - * .build(); - * } - * </pre> - * - * @param <K> Key type - * @param <V> Value type - * @author Jonathan Halterman - */ -public final class ExpiringMap<K, V> implements ConcurrentMap<K, V> { - static volatile ScheduledExecutorService EXPIRER; - static volatile ThreadPoolExecutor LISTENER_SERVICE; - static ThreadFactory THREAD_FACTORY; - - List<ExpirationListener<K, V>> expirationListeners; - List<ExpirationListener<K, V>> asyncExpirationListeners; - private final AtomicLong expirationNanos; - private int maxSize; - private final AtomicReference<ExpirationPolicy> expirationPolicy; - private final EntryLoader<? super K, ? extends V> entryLoader; - private final ExpiringEntryLoader<? super K, ? extends V> expiringEntryLoader; - private final ReadWriteLock readWriteLock = new ReentrantReadWriteLock(); - private final Lock readLock = readWriteLock.readLock(); - private final Lock writeLock = readWriteLock.writeLock(); - /** - * Guarded by "readWriteLock" - */ - private final EntryMap<K, V> entries; - private final boolean variableExpiration; - - public interface ExpirationListener<K, V> { - void expired(K var1, V var2); - } - - /** - * Sets the {@link ThreadFactory} that is used to create expiration and listener - * callback threads for all ExpiringMap instances. - * - * @param threadFactory - * @throws NullPointerException if {@code threadFactory} is null - */ - public static void setThreadFactory(@NonNull ThreadFactory threadFactory) { - THREAD_FACTORY = threadFactory; - } - - /** - * Creates a new instance of ExpiringMap. - * - * @param builder The map builder - */ - private ExpiringMap(final Builder<K, V> builder) { - if (EXPIRER == null) - synchronized (ExpiringMap.class) { - if (EXPIRER == null) - EXPIRER = Executors.newSingleThreadScheduledExecutor( - THREAD_FACTORY == null ? new NamedThreadFactory("ExpiringMap-Expirer") : THREAD_FACTORY); - } - - if (LISTENER_SERVICE == null && builder.asyncExpirationListeners != null) - synchronized (ExpiringMap.class) { - if (LISTENER_SERVICE == null) - LISTENER_SERVICE = (ThreadPoolExecutor) Executors.newCachedThreadPool( - THREAD_FACTORY == null ? new NamedThreadFactory("ExpiringMap-Listener-%s") : THREAD_FACTORY); - } - - variableExpiration = builder.variableExpiration; - entries = variableExpiration ? new EntryTreeHashMap<>() : new EntryLinkedHashMap<>(); - if (builder.expirationListeners != null) - expirationListeners = new CopyOnWriteArrayList<>(builder.expirationListeners); - if (builder.asyncExpirationListeners != null) - asyncExpirationListeners = new CopyOnWriteArrayList<>(builder.asyncExpirationListeners); - expirationPolicy = new AtomicReference<>(builder.expirationPolicy); - expirationNanos = new AtomicLong(TimeUnit.NANOSECONDS.convert(builder.duration, builder.timeUnit)); - maxSize = builder.maxSize; - entryLoader = builder.entryLoader; - expiringEntryLoader = builder.expiringEntryLoader; - } - - /** - * Builds ExpiringMap instances. Defaults to ExpirationPolicy.CREATED, - * expiration of 60 TimeUnit.SECONDS and a maxSize of Integer.MAX_VALUE. - */ - public static final class Builder<K, V> { - private ExpirationPolicy expirationPolicy = ExpirationPolicy.CREATED; - private List<ExpirationListener<K, V>> expirationListeners; - private List<ExpirationListener<K, V>> asyncExpirationListeners; - private TimeUnit timeUnit = TimeUnit.SECONDS; - private boolean variableExpiration; - private long duration = 60; - private int maxSize = Integer.MAX_VALUE; - private EntryLoader<K, V> entryLoader; - private ExpiringEntryLoader<K, V> expiringEntryLoader; - - /** - * Creates a new Builder object. - */ - private Builder() { - } - - /** - * Builds and returns an expiring map. - * - * @param <K1> Key type - * @param <V1> Value type - */ - - public <K1 extends K, V1 extends V> ExpiringMap<K1, V1> build() { - return new ExpiringMap<>((Builder<K1, V1>) this); - } - - /** - * Sets the default map entry expiration. - * - * @param duration the length of time after an entry is created that it should - * be removed - * @param timeUnit the unit that {@code duration} is expressed in - * @throws NullPointerException if {@code timeUnit} is null - */ - public Builder<K, V> expiration(long duration, @NonNull TimeUnit timeUnit) { - this.duration = duration; - this.timeUnit = timeUnit; - return this; - } - - /** - * Sets the maximum size of the map. Once this size has been reached, adding an - * additional entry will expire the first entry in line for expiration based on - * the expiration policy. - * - * @param maxSize The maximum size of the map. - */ - public Builder<K, V> maxSize(int maxSize) { - Valid.checkBoolean(maxSize > 0, "maxSize"); - this.maxSize = maxSize; - return this; - } - - /** - * Sets the EntryLoader to use when loading entries. Either an EntryLoader or - * ExpiringEntryLoader may be set, not both. - * - * @param loader to set - * @throws NullPointerException if {@code loader} is null - * @throws IllegalStateException if an - * {@link #expiringEntryLoader(ExpiringEntryLoader) - * ExpiringEntryLoader} is set - */ - - public <K1 extends K, V1 extends V> Builder<K1, V1> entryLoader(@NonNull EntryLoader<? super K1, ? super V1> loader) { - assertNoLoaderSet(); - entryLoader = (EntryLoader<K, V>) loader; - return (Builder<K1, V1>) this; - } - - /** - * Sets the ExpiringEntryLoader to use when loading entries and configures - * {@link #variableExpiration() variable expiration}. Either an EntryLoader or - * ExpiringEntryLoader may be set, not both. - * - * @param loader to set - * @throws NullPointerException if {@code loader} is null - * @throws IllegalStateException if an {@link #entryLoader(EntryLoader) - * EntryLoader} is set - */ - public <K1 extends K, V1 extends V> Builder<K1, V1> expiringEntryLoader(@NonNull ExpiringEntryLoader<? super K1, ? super V1> loader) { - assertNoLoaderSet(); - expiringEntryLoader = (ExpiringEntryLoader<K, V>) loader; - variableExpiration(); - return (Builder<K1, V1>) this; - } - - /** - * Configures the expiration listener that will receive notifications upon each - * map entry's expiration. Notifications are delivered synchronously and block - * map write operations. - * - * @param listener to set - * @throws NullPointerException if {@code listener} is null - */ - public <K1 extends K, V1 extends V> Builder<K1, V1> expirationListener( - ExpirationListener<? super K1, ? super V1> listener) { - Valid.checkNotNull(listener, "listener"); - if (expirationListeners == null) - expirationListeners = new ArrayList<>(); - expirationListeners.add((ExpirationListener<K, V>) listener); - return (Builder<K1, V1>) this; - } - - /** - * Configures the expiration listeners which will receive notifications upon - * each map entry's expiration. Notifications are delivered synchronously and - * block map write operations. - * - * @param listeners to set - * @throws NullPointerException if {@code listener} is null - */ - - public <K1 extends K, V1 extends V> Builder<K1, V1> expirationListeners( - List<ExpirationListener<? super K1, ? super V1>> listeners) { - Valid.checkNotNull(listeners, "listeners"); - if (expirationListeners == null) - expirationListeners = new ArrayList<>(listeners.size()); - for (final ExpirationListener<? super K1, ? super V1> listener : listeners) - expirationListeners.add((ExpirationListener<K, V>) listener); - return (Builder<K1, V1>) this; - } - - /** - * Configures the expiration listener which will receive asynchronous - * notifications upon each map entry's expiration. - * - * @param listener to set - * @throws NullPointerException if {@code listener} is null - */ - public <K1 extends K, V1 extends V> Builder<K1, V1> asyncExpirationListener( - ExpirationListener<? super K1, ? super V1> listener) { - Valid.checkNotNull(listener, "listener"); - if (asyncExpirationListeners == null) - asyncExpirationListeners = new ArrayList<>(); - asyncExpirationListeners.add((ExpirationListener<K, V>) listener); - return (Builder<K1, V1>) this; - } - - /** - * Configures the expiration listeners which will receive asynchronous - * notifications upon each map entry's expiration. - * - * @param listeners to set - * @throws NullPointerException if {@code listener} is null - */ - public <K1 extends K, V1 extends V> Builder<K1, V1> asyncExpirationListeners( - List<ExpirationListener<? super K1, ? super V1>> listeners) { - Valid.checkNotNull(listeners, "listeners"); - if (asyncExpirationListeners == null) - asyncExpirationListeners = new ArrayList<>(listeners.size()); - for (final ExpirationListener<? super K1, ? super V1> listener : listeners) - asyncExpirationListeners.add((ExpirationListener<K, V>) listener); - return (Builder<K1, V1>) this; - } - - /** - * Configures the map entry expiration policy. - * - * @param expirationPolicy - * @throws NullPointerException if {@code expirationPolicy} is null - */ - public Builder<K, V> expirationPolicy(@NonNull ExpirationPolicy expirationPolicy) { - this.expirationPolicy = expirationPolicy; - return this; - } - - /** - * Allows for map entries to have individual expirations and for expirations to - * be changed. - */ - public Builder<K, V> variableExpiration() { - variableExpiration = true; - return this; - } - - private void assertNoLoaderSet() { - Valid.checkBoolean(entryLoader == null && expiringEntryLoader == null, - "Either entryLoader or expiringEntryLoader may be set, not both"); - } - } - - /** - * Entry map definition. - */ - private interface EntryMap<K, V> extends Map<K, ExpiringEntry<K, V>> { - /** - * Returns the first entry in the map or null if the map is empty. - */ - ExpiringEntry<K, V> first(); - - /** - * Reorders the given entry in the map. - * - * @param entry to reorder - */ - void reorder(ExpiringEntry<K, V> entry); - - /** - * Returns a values iterator. - */ - Iterator<ExpiringEntry<K, V>> valuesIterator(); - } - - /** - * Entry LinkedHashMap implementation. - */ - private static class EntryLinkedHashMap<K, V> extends LinkedHashMap<K, ExpiringEntry<K, V>> - implements EntryMap<K, V> { - private static final long serialVersionUID = 1L; - - @Override - public boolean containsValue(Object value) { - for (final ExpiringEntry<K, V> entry : values()) { - final V v = entry.value; - if (v == value || value != null && value.equals(v)) - return true; - } - return false; - } - - @Override - public ExpiringEntry<K, V> first() { - return isEmpty() ? null : values().iterator().next(); - } - - @Override - public void reorder(ExpiringEntry<K, V> value) { - remove(value.key); - value.resetExpiration(); - put(value.key, value); - } - - @Override - public Iterator<ExpiringEntry<K, V>> valuesIterator() { - return values().iterator(); - } - - abstract class AbstractHashIterator { - private final Iterator<Map.Entry<K, ExpiringEntry<K, V>>> iterator = entrySet().iterator(); - private ExpiringEntry<K, V> next; - - public boolean hasNext() { - return iterator.hasNext(); - } - - public ExpiringEntry<K, V> getNext() { - next = iterator.next().getValue(); - return next; - } - - public void remove() { - iterator.remove(); - } - } - - final class KeyIterator extends AbstractHashIterator implements Iterator<K> { - @Override - public K next() { - return getNext().key; - } - } - - final class ValueIterator extends AbstractHashIterator implements Iterator<V> { - @Override - public V next() { - return getNext().value; - } - } - - public final class EntryIterator extends AbstractHashIterator implements Iterator<Map.Entry<K, V>> { - @Override - public Map.Entry<K, V> next() { - return mapEntryFor(getNext()); - } - } - } - - /** - * Entry TreeHashMap implementation for variable expiration ExpiringMap entries. - */ - private static class EntryTreeHashMap<K, V> extends HashMap<K, ExpiringEntry<K, V>> implements EntryMap<K, V> { - private static final long serialVersionUID = 1L; - SortedSet<ExpiringEntry<K, V>> sortedSet = new ConcurrentSkipListSet<>(); - - @Override - public void clear() { - super.clear(); - sortedSet.clear(); - } - - @Override - public boolean containsValue(Object value) { - for (final ExpiringEntry<K, V> entry : values()) { - final V v = entry.value; - if (v == value || value != null && value.equals(v)) - return true; - } - return false; - } - - @Override - public ExpiringEntry<K, V> first() { - return sortedSet.isEmpty() ? null : sortedSet.first(); - } - - @Override - public ExpiringEntry<K, V> put(K key, ExpiringEntry<K, V> value) { - sortedSet.add(value); - return super.put(key, value); - } - - @Override - public ExpiringEntry<K, V> remove(Object key) { - final ExpiringEntry<K, V> entry = super.remove(key); - if (entry != null) - sortedSet.remove(entry); - return entry; - } - - @Override - public void reorder(ExpiringEntry<K, V> value) { - sortedSet.remove(value); - value.resetExpiration(); - sortedSet.add(value); - } - - @Override - public Iterator<ExpiringEntry<K, V>> valuesIterator() { - return new ExpiringEntryIterator(); - } - - abstract class AbstractHashIterator { - private final Iterator<ExpiringEntry<K, V>> iterator = sortedSet.iterator(); - protected ExpiringEntry<K, V> next; - - public boolean hasNext() { - return iterator.hasNext(); - } - - public ExpiringEntry<K, V> getNext() { - next = iterator.next(); - return next; - } - - public void remove() { - EntryTreeHashMap.super.remove(next.key); - iterator.remove(); - } - } - - final class ExpiringEntryIterator extends AbstractHashIterator implements Iterator<ExpiringEntry<K, V>> { - @Override - public ExpiringEntry<K, V> next() { - return getNext(); - } - } - - final class KeyIterator extends AbstractHashIterator implements Iterator<K> { - @Override - public K next() { - return getNext().key; - } - } - - final class ValueIterator extends AbstractHashIterator implements Iterator<V> { - @Override - public V next() { - return getNext().value; - } - } - - final class EntryIterator extends AbstractHashIterator implements Iterator<Map.Entry<K, V>> { - @Override - public Map.Entry<K, V> next() { - return mapEntryFor(getNext()); - } - } - } - - /** - * Expiring map entry implementation. - */ - static class ExpiringEntry<K, V> implements Comparable<ExpiringEntry<K, V>> { - final AtomicLong expirationNanos; - /** - * Epoch time at which the entry is expected to expire - */ - final AtomicLong expectedExpiration; - final AtomicReference<ExpirationPolicy> expirationPolicy; - final K key; - /** - * Guarded by "this" - */ - volatile Future<?> entryFuture; - /** - * Guarded by "this" - */ - V value; - /** - * Guarded by "this" - */ - volatile boolean scheduled; - - /** - * Creates a new ExpiringEntry object. - * - * @param key for the entry - * @param value for the entry - * @param expirationPolicy for the entry - * @param expirationNanos for the entry - */ - ExpiringEntry(K key, V value, AtomicReference<ExpirationPolicy> expirationPolicy, AtomicLong expirationNanos) { - this.key = key; - this.value = value; - this.expirationPolicy = expirationPolicy; - this.expirationNanos = expirationNanos; - this.expectedExpiration = new AtomicLong(); - resetExpiration(); - } - - @Override - public int compareTo(ExpiringEntry<K, V> other) { - if (key.equals(other.key)) - return 0; - return expectedExpiration.get() < other.expectedExpiration.get() ? -1 : 1; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (key == null ? 0 : key.hashCode()); - result = prime * result + (value == null ? 0 : value.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final ExpiringEntry<?, ?> other = (ExpiringEntry<?, ?>) obj; - if (!key.equals(other.key)) - return false; - if (value == null) { - if (other.value != null) - return false; - } else if (!value.equals(other.value)) - return false; - return true; - } - - @Override - public String toString() { - return value != null ? value.toString() : ""; - } - - /** - * Marks the entry as canceled. - * - * @return true if the entry was scheduled - */ - synchronized boolean cancel() { - final boolean result = scheduled; - if (entryFuture != null) - entryFuture.cancel(false); - - entryFuture = null; - scheduled = false; - return result; - } - - /** - * Gets the entry value. - */ - synchronized V getValue() { - return value; - } - - /** - * Resets the entry's expected expiration. - */ - void resetExpiration() { - expectedExpiration.set(expirationNanos.get() + System.nanoTime()); - } - - /** - * Marks the entry as scheduled. - */ - synchronized void schedule(Future<?> entryFuture) { - this.entryFuture = entryFuture; - scheduled = true; - } - - /** - * Sets the entry value. - */ - synchronized void setValue(V value) { - this.value = value; - } - } - - /** - * Creates an ExpiringMap builder. - * - * @return New ExpiringMap builder - */ - public static Builder<Object, Object> builder() { - return new Builder<>(); - } - - /** - * Creates a new instance of ExpiringMap with ExpirationPolicy.CREATED and an - * expiration of 60 seconds. - */ - - public static <K, V> ExpiringMap<K, V> create() { - return new ExpiringMap<>((Builder<K, V>) ExpiringMap.builder()); - } - - /** - * Adds an expiration listener. - * - * @param listener to add - * @throws NullPointerException if {@code listener} is null - */ - public synchronized void addExpirationListener(ExpirationListener<K, V> listener) { - Valid.checkNotNull(listener, "listener"); - if (expirationListeners == null) - expirationListeners = new CopyOnWriteArrayList<>(); - expirationListeners.add(listener); - } - - /** - * Adds an asynchronous expiration listener. - * - * @param listener to add - * @throws NullPointerException if {@code listener} is null - */ - public synchronized void addAsyncExpirationListener(ExpirationListener<K, V> listener) { - Valid.checkNotNull(listener, "listener"); - if (asyncExpirationListeners == null) - asyncExpirationListeners = new CopyOnWriteArrayList<>(); - asyncExpirationListeners.add(listener); - } - - @Override - public void clear() { - writeLock.lock(); - try { - for (final ExpiringEntry<K, V> entry : entries.values()) - entry.cancel(); - entries.clear(); - } finally { - writeLock.unlock(); - } - } - - @Override - public boolean containsKey(Object key) { - readLock.lock(); - try { - return entries.containsKey(key); - } finally { - readLock.unlock(); - } - } - - @Override - public boolean containsValue(Object value) { - readLock.lock(); - try { - return entries.containsValue(value); - } finally { - readLock.unlock(); - } - } - - @Override - public Set<Map.Entry<K, V>> entrySet() { - return new AbstractSet<Map.Entry<K, V>>() { - @Override - public void clear() { - ExpiringMap.this.clear(); - } - - @Override - public boolean contains(Object entry) { - if (!(entry instanceof Map.Entry)) - return false; - final Map.Entry<?, ?> e = (Map.Entry<?, ?>) entry; - return containsKey(e.getKey()); - } - - @Override - public Iterator<Map.Entry<K, V>> iterator() { - return entries instanceof EntryLinkedHashMap ? ((EntryLinkedHashMap<K, V>) entries).new EntryIterator() - : ((EntryTreeHashMap<K, V>) entries).new EntryIterator(); - } - - @Override - public boolean remove(Object entry) { - if (entry instanceof Map.Entry) { - final Map.Entry<?, ?> e = (Map.Entry<?, ?>) entry; - return ExpiringMap.this.remove(e.getKey()) != null; - } - return false; - } - - @Override - public int size() { - return ExpiringMap.this.size(); - } - }; - } - - @Override - public boolean equals(Object obj) { - readLock.lock(); - try { - return entries.equals(obj); - } finally { - readLock.unlock(); - } - } - - @Override - public V get(Object key) { - final ExpiringEntry<K, V> entry = getEntry(key); - - if (entry == null) - return load((K) key); - else if (ExpirationPolicy.ACCESSED.equals(entry.expirationPolicy.get())) - resetEntry(entry, false); - - return entry.getValue(); - } - - private V load(K key) { - if (entryLoader == null && expiringEntryLoader == null) - return null; - - writeLock.lock(); - try { - // Double check for entry - final ExpiringEntry<K, V> entry = getEntry(key); - if (entry != null) - return entry.getValue(); - - if (entryLoader != null) { - final V value = entryLoader.load(key); - put(key, value); - return value; - } else { - final ExpiringValue<? extends V> expiringValue = expiringEntryLoader.load(key); - if (expiringValue == null) { - put(key, null); - return null; - } else { - final long duration = expiringValue.getTimeUnit() == null ? expirationNanos.get() : expiringValue.getDuration(); - final TimeUnit timeUnit = expiringValue.getTimeUnit() == null ? TimeUnit.NANOSECONDS : expiringValue.getTimeUnit(); - put(key, expiringValue.getValue(), expiringValue.getExpirationPolicy() == null ? expirationPolicy.get() - : expiringValue.getExpirationPolicy(), duration, timeUnit); - return expiringValue.getValue(); - } - } - } finally { - writeLock.unlock(); - } - } - - /** - * Returns the map's default expiration duration in milliseconds. - * - * @return The expiration duration (milliseconds) - */ - public long getExpiration() { - return TimeUnit.NANOSECONDS.toMillis(expirationNanos.get()); - } - - /** - * Gets the expiration duration in milliseconds for the entry corresponding to - * the given key. - * - * @param key - * @return The expiration duration in milliseconds - * @throws NullPointerException if {@code key} is null - * @throws NoSuchElementException If no entry exists for the given key - */ - public long getExpiration(K key) { - Valid.checkNotNull(key, "key"); - final ExpiringEntry<K, V> entry = getEntry(key); - - return TimeUnit.NANOSECONDS.toMillis(entry.expirationNanos.get()); - } - - /** - * Gets the ExpirationPolicy for the entry corresponding to the given - * {@code key}. - * - * @param key - * @return The ExpirationPolicy for the {@code key} - * @throws NullPointerException if {@code key} is null - * @throws NoSuchElementException If no entry exists for the given key - */ - public ExpirationPolicy getExpirationPolicy(K key) { - Valid.checkNotNull(key, "key"); - final ExpiringEntry<K, V> entry = getEntry(key); - Valid.checkNotNull(entry); - return entry.expirationPolicy.get(); - } - - /** - * Gets the expected expiration, in milliseconds from the current time, for the - * entry corresponding to the given {@code key}. - * - * @param key - * @return The expiration duration in milliseconds - * @throws NullPointerException if {@code key} is null - * @throws NoSuchElementException If no entry exists for the given key - */ - public long getExpectedExpiration(K key) { - Valid.checkNotNull(key, "key"); - final ExpiringEntry<K, V> entry = getEntry(key); - Valid.checkNotNull(entry); - return TimeUnit.NANOSECONDS.toMillis(entry.expectedExpiration.get() - System.nanoTime()); - } - - /** - * Gets the maximum size of the map. Once this size has been reached, adding an - * additional entry will expire the first entry in line for expiration based on - * the expiration policy. - * - * @return The maximum size of the map. - */ - public int getMaxSize() { - return maxSize; - } - - @Override - public int hashCode() { - readLock.lock(); - try { - return entries.hashCode(); - } finally { - readLock.unlock(); - } - } - - @Override - public boolean isEmpty() { - readLock.lock(); - try { - return entries.isEmpty(); - } finally { - readLock.unlock(); - } - } - - @Override - public Set<K> keySet() { - return new AbstractSet<K>() { - @Override - public void clear() { - ExpiringMap.this.clear(); - } - - @Override - public boolean contains(Object key) { - return containsKey(key); - } - - @Override - public Iterator<K> iterator() { - return entries instanceof EntryLinkedHashMap ? ((EntryLinkedHashMap<K, V>) entries).new KeyIterator() - : ((EntryTreeHashMap<K, V>) entries).new KeyIterator(); - } - - @Override - public boolean remove(Object value) { - return ExpiringMap.this.remove(value) != null; - } - - @Override - public int size() { - return ExpiringMap.this.size(); - } - }; - } - - /** - * Puts {@code value} in the map for {@code key}. Resets the entry's expiration - * unless an entry already exists for the same {@code key} and {@code value}. - * - * @param key to put value for - * @param value to put for key - * @return the old value - * @throws NullPointerException if {@code key} is null - */ - @Override - public V put(K key, V value) { - Valid.checkNotNull(key, "key"); - return putInternal(key, value, expirationPolicy.get(), expirationNanos.get()); - } - - /** - * @see #put(Object, Object, ExpirationPolicy, long, TimeUnit) - */ - public V put(K key, V value, ExpirationPolicy expirationPolicy) { - return put(key, value, expirationPolicy, expirationNanos.get(), TimeUnit.NANOSECONDS); - } - - /** - * @see #put(Object, Object, ExpirationPolicy, long, TimeUnit) - */ - public V put(K key, V value, long duration, TimeUnit timeUnit) { - return put(key, value, expirationPolicy.get(), duration, timeUnit); - } - - /** - * Puts {@code value} in the map for {@code key}. Resets the entry's expiration - * unless an entry already exists for the same {@code key} and {@code value}. - * Requires that variable expiration be enabled. - * - * @param key Key to put value for - * @param value Value to put for key - * @param duration the length of time after an entry is created that it should - * be removed - * @param timeUnit the unit that {@code duration} is expressed in - * @return the old value - * @throws UnsupportedOperationException If variable expiration is not enabled - * @throws NullPointerException if {@code key}, - * {@code expirationPolicy} or - * {@code timeUnit} are null - */ - public V put(K key, V value, ExpirationPolicy expirationPolicy, long duration, TimeUnit timeUnit) { - Valid.checkNotNull(key, "key"); - Valid.checkNotNull(expirationPolicy, "expirationPolicy"); - Valid.checkNotNull(timeUnit, "timeUnit"); - Valid.checkBoolean(variableExpiration, "Variable expiration is not enabled"); - return putInternal(key, value, expirationPolicy, TimeUnit.NANOSECONDS.convert(duration, timeUnit)); - } - - @Override - public void putAll(Map<? extends K, ? extends V> map) { - Valid.checkNotNull(map, "map"); - final long expiration = expirationNanos.get(); - final ExpirationPolicy expirationPolicy = this.expirationPolicy.get(); - writeLock.lock(); - try { - for (final Map.Entry<? extends K, ? extends V> entry : map.entrySet()) - putInternal(entry.getKey(), entry.getValue(), expirationPolicy, expiration); - } finally { - writeLock.unlock(); - } - } - - @Override - public V putIfAbsent(K key, V value) { - Valid.checkNotNull(key, "key"); - writeLock.lock(); - try { - if (!entries.containsKey(key)) - return putInternal(key, value, expirationPolicy.get(), expirationNanos.get()); - else - return entries.get(key).getValue(); - } finally { - writeLock.unlock(); - } - } - - @Override - public V remove(Object key) { - Valid.checkNotNull(key, "key"); - writeLock.lock(); - try { - final ExpiringEntry<K, V> entry = entries.remove(key); - if (entry == null) - return null; - if (entry.cancel()) - scheduleEntry(entries.first()); - return entry.getValue(); - } finally { - writeLock.unlock(); - } - } - - @Override - public boolean remove(Object key, Object value) { - Valid.checkNotNull(key, "key"); - writeLock.lock(); - try { - final ExpiringEntry<K, V> entry = entries.get(key); - if (entry != null && entry.getValue().equals(value)) { - entries.remove(key); - if (entry.cancel()) - scheduleEntry(entries.first()); - return true; - } else - return false; - } finally { - writeLock.unlock(); - } - } - - @Override - public V replace(K key, V value) { - Valid.checkNotNull(key, "key"); - writeLock.lock(); - try { - if (entries.containsKey(key)) - return putInternal(key, value, expirationPolicy.get(), expirationNanos.get()); - else - return null; - } finally { - writeLock.unlock(); - } - } - - @Override - public boolean replace(K key, V oldValue, V newValue) { - Valid.checkNotNull(key, "key"); - writeLock.lock(); - try { - final ExpiringEntry<K, V> entry = entries.get(key); - if (entry != null && entry.getValue().equals(oldValue)) { - putInternal(key, newValue, expirationPolicy.get(), expirationNanos.get()); - return true; - } else - return false; - } finally { - writeLock.unlock(); - } - } - - /** - * Removes an expiration listener. - * - * @param listener - * @throws NullPointerException if {@code listener} is null - */ - public void removeExpirationListener(ExpirationListener<K, V> listener) { - Valid.checkNotNull(listener, "listener"); - for (int i = 0; i < expirationListeners.size(); i++) - if (expirationListeners.get(i).equals(listener)) { - expirationListeners.remove(i); - return; - } - } - - /** - * Removes an asynchronous expiration listener. - * - * @param listener - * @throws NullPointerException if {@code listener} is null - */ - public void removeAsyncExpirationListener(ExpirationListener<K, V> listener) { - Valid.checkNotNull(listener, "listener"); - for (int i = 0; i < asyncExpirationListeners.size(); i++) - if (asyncExpirationListeners.get(i).equals(listener)) { - asyncExpirationListeners.remove(i); - return; - } - } - - /** - * Resets expiration for the entry corresponding to {@code key}. - * - * @param key to reset expiration for - * @throws NullPointerException if {@code key} is null - */ - public void resetExpiration(K key) { - Valid.checkNotNull(key, "key"); - final ExpiringEntry<K, V> entry = getEntry(key); - if (entry != null) - resetEntry(entry, false); - } - - /** - * Sets the expiration duration for the entry corresponding to the given key. - * Supported only if variable expiration is enabled. - * - * @param key Key to set expiration for - * @param duration the length of time after an entry is created that it should - * be removed - * @param timeUnit the unit that {@code duration} is expressed in - * @throws NullPointerException if {@code key} or {@code timeUnit} are - * null - * @throws UnsupportedOperationException If variable expiration is not enabled - */ - public void setExpiration(K key, long duration, TimeUnit timeUnit) { - Valid.checkNotNull(key, "key"); - Valid.checkNotNull(timeUnit, "timeUnit"); - Valid.checkBoolean(variableExpiration, "Variable expiration is not enabled"); - writeLock.lock(); - try { - final ExpiringEntry<K, V> entry = entries.get(key); - if (entry != null) { - entry.expirationNanos.set(TimeUnit.NANOSECONDS.convert(duration, timeUnit)); - resetEntry(entry, true); - } - } finally { - writeLock.unlock(); - } - } - - /** - * Updates the default map entry expiration. Supported only if variable - * expiration is enabled. - * - * @param duration the length of time after an entry is created that it should - * be removed - * @param timeUnit the unit that {@code duration} is expressed in - * @throws NullPointerException {@code timeUnit} is null - * @throws UnsupportedOperationException If variable expiration is not enabled - */ - public void setExpiration(long duration, TimeUnit timeUnit) { - Valid.checkNotNull(timeUnit, "timeUnit"); - Valid.checkBoolean(variableExpiration, "Variable expiration is not enabled"); - expirationNanos.set(TimeUnit.NANOSECONDS.convert(duration, timeUnit)); - } - - /** - * Sets the global expiration policy for the map. Individual expiration policies - * may override the global policy. - * - * @param expirationPolicy - * @throws NullPointerException {@code expirationPolicy} is null - */ - public void setExpirationPolicy(ExpirationPolicy expirationPolicy) { - Valid.checkNotNull(expirationPolicy, "expirationPolicy"); - this.expirationPolicy.set(expirationPolicy); - } - - /** - * Sets the expiration policy for the entry corresponding to the given key. - * - * @param key to set policy for - * @param expirationPolicy to set - * @throws NullPointerException if {@code key} or - * {@code expirationPolicy} are null - * @throws UnsupportedOperationException If variable expiration is not enabled - */ - public void setExpirationPolicy(K key, ExpirationPolicy expirationPolicy) { - Valid.checkNotNull(key, "key"); - Valid.checkNotNull(expirationPolicy, "expirationPolicy"); - Valid.checkBoolean(variableExpiration, "Variable expiration is not enabled"); - final ExpiringEntry<K, V> entry = getEntry(key); - if (entry != null) - entry.expirationPolicy.set(expirationPolicy); - } - - /** - * Sets the maximum size of the map. Once this size has been reached, adding an - * additional entry will expire the first entry in line for expiration based on - * the expiration policy. - * - * @param maxSize The maximum size of the map. - */ - public void setMaxSize(int maxSize) { - Valid.checkBoolean(maxSize > 0, "maxSize"); - this.maxSize = maxSize; - } - - @Override - public int size() { - readLock.lock(); - try { - return entries.size(); - } finally { - readLock.unlock(); - } - } - - @Override - public String toString() { - readLock.lock(); - try { - return entries.toString(); - } finally { - readLock.unlock(); - } - } - - @Override - public Collection<V> values() { - return new AbstractCollection<V>() { - @Override - public void clear() { - ExpiringMap.this.clear(); - } - - @Override - public boolean contains(Object value) { - return containsValue(value); - } - - @Override - public Iterator<V> iterator() { - return entries instanceof EntryLinkedHashMap ? ((EntryLinkedHashMap<K, V>) entries).new ValueIterator() - : ((EntryTreeHashMap<K, V>) entries).new ValueIterator(); - } - - @Override - public int size() { - return ExpiringMap.this.size(); - } - }; - } - - /** - * Notifies expiration listeners that the given entry expired. Must not be - * called from within a locked context. - * - * @param entry Entry to expire - */ - void notifyListeners(final ExpiringEntry<K, V> entry) { - if (asyncExpirationListeners != null) - for (final ExpirationListener<K, V> listener : asyncExpirationListeners) - LISTENER_SERVICE.execute(() -> { - try { - listener.expired(entry.key, entry.getValue()); - } catch (final Exception ignoreUserExceptions) { - } - }); - - if (expirationListeners != null) - for (final ExpirationListener<K, V> listener : expirationListeners) - try { - listener.expired(entry.key, entry.getValue()); - } catch (final Exception ignoreUserExceptions) { - } - } - - /** - * Returns the internal ExpiringEntry for the {@code key}, obtaining a read - * lock. - */ - ExpiringEntry<K, V> getEntry(Object key) { - readLock.lock(); - try { - return entries.get(key); - } finally { - readLock.unlock(); - } - } - - /** - * Puts the given key/value in storage, scheduling the new entry for expiration - * if needed. If a previous value existed for the given key, it is first - * cancelled and the entries reordered to reflect the new expiration. - */ - V putInternal(K key, V value, ExpirationPolicy expirationPolicy, long expirationNanos) { - writeLock.lock(); - try { - ExpiringEntry<K, V> entry = entries.get(key); - V oldValue = null; - - if (entry == null) { - entry = new ExpiringEntry<>(key, value, - variableExpiration ? new AtomicReference<>(expirationPolicy) : this.expirationPolicy, - variableExpiration ? new AtomicLong(expirationNanos) : this.expirationNanos); - if (entries.size() >= maxSize) { - final ExpiringEntry<K, V> expiredEntry = entries.first(); - entries.remove(expiredEntry.key); - notifyListeners(expiredEntry); - } - entries.put(key, entry); - if (entries.size() == 1 || entries.first().equals(entry)) - scheduleEntry(entry); - } else { - oldValue = entry.getValue(); - if (!ExpirationPolicy.ACCESSED.equals(expirationPolicy) - && (oldValue == null && value == null || oldValue != null && oldValue.equals(value))) - return value; - - entry.setValue(value); - resetEntry(entry, false); - } - - return oldValue; - } finally { - writeLock.unlock(); - } - } - - /** - * Resets the given entry's schedule canceling any existing scheduled expiration - * and reordering the entry in the internal map. Schedules the next entry in the - * map if the given {@code entry} was scheduled or if {@code scheduleNext} is - * true. - * - * @param entry to reset - * @param scheduleFirstEntry whether the first entry should be automatically - * scheduled - */ - void resetEntry(ExpiringEntry<K, V> entry, boolean scheduleFirstEntry) { - writeLock.lock(); - try { - final boolean scheduled = entry.cancel(); - entries.reorder(entry); - - if (scheduled || scheduleFirstEntry) - scheduleEntry(entries.first()); - } finally { - writeLock.unlock(); - } - } - - /** - * Schedules an entry for expiration. Guards against concurrent - * schedule/schedule, cancel/schedule and schedule/cancel calls. - * - * @param entry Entry to schedule - */ - void scheduleEntry(ExpiringEntry<K, V> entry) { - if (entry == null || entry.scheduled) - return; - - Runnable runnable = null; - synchronized (entry) { - if (entry.scheduled) - return; - - final WeakReference<ExpiringEntry<K, V>> entryReference = new WeakReference<>(entry); - runnable = () -> { - final ExpiringEntry<K, V> entry1 = entryReference.get(); - - writeLock.lock(); - try { - if (entry1 != null && entry1.scheduled) { - entries.remove(entry1.key); - notifyListeners(entry1); - } - - try { - // Expires entries and schedules the next entry - final Iterator<ExpiringEntry<K, V>> iterator = entries.valuesIterator(); - boolean schedulePending = true; - - while (iterator.hasNext() && schedulePending) { - final ExpiringEntry<K, V> nextEntry = iterator.next(); - if (nextEntry.expectedExpiration.get() <= System.nanoTime()) { - iterator.remove(); - notifyListeners(nextEntry); - } else { - scheduleEntry(nextEntry); - schedulePending = false; - } - } - } catch (final NoSuchElementException ignored) { - } - } finally { - writeLock.unlock(); - } - }; - - final Future<?> entryFuture = EXPIRER.schedule(runnable, entry.expectedExpiration.get() - System.nanoTime(), - TimeUnit.NANOSECONDS); - entry.schedule(entryFuture); - } - } - - private static <K, V> Map.Entry<K, V> mapEntryFor(final ExpiringEntry<K, V> entry) { - return new Map.Entry<K, V>() { - @Override - public K getKey() { - return entry.key; - } - - @Override - public V getValue() { - return entry.value; - } - - @Override - public V setValue(V value) { - throw new UnsupportedOperationException(); - } - }; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/ExpiringValue.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/ExpiringValue.java deleted file mode 100644 index 23bd11cc798e6d7cb657ee4b6bfdabadc50b9ddc..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/ExpiringValue.java +++ /dev/null @@ -1,116 +0,0 @@ -package org.mineacademy.fo.collection.expiringmap; - -import java.util.concurrent.TimeUnit; - -/** - * A value which should be stored in an {@link ExpiringMap} with optional control over its expiration. - * - * @param <V> the type of value being stored - */ -public final class ExpiringValue<V> { - private static final long UNSET_DURATION = -1L; - private final V value; - private final ExpirationPolicy expirationPolicy; - private final long duration; - private final TimeUnit timeUnit; - - /** - * Creates an ExpiringValue to be stored in an {@link ExpiringMap}. The map's default values for - * {@link ExpirationPolicy expiration policy} and {@link ExpiringMap#getExpiration()} expiration} will be used. - * - * @param value the value to store - * @see ExpiringMap#put(Object, Object) - */ - public ExpiringValue(V value) { - this(value, UNSET_DURATION, null, null); - } - - /** - * Creates an ExpiringValue to be stored in an {@link ExpiringMap}. The map's default - * {@link ExpiringMap#getExpiration()} expiration} will be used. - * - * @param value the value to store - * @param expirationPolicy the expiration policy for the value - * @see ExpiringMap#put(Object, Object, ExpirationPolicy) - */ - public ExpiringValue(V value, ExpirationPolicy expirationPolicy) { - this(value, UNSET_DURATION, null, expirationPolicy); - } - - /** - * Creates an ExpiringValue to be stored in an {@link ExpiringMap}. The map's default {@link ExpirationPolicy - * expiration policy} will be used. - * - * @param value the value to store - * @param duration the length of time after an entry is created that it should be removed - * @param timeUnit the unit that {@code duration} is expressed in - * @throws NullPointerException on null timeUnit - * @see ExpiringMap#put(Object, Object, long, TimeUnit) - */ - public ExpiringValue(V value, long duration, TimeUnit timeUnit) { - this(value, duration, timeUnit, null); - if (timeUnit == null) - throw new NullPointerException(); - } - - /** - * Creates an ExpiringValue to be stored in an {@link ExpiringMap}. - * - * @param value the value to store - * @param duration the length of time after an entry is created that it should be removed - * @param timeUnit the unit that {@code duration} is expressed in - * @param expirationPolicy the expiration policy for the value - * @throws NullPointerException on null timeUnit - * @see ExpiringMap#put(Object, Object, ExpirationPolicy, long, TimeUnit) - */ - public ExpiringValue(V value, ExpirationPolicy expirationPolicy, long duration, TimeUnit timeUnit) { - this(value, duration, timeUnit, expirationPolicy); - if (timeUnit == null) - throw new NullPointerException(); - } - - private ExpiringValue(V value, long duration, TimeUnit timeUnit, ExpirationPolicy expirationPolicy) { - this.value = value; - this.expirationPolicy = expirationPolicy; - this.duration = duration; - this.timeUnit = timeUnit; - } - - public V getValue() { - return value; - } - - public ExpirationPolicy getExpirationPolicy() { - return expirationPolicy; - } - - public long getDuration() { - return duration; - } - - public TimeUnit getTimeUnit() { - return timeUnit; - } - - @Override - public int hashCode() { - return value != null ? value.hashCode() : 0; - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - final ExpiringValue<?> that = (ExpiringValue<?>) o; - return !(value != null ? !value.equals(that.value) : that.value != null) && expirationPolicy == that.expirationPolicy && duration == that.duration && timeUnit == that.timeUnit; - - } - - @Override - public String toString() { - return "ExpiringValue{" + "value=" + value + ", expirationPolicy=" + expirationPolicy + ", duration=" + duration + ", timeUnit=" + timeUnit + '}'; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/NamedThreadFactory.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/NamedThreadFactory.java deleted file mode 100644 index 7d6a560e2f6fc1d3b2fe132f78d541b7875ba4f7..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/collection/expiringmap/NamedThreadFactory.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.mineacademy.fo.collection.expiringmap; - -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * Named thread factory. - */ -public final class NamedThreadFactory implements ThreadFactory { - private final AtomicInteger threadNumber = new AtomicInteger(1); - private final String nameFormat; - - /** - * Creates a thread factory that names threads according to the {@code nameFormat} by supplying a - * single argument to the format representing the thread number. - */ - public NamedThreadFactory(String nameFormat) { - this.nameFormat = nameFormat; - } - - @Override - public Thread newThread(Runnable r) { - final Thread thread = new Thread(r, String.format(nameFormat, threadNumber.getAndIncrement())); - thread.setDaemon(true); - return thread; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/DebugCommand.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/DebugCommand.java deleted file mode 100644 index 8489e293c456b10b054767fa682cb4484cce2f8c..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/DebugCommand.java +++ /dev/null @@ -1,181 +0,0 @@ -package org.mineacademy.fo.command; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.StandardCopyOption; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; - -import org.bukkit.Bukkit; -import org.bukkit.configuration.file.FileConfiguration; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.FileUtil; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.TimeUtil; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.fo.settings.SimpleLocalization; - -import lombok.Setter; - -/** - * A sample sub-command that you can automatically add - * to your main command group to help collect debugging information - * users can submit to you when they have problems. - */ -public final class DebugCommand extends SimpleSubCommand { - - /** - * Set the custom debug lines you would like to add to the debug file - */ - @Setter - private static Consumer<List<String>> debugLines; - - /** - * Create a new sub-command with the given permission. - * - * @param permission - */ - public DebugCommand(String permission) { - this(); - - setPermission(permission); - } - - public DebugCommand() { - super("debug"); - - setDescription("ZIP your settings for reporting bugs."); - } - - @Override - protected void onCommand() { - tell(SimpleLocalization.Commands.DEBUG_PREPARING); - - final File debugFolder = FileUtil.getFile("debug"); - final List<File> files = listFilesRecursively(SimplePlugin.getData(), new ArrayList<>()); - - // Clean up the old folder if exists - FileUtil.deleteRecursivelly(debugFolder); - - // Collect general debug information first - writeDebugInformation(); - - // Copy all plugin files - copyFilesToDebug(files); - - // Zip the folder - zipAndRemoveFolder(debugFolder); - - tell(SimpleLocalization.Commands.DEBUG_SUCCESS.replace("{amount}", String.valueOf(files.size()))); - } - - /* - * Write our own debug information - */ - private void writeDebugInformation() { - - final List<String> lines = Common.toList(Common.consoleLine(), - " Debug log generated " + TimeUtil.getFormattedDate(), - Common.consoleLine(), - "Plugin: " + SimplePlugin.getInstance().getDescription().getFullName(), - "Server Version: " + Bukkit.getName() + " " + MinecraftVersion.getServerVersion(), - "Java: " + System.getProperty("java.version") + " (" + System.getProperty("java.specification.vendor") + "/" + System.getProperty("java.vm.vendor") + ")", - "OS: " + System.getProperty("os.name") + " " + System.getProperty("os.version"), - "Online mode: " + Bukkit.getOnlineMode(), - "Players Online: " + Remain.getOnlinePlayers().size(), - "Plugins: " + Common.join(Bukkit.getPluginManager().getPlugins(), ", ", plugin -> plugin.getDescription().getFullName())); - - if (debugLines != null) - debugLines.accept(lines); - - FileUtil.write("debug/general.txt", lines); - } - - /* - * Copy the given files into debug/ folder - */ - private void copyFilesToDebug(List<File> files) { - - for (final File file : files) { - - try { - // Get the path in our folder - final String path = file.getPath().replace("\\", "/").replace("plugins/" + SimplePlugin.getNamed(), ""); - - // Create a copy file - final File copy = FileUtil.createIfNotExists("debug/" + path); - - // Strip sensitive keys from .YML files - if (file.getName().endsWith(".yml")) { - final FileConfiguration config = FileUtil.loadConfigurationStrict(file); - final FileConfiguration copyConfig = FileUtil.loadConfigurationStrict(copy); - - for (final Map.Entry<String, Object> entry : config.getValues(true).entrySet()) { - final String key = entry.getKey(); - - if (!key.contains("MySQL")) - copyConfig.set(key, entry.getValue()); - } - - copyConfig.save(copy); - } - - else - Files.copy(file.toPath(), copy.toPath(), StandardCopyOption.REPLACE_EXISTING); - - } catch (final Exception ex) { - ex.printStackTrace(); - - returnTell(SimpleLocalization.Commands.DEBUG_COPY_FAIL.replace("{file}", file.getName())); - } - } - } - - /* - * Zips the given folder and removes it afterwards - */ - private void zipAndRemoveFolder(File folder) { - try { - final String path = folder.getPath(); - - FileUtil.zip(path, path); - FileUtil.deleteRecursivelly(folder); - - } catch (final IOException ex) { - ex.printStackTrace(); - - returnTell(SimpleLocalization.Commands.DEBUG_ZIP_FAIL); - } - } - - /* - * Load the list of files available to ZIP - */ - private List<File> listFilesRecursively(File folder, List<File> files) { - for (final File file : folder.listFiles()) - if (file.isDirectory()) { - // Ignore log directory and ignore the debug directory itself - if (!file.getName().equals("logs") && !file.getName().equals("debug")) - listFilesRecursively(file, files); - - } else { - // Ignore the debug zip file itself - if (!file.getName().equals("debug.zip") && !file.getName().equals("mysql.yml")) - files.add(file); - } - - return files; - } - - /** - * @see org.mineacademy.fo.command.SimpleCommand#tabComplete() - */ - @Override - protected List<String> tabComplete() { - return NO_COMPLETE; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/PermsCommand.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/PermsCommand.java deleted file mode 100644 index 163f1cb3d68749c534ed2876aa0de98cbc48ab05..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/PermsCommand.java +++ /dev/null @@ -1,176 +0,0 @@ -package org.mineacademy.fo.command; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.List; - -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.command.annotation.Permission; -import org.mineacademy.fo.command.annotation.PermissionGroup; -import org.mineacademy.fo.constants.FoPermissions; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.ChatPaginator; -import org.mineacademy.fo.model.Replacer; -import org.mineacademy.fo.model.SimpleComponent; -import org.mineacademy.fo.settings.SimpleLocalization.Commands; -import org.mineacademy.fo.settings.SimpleSettings; - -import lombok.NonNull; - -/** - * A simple predefined command for quickly listing all permissions - * the plugin uses, given they are stored in a {@link FoPermissions} class. - */ -public final class PermsCommand extends SimpleSubCommand { - - /* - * Classes with permissions listed as fields - */ - private final Class<? extends FoPermissions> classToList; - - /* - * Special variables to replace in the annotation of each permission field in permissions class - */ - private final SerializedMap variables; - - /** - * Create a new "permisions|perms" subcommand using the given class - * that automatically replaces {label} in the \@PermissionGroup annotation in that class. - * - * @param classToList - */ - public PermsCommand(@NonNull Class<? extends FoPermissions> classToList) { - this(classToList, SerializedMap - .of("label", SimpleSettings.MAIN_COMMAND_ALIASES.get(0))); - } - - /** - * Create a new "permisions|perms" subcommand using the given class - * that automatically replaces {label} in the \@PermissionGroup annotation in that class - * and the given command permission. - * - * @param classToList - * @param permission - */ - public PermsCommand(@NonNull Class<? extends FoPermissions> classToList, String permission) { - this(classToList, SerializedMap - .of("label", SimpleSettings.MAIN_COMMAND_ALIASES.get(0))); - - setPermission(permission); - } - - /** - * Create a new "permisions|perms" subcommand using the given class with - * the given variables to replace in the \@PermissionGroup annotation in that class. - * - * @param classToList - * @param variables - */ - public PermsCommand(@NonNull Class<? extends FoPermissions> classToList, SerializedMap variables) { - super("permissions|perms"); - - this.classToList = classToList; - this.variables = variables; - - setDescription(Commands.PERMS_DESCRIPTION); - setUsage(Commands.PERMS_USAGE); - - // Invoke to check for errors early - list(); - } - - @Override - protected void onCommand() { - - final String phrase = args.length > 0 ? joinArgs(0) : null; - - new ChatPaginator(15) - .setFoundationHeader(Commands.PERMS_HEADER) - .setPages(list(phrase)) - .send(sender); - } - - /* - * Iterate through all classes and superclasses in the given classes and fill their permissions - */ - private List<SimpleComponent> list() { - return this.list(null); - } - - /* - * Iterate through all classes and superclasses in the given classes and fill their permissions - * that match the given phrase - */ - private List<SimpleComponent> list(String phrase) { - final List<SimpleComponent> messages = new ArrayList<>(); - Class<?> iteratedClass = classToList; - - try { - do { - listIn(iteratedClass, messages, phrase); - - } while (!(iteratedClass = iteratedClass.getSuperclass()).isAssignableFrom(Object.class)); - - } catch (final Exception ex) { - ex.printStackTrace(); - } - - return messages; - } - - /* - * Find annotations and compile permissions list from the given class and given existing - * permissions that match the given phrase - */ - private void listIn(Class<?> clazz, List<SimpleComponent> messages, String phrase) throws ReflectiveOperationException { - - if (!clazz.isAssignableFrom(FoPermissions.class)) { - final PermissionGroup group = clazz.getAnnotation(PermissionGroup.class); - - if (!messages.isEmpty() && !clazz.isAnnotationPresent(PermissionGroup.class)) - throw new FoException("Please place @PermissionGroup over " + clazz); - - messages.add(SimpleComponent - .of("&7- " + (messages.isEmpty() ? Commands.PERMS_MAIN : group.value()) + " " + Commands.PERMS_PERMISSIONS) - .onClickOpenUrl("")); - } - - for (final Field field : clazz.getDeclaredFields()) { - if (!field.isAnnotationPresent(Permission.class)) - continue; - - final Permission annotation = field.getAnnotation(Permission.class); - - final String info = Replacer.replaceVariables(annotation.value(), variables); - final boolean def = annotation.def(); - - if (info.contains("{") && info.contains("}")) - throw new FoException("Forgotten unreplaced variable in " + info + " for field " + field + " in " + clazz); - - final String node = Replacer.replaceVariables((String) field.get(null), variables); - final boolean has = sender == null ? false : hasPerm(node); - - if (phrase == null || node.contains(phrase)) - messages.add(SimpleComponent - .of(" " + (has ? "&a" : "&7") + node + (def ? " " + Commands.PERMS_TRUE_BY_DEFAULT : "")) - .onClickOpenUrl("") - .onHover(Commands.PERMS_INFO + info, - Commands.PERMS_DEFAULT + (def ? Commands.PERMS_YES : Commands.PERMS_NO), - Commands.PERMS_APPLIED + (has ? Commands.PERMS_YES : Commands.PERMS_NO))); - } - - for (final Class<?> inner : clazz.getDeclaredClasses()) { - messages.add(SimpleComponent.of("&r ")); - - listIn(inner, messages, phrase); - } - } - - /** - * @see org.mineacademy.fo.command.SimpleCommand#tabComplete() - */ - @Override - protected List<String> tabComplete() { - return NO_COMPLETE; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/ReloadCommand.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/ReloadCommand.java deleted file mode 100644 index c6cd66a9eef8e1fdd4312832e7533541e431d9f9..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/ReloadCommand.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.mineacademy.fo.command; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.mineacademy.fo.FileUtil; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.settings.SimpleLocalization; -import org.mineacademy.fo.settings.SimpleLocalization.Commands; - -/** - * A simple predefined sub-command for quickly reloading the plugin - * using /{label} reload|rl - */ -public final class ReloadCommand extends SimpleSubCommand { - - /** - * Create a new reload sub-command with the given permission. - * - * @param permission - */ - public ReloadCommand(String permission) { - this(); - - setPermission(permission); - } - - /** - * Create a new reload sub-command - */ - public ReloadCommand() { - super("reload|rl"); - - setDescription(Commands.RELOAD_DESCRIPTION); - } - - @Override - protected void onCommand() { - try { - tell(Commands.RELOAD_STARTED); - - // Syntax check YML files before loading - boolean syntaxParsed = true; - - final List<File> yamlFiles = new ArrayList<>(); - - collectYamlFiles(SimplePlugin.getData(), yamlFiles); - - for (final File file : yamlFiles) { - try { - FileUtil.loadConfigurationStrict(file); - - } catch (final Throwable t) { - t.printStackTrace(); - - syntaxParsed = false; - } - } - - if (!syntaxParsed) { - tell(SimpleLocalization.Commands.RELOAD_FILE_LOAD_ERROR); - - return; - } - - SimplePlugin.getInstance().reload(); - tell(SimpleLocalization.Commands.RELOAD_SUCCESS); - - } catch (final Throwable t) { - tell(SimpleLocalization.Commands.RELOAD_FAIL.replace("{error}", t.getMessage() != null ? t.getMessage() : "unknown")); - - t.printStackTrace(); - } - } - - /* - * Get a list of all files ending with "yml" in the given directory - * and its subdirectories - */ - private List<File> collectYamlFiles(File directory, List<File> list) { - - if (directory.exists()) - for (final File file : directory.listFiles()) { - if (file.getName().endsWith("yml")) - list.add(file); - - if (file.isDirectory()) - collectYamlFiles(file, list); - } - - return list; - } - - /** - * @see org.mineacademy.fo.command.SimpleCommand#tabComplete() - */ - @Override - protected List<String> tabComplete() { - return NO_COMPLETE; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/SimpleCommand.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/SimpleCommand.java deleted file mode 100644 index 61af97a11829545ceee5527f81fe07ada0cc5cc0..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/SimpleCommand.java +++ /dev/null @@ -1,1651 +0,0 @@ -package org.mineacademy.fo.command; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.function.Consumer; -import java.util.function.Function; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.command.PluginCommand; -import org.bukkit.command.TabCompleter; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitTask; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Messenger; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.TabUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.collection.expiringmap.ExpiringMap; -import org.mineacademy.fo.command.SimpleCommandGroup.MainCommand; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.debug.LagCatcher; -import org.mineacademy.fo.exception.CommandException; -import org.mineacademy.fo.exception.EventHandledException; -import org.mineacademy.fo.exception.InvalidCommandArgException; -import org.mineacademy.fo.model.ChatPaginator; -import org.mineacademy.fo.model.Replacer; -import org.mineacademy.fo.model.SimpleComponent; -import org.mineacademy.fo.model.SimpleTime; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.fo.settings.SimpleLocalization; - -import lombok.Getter; -import lombok.NonNull; - -/** - * A simple command used to replace all Bukkit/Spigot command functionality - * across any plugin that utilizes this. - */ -public abstract class SimpleCommand extends Command { - - /** - * If this flag is true, we will use {@link Messenger} to send - * messages (no prefix supported) - * - * @deprecated use {@link Messenger#ENABLED} instead - */ - @Deprecated - public static boolean USE_MESSENGER = Messenger.ENABLED; - - /** - * Denotes an empty list used to disable tab-completion - */ - protected static final List<String> NO_COMPLETE = Collections.unmodifiableList(new ArrayList<>()); - - /** - * Return the default permission syntax - * - * @return - */ - protected static final String getDefaultPermission() { - return SimplePlugin.getNamed().toLowerCase() + ".command.{label}"; - } - - /** - * You can set the cooldown time before executing the command again. This map - * stores the player uuid and his last execution of the command. - */ - private final ExpiringMap<UUID, Long> cooldownMap = ExpiringMap.builder().expiration(30, TimeUnit.MINUTES).build(); - - /** - * The command label, eg. boss for /boss - * <p> - * This variable is updated dynamically when the command is run with the - * last known version of the label, e.g. /boss or /b will set it to boss or b - * respectively - */ - private String label; - - /** - * Has this command been already registered? - */ - private boolean registered = false; - - /** - * Should we add {@link Common#getTellPrefix()} automatically when calling tell and returnTell methods - * from this command? - */ - private boolean addTellPrefix = true; - - /** - * The {@link Common#getTellPrefix()} custom prefix only used for sending messages in {@link #onCommand()} method - * for this command, empty by default, then we use the one in Common - */ - private String tellPrefix = ""; - - /** - * Minimum arguments required to run this command - */ - @Getter - private int minArguments = 0; - - /** - * The command cooldown before we can run this command again - */ - private int cooldownSeconds = 0; - - /** - * A custom message when the player attempts to run this command - * within {@link #cooldownSeconds}. By default we use the one found in - * {@link SimpleLocalization.Commands#COOLDOWN_WAIT} - * <p> - * TIP: Use {duration} to replace the remaining time till next run - */ - private String cooldownMessage = null; - - /** - * Should we automatically send usage message when the first argument - * equals to "help" or "?" ? - */ - private boolean autoHandleHelp = true; - - // ---------------------------------------------------------------------- - // Temporary variables - // ---------------------------------------------------------------------- - - /** - * The command sender, or null if does not exist - * <p> - * This variable is updated dynamically when the command is run with the - * last known sender - */ - protected CommandSender sender; - - /** - * The arguments used when the command was last executed - * <p> - * This variable is updated dynamically when the command is run with the - * last known arguments - */ - protected String[] args; - - // ---------------------------------------------------------------------- - - /** - * Create a new simple command with the given label. - * <p> - * Separate the label with | to split between label and aliases. - * Example: remove|r|rm will create a /remove command that can - * also be run by typing /r and /rm as its aliases. - * - * @param label - */ - protected SimpleCommand(final String label) { - this(parseLabel0(label), parseAliases0(label)); - } - - /** - * Create a new simple command from the list. The first - * item in the list is the main label and the other ones are the aliases. - */ - protected SimpleCommand(final StrictList<String> labels) { - this(parseLabelList0(labels), labels.size() > 1 ? labels.subList(1, labels.size()) : null); - } - - /** - * Create a new simple command - * - * @param label - * @param aliases - */ - protected SimpleCommand(final String label, final List<String> aliases) { - super(label); - - // NOTICE: - // Any usages of "this instanceof" is considered a poor quality code. The reason we use it - // is that we know for certain these parent classes exist, and we need to navigate - // developers on their proper usage. We recommend you avoid using "this instanceof" if possible. - Valid.checkBoolean(!(this instanceof CommandExecutor), "Please do not write 'implements CommandExecutor' for /" + super.getLabel() + " cmd, we already have a listener there"); - Valid.checkBoolean(!(this instanceof TabCompleter), "Please do not write 'implements TabCompleter' for /" + super.getLabel() + " cmd, simply override tabComplete method"); - - setLabel(label); - - if (aliases != null) - setAliases(aliases); - - // Set a default permission for this command - setPermission(getDefaultPermission()); - } - - /* - * Split the given label by | and get the first part, used as the main label - */ - private static String parseLabel0(final String label) { - Valid.checkNotNull(label, "Label must not be null!"); - - return label.split("(\\||\\/)")[0]; - } - - /* - * Split the given label by | and use the second and further parts as aliases - */ - private static List<String> parseAliases0(final String label) { - final String[] aliases = label.split("(\\||\\/)"); - - return aliases.length > 0 ? Arrays.asList(Arrays.copyOfRange(aliases, 1, aliases.length)) : new ArrayList<>(); - } - - /* - * Return the first index from the list or thrown an error if list empty - */ - private static String parseLabelList0(final StrictList<String> labels) { - Valid.checkBoolean(!labels.isEmpty(), "Command label must not be empty!"); - - return labels.get(0); - } - - // ---------------------------------------------------------------------- - // Registration - // ---------------------------------------------------------------------- - - /** - * Registers this command into Bukkit. - * <p> - * Throws an error if the command {@link #isRegistered()} already. - */ - public final void register() { - register(true); - } - - /** - * Registers this command into Bukkit. - * <p> - * Throws an error if the command {@link #isRegistered()} already. - * - * @param unregisterOldAliases If a command with the same label is already present, should - * we remove associated aliases with the old command? This solves a problem - * in ChatControl where unregistering /tell from the Essentials plugin would also - * unregister /t from Towny, which is undesired. - */ - public final void register(final boolean unregisterOldAliases) { - this.register(true, unregisterOldAliases); - } - - /** - * Registers this command into Bukkit. - * <p> - * Throws an error if the command {@link #isRegistered()} already. - * - * @param unregisterOldCommand Unregister old command if exists with the same label? - * @param unregisterOldAliases If a command with the same label is already present, should - * we remove associated aliases with the old command? This solves a problem - * in ChatControl where unregistering /tell from the Essentials plugin would also - * unregister /t from Towny, which is undesired. - */ - public final void register(final boolean unregisterOldCommand, final boolean unregisterOldAliases) { - Valid.checkBoolean(!(this instanceof SimpleSubCommand), "Sub commands cannot be registered!"); - Valid.checkBoolean(!registered, "The command /" + getLabel() + " has already been registered!"); - - if (!canRegister()) - return; - - final PluginCommand oldCommand = Bukkit.getPluginCommand(getLabel()); - - if (oldCommand != null && unregisterOldCommand) { - final String owningPlugin = oldCommand.getPlugin().getName(); - - if (!owningPlugin.equals(SimplePlugin.getNamed())) - Debugger.debug("command", "Command /" + getLabel() + " already (" + owningPlugin + "), overriding and unregistering /" + oldCommand.getLabel() + ", /" + String.join(", /", oldCommand.getAliases())); - - Remain.unregisterCommand(oldCommand.getLabel(), unregisterOldAliases); - } - - Remain.registerCommand(this); - registered = true; - } - - /** - * Removes the command from Bukkit. - * <p> - * Throws an error if the command is not {@link #isRegistered()}. - */ - public final void unregister() { - Valid.checkBoolean(!(this instanceof SimpleSubCommand), "Sub commands cannot be unregistered!"); - Valid.checkBoolean(registered, "The command /" + getLabel() + " is not registered!"); - - Remain.unregisterCommand(getLabel()); - registered = false; - } - - /** - * Return true if this command can be registered through {@link #register()} methods. - * By default true. - * - * @return - */ - protected boolean canRegister() { - return true; - } - - // ---------------------------------------------------------------------- - // Execution - // ---------------------------------------------------------------------- - - /** - * Execute this command, updates the {@link #sender}, {@link #label} and {@link #args} variables, - * checks permission and returns if the sender lacks it, - * checks minimum arguments and finally passes the command to the child class. - * <p> - * Also contains various error handling scenarios - */ - @Override - public final boolean execute(final CommandSender sender, final String label, final String[] args) { - - if (SimplePlugin.isReloading() || !SimplePlugin.getInstance().isEnabled()) { - Common.tell(sender, SimpleLocalization.Commands.USE_WHILE_NULL.replace("{state}", (SimplePlugin.isReloading() ? SimpleLocalization.Commands.RELOADING : SimpleLocalization.Commands.DISABLED))); - - return false; - } - - // Set variables to re-use later - this.sender = sender; - this.label = label; - this.args = args; - - // Set tell prefix only if the parent setting was on - final boolean hadTellPrefix = Common.ADD_TELL_PREFIX; - if (hadTellPrefix) - Common.ADD_TELL_PREFIX = addTellPrefix; - - // Optional sublabel if this is a sub command - final String sublabel = this instanceof SimpleSubCommand ? " " + ((SimpleSubCommand) this).getSublabel() : ""; - - // Catch "errors" that contain a message to send to the player - // Measure performance of all commands - final String lagSection = "Command /" + getLabel() + sublabel + (args.length > 0 ? " " + String.join(" ", args) : ""); - - try { - // Prevent duplication since MainCommand delegates this - if (!(this instanceof MainCommand)) - LagCatcher.start(lagSection); - - // Check if sender has the proper permission - if (getPermission() != null) - checkPerm(getPermission()); - - // Check for minimum required arguments and print help - if (args.length < getMinArguments() || autoHandleHelp && args.length == 1 && ("help".equals(args[0]) || "?".equals(args[0]))) { - - Common.runAsync(() -> { - final String usage = getMultilineUsageMessage() != null ? String.join("\n&c", getMultilineUsageMessage()) : getUsage() != null ? getUsage() : null; - Valid.checkNotNull(usage, "getUsage() nor getMultilineUsageMessage() not implemented for '/" + getLabel() + sublabel + "' command!"); - - final ChatPaginator paginator = new ChatPaginator(SimpleLocalization.Commands.HEADER_SECONDARY_COLOR); - final List<String> pages = new ArrayList<>(); - - if (!Common.getOrEmpty(getDescription()).isEmpty()) { - pages.add(replacePlaceholders(SimpleLocalization.Commands.LABEL_DESCRIPTION)); - pages.add(replacePlaceholders("&c" + getDescription())); - } - - if (getMultilineUsageMessage() != null) { - pages.add(""); - pages.add(replacePlaceholders(SimpleLocalization.Commands.LABEL_USAGES)); - - for (final String usagePart : usage.split("\n")) - pages.add(replacePlaceholders("&c" + usagePart)); - - } else { - pages.add(""); - pages.add(SimpleLocalization.Commands.LABEL_USAGE); - pages.add("&c" + replacePlaceholders("/" + label + sublabel + (!usage.startsWith("/") ? " " + Common.stripColors(usage) : ""))); - } - - paginator - .setFoundationHeader(SimpleLocalization.Commands.LABEL_HELP_FOR.replace("{label}", getLabel() + sublabel)) - .setPages(Common.toArray(pages)); - - // Force sending on the main thread - Common.runLater(() -> paginator.send(sender)); - }); - - return true; - } - - // Check if we can run this command in time - if (cooldownSeconds > 0) - handleCooldown(); - - onCommand(); - - } catch (final InvalidCommandArgException ex) { - if (getMultilineUsageMessage() == null) - dynamicTellError(ex.getMessage() != null ? ex.getMessage() : SimpleLocalization.Commands.INVALID_SUB_ARGUMENT); - else { - dynamicTellError(SimpleLocalization.Commands.INVALID_ARGUMENT_MULTILINE); - - for (final String line : getMultilineUsageMessage()) - tellNoPrefix("&c" + line); - } - - } catch (final EventHandledException ex) { - if (ex.getMessages() != null) - dynamicTellError(ex.getMessages()); - - } catch (final CommandException ex) { - if (ex.getMessages() != null) - dynamicTellError(ex.getMessages()); - - } catch (final Throwable t) { - dynamicTellError(SimpleLocalization.Commands.ERROR.replace("{error}", t.toString())); - - Common.error(t, "Failed to execute command /" + getLabel() + sublabel + " " + String.join(" ", args)); - - } finally { - Common.ADD_TELL_PREFIX = hadTellPrefix; - - // Prevent duplication since MainCommand delegates this - if (!(this instanceof MainCommand)) - LagCatcher.end(lagSection, 8, "{section} took {time} ms"); - } - - return true; - } - - /* - * If messenger is on, we send the message prefixed with Messenger.getErrorPrefix() - * otherwise we just send a normal message - */ - private void dynamicTellError(final String... messages) { - if (USE_MESSENGER) - for (final String message : messages) - tellError(message); - else - tell(messages); - } - - /** - * Check if the command cooldown is active and if the command - * is run within the given limit, we stop it and inform the player - */ - private void handleCooldown() { - if (isPlayer()) { - final Player player = getPlayer(); - - final long lastExecution = cooldownMap.getOrDefault(player.getUniqueId(), 0L); - final long lastExecutionDifference = (System.currentTimeMillis() - lastExecution) / 1000; - - // Check if the command was not run earlier within the wait threshold - checkBoolean(lastExecution == 0 || lastExecutionDifference > cooldownSeconds, Common.getOrDefault(cooldownMessage, SimpleLocalization.Commands.COOLDOWN_WAIT).replace("{duration}", cooldownSeconds - lastExecutionDifference + 1 + "")); - - // Update the last try with the current time - cooldownMap.put(player.getUniqueId(), System.currentTimeMillis()); - } - } - - /** - * Executed when the command is run. You can get the variables sender and args directly, - * and use convenience checks in the simple command class. - */ - protected abstract void onCommand(); - - /** - * Get a custom multilined usagem message to be shown instead of the one line one - * - * @return the multiline custom usage message, or null - */ - protected String[] getMultilineUsageMessage() { - return null; - } - - // ---------------------------------------------------------------------- - // Convenience checks - // - // Here is how they work: When you command is executed, simply call any - // of these checks. If they fail, an error will be thrown inside of - // which will be a message for the player. - // - // We catch that error and send the message to the player without any - // harm or console errors to your plugin. That is intended and saves time. - // ---------------------------------------------------------------------- - - /** - * Checks if the player is a console and throws an error if he is - * - * @throws CommandException - */ - protected final void checkConsole() throws CommandException { - if (!isPlayer()) - throw new CommandException("&c" + SimpleLocalization.Commands.NO_CONSOLE); - } - - /** - * Checks if the current sender has the given permission - * - * @param perm - * @throws CommandException - */ - public final void checkPerm(@NonNull final String perm) throws CommandException { - if (isPlayer() && !hasPerm(perm)) - throw new CommandException(getPermissionMessage().replace("{permission}", perm)); - } - - /** - * Checks if the given sender has the given permission - * - * @param sender - * @param perm - * @throws CommandException - */ - public final void checkPerm(@NonNull CommandSender sender, @NonNull final String perm) throws CommandException { - if (isPlayer() && !hasPerm(sender, perm)) - throw new CommandException(getPermissionMessage().replace("{permission}", perm)); - } - - /** - * Check if the command arguments are of the minimum length - * - * @param minimumLength - * @param falseMessage - * @throws CommandException - */ - protected final void checkArgs(final int minimumLength, final String falseMessage) throws CommandException { - if (args.length < minimumLength) - returnTell((USE_MESSENGER ? "" : "&c") + falseMessage); - } - - /** - * Checks if the given boolean is true - * - * @param value - * @param falseMessage - * @throws CommandException - */ - protected final void checkBoolean(final boolean value, final String falseMessage) throws CommandException { - if (!value) - returnTell((USE_MESSENGER ? "" : "&c") + falseMessage); - } - - /** - * Check if the given boolean is true or returns {@link #returnInvalidArgs()} - * - * @param value - * - * @throws CommandException - */ - protected final void checkUsage(final boolean value) throws CommandException { - if (!value) - returnInvalidArgs(); - } - - /** - * Checks if the given object is not null - * - * @param value - * @param messageIfNull - * @throws CommandException - */ - protected final void checkNotNull(final Object value, final String messageIfNull) throws CommandException { - if (value == null) - returnTell((USE_MESSENGER ? "" : "&c") + messageIfNull); - } - - /** - * Attempts to find the offline player by name, sends an error message to sender if he did not play before - * or runs the specified callback. - * - * The offline player lookup is done async, the callback is synchronized. - * - * @param name - * @param callback - * @throws CommandException - */ - protected final void findOfflinePlayer(final String name, Consumer<OfflinePlayer> callback) throws CommandException { - runAsync(() -> { - final OfflinePlayer targetPlayer = Bukkit.getOfflinePlayer(name); - checkBoolean(targetPlayer != null && (targetPlayer.isOnline() || targetPlayer.hasPlayedBefore()), SimpleLocalization.Player.NOT_PLAYED_BEFORE.replace("{player}", name)); - - runLater(() -> callback.accept(targetPlayer)); - }); - } - - /** - * Attempts to find a non-vanished online player, failing with the message - * found at {@link SimpleLocalization.Player#NOT_ONLINE} - * - * @param name - * @return - * @throws CommandException - */ - protected final Player findPlayer(final String name) throws CommandException { - return findPlayer(name, SimpleLocalization.Player.NOT_ONLINE); - } - - /** - * Attempts to find a non-vanished online player, failing with a false message - * - * @param name - * @param falseMessage - * @return - * @throws CommandException - */ - protected final Player findPlayer(final String name, final String falseMessage) throws CommandException { - final Player player = findPlayerInternal(name); - checkBoolean(player != null && player.isOnline() && !PlayerUtil.isVanished(player), falseMessage.replace("{player}", name)); - - return player; - } - - /** - * Return the player by the given name, and, when the name is null, return the sender if sender is player. - * - * @param name - * @return - * @throws CommandException - */ - protected final Player findPlayerOrSelf(final String name) throws CommandException { - if (name == null) { - checkBoolean(isPlayer(), SimpleLocalization.Commands.CONSOLE_MISSING_PLAYER_NAME); - - return getPlayer(); - } - - final Player player = findPlayerInternal(name); - checkBoolean(player != null && player.isOnline(), SimpleLocalization.Player.NOT_ONLINE.replace("{player}", name)); - - return player; - } - - /** - * A simple call to Bukkit.getPlayer(name) meant to be overriden - * if you have a custom implementation of getting players by name. - * - * Example use: ChatControl can find players by their nicknames too - * - * @param name - * @return - */ - protected Player findPlayerInternal(String name) { - return Bukkit.getPlayer(name); - } - - /** - * Attempts to convert the given input (such as 1 hour) into - * a {@link SimpleTime} object - * - * @param raw - * @return - */ - protected final SimpleTime findTime(String raw) { - try { - return SimpleTime.from(raw); - - } catch (final IllegalArgumentException ex) { - returnTell(SimpleLocalization.Commands.INVALID_TIME.replace("{input}", raw)); - - return null; - } - } - - /** - * Attempts to parse the given name into a CompMaterial, will work for both modern - * and legacy materials: MONSTER_EGG and SHEEP_SPAWN_EGG - * <p> - * You can use the {enum} or {item} variable to replace with the given name - * - * @param name - * @param falseMessage - * @return - * @throws CommandException - */ - protected final CompMaterial findMaterial(final String name, final String falseMessage) throws CommandException { - final CompMaterial found = CompMaterial.fromString(name); - - checkNotNull(found, falseMessage.replace("{enum}", name).replace("{item}", name)); - return found; - } - - /** - * Finds an enumeration of a certain type, if it fails it prints a false message to the player - * You can use the {enum} variable in the false message for the name parameter - * - * @param <T> - * @param enumType - * @param name - * @param falseMessage - * @return - * @throws CommandException - */ - protected final <T extends Enum<T>> T findEnum(final Class<T> enumType, final String name, final String falseMessage) throws CommandException { - return this.findEnum(enumType, name, null, falseMessage); - } - - /** - * Finds an enumeration of a certain type, if it fails it prints a false message to the player - * You can use the {enum} variable in the false message for the name parameter - * - * You can also use the condition to filter certain enums and act as if they did not existed - * if your function returns false for such - * - * @param <T> - * @param enumType - * @param name - * @param condition - * @param falseMessage - * @return - * @throws CommandException - */ - protected final <T extends Enum<T>> T findEnum(final Class<T> enumType, final String name, final Function<T, Boolean> condition, final String falseMessage) throws CommandException { - T found = null; - - try { - found = ReflectionUtil.lookupEnum(enumType, name); - - if (!condition.apply(found)) - found = null; - - } catch (final Throwable t) { - // Not found, pass through below to error out - } - - checkNotNull(found, falseMessage.replace("{enum}", name).replace("{available}", Common.join(enumType.getEnumConstants()))); - return found; - } - - /** - * A convenience method for parsing a number that is between two bounds - * You can use {min} and {max} in the message to be automatically replaced - * - * @param index - * @param min - * @param max - * @param falseMessage - * @return - */ - protected final int findNumber(final int index, final int min, final int max, final String falseMessage) { - return findNumber(Integer.class, index, min, max, falseMessage); - } - - /** - * A convenience method for parsing a number at the given args index - * - * @param index - * @param falseMessage - * @return - */ - protected final int findNumber(final int index, final String falseMessage) { - return findNumber(Integer.class, index, falseMessage); - } - - /** - * A convenience method for parsing any number type that is between two bounds - * Number can be of any type, that supports method valueOf(String) - * You can use {min} and {max} in the message to be automatically replaced - * - * @param <T> - * @param numberType - * @param index - * @param min - * @param max - * @param falseMessage - * @return - */ - protected final <T extends Number & Comparable<T>> T findNumber(final Class<T> numberType, final int index, final T min, final T max, final String falseMessage) { - final T number = findNumber(numberType, index, falseMessage); - checkBoolean(number.compareTo(min) >= 0 && number.compareTo(max) <= 0, falseMessage.replace("{min}", min + "").replace("{max}", max + "")); - - return number; - } - - /** - * A convenience method for parsing any number type at the given args index - * Number can be of any type, that supports method valueOf(String) - * - * @param <T> - * @param numberType - * @param index - * @param falseMessage - * @return - */ - protected final <T extends Number> T findNumber(final Class<T> numberType, final int index, final String falseMessage) { - checkBoolean(index < args.length, falseMessage); - - try { - return (T) numberType.getMethod("valueOf", String.class).invoke(null, args[index]); // Method valueOf is part of all main Number sub classes, eg. Short, Integer, Double, etc. - } - - catch (final IllegalAccessException | NoSuchMethodException e) { - e.printStackTrace(); - - } catch (final InvocationTargetException e) { - - // Print stack trace for all exceptions, except NumberFormatException - // NumberFormatException is expected to happen, in this case we just want to display falseMessage without stack trace - if (!(e.getCause() instanceof NumberFormatException)) - e.printStackTrace(); - } - - throw new CommandException(replacePlaceholders((USE_MESSENGER ? "" : "&c") + falseMessage)); - } - - /** - * A convenience method for parsing a boolean at the given args index - * - * @param index - * @param invalidMessage - * @return - */ - protected final boolean findBoolean(final int index, final String invalidMessage) { - checkBoolean(index < args.length, invalidMessage); - - if (args[index].equalsIgnoreCase("true")) - return true; - - else if (args[index].equalsIgnoreCase("false")) - return false; - - throw new CommandException(replacePlaceholders((USE_MESSENGER ? "" : "&c") + invalidMessage)); - } - - // ---------------------------------------------------------------------- - // Other checks - // ---------------------------------------------------------------------- - - /** - * A convenience check for quickly determining if the sender has a given - * permission. - * - * TIP: For a more complete check use {@link #checkPerm(String)} that - * will automatically return your command if they lack the permission. - * - * @param permission - * @return - */ - protected final boolean hasPerm(String permission) { - return this.hasPerm(sender, permission); - } - - /** - * A convenience check for quickly determining if the sender has a given - * permission. - * - * TIP: For a more complete check use {@link #checkPerm(String)} that - * will automatically return your command if they lack the permission. - * - * @param sender - * @param permission - * @return - */ - protected final boolean hasPerm(CommandSender sender, String permission) { - return permission == null ? true : PlayerUtil.hasPerm(sender, permission.replace("{label}", getLabel())); - } - - // ---------------------------------------------------------------------- - // Messaging - // ---------------------------------------------------------------------- - - /** - * Sends a message to the player - * - * @see Replacer#replaceArray - * - * @param message - * @param replacements - */ - protected final void tellReplaced(final String message, final Object... replacements) { - tell(Replacer.replaceArray(message, replacements)); - } - - /** - * Sends a interactive chat component to the sender, not replacing any special - * variables just executing the {@link SimpleComponent#send(CommandSender...)} method - * as a shortcut - * - * @param components - */ - protected final void tell(List<SimpleComponent> components) { - if (components != null) - tell(components.toArray(new SimpleComponent[components.size()])); - } - - /** - * Sends a interactive chat component to the sender, not replacing any special - * variables just executing the {@link SimpleComponent#send(CommandSender...)} method - * as a shortcut - * - * @param components - */ - protected final void tell(SimpleComponent... components) { - if (components != null) - for (final SimpleComponent component : components) - component.send(sender); - } - - /** - * Send the player a Replacer message - * - * @param replacer - */ - protected final void tell(Replacer replacer) { - if (replacer != null) - tell(replacer.getReplacedMessage()); - } - - /** - * Send a list of messages to the player - * - * @param messages - */ - protected final void tell(Collection<String> messages) { - if (messages != null) - tell(messages.toArray(new String[messages.size()])); - } - - /** - * Send the player a Replacer message - * - * @param replacer - */ - protected final void tellNoPrefix(Replacer replacer) { - if (replacer != null) - tellNoPrefix(replacer.getReplacedMessage()); - } - - /** - * Sends a multiline message to the player without plugin's prefix. - * - * @param messages - */ - protected final void tellNoPrefix(Collection<String> messages) { - tellNoPrefix(messages.toArray(new String[messages.size()])); - } - - /** - * Sends a multiline message to the player without plugin's prefix. - * - * @param messages - */ - protected final void tellNoPrefix(String... messages) { - final boolean tellPrefix = Common.ADD_TELL_PREFIX; - final boolean localPrefix = addTellPrefix; - - Common.ADD_TELL_PREFIX = false; - addTellPrefix = false; - - tell(messages); - - Common.ADD_TELL_PREFIX = tellPrefix; - addTellPrefix = localPrefix; - } - - /** - * Sends a multiline message to the player, avoiding prefix if 3 lines or more - * - * @param messages - */ - protected final void tell(String... messages) { - if (messages != null) { - messages = replacePlaceholders(messages); - - if (!addTellPrefix || USE_MESSENGER || messages.length > 2) { - - if (USE_MESSENGER && addTellPrefix) { - tellInfo(messages[0]); - - if (messages.length > 1) - for (int i = 1; i < messages.length; i++) - Common.tellNoPrefix(sender, messages[i]); - - } else - Common.tellNoPrefix(sender, messages); - - } else if (tellPrefix.isEmpty()) - Common.tell(sender, messages); - else - for (final String message : messages) - Common.tellNoPrefix(sender, (tellPrefix.isEmpty() ? "" : tellPrefix + " ") + message); - } - } - - /** - * Sends a no prefix message to the player - * - * @param message - */ - protected final void tellSuccess(String message) { - if (message != null) { - message = replacePlaceholders(message); - - Messenger.success(sender, message); - } - } - - /** - * Sends a no prefix message to the player - * - * @param message - */ - protected final void tellInfo(String message) { - if (message != null) { - message = replacePlaceholders(message); - - Messenger.info(sender, message); - } - } - - /** - * Sends a no prefix message to the player - * - * @param message - */ - protected final void tellWarn(String message) { - if (message != null) { - message = replacePlaceholders(message); - - Messenger.warn(sender, message); - } - } - - /** - * Sends a no prefix message to the player - * - * @param message - */ - protected final void tellError(String message) { - if (message != null) { - message = replacePlaceholders(message); - - Messenger.error(sender, message); - } - } - - /** - * Sends a no prefix message to the player - * - * @param message - */ - protected final void tellQuestion(String message) { - if (message != null) { - message = replacePlaceholders(message); - - Messenger.question(sender, message); - } - } - - /** - * Convenience method for returning the command with the {@link SimpleLocalization.Commands#INVALID_ARGUMENT} - * message for player - */ - protected final void returnInvalidArgs() { - tellError(SimpleLocalization.Commands.INVALID_ARGUMENT.replace("{label}", getLabel())); - - throw new CommandException(); - } - - /** - * Sends a message to the player and throws a message error, preventing further execution - * - * @param messages - * @throws CommandException - */ - protected final void returnTell(final Collection<String> messages) throws CommandException { - returnTell(messages.toArray(new String[messages.size()])); - } - - /** - * Sends a message to the player and throws a message error, preventing further execution - * - * @param replacer - * @throws CommandException - */ - protected final void returnTell(final Replacer replacer) throws CommandException { - returnTell(replacer.getReplacedMessage()); - } - - /** - * Sends a message to the player and throws a message error, preventing further execution - * - * @param messages - * @throws CommandException - */ - protected final void returnTell(final String... messages) throws CommandException { - throw new CommandException(replacePlaceholders(messages)); - } - - /** - * Ho ho ho, returns the command usage to the sender - * - * @throws InvalidCommandArgException - */ - protected final void returnUsage() throws InvalidCommandArgException { - throw new InvalidCommandArgException(); - } - - // ---------------------------------------------------------------------- - // Placeholder - // ---------------------------------------------------------------------- - - /** - * Replaces placeholders in all messages - * To change them override {@link #replacePlaceholders(String)} - * - * @param messages - * @return - */ - protected final String[] replacePlaceholders(final String[] messages) { - for (int i = 0; i < messages.length; i++) - messages[i] = replacePlaceholders(messages[i]).replace("{prefix}", Common.getTellPrefix()); - - return messages; - } - - /** - * Replaces placeholders in the message - * - * @param message - * @return - */ - protected String replacePlaceholders(String message) { - // Replace basic labels - message = replaceBasicPlaceholders0(message); - - // Replace {X} with arguments - for (int i = 0; i < args.length; i++) - message = message.replace("{" + i + "}", Common.getOrEmpty(args[i])); - - return message; - } - - /** - * Internal method for replacing {label} and {sublabel} - * - * @param message - * @return - */ - private String replaceBasicPlaceholders0(final String message) { - return message - .replace("{label}", getLabel()) - .replace("{sublabel}", this instanceof SimpleSubCommand ? ((SimpleSubCommand) this).getSublabels()[0] : super.getLabel()); - } - - /** - * Utility method to safely update the args, increasing them if the position is too high - * <p> - * Used in placeholders - * - * @param position - * @param value - */ - protected final void setArg(final int position, final String value) { - if (args.length <= position) - args = Arrays.copyOf(args, position + 1); - - args[position] = value; - } - - /** - * Convenience method for returning the last word in arguments - * - * @return - */ - protected final String getLastArg() { - return args.length > 0 ? args[args.length - 1] : ""; - } - - /** - * Copies and returns the arguments {@link #args} from the given range - * to their end - * - * @param from - * @return - */ - protected final String[] rangeArgs(final int from) { - return rangeArgs(from, args.length); - } - - /** - * Copies and returns the arguments {@link #args} from the given range - * to the given end - * - * @param from - * @param to - * @return - */ - protected final String[] rangeArgs(final int from, final int to) { - return Arrays.copyOfRange(args, from, to); - } - - /** - * Copies and returns the arguments {@link #args} from the given range - * to their end joined by spaces - * - * @param from - * @return - */ - protected final String joinArgs(final int from) { - return joinArgs(from, args.length); - } - - /** - * Copies and returns the arguments {@link #args} from the given range - * to the given end joined by spaces - * - * @param from - * @param to - * @return - */ - protected final String joinArgs(final int from, final int to) { - String message = ""; - - for (int i = from; i < args.length && i < to; i++) - message += args[i] + (i + 1 == args.length ? "" : " "); - - return message; - } - - // ---------------------------------------------------------------------- - // Tab completion - // ---------------------------------------------------------------------- - - /** - * Show tab completion suggestions when the given sender - * writes the command with the given arguments - * <p> - * Tab completion is only shown if the sender has {@link #getPermission()} - * - * @param sender - * @param alias - * @param args - * @param location - * @return - * @deprecated location is not used - */ - @Deprecated - @Override - public final List<String> tabComplete(final CommandSender sender, final String alias, final String[] args, final Location location) throws IllegalArgumentException { - return tabComplete(sender, alias, args); - } - - /** - * Show tab completion suggestions when the given sender - * writes the command with the given arguments - * <p> - * Tab completion is only shown if the sender has {@link #getPermission()} - * - * @param sender - * @param alias - * @param args - * @return - */ - @Override - public final List<String> tabComplete(final CommandSender sender, final String alias, final String[] args) throws IllegalArgumentException { - this.sender = sender; - label = alias; - this.args = args; - - if (hasPerm(getPermission())) { - List<String> suggestions = tabComplete(); - - // Return online player names when suggestions are null - simulate Bukkit behaviour - if (suggestions == null) - suggestions = completeLastWordPlayerNames(); - - return suggestions; - } - - return new ArrayList<>(); - } - - /** - * Override this method to support tab completing in your command. - * <p> - * You can then use "sender", "label" or "args" fields from {@link SimpleCommand} - * class normally and return a list of tab completion suggestions. - * <p> - * We already check for {@link #getPermission()} and only call this method if the - * sender has it. - * <p> - * TIP: Use {@link #completeLastWord(Iterable)} and {@link #getLastArg()} methods - * in {@link SimpleCommand} for your convenience - * - * @return the list of suggestions to complete, or null to complete player names automatically - */ - protected List<String> tabComplete() { - return null; - } - - /** - * Convenience method for automatically completing the last word - * with the given suggestions. We sort them and only select ones - * that the last word starts with. - * - * @param <T> - * @param suggestions - * @return - */ - protected final <T> List<String> completeLastWord(final T... suggestions) { - return TabUtil.complete(getLastArg(), suggestions); - } - - /** - * Convenience method for automatically completing the last word - * with the given suggestions. We sort them and only select ones - * that the last word starts with. - * - * @param <T> - * @param suggestions - * @return - */ - protected final <T> List<String> completeLastWord(final Iterable<T> suggestions) { - final List<T> list = new ArrayList<>(); - - for (final T suggestion : suggestions) - list.add(suggestion); - - return TabUtil.complete(getLastArg(), list.toArray()); - } - - /** - * Convenience method for automatically completing the last word - * with the given suggestions converting them to a string. We sort them and only select ones - * that the last word starts with. - * - * @param <T> - * @param suggestions - * @param toString - * @return - */ - protected final <T> List<String> completeLastWord(final Iterable<T> suggestions, Function<T, String> toString) { - final List<String> list = new ArrayList<>(); - - for (final T suggestion : suggestions) - list.add(toString.apply(suggestion)); - - return TabUtil.complete(getLastArg(), list.toArray()); - } - - /** - * Convenience method for completing all player names that the sender can see - * and that are not vanished - * <p> - * TIP: You can simply return null for the same behaviour - * - * @return - */ - protected List<String> completeLastWordPlayerNames() { - return TabUtil.complete(getLastArg(), isPlayer() ? Common.getPlayerNames(false) : Common.getPlayerNames()); - } - - // ---------------------------------------------------------------------- - // Temporary variables and safety - // ---------------------------------------------------------------------- - - /** - * Attempts to get the sender as player, only works if the sender is actually a player, - * otherwise we return null - * - * @return - */ - protected final Player getPlayer() { - return isPlayer() ? (Player) getSender() : null; - } - - /** - * Return whether the sender is a living player - * - * @return - */ - protected final boolean isPlayer() { - return sender instanceof Player; - } - - /** - * Should we add {@link Common#getTellPrefix()} automatically when calling tell and returnTell methods - * from this command? - * - * @param addTellPrefix - */ - protected final void addTellPrefix(final boolean addTellPrefix) { - this.addTellPrefix = addTellPrefix; - } - - /** - * Sets a custom prefix used in tell messages for this command. - * This overrides {@link Common#getTellPrefix()} however won't work if - * {@link #addTellPrefix} is disabled - * - * @param tellPrefix - */ - protected final void setTellPrefix(final String tellPrefix) { - this.tellPrefix = tellPrefix; - } - - /** - * Sets the minimum number of arguments to run this command - * - * @param minArguments - */ - protected final void setMinArguments(final int minArguments) { - Valid.checkBoolean(minArguments >= 0, "Minimum arguments must be 0 or greater"); - - this.minArguments = minArguments; - } - - /** - * Set the time before the same player can execute this command again - * - * @param cooldown - * @param unit - */ - protected final void setCooldown(final int cooldown, final TimeUnit unit) { - Valid.checkBoolean(cooldown >= 0, "Cooldown must be >= 0 for /" + getLabel()); - - cooldownSeconds = (int) unit.toSeconds(cooldown); - } - - /** - * Set a custom cooldown message, by default we use the one found in {@link SimpleLocalization.Commands#COOLDOWN_WAIT} - * <p> - * Use {duration} to dynamically replace the remaining time - * - * @param cooldownMessage - */ - protected final void setCooldownMessage(final String cooldownMessage) { - this.cooldownMessage = cooldownMessage; - } - - /** - * Get the permission for this command, either the one you set or our from Localization - */ - @Override - public final String getPermissionMessage() { - return Common.getOrDefault(super.getPermissionMessage(), SimpleLocalization.NO_PERMISSION); - } - - /** - * By default we check if the player has the permission you set in setPermission. - * <p> - * If that is null, we check for the following: - * {yourpluginname}.command.{label} for {@link SimpleCommand} - * {yourpluginname}.command.{label}.{sublabel} for {@link SimpleSubCommand} - * <p> - * We handle lacking permissions automatically and return with an no-permission message - * when the player lacks it. - * - * @return - */ - @Override - public final String getPermission() { - return super.getPermission() == null ? null : replaceBasicPlaceholders0(super.getPermission()); - } - - /** - * Get the permission without replacing variables - * - * @return - * @deprecated internal use only - */ - @Deprecated - protected final String getRawPermission() { - return super.getPermission(); - } - - /** - * Sets the permission required for this command to run. If you set the - * permission to null we will not require any permission (unsafe). - * - * @param - */ - @Override - public final void setPermission(final String permission) { - super.setPermission(permission); - } - - /** - * Get the sender of this command - * - * @return - */ - protected final CommandSender getSender() { - Valid.checkNotNull(sender, "Sender cannot be null"); - - return sender; - } - - /** - * Get aliases for this command - */ - @Override - public final List<String> getAliases() { - return super.getAliases(); - } - - /** - * Get description for this command - */ - @Override - public final String getDescription() { - return super.getDescription(); - } - - /** - * Get the name of this command - */ - @Override - public final String getName() { - return super.getName(); - } - - /** - * Get the usage message of this command - */ - @Override - public final String getUsage() { - final String bukkitUsage = super.getUsage(); - - return bukkitUsage.equals("/" + getMainLabel()) ? "" : bukkitUsage; - } - - /** - * Get the most recent label for this command - */ - @Override - public final String getLabel() { - return label; - } - - /** - * Get the label given when the command was created or last updated with {@link #setLabel(String)} - * - * @return - */ - public final String getMainLabel() { - return super.getLabel(); - } - - /** - * Updates the label of this command - */ - @Override - public final boolean setLabel(final String label) { - this.label = label; - - return super.setLabel(label); - } - - /** - * Set whether we automatically show usage params in {@link #getMinArguments()} - * and when the first arg == "help" or "?" - * <p> - * True by default - * - * @param autoHandleHelp - */ - protected final void setAutoHandleHelp(final boolean autoHandleHelp) { - this.autoHandleHelp = autoHandleHelp; - } - - // ---------------------------------------------------------------------- - // Scheduling - // ---------------------------------------------------------------------- - - /** - * Runs the given task later, this supports checkX methods - * where we handle sending messages to player automatically - * - * @param runnable - * @return - */ - protected final BukkitTask runLater(Runnable runnable) { - return Common.runLater(() -> this.delegateTask(runnable)); - } - - /** - * Runs the given task later, this supports checkX methods - * where we handle sending messages to player automatically - * - * @param delayTicks - * @param runnable - * @return - */ - protected final BukkitTask runLater(int delayTicks, Runnable runnable) { - return Common.runLater(delayTicks, () -> this.delegateTask(runnable)); - } - - /** - * Runs the given task asynchronously, this supports checkX methods - * where we handle sending messages to player automatically - * - * @param runnable - * @return - */ - protected final BukkitTask runAsync(Runnable runnable) { - return Common.runAsync(() -> this.delegateTask(runnable)); - } - - /** - * Runs the given task asynchronously, this supports checkX methods - * where we handle sending messages to player automatically - * - * @param delayTicks - * @param runnable - * @return - */ - protected final BukkitTask runAsync(int delayTicks, Runnable runnable) { - return Common.runLaterAsync(delayTicks, () -> this.delegateTask(runnable)); - } - - /* - * A helper method to catch command-related exceptions from runnables - */ - private void delegateTask(Runnable runnable) { - try { - runnable.run(); - - } catch (final CommandException ex) { - if (ex.getMessages() != null) - for (final String message : ex.getMessages()) - Messenger.error(sender, message); - - } catch (final Throwable t) { - Messenger.error(sender, SimpleLocalization.Commands.ERROR.replace("{error}", t.toString())); - - throw t; - } - } - - @Override - public boolean equals(final Object obj) { - return obj instanceof SimpleCommand ? ((SimpleCommand) obj).getLabel().equals(getLabel()) && ((SimpleCommand) obj).getAliases().equals(getAliases()) : false; - } - - @Override - public final String toString() { - return "Command{label=/" + label + "}"; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/SimpleCommandGroup.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/SimpleCommandGroup.java deleted file mode 100644 index 3a351641aa574ab8fceec11319ead59e7a66c924..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/SimpleCommandGroup.java +++ /dev/null @@ -1,560 +0,0 @@ -package org.mineacademy.fo.command; - -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Collections; -import java.util.List; - -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MathUtil; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.RandomUtil; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.ChatPaginator; -import org.mineacademy.fo.model.Replacer; -import org.mineacademy.fo.model.SimpleComponent; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.settings.SimpleLocalization; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * A command group contains a set of different subcommands - * associated with the main command, for example: /arena join, /arena leave etc. - */ -@NoArgsConstructor(access = AccessLevel.PROTECTED) -public abstract class SimpleCommandGroup { - - /** - * The list of sub-commands belonging to this command tree, for example - * the /boss command has subcommands /boss region, /boss menu etc. - */ - private final StrictList<SimpleSubCommand> subcommands = new StrictList<>(); - - /** - * The registered main command, if any - */ - private SimpleCommand mainCommand; - - /** - * How many commands shall we display per page by default? - * - * Defaults to 12 - */ - @Setter(value = AccessLevel.PROTECTED) - private int commandsPerPage = 12; - - // ---------------------------------------------------------------------- - // Main functions - // ---------------------------------------------------------------------- - - /** - * Register this command group into Bukkit and start using it - * - * @param labelAndAliases - */ - public final void register(final StrictList<String> labelAndAliases) { - register(labelAndAliases.get(0), (labelAndAliases.size() > 1 ? labelAndAliases.range(1) : new StrictList<String>()).getSource()); - } - - /** - * Register this command group into Bukkit and start using it - * - * @param label - * @param aliases - */ - public final void register(final String label, final List<String> aliases) { - Valid.checkBoolean(!isRegistered(), "Main command already registered as: " + mainCommand); - - mainCommand = new MainCommand(label); - - if (aliases != null) - mainCommand.setAliases(aliases); - - mainCommand.register(); - registerSubcommands(); - - // Sort A-Z - Collections.sort(subcommands.getSource(), (f, s) -> f.getSublabel().compareTo(s.getSublabel())); - - // Check for collision - checkSubCommandAliasesCollision(); - } - - /* - * Enforce non-overlapping aliases for subcommands - */ - private void checkSubCommandAliasesCollision() { - final List<String> aliases = new ArrayList<>(); - - for (final SimpleSubCommand subCommand : subcommands) - for (final String alias : subCommand.getSublabels()) { - Valid.checkBoolean(!aliases.contains(alias), "Subcommand '/" + getLabel() + " " + subCommand.getSublabel() + "' has alias '" + alias + "' that is already in use by another subcommand!"); - - aliases.add(alias); - } - } - - /** - * Remove this command group from Bukkit. Takes immediate changes in the game. - */ - public final void unregister() { - Valid.checkBoolean(isRegistered(), "Main command not registered!"); - - mainCommand.unregister(); - mainCommand = null; - - subcommands.clear(); - } - - /** - * Has the command group been registered yet? - * - * @return - */ - public final boolean isRegistered() { - return mainCommand != null; - } - - /** - * Scans all of your plugin's classes and registers commands extending the given class - * automatically. - * - * @param <T> - * @param ofClass - * - * @deprecated produces unexpected results if called more than once from your code, deal with caution! - */ - @Deprecated - protected final <T extends SimpleSubCommand> void autoRegisterSubcommands(final Class<T> ofClass) { - for (final Class<? extends SimpleSubCommand> clazz : ReflectionUtil.getClasses(SimplePlugin.getInstance(), ofClass)) - if (!Modifier.isAbstract(clazz.getModifiers())) - registerSubcommand(ReflectionUtil.instantiate(clazz)); - } - - /** - * Extending method to register subcommands, call - * {@link #registerSubcommand(SimpleSubCommand)} and {@link #registerHelpLine(String...)} - * there for your command group. - */ - protected abstract void registerSubcommands(); - - /** - * Registers a new subcommand for this group - * - * @param command - */ - protected final void registerSubcommand(final SimpleSubCommand command) { - Valid.checkNotNull(mainCommand, "Cannot add subcommands when main command is missing! Call register()"); - Valid.checkBoolean(!subcommands.contains(command), "Subcommand /" + mainCommand.getLabel() + " " + command.getSublabel() + " already registered when trying to add " + command.getClass()); - - subcommands.add(command); - } - - /** - * Registers a simple help message for this group, used in /{label} help|? - * since we add help for all subcommands automatically - * - * @param menuHelp - */ - protected final void registerHelpLine(final String... menuHelp) { - Valid.checkNotNull(mainCommand, "Cannot add subcommands when main command is missing! Call register()"); - - subcommands.add(new FillerSubCommand(this, menuHelp)); - } - - // ---------------------------------------------------------------------- - // Shortcuts - // ---------------------------------------------------------------------- - - /** - * Get the label for this command group, failing if not yet registered - * - * @return - */ - public final String getLabel() { - Valid.checkBoolean(isRegistered(), "Main command has not yet been set!"); - - return mainCommand.getMainLabel(); - } - - /** - * Return aliases for the main command - * - * @return - */ - public final List<String> getAliases() { - return mainCommand.getAliases(); - } - - // ---------------------------------------------------------------------- - // Functions - // ---------------------------------------------------------------------- - - /** - * Return the message displayed when no parameter is given, by - * default we give credits - * <p> - * If you specify "author" in your plugin.yml we display author information - * If you override {@link SimplePlugin#getFoundedYear()} we display copyright - * - * @param sender the command sender that requested this to be shown to him - * may be null - * @return - */ - protected List<SimpleComponent> getNoParamsHeader(CommandSender sender) { - final int foundedYear = SimplePlugin.getInstance().getFoundedYear(); - final int yearNow = Calendar.getInstance().get(Calendar.YEAR); - - final List<String> messages = new ArrayList<>(); - - messages.add("&8" + Common.chatLineSmooth()); - messages.add(getHeaderPrefix() + " " + SimplePlugin.getNamed() + getTrademark() + " &7" + SimplePlugin.getVersion()); - messages.add(" "); - - { - final String authors = String.join(", ", SimplePlugin.getInstance().getDescription().getAuthors()); - - if (!authors.isEmpty()) - messages.add(" &7" + SimpleLocalization.Commands.LABEL_AUTHORS + " &f" + authors + (foundedYear != -1 ? " &7\u00A9 " + foundedYear + (yearNow != foundedYear ? " - " + yearNow : "") : "")); - } - - { - final String credits = getCredits(); - - if (credits != null && !credits.isEmpty()) - messages.add(" " + credits); - } - - messages.add("&8" + Common.chatLineSmooth()); - - return Common.convert(messages, SimpleComponent::of); - } - - /** - * Should we send command helps instead of no-param header? - * - * @return - */ - - protected boolean sendHelpIfNoArgs() { - return false; - } - - // Return the TM symbol in case we have it for kangarko's plugins - private String getTrademark() { - return SimplePlugin.getInstance().getDescription().getAuthors().contains("kangarko") ? getHeaderPrefix() + "&8\u2122" : ""; - } - - /** - * Get a part of the {@link #getNoParamsHeader()} typically showing - * your website where the user can find more information about this command - * or your plugin in general - * - * @return - */ - protected String getCredits() { - return "&7Visit &fmineacademy.org &7for more information."; - } - - /** - * Return which subcommands should trigger the automatic help - * menu that shows all subcommands sender has permission for. - * <p> - * Also see {@link #getHelpHeader()} - * <p> - * Default: help and ? - * - * @return - */ - protected List<String> getHelpLabel() { - return Arrays.asList("help", "?"); - } - - /** - * Return the header messages used in /{label} help|? typically - * used to tell all available subcommands from this command group - * - * @return - */ - protected String[] getHelpHeader() { - return new String[] { - "&8", - "&8" + Common.chatLineSmooth(), - getHeaderPrefix() + " " + SimplePlugin.getNamed() + getTrademark() + " &7" + SimplePlugin.getVersion(), - " ", - "&2 [] &f= " + SimpleLocalization.Commands.LABEL_OPTIONAL_ARGS, - "&6 <> &f= " + SimpleLocalization.Commands.LABEL_REQUIRED_ARGS, - " " - }; - } - - /** - * Return the subcommand description when listing all commands using the "help" or "?" subcommand - * @return - */ - protected String getSubcommandDescription() { - return SimpleLocalization.Commands.LABEL_SUBCOMMAND_DESCRIPTION; - } - - /** - * Return the default color in the {@link #getHelpHeader()}, - * GOLD + BOLD colors by default - * - * @return - */ - protected String getHeaderPrefix() { - return "" + ChatColor.GOLD + ChatColor.BOLD; - } - - // ---------------------------------------------------------------------- - // Execution - // ---------------------------------------------------------------------- - - /** - * The main command handling this command group - */ - public final class MainCommand extends SimpleCommand { - - /** - * Create new main command with the given label - * - * @param label - */ - private MainCommand(final String label) { - super(label); - - // Let everyone view credits of this command when they run it without any sublabels - setPermission(null); - - // We handle help ourselves - setAutoHandleHelp(false); - } - - /** - * Handle this command group, print a special message when no arguments are given, - * execute subcommands, handle help or ? argument and more. - */ - @Override - protected void onCommand() { - - // Print a special message on no arguments - if (args.length == 0) { - if (sendHelpIfNoArgs()) - tellSubcommandsHelp(); - else - tell(getNoParamsHeader(sender)); - - return; - } - - final String argument = args[0]; - final SimpleSubCommand command = findSubcommand(argument); - - // Handle subcommands - if (command != null) { - final String oldSublabel = command.getSublabel(); - - try { - // Simulate our main label - command.setSublabel(args[0]); - - // Run the command - command.execute(sender, getLabel(), args.length == 1 ? new String[] {} : Arrays.copyOfRange(args, 1, args.length)); - - } finally { - // Restore old sublabel after the command has been run - command.setSublabel(oldSublabel); - } - } - - // Handle help argument - else if (!getHelpLabel().isEmpty() && Valid.isInList(argument, getHelpLabel())) - tellSubcommandsHelp(); - - // Handle unknown argument - else - returnInvalidArgs(); - } - - /** - * Automatically tells all help for all subcommands - */ - protected void tellSubcommandsHelp() { - - // Building help can be heavy so do it off of the main thread - Common.runAsync(() -> { - if (subcommands.isEmpty()) { - tellError(SimpleLocalization.Commands.HEADER_NO_SUBCOMMANDS); - - return; - } - - final List<SimpleComponent> lines = new ArrayList<>(); - final boolean atLeast17 = MinecraftVersion.atLeast(V.v1_7); - - for (final SimpleSubCommand subcommand : subcommands) - if (subcommand.showInHelp() && hasPerm(subcommand.getPermission())) { - if (subcommand instanceof FillerSubCommand) { - tellNoPrefix(((FillerSubCommand) subcommand).getHelpMessages()); - - continue; - } - - final String usage = colorizeUsage(subcommand.getUsage()); - final String desc = Common.getOrEmpty(subcommand.getDescription()); - final String plainMessage = Replacer.replaceArray(getSubcommandDescription(), - "label", getLabel(), - "sublabel", (atLeast17 ? "&n" : "") + subcommand.getSublabel() + (atLeast17 ? "&r" : ""), - "usage", usage, - "description", !desc.isEmpty() && !atLeast17 ? desc : "", - "dash", !desc.isEmpty() && !atLeast17 ? "&e-" : ""); - - final SimpleComponent line = SimpleComponent.of(plainMessage); - - if (!desc.isEmpty() && atLeast17) { - final String command = Common.stripColors(plainMessage).substring(1); - final List<String> hover = new ArrayList<>(); - - hover.add(SimpleLocalization.Commands.HELP_TOOLTIP_DESCRIPTION.replace("{description}", desc)); - - if (subcommand.getPermission() != null) - hover.add(SimpleLocalization.Commands.HELP_TOOLTIP_PERMISSION.replace("{permission}", subcommand.getPermission())); - - if (subcommand.getMultilineUsageMessage() != null && subcommand.getMultilineUsageMessage().length > 0) { - hover.add(SimpleLocalization.Commands.HELP_TOOLTIP_USAGE); - - for (final String usageLine : subcommand.getMultilineUsageMessage()) - hover.add("&f" + replacePlaceholders(colorizeUsage(usageLine.replace("{sublabel}", subcommand.getSublabel())))); - - } else - hover.add(SimpleLocalization.Commands.HELP_TOOLTIP_USAGE + (usage.isEmpty() ? command : usage)); - - line.onHover(hover); - line.onClickSuggestCmd("/" + getLabel() + " " + subcommand.getSublabel()); - } - - lines.add(line); - } - - if (!lines.isEmpty()) { - final ChatPaginator pages = new ChatPaginator(MathUtil.range(0, lines.size(), commandsPerPage), ChatColor.DARK_GRAY); - - if (getHelpHeader() != null) - pages.setHeader(getHelpHeader()); - - pages.setPages(lines); - - // Send the component on the main thread - Common.runLater(() -> pages.send(sender)); - - } else - tellError(SimpleLocalization.Commands.HEADER_NO_SUBCOMMANDS_PERMISSION); - }); - } - - /** - * Replaces some usage parameters such as <> or [] with colorized brackets - * - * @param message - * @return - */ - private String colorizeUsage(final String message) { - return message == null ? "" : message.replace("<", "&6<").replace(">", "&6>&f").replace("[", "&2[").replace("]", "&2]&f").replaceAll(" \\-([a-zA-Z])", " &3-$1"); - } - - /** - * Finds a subcommand by label - * - * @param label - * @return - */ - private SimpleSubCommand findSubcommand(final String label) { - for (final SimpleSubCommand command : subcommands) { - if (command instanceof FillerSubCommand) - continue; - - for (final String alias : command.getSublabels()) - if (alias.equalsIgnoreCase(label)) - return command; - } - - return null; - } - - /** - * Handle tabcomplete for subcommands and their tabcomplete - */ - @Override - public List<String> tabComplete() { - if (args.length == 1) - return tabCompleteSubcommands(sender, args[0]); - - if (args.length > 1) { - final SimpleSubCommand cmd = findSubcommand(args[0]); - - if (cmd != null) - return cmd.tabComplete(sender, getLabel(), Arrays.copyOfRange(args, 1, args.length)); - } - - return null; - } - - /** - * Automatically tab-complete subcommands - * - * @param sender - * @param param - * @return - */ - private List<String> tabCompleteSubcommands(final CommandSender sender, String param) { - param = param.toLowerCase(); - - final List<String> tab = new ArrayList<>(); - - for (final SimpleSubCommand subcommand : subcommands) - if (subcommand.showInHelp() && !(subcommand instanceof FillerSubCommand) && hasPerm(subcommand.getPermission())) - for (final String label : subcommand.getSublabels()) - if (!label.trim().isEmpty() && label.startsWith(param)) - tab.add(label); - - return tab; - } - } - - // ---------------------------------------------------------------------- - // Helper - // ---------------------------------------------------------------------- - - /** - * A helper class for showing plain messages in /{label} help|? - */ - private final class FillerSubCommand extends SimpleSubCommand { - - @Getter - private final String[] helpMessages; - - private FillerSubCommand(final SimpleCommandGroup parent, final String... menuHelp) { - super(parent, "_" + RandomUtil.nextBetween(1, Short.MAX_VALUE)); - - this.helpMessages = menuHelp; - } - - @Override - protected void onCommand() { - throw new FoException("Filler space command cannot be run!"); - } - } - -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/SimpleSubCommand.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/SimpleSubCommand.java deleted file mode 100644 index 165994fee6d7ce4bcd22d9bd0a55dc2069dc75ae..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/SimpleSubCommand.java +++ /dev/null @@ -1,99 +0,0 @@ -package org.mineacademy.fo.command; - -import java.util.Arrays; - -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.plugin.SimplePlugin; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; - -/** - * A simple subcommand belonging to a {@link SimpleCommandGroup} - */ -public abstract class SimpleSubCommand extends SimpleCommand { - - /** - * All registered sublabels this subcommand can have - */ - @Getter - private final String[] sublabels; - - /** - * The latest sublabel used when the subcommand was run, - * always updated on executing - */ - @Setter(value = AccessLevel.PROTECTED) - @Getter(value = AccessLevel.PROTECTED) - private String sublabel; - - /** - * Create a new subcommand given the main plugin instance defines a main command group - * - * @param sublabel - */ - protected SimpleSubCommand(String sublabel) { - this(getMainCommandGroup0(), sublabel); - } - - /* - * Attempts to get the main command group, failing with an error if not defined - */ - private static SimpleCommandGroup getMainCommandGroup0() { - final SimpleCommandGroup main = SimplePlugin.getInstance().getMainCommand(); - Valid.checkNotNull(main, SimplePlugin.getNamed() + " does not define a main command group!"); - - return main; - } - - /** - * Creates a new subcommand belonging to a command group - * - * @param parent - * @param sublabel - */ - protected SimpleSubCommand(SimpleCommandGroup parent, String sublabel) { - super(parent.getLabel()); - - this.sublabels = sublabel.split("(\\||\\/)"); - Valid.checkBoolean(sublabels.length > 0, "Please set at least 1 sublabel"); - - this.sublabel = sublabels[0]; - - // If the default perm was not changed, improve it - if (getRawPermission().equals(getDefaultPermission())) { - final SimplePlugin instance = SimplePlugin.getInstance(); - - if (instance.getMainCommand() != null && instance.getMainCommand().getLabel().equals(this.getMainLabel())) - setPermission(getRawPermission().replace("{label}", "{sublabel}")); // simply replace label with sublabel - - else - setPermission(getRawPermission() + ".{sublabel}"); // append the sublabel at the end since this is not our main command - } - } - - /** - * The command group automatically displays all subcommands in the /{label} help|? menu. - * Shall we display the subcommand in this menu? - * - * @return - */ - protected boolean showInHelp() { - return true; - } - - /** - * Replace additional {sublabel} placeholder for this subcommand. - * See {@link SimpleCommand#replacePlaceholders(String)} - */ - @Override - protected String replacePlaceholders(String message) { - return super.replacePlaceholders(message).replace("{sublabel}", getSublabel()); - } - - @Override - public final boolean equals(Object obj) { - return obj instanceof SimpleSubCommand ? Arrays.equals(((SimpleSubCommand) obj).sublabels, this.sublabels) : false; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/annotation/Permission.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/annotation/Permission.java deleted file mode 100644 index cdf8dd0c7ce63fffd6ac0e79f10934044c4eeeb1..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/annotation/Permission.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.mineacademy.fo.command.annotation; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -@Retention(RUNTIME) -@Target(FIELD) -public @interface Permission { - - public String value() default ""; - - public boolean def() default false; -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/annotation/PermissionGroup.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/annotation/PermissionGroup.java deleted file mode 100644 index 1ebed9321345390f723e72641580a564e4621e1f..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/command/annotation/PermissionGroup.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.mineacademy.fo.command.annotation; - -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -@Retention(RUNTIME) -@Target(TYPE) -public @interface PermissionGroup { - - public String value() default ""; -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/constants/FoConstants.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/constants/FoConstants.java deleted file mode 100644 index b9a80cd5d30dfbef823d07d6e5ca906f572e2dc6..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/constants/FoConstants.java +++ /dev/null @@ -1,142 +0,0 @@ -package org.mineacademy.fo.constants; - -import java.util.UUID; - -import org.bukkit.entity.Player; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.TimeUtil; -import org.mineacademy.fo.plugin.SimplePlugin; - -/** - * Stores constants for this plugin - */ -public final class FoConstants { - - /** - * Represents a UUID consisting of 0's only - */ - public static final UUID NULL_UUID = UUID.fromString("00000000-0000-0000-0000-000000000000"); - - public static final class File { - - /** - * The name of our settings file - */ - public static final String SETTINGS = "settings.yml"; - - /** - * The error.log file created automatically to log errors to - */ - public static final String ERRORS = "error.log"; - - /** - * The debug.log file to log debug messages to - */ - public static final String DEBUG = "debug.log"; - - /** - * The data.db file (uses YAML) for saving various data - */ - public static final String DATA = "data.db"; - - /** - * Files related to the ChatControl plugin - */ - public static final class ChatControl { - - /** - * The command-spy.log file in logs/ folder - */ - public static final String COMMAND_SPY = "logs/command-spy.log"; - - /** - * The chat log file in logs/ folder - */ - public static final String CHAT_LOG = "logs/chat.log"; - - /** - * The admin log in log/s folder - */ - public static final String ADMIN_CHAT = "logs/admin-chat.log"; - - /** - * The bungee chat log file in logs/ folder - */ - public static final String BUNGEE_CHAT = "logs/bungee-chat.log"; - - /** - * The rules log file in logs/ folder - */ - public static final String RULES_LOG = "logs/rules.log"; - - /** - * The console log file in logs/ folder - */ - public static final String CONSOLE_LOG = "logs/console.log"; - - /** - * The file logging channels joins and leaves in logs/ folder - */ - public static final String CHANNEL_JOINS = "logs/channel-joins.log"; - } - } - - public static final class Header { - - /** - * The header for data.db file - */ - public static final String[] DATA_FILE = new String[] { - "", - "This file stores various data you create via the plugin.", - "", - " ** THE FILE IS MACHINE GENERATED. PLEASE DO NOT EDIT **", - "" - }; - - /** - * The header that is put into the file that has been automatically - * updated and comments were lost - */ - public static final String[] UPDATED_FILE = new String[] { - Common.configLine(), - "", - " Your file has been automatically updated at " + TimeUtil.getFormattedDate(), - " to " + SimplePlugin.getNamed() + " " + SimplePlugin.getVersion(), - "", - " Unfortunatelly, due to how Bukkit saves all .yml files, it was not possible", - " preserve the documentation comments in your file. We apologize.", - "", - " If you'd like to view the default file, you can either:", - " a) Open the " + SimplePlugin.getSource().getName() + " with a WinRar or similar", - " b) or, visit: https://github.com/kangarko/" + SimplePlugin.getNamed() + "/wiki", - "", - Common.configLine(), - "" - }; - } - - public static final class NBT { - - /** - * Represents our NBT tag used in {@link NBTUtil} - */ - public static final String TAG = SimplePlugin.getNamed() + "_NbtTag"; - - /** - * An internal metadata tag the player gets when he opens the menu - * - * <p> - * Used in {@link #getMenu(Player)} - */ - public static final String TAG_MENU_CURRENT = SimplePlugin.getNamed() + "_Menu"; - - /** - * An internal metadata tag the player gets when he opens another menu - * - * <p> - * Used in {@link #getPreviousMenu(Player)} - */ - public static final String TAG_MENU_PREVIOUS = SimplePlugin.getNamed() + "_Previous_Menu"; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/constants/FoPermissions.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/constants/FoPermissions.java deleted file mode 100644 index ee1ff60eaa23da4e34afb1392988a36c41c151f3..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/constants/FoPermissions.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.mineacademy.fo.constants; - -import org.mineacademy.fo.command.annotation.Permission; -import org.mineacademy.fo.plugin.SimplePlugin; - -/** - * Used to store basic library permissions - */ -public class FoPermissions { - - @Permission(value = "Receive plugin update notifications on join.") - public static final String NOTIFY_UPDATE; - - static { - NOTIFY_UPDATE = SimplePlugin.getNamed().toLowerCase() + ".notify.update"; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/conversation/SimpleCanceller.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/conversation/SimpleCanceller.java deleted file mode 100644 index 2643e79fa98ccd722b6868fcb7562dd0f7071179..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/conversation/SimpleCanceller.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.mineacademy.fo.conversation; - -import java.util.Arrays; -import java.util.List; - -import org.bukkit.conversations.Conversation; -import org.bukkit.conversations.ConversationCanceller; -import org.bukkit.conversations.ConversationContext; -import org.mineacademy.fo.Valid; - -/** - * A simple conversation canceller - * If the players message matches any word in the list, his conversation is cancelled - */ -public final class SimpleCanceller implements ConversationCanceller { - - /** - * The words that trigger the conversation cancellation - */ - private final List<String> cancelPhrases; - - /** - * Create a new convo canceler based off the given strings - * If the players message matches any word in the list, his conversation is cancelled - * - * @param cancelPhrases - */ - public SimpleCanceller(String... cancelPhrases) { - this(Arrays.asList(cancelPhrases)); - } - - /** - * Create a new convo canceler from the given lists - * If the players message matches any word in the list, his conversation is cancelled - * - * @param cancelPhrases - */ - public SimpleCanceller(List<String> cancelPhrases) { - Valid.checkBoolean(!cancelPhrases.isEmpty(), "Cancel phrases are empty for conversation cancel listener!"); - - this.cancelPhrases = cancelPhrases; - } - - @Override - public void setConversation(Conversation conversation) { - } - - /** - * Listen to cancel phrases and exit if they equals - */ - @Override - public boolean cancelBasedOnInput(ConversationContext context, String input) { - for (final String phrase : cancelPhrases) - if (input.equalsIgnoreCase(phrase)) - return true; - - return false; - } - - @Override - public ConversationCanceller clone() { - return new SimpleCanceller(cancelPhrases); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/conversation/SimpleConversation.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/conversation/SimpleConversation.java deleted file mode 100644 index 142dfe86bd25fbb3534b8f73659039cdc24561fa..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/conversation/SimpleConversation.java +++ /dev/null @@ -1,333 +0,0 @@ -package org.mineacademy.fo.conversation; - -import java.util.concurrent.TimeUnit; - -import org.bukkit.conversations.Conversable; -import org.bukkit.conversations.Conversation; -import org.bukkit.conversations.ConversationAbandonedEvent; -import org.bukkit.conversations.ConversationAbandonedListener; -import org.bukkit.conversations.ConversationCanceller; -import org.bukkit.conversations.ConversationContext; -import org.bukkit.conversations.ConversationPrefix; -import org.bukkit.conversations.InactivityConversationCanceller; -import org.bukkit.conversations.Prompt; -import org.bukkit.entity.Player; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.expiringmap.ExpiringMap; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.model.BoxedMessage; -import org.mineacademy.fo.model.Variables; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompSound; - -import lombok.AccessLevel; -import lombok.Getter; - -/** - * A simple way to communicate with the player - * - their chat will be isolated and they chat messages processed and - * the conversation input. - */ -public abstract class SimpleConversation implements ConversationAbandonedListener { - - /** - * The menu to return to, if any - */ - private Menu menuToReturnTo; - - /** - * Creates a simple conversation - */ - protected SimpleConversation() { - this(null); - } - - /** - * Creates a simple conversation that opens the - * menu when finished - * - * @param menuToReturnTo - */ - protected SimpleConversation(final Menu menuToReturnTo) { - this.menuToReturnTo = menuToReturnTo; - } - - /** - * Start a conversation with the player, throwing error if {@link Player#isConversing()} - * - * @param player - */ - public final void start(final Player player) { - Valid.checkBoolean(!player.isConversing(), "Player " + player.getName() + " is already conversing!"); - - // Do not allow open inventory since they cannot type anyways - player.closeInventory(); - - // Setup - final CustomConversation conversation = new CustomConversation(player); - final CustomCanceller canceller = new CustomCanceller(); - - canceller.setConversation(conversation); - - conversation.getCancellers().add(canceller); - conversation.getCancellers().add(getCanceller()); - - conversation.addConversationAbandonedListener(this); - - conversation.begin(); - } - - /** - * Get the first prompt in this conversation for the player - * - * @return - */ - protected abstract Prompt getFirstPrompt(); - - /** - * Listen for and handle existing the conversation - */ - @Override - public final void conversationAbandoned(final ConversationAbandonedEvent event) { - final ConversationContext context = event.getContext(); - final Conversable conversing = context.getForWhom(); - - final Object source = event.getSource(); - final boolean timeout = (boolean) context.getAllSessionData().getOrDefault("FLP#TIMEOUT", false); - - // Remove the session data so that they are invisible to other plugnis - context.getAllSessionData().remove("FLP#TIMEOUT"); - - if (source instanceof CustomConversation) { - final SimplePrompt lastPrompt = ((CustomConversation) source).getLastSimplePrompt(); - - if (lastPrompt != null) - lastPrompt.onConversationEnd(this, event); - } - - onConversationEnd(event, timeout); - - if (conversing instanceof Player) { - final Player player = (Player) conversing; - - (event.gracefulExit() ? CompSound.SUCCESSFUL_HIT : CompSound.NOTE_BASS).play(player, 1F, 1F); - - if (menuToReturnTo != null && reopenMenu()) - menuToReturnTo.newInstance().displayTo(player); - } - } - - /** - * Fired when the user quits this conversation (see {@link #getCanceller()}, or - * simply quits the game) - * - * - * @param event - * @param canceledFromInactivity true if user failed to enter input in the period set in {@link #getTimeout()} - */ - protected void onConversationEnd(final ConversationAbandonedEvent event, boolean canceledFromInactivity) { - this.onConversationEnd(event); - } - - /** - * Fired when the user quits this conversation (see {@link #getCanceller()}, or - * simply quits the game) - * - * @param event - */ - protected void onConversationEnd(final ConversationAbandonedEvent event) { - } - - /** - * Get conversation prefix before each message - * <p> - * By default we use the plugins tell prefix - * <p> - * TIP: You can use {@link SimplePrefix} - * - * @return - */ - protected ConversationPrefix getPrefix() { - return new SimplePrefix(Common.ADD_TELL_PREFIX ? addLastSpace(Common.getTellPrefix()) : ""); - } - - /* - * Add a space to the prefix if it ends with one - */ - private final String addLastSpace(final String prefix) { - return prefix.endsWith(" ") ? prefix : prefix + " "; - } - - /** - * Return the canceller that listens for certain words to exit the convo, - * by default we use {@link SimpleCanceller} that listens to quit|cancel|exit - * - * @return - */ - protected ConversationCanceller getCanceller() { - return new SimpleCanceller("quit", "cancel", "exit"); - } - - /** - * Return true if we should insert a prefix before each message, see {@link #getPrefix()} - * - * @return - */ - protected boolean insertPrefix() { - return true; - } - - /** - * If we detect the player has a menu opened should we reopen it? - * - * @return - */ - protected boolean reopenMenu() { - return true; - } - - /** - * Get the timeout in seconds before automatically exiting the convo - * - * @return - */ - protected int getTimeout() { - return 60; - } - - /** - * Sets the menu to return to after the end of this conversation - * - * @param menu - */ - public void setMenuToReturnTo(final Menu menu) { - this.menuToReturnTo = menu; - } - - // ------------------------------------------------------------------------------------------------------------ - // Static access - // ------------------------------------------------------------------------------------------------------------ - - /** - * Sends a boxed message to the conversable player later - * - * @param delayTicks - * @param conversable - * @param messages - */ - protected static final void tellBoxed(final int delayTicks, final Conversable conversable, final String... messages) { - Common.runLater(delayTicks, () -> tellBoxed(conversable, messages)); - } - - /** - * Sends a boxed message to the conversable player - * - * @param conversable - * @param messages - */ - protected static final void tellBoxed(final Conversable conversable, final String... messages) { - BoxedMessage.tell((Player) conversable, messages); - } - - /** - * Shortcut method for direct message send to the player - * - * @param conversable - * @param message - */ - protected static final void tell(final Conversable conversable, final String message) { - Common.tellConversing(conversable, Variables.replace(message, (Player) conversable)); - } - - /** - * Send a message to the conversable player later - * - * @param delayTicks - * @param conversable - * @param message - */ - protected static final void tellLater(final int delayTicks, final Conversable conversable, final String message) { - Common.tellLaterConversing(delayTicks, conversable, Variables.replace(message, (Player) conversable)); - } - - // ------------------------------------------------------------------------------------------------------------ - // Classes - // ------------------------------------------------------------------------------------------------------------ - - private final class CustomCanceller extends InactivityConversationCanceller { - - /** - * @param plugin - * @param timeoutSeconds - */ - public CustomCanceller() { - super(SimplePlugin.getInstance(), getTimeout()); - } - - /** - * @see org.bukkit.conversations.InactivityConversationCanceller#cancelling(org.bukkit.conversations.Conversation) - */ - @Override - protected void cancelling(Conversation conversation) { - conversation.getContext().setSessionData("FLP#TIMEOUT", true); - } - } - - /** - * Custom conversation class used for only showing the question once per 20 seconds interval - */ - private final class CustomConversation extends Conversation { - - /** - * Holds the information about the last prompt, used to invoke onConversationEnd - */ - @Getter(value = AccessLevel.PRIVATE) - private SimplePrompt lastSimplePrompt; - - private CustomConversation(final Conversable forWhom) { - super(SimplePlugin.getInstance(), forWhom, SimpleConversation.this.getFirstPrompt()); - - localEchoEnabled = false; - - if (insertPrefix() && SimpleConversation.this.getPrefix() != null) - prefix = SimpleConversation.this.getPrefix(); - - } - - @Override - public void outputNextPrompt() { - if (currentPrompt == null) - abandon(new ConversationAbandonedEvent(this)); - - else { - // Save the time when we showed the question to the player - // so that we only show it once per the given threshold - final String promptClass = currentPrompt.getClass().getSimpleName(); - final String question = currentPrompt.getPromptText(context); - - try { - final ExpiringMap<String, Void /*dont have expiring set class*/> askedQuestions = (ExpiringMap<String, Void>) context.getAllSessionData().getOrDefault("Asked_" + promptClass, ExpiringMap.builder().expiration(getTimeout(), TimeUnit.SECONDS).build()); - - if (!askedQuestions.containsKey(question)) { - askedQuestions.put(question, null); - - context.setSessionData("Asked_" + promptClass, askedQuestions); - context.getForWhom().sendRawMessage(prefix.getPrefix(context) + question); - } - } catch (final NoSuchMethodError ex) { - // Unfortunately, old MC version was detected - } - - // Save last prompt if it is our class - if (currentPrompt instanceof SimplePrompt) - lastSimplePrompt = ((SimplePrompt) currentPrompt).clone(); - - if (!currentPrompt.blocksForInput(context)) { - currentPrompt = currentPrompt.acceptInput(context, null); - outputNextPrompt(); - } - } - } - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/conversation/SimpleDecimalPrompt.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/conversation/SimpleDecimalPrompt.java deleted file mode 100644 index de0e639399909986ebc52a22c71bea20448b7d9c..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/conversation/SimpleDecimalPrompt.java +++ /dev/null @@ -1,102 +0,0 @@ -package org.mineacademy.fo.conversation; - -import java.util.function.Consumer; - -import org.bukkit.conversations.ConversationContext; -import org.bukkit.conversations.Prompt; -import org.bukkit.entity.Player; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.settings.SimpleLocalization; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.NoArgsConstructor; -import lombok.NonNull; -import lombok.Setter; - -/** - * A prompt that only accepts whole or decimal numbers - */ -@NoArgsConstructor -@AllArgsConstructor -public class SimpleDecimalPrompt extends SimplePrompt { - - /** - * The question you can set in the constructor already - */ - @Setter(value = AccessLevel.PROTECTED) - private String question = null; - - /** - * What happens when the number is entered - */ - @Setter(value = AccessLevel.PROTECTED) - private Consumer<Double> successAction; - - /** - * The menu question - * - * @see org.mineacademy.fo.conversation.SimplePrompt#getPrompt(org.bukkit.conversations.ConversationContext) - */ - @Override - protected String getPrompt(final ConversationContext ctx) { - Valid.checkNotNull(question, "Please either call setQuestion or override getPrompt"); - - return "&6" + question; - } - - /** - * Return true if input is a valid number - * - * @see org.mineacademy.fo.conversation.SimplePrompt#isInputValid(org.bukkit.conversations.ConversationContext, java.lang.String) - */ - @Override - protected boolean isInputValid(final ConversationContext context, final String input) { - return Valid.isDecimal(input) || Valid.isInteger(input); - } - - /** - * Show the message when the input is not a number - * - * @see org.mineacademy.fo.conversation.SimplePrompt#getFailedValidationText(org.bukkit.conversations.ConversationContext, java.lang.String) - */ - @Override - protected String getFailedValidationText(final ConversationContext context, final String invalidInput) { - return SimpleLocalization.Commands.INVALID_NUMBER.replace("{input}", invalidInput); - } - - /** - * Parse through - * - * @see org.bukkit.conversations.ValidatingPrompt#acceptValidatedInput(org.bukkit.conversations.ConversationContext, java.lang.String) - */ - @Override - protected final Prompt acceptValidatedInput(@NonNull final ConversationContext context, @NonNull final String input) { - return acceptValidatedInput(context, Double.parseDouble(input)); - } - - /** - * What happens when the number is entered - * - * @param context - * @param input - * @return the next prompt, or {@link Prompt#END_OF_CONVERSATION} (that is actualy null) to exit - */ - protected Prompt acceptValidatedInput(final ConversationContext context, final double input) { - Valid.checkNotNull(question, "Please either call setSuccessAction or override acceptValidatedInput"); - - successAction.accept(input); - return Prompt.END_OF_CONVERSATION; - } - - /** - * Show the question with the action to the player - * - * @param player - * @param question - * @param successAction - */ - public static void show(final Player player, final String question, final Consumer<Double> successAction) { - new SimpleDecimalPrompt(question, successAction).show(player); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/conversation/SimplePrefix.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/conversation/SimplePrefix.java deleted file mode 100644 index bd3b970fd3d4ebb434da9b3eab370517a8353011..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/conversation/SimplePrefix.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.mineacademy.fo.conversation; - -import org.bukkit.conversations.ConversationContext; -import org.bukkit.conversations.ConversationPrefix; -import org.mineacademy.fo.Common; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * A simple conversation prefix with a static string - */ -@RequiredArgsConstructor -public final class SimplePrefix implements ConversationPrefix { - - /** - * The conversation prefix - */ - @Getter - private final String prefix; - - @Override - public String getPrefix(ConversationContext context) { - return Common.colorize(prefix); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/conversation/SimplePrompt.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/conversation/SimplePrompt.java deleted file mode 100644 index b7f55e4ac7bd80754e4bcb6372cd00b9526e991c..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/conversation/SimplePrompt.java +++ /dev/null @@ -1,231 +0,0 @@ -package org.mineacademy.fo.conversation; - -import org.bukkit.conversations.Conversable; -import org.bukkit.conversations.ConversationAbandonedEvent; -import org.bukkit.conversations.ConversationContext; -import org.bukkit.conversations.ConversationPrefix; -import org.bukkit.conversations.Prompt; -import org.bukkit.conversations.ValidatingPrompt; -import org.bukkit.entity.Player; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.model.Variables; - -import lombok.SneakyThrows; - -/** - * Represents one question for the player during a server conversation - */ -public abstract class SimplePrompt extends ValidatingPrompt implements Cloneable { - - /** - * Open the players menu back if any? - */ - private boolean openMenu = true; - - /** - * The player who sees the input - */ - private Player player = null; - - protected SimplePrompt() { - } - - /** - * Create a new prompt, show we open players menu back if he has any? - * - * @param openMenu - */ - protected SimplePrompt(final boolean openMenu) { - this.openMenu = openMenu; - } - - /** - * Return the prefix before tell messages - * - * @param ctx - * @return - */ - protected String getCustomPrefix() { - return null; - } - - /** - * Return the question, implemented in own way using colors - * - * @param - * @return - */ - @Override - public final String getPromptText(final ConversationContext context) { - return String.join("\n", Common.splitNewline(Variables.replace(getPrompt(context), getPlayer(context)))); - } - - /** - * Return the question to the user in this prompt - * - * @param context - * @return - */ - protected abstract String getPrompt(ConversationContext context); - - /** - * Checks if the input from the user was valid, if it was, we can continue to the next prompt - * - * @param context - * @param input - * @return - */ - @Override - protected boolean isInputValid(final ConversationContext context, final String input) { - return true; - } - - /** - * Return the failed error message when {@link #isInputValid(ConversationContext, String)} returns false - */ - @Override - protected String getFailedValidationText(final ConversationContext context, final String invalidInput) { - return null; - } - - /** - * Converts the {@link ConversationContext} into a {@link Player} - * or throws an error if it is not a player - * - * @param ctx - * @return - */ - protected final Player getPlayer(final ConversationContext ctx) { - Valid.checkBoolean(ctx.getForWhom() instanceof Player, "Conversable is not a player but: " + ctx.getForWhom()); - - return (Player) ctx.getForWhom(); - } - - /** - * Send the player (in case any) the given message - * - * @param ctx - * @param message - */ - protected final void tell(final String message) { - Valid.checkNotNull(player, "Cannot use tell() when player not yet set!"); - - tell(player, message); - } - - /** - * Send the player (in case any) the given message - * - * @param context - * @param message - */ - protected final void tell(final ConversationContext context, final String message) { - tell(getPlayer(context), message); - } - - /** - * Sends the message to the player - * - * @param conversable - * @param message - */ - protected final void tell(final Conversable conversable, final String message) { - Common.tellConversing(conversable, (getCustomPrefix() != null ? getCustomPrefix() : "") + message); - } - - /** - * Sends the message to the player later - * - * @param delayTicks - * @param conversable - * @param message - */ - protected final void tellLater(final int delayTicks, final Conversable conversable, final String message) { - Common.tellLaterConversing(delayTicks, conversable, (getCustomPrefix() != null ? getCustomPrefix() : "") + message); - } - - /** - * Called when the whole conversation is over. This is called before {@link SimpleConversation#onConversationEnd(ConversationAbandonedEvent)} - * - * @param conversation - * @param event - */ - public void onConversationEnd(final SimpleConversation conversation, final ConversationAbandonedEvent event) { - } - - // Do not allow superclasses to modify this since we have isInputValid here - @Override - public final Prompt acceptInput(final ConversationContext context, final String input) { - if (isInputValid(context, input)) - return acceptValidatedInput(context, input); - - else { - final String failPrompt = getFailedValidationText(context, input); - - if (failPrompt != null) - tellLater(1, context.getForWhom(), Variables.replace("&c" + failPrompt, getPlayer(context))); - - // Redisplay this prompt to the user to re-collect input - return this; - } - } - - /** - * Shows this prompt as a conversation to the player - * <p> - * NB: Do not call this as a means to showing this prompt DURING AN EXISTING - * conversation as it will fail! Use {@link #acceptValidatedInput(ConversationContext, String)} instead - * to show the next prompt - * - * @param player - */ - public final SimpleConversation show(final Player player) { - Valid.checkBoolean(!player.isConversing(), "Player " + player.getName() + " is already conversing! Show them their next prompt in acceptValidatedInput() in " + getClass().getSimpleName() + " instead!"); - - this.player = player; - - final SimpleConversation conversation = new SimpleConversation() { - - @Override - protected Prompt getFirstPrompt() { - return SimplePrompt.this; - } - - @Override - protected ConversationPrefix getPrefix() { - final String prefix = SimplePrompt.this.getCustomPrefix(); - - return prefix != null ? new SimplePrefix(prefix) : super.getPrefix(); - } - }; - - if (openMenu) { - final Menu menu = Menu.getMenu(player); - - if (menu != null) - conversation.setMenuToReturnTo(menu); - } - - conversation.start(player); - - return conversation; - } - - @SneakyThrows - @Override - public SimplePrompt clone() { - return (SimplePrompt) super.clone(); - } - - /** - * Show the given prompt to the player - * - * @param player - * @param prompt - */ - public static final void show(final Player player, final SimplePrompt prompt) { - prompt.show(player); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/database/SimpleDatabase.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/database/SimpleDatabase.java deleted file mode 100644 index a2ca376027aa4efba5c5271a16f4ddfa8b451c43..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/database/SimpleDatabase.java +++ /dev/null @@ -1,539 +0,0 @@ -package org.mineacademy.fo.database; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; -import java.util.Map.Entry; -import java.util.Timer; -import java.util.TimerTask; - -import org.mineacademy.fo.Common; -import org.mineacademy.fo.FileUtil; -import org.mineacademy.fo.RandomUtil; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.SerializeUtil; -import org.mineacademy.fo.TimeUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.remain.Remain; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NonNull; -import lombok.RequiredArgsConstructor; - -/** - * Represents a simple MySQL database - * <p> - * Before running queries make sure to call connect() methods. - * <p> - * You can also override {@link #onConnected()} to run your code after the - * connection has been established. - * <p> - * To use this class you must know the MySQL command syntax! - */ -public class SimpleDatabase { - - /** - * The established connection, or null if none - */ - @Getter(value = AccessLevel.PROTECTED) - private volatile Connection connection; - - /** - * The last credentials from the connect function, or null if never called - */ - private LastCredentials lastCredentials; - - /** - * Map of variables you can use with the {} syntax in SQL - */ - private final StrictMap<String, String> sqlVariables = new StrictMap<>(); - - /** - * Indicates that {@link #batchUpdate(List)} is ongoing - */ - private boolean batchUpdateGoingOn = false; - - // -------------------------------------------------------------------- - // Connecting - // -------------------------------------------------------------------- - - /** - * Attempts to establish a new database connection - * - * @param host - * @param port - * @param database - * @param user - * @param password - */ - public final void connect(final String host, final int port, final String database, final String user, final String password) { - connect(host, port, database, user, password, null); - } - - /** - * Attempts to establish a new database connection, - * you can then use {table} in SQL to replace with your table name - * - * @param host - * @param port - * @param database - * @param user - * @param password - * @param table - */ - public final void connect(final String host, final int port, final String database, final String user, final String password, final String table) { - connect(host, port, database, user, password, table, true); - } - - /** - * Attempts to establish a new database connection - * you can then use {table} in SQL to replace with your table name - * - * @param host - * @param port - * @param database - * @param user - * @param password - * @param table - * @param autoReconnect - */ - public final void connect(final String host, final int port, final String database, final String user, final String password, final String table, final boolean autoReconnect) { - connect("jdbc:mysql://" + host + ":" + port + "/" + database + "?useSSL=false&useUnicode=yes&characterEncoding=UTF-8&autoReconnect=" + autoReconnect, user, password, table); - } - - /** - * Connects to the database - * - * @param url - * @param user - * @param password - */ - public final void connect(final String url, final String user, final String password) { - connect(url, user, password, null); - } - - /** - * Connects to the database - * you can then use {table} in SQL to replace with your table name* - * - * @param url - * @param user - * @param password - * @param table - */ - public final void connect(final String url, final String user, final String password, final String table) { - - // Close any open connection - close(); - - try { - if (!ReflectionUtil.isClassAvailable("com.mysql.cj.jdbc.Driver")) - Class.forName("com.mysql.jdbc.Driver"); - - this.lastCredentials = new LastCredentials(url, user, password, table); - this.connection = DriverManager.getConnection(url, user, password); - - onConnected(); - - } catch (final Exception e) { - - if (Common.getOrEmpty(e.getMessage()).contains("No suitable driver found")) - Common.logFramed(true, - "Failed to look up MySQL driver", - "If you had MySQL disabled, then enabled it and reload,", - "this is normal - just restart.", - "", - "You have have access to your server machine, try installing", - "https://dev.mysql.com/downloads/connector/j/5.1.html#downloads", - "", - "If this problem persists after a restart, please contact", - "your hosting provider."); - else - Common.logFramed(true, - "Failed to connect to MySQL database", - "URL: " + url, - "Error: " + e.getMessage()); - - Remain.sneaky(e); - } - } - - /** - * Attempts to connect using last known credentials. Fails gracefully if those are not provided - * i.e. connect function was never called - */ - private final void connectUsingLastCredentials() { - if (lastCredentials != null) - connect(lastCredentials.url, lastCredentials.user, lastCredentials.password, lastCredentials.table); - } - - /** - * Called automatically after the first connection has been established - */ - protected void onConnected() { - } - - // -------------------------------------------------------------------- - // Disconnecting - // -------------------------------------------------------------------- - - /** - * Attempts to close the connection, if not null - */ - public final void close() { - if (connection != null) - try { - connection.close(); - - } catch (final SQLException e) { - Common.error(e, "Error closing MySQL connection!"); - } - } - - // -------------------------------------------------------------------- - // Querying - // -------------------------------------------------------------------- - - /** - * Insert the given column-values pairs into the {@link #getTable()} - * - * @param columsAndValues - */ - protected final void insert(@NonNull SerializedMap columsAndValues) { - this.insert("{table}", columsAndValues); - } - - /** - * Insert the given column-values pairs into the given table - * - * @param table - * @param columsAndValues - */ - protected final void insert(String table, @NonNull SerializedMap columsAndValues) { - final String columns = Common.join(columsAndValues.keySet()); - final String values = Common.join(columsAndValues.values(), ", ", value -> value == null || value.equals("NULL") ? "NULL" : "'" + SerializeUtil.serialize(value).toString() + "'"); - final String duplicateUpdate = Common.join(columsAndValues.entrySet(), ", ", entry -> entry.getKey() + "=VALUES(" + entry.getKey() + ")"); - - update("INSERT INTO " + replaceVariables(table) + " (" + columns + ") VALUES (" + values + ") ON DUPLICATE KEY UPDATE " + duplicateUpdate + ";"); - } - - /** - * Insert the batch map into {@link #getTable()} - * - * @param maps - */ - protected final void insertBatch(@NonNull List<SerializedMap> maps) { - this.insertBatch("{table}", maps); - } - - /** - * Insert the batch map into the database - * - * @param table - * @param maps - */ - protected final void insertBatch(String table, @NonNull List<SerializedMap> maps) { - final List<String> sqls = new ArrayList<>(); - - for (final SerializedMap map : maps) { - final String columns = Common.join(map.keySet()); - final String values = Common.join(map.values(), ", ", this::parseValue); - final String duplicateUpdate = Common.join(map.entrySet(), ", ", entry -> entry.getKey() + "=VALUES(" + entry.getKey() + ")"); - - sqls.add("INSERT INTO " + table + " (" + columns + ") VALUES (" + values + ") ON DUPLICATE KEY UPDATE " + duplicateUpdate + ";"); - } - - this.batchUpdate(sqls); - } - - /* - * A helper method to insert compatible value to db - */ - private final String parseValue(Object value) { - return value == null || value.equals("NULL") ? "NULL" : "'" + SerializeUtil.serialize(value).toString() + "'"; - } - - /** - * Attempts to execute a new update query - * <p> - * Make sure you called connect() first otherwise an error will be thrown - * - * @param sql - */ - protected final void update(String sql) { - checkEstablished(); - - if (!isConnected()) - connectUsingLastCredentials(); - - sql = replaceVariables(sql); - Valid.checkBoolean(!sql.contains("{table}"), "Table not set! Either use connect() method that specifies it or call addVariable(table, 'yourtablename') in your constructor!"); - - Debugger.debug("mysql", "Updating MySQL with: " + sql); - - try { - final Statement statement = connection.createStatement(); - - statement.executeUpdate(sql); - statement.close(); - - } catch (final SQLException e) { - handleError(e, "Error on updating MySQL with: " + sql); - } - } - - /** - * Attempts to execute a new query - * <p> - * Make sure you called connect() first otherwise an error will be thrown - * - * @param sql - * @return - */ - protected final ResultSet query(String sql) { - checkEstablished(); - - if (!isConnected()) - connectUsingLastCredentials(); - - sql = replaceVariables(sql); - - Debugger.debug("mysql", "Querying MySQL with: " + sql); - - try { - final Statement statement = connection.createStatement(); - final ResultSet resultSet = statement.executeQuery(sql); - - return resultSet; - - } catch (final SQLException ex) { - handleError(ex, "Error on querying MySQL with: " + sql); - } - - return null; - } - - /** - * Executes a massive batch update - * - * @param sqls - */ - protected final void batchUpdate(@NonNull List<String> sqls) { - if (sqls.size() == 0) - return; - - try { - final Statement batchStatement = getConnection().createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); - final int processedCount = sqls.size(); - - // Prevent automatically sending db instructions - getConnection().setAutoCommit(false); - - for (final String sql : sqls) - batchStatement.addBatch(replaceVariables(sql)); - - if (processedCount > 10_000) - Common.log("Updating your database (" + processedCount + " entries)... PLEASE BE PATIENT THIS WILL TAKE " - + (processedCount > 50_000 ? "10-20 MINUTES" : "5-10 MINUTES") + " - If server will print a crash report, ignore it, update will proceed."); - - // Set the flag to start time notifications timer - batchUpdateGoingOn = true; - - // Notify console that progress still is being made - new Timer().scheduleAtFixedRate(new TimerTask() { - - @Override - public void run() { - if (batchUpdateGoingOn) - Common.log("Still executing, " + RandomUtil.nextItem("keep calm", "stand by", "watch the show", "check your db", "drink water", "call your friend") + " and DO NOT SHUTDOWN YOUR SERVER."); - else - cancel(); - } - }, 1000 * 30, 1000 * 30); - - // Execute - batchStatement.executeBatch(); - - // This will block the thread - getConnection().commit(); - - //Common.log("Updated " + processedCount + " database entries."); - - } catch (final Throwable t) { - final List<String> errorLog = new ArrayList<>(); - - errorLog.add(Common.consoleLine()); - errorLog.add(" [" + TimeUtil.getFormattedDateShort() + "] Failed to save batch sql, please contact the plugin author with this file content: " + t); - errorLog.add(Common.consoleLine()); - - for (final String statement : sqls) - errorLog.add(replaceVariables(statement)); - - FileUtil.write("sql-error.log", sqls); - - t.printStackTrace(); - - } finally { - try { - getConnection().setAutoCommit(true); - - } catch (final SQLException ex) { - ex.printStackTrace(); - } - - // Even in case of failure, cancel - batchUpdateGoingOn = false; - } - } - - /** - * Attempts to return a prepared statement - * <p> - * Make sure you called connect() first otherwise an error will be thrown - * - * @param sql - * @return - * @throws SQLException - */ - protected final java.sql.PreparedStatement prepareStatement(String sql) throws SQLException { - checkEstablished(); - - if (!isConnected()) - connectUsingLastCredentials(); - - sql = replaceVariables(sql); - - Debugger.debug("mysql", "Preparing statement: " + sql); - - return connection.prepareStatement(sql); - } - - /** - * Is the connection established, open and valid? - * Performs a blocking ping request to the database - * - * @return whether the connection driver was set - */ - protected final boolean isConnected() { - if (!isLoaded()) - return false; - - try { - return !connection.isClosed() && connection.isValid(0); - - } catch (final SQLException ex) { - return false; - } - } - - /* - * Checks if there's a collation-related error and prints warning message for the user to - * update his database. - */ - private void handleError(Throwable t, String fallbackMessage) { - if (t.toString().contains("Unknown collation")) { - Common.log("You need to update your MySQL provider driver. We switched to support unicode using 4 bits length because the previous system only supported 3 bits."); - Common.log("Some characters such as smiley or Chinese are stored in 4 bits so they would crash the 3-bit database leading to more problems. Most hosting providers have now widely adopted the utf8mb4_unicode_520_ci encoding you seem lacking. Disable MySQL connection or update your driver to fix this."); - } - - else - Common.throwError(t, fallbackMessage); - } - - // -------------------------------------------------------------------- - // Non-blocking checking - // -------------------------------------------------------------------- - - /** - * Return the table from last connection, throwing an error if never connected - * - * @return - */ - protected final String getTable() { - checkEstablished(); - - return Common.getOrEmpty(lastCredentials.table); - } - - /** - * Checks if the connect() function was called - */ - private final void checkEstablished() { - Valid.checkBoolean(isLoaded(), "Connection was never established"); - } - - /** - * Return true if the connect function was called so that the driver was loaded - * - * @return - */ - public final boolean isLoaded() { - return connection != null; - } - - // -------------------------------------------------------------------- - // Variables - // -------------------------------------------------------------------- - - /** - * Adds a new variable you can then use in your queries. - * The variable name will be added {} brackets automatically. - * - * @param name - * @param value - */ - protected final void addVariable(final String name, final String value) { - sqlVariables.put(name, value); - } - - /** - * Replace the {table} and {@link #sqlVariables} in the sql query - * - * @param sql - * @return - */ - protected final String replaceVariables(String sql) { - - for (final Entry<String, String> entry : sqlVariables.entrySet()) - sql = sql.replace("{" + entry.getKey() + "}", entry.getValue()); - - return sql.replace("{table}", getTable()); - } - - /** - * Stores last known credentials from the connect() functions - */ - @RequiredArgsConstructor - private final class LastCredentials { - - /** - * The connecting URL, for example: - * <p> - * jdbc:mysql://host:port/database - */ - private final String url; - - /** - * The user name for the database - */ - private final String user; - - /** - * The password for the database - */ - private final String password; - - /** - * The table. Never used in this class, only stored for your convenience - */ - private final String table; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/database/SimpleFlatDatabase.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/database/SimpleFlatDatabase.java deleted file mode 100644 index c4098c34f2fee5b06e3c07db7d7c9fbbd7f2b77a..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/database/SimpleFlatDatabase.java +++ /dev/null @@ -1,240 +0,0 @@ -package org.mineacademy.fo.database; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - -import org.apache.commons.lang.WordUtils; -import org.bukkit.Bukkit; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MathUtil; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.debug.LagCatcher; -import org.mineacademy.fo.settings.SimpleSettings; - -import lombok.NonNull; - -/** - * Represents a simple database where values are flattened and stored - * by {@link UUID} from the given {@link Identifiable} interface. - * <p> - * The table structure is as follows: - * <p> - * UUID varchar(64) | Name text | Data text | Updated bigint - * ------------------------------------------------------------ - * Player's uuid | Last known name | {json data} | Date of last save call - * <p> - * We use JSON to flatten those values and provide convenience methods - * {@link #onLoad(SerializedMap, Identifiable)} and {@link #onSave(Identifiable)} - * for you to override so that you can easily save/load data to MySQL. - * <p> - * Also see {@link #getExpirationDays()}, by default we remove values not touched - * within the last 90 days. - * <p> - * For a less-restricting solution see {@link SimpleDatabase} however you will - * need to run own queries and implement own table structure that requires MySQL - * command syntax knowledge. - * - * @param <T> the model you use to load/save entries, such as your player cache - */ -public abstract class SimpleFlatDatabase<T> extends SimpleDatabase { - - /** - * An internal flag to prevent dead lock so that we do not call any - * more queries within the {@link #load(UUID, Object)} or {@link #save(UUID, Object)} methods - */ - private boolean isQuerying = false; - - /** - * Creates the table if it does not exist - * <p> - * To override this override {@link #onConnectFinish()} - */ - @Override - protected final void onConnected() { - - // First, see if the database exists, create it if not - update("CREATE TABLE IF NOT EXISTS {table}(UUID varchar(64), Name text, Data text, Updated bigint)"); - - // Remove entries that have not been updated in the last X days - removeOldEntries(); - - // Call any hooks - onConnectFinish(); - } - - /** - * You can override this to run code after the connection was made and - * the table created as well as purged ({@link #removeOldEntries()}) - */ - protected void onConnectFinish() { - } - - /** - * Remove entries that have not been updated (called {@link #save(Identifiable)} method) for the - * last given X amount of days - */ - private void removeOldEntries() { - final long threshold = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(getExpirationDays()); - - update("DELETE FROM {table} WHERE Updated < " + threshold + ""); - } - - /** - * When you call the save method, we write the last updated time to the entry. - * On plugin loading we can remove entries that have not been saved/updated - * for the given amount of days. - * <p> - * Default: 90 days - * - * @return - */ - protected int getExpirationDays() { - return 90; - } - - /** - * Load the data for the given unique ID and his cache - * - * @param uuid - * @param cache - */ - public final void load(final UUID uuid, final T cache) { - if (!isLoaded() || isQuerying) - return; - - try { - LagCatcher.start("mysql"); - isQuerying = true; - - Debugger.debug("mysql", "---------------- MySQL - Loading data for " + uuid); - - final ResultSet resultSet = query("SELECT * FROM {table} WHERE UUID='" + uuid + "'"); - final String dataRaw = resultSet.next() ? resultSet.getString("Data") : "{}"; - Debugger.debug("mysql", "JSON: " + dataRaw); - - final SerializedMap data = SerializedMap.fromJson(dataRaw); - Debugger.debug("mysql", "Deserialized data: " + data); - - // Call the user specified load method - onLoad(data, cache); - - // Close connection at the end - resultSet.close(); - - } catch (final Throwable t) { - Common.error(t, - "Failed to load data from MySQL!", - "UUID: " + uuid, - "Error: %error"); - - } finally { - isQuerying = false; - - logPerformance("loading"); - } - } - - /** - * Your method to load the data for the given unique ID and his cache - * - * @param map the map that is automatically converted from the JSON array - * stored in the database - * @param data the data you want to fill out to - */ - protected abstract void onLoad(SerializedMap map, T data); - - /** - * Save the data for the given name, unique ID and his cache - * <p> - * If the onSave returns empty data we delete the row - * - * @param name last known name - players may change those - * @param uuid - * @param cache - */ - public final void save(final String name, final UUID uuid, final T cache) { - if (!isLoaded() || isQuerying) - return; - - try { - LagCatcher.start("mysql"); - isQuerying = true; - - // Save using the user configured save method - final SerializedMap data = onSave(cache); - - Debugger.debug("mysql", "---------------- MySQL - Saving data for " + uuid); - Debugger.debug("mysql", "Raw data: " + data); - Debugger.debug("mysql", "JSON: " + (data == null ? "null" : data.toJson())); - - // Remove data if empty - if (data == null || data.isEmpty()) { - update("DELETE FROM {table} WHERE UUID= '" + uuid + "';"); - - if (Debugger.isDebugged("mysql")) - Debugger.debug("mysql", "Data was empty, row has been removed."); - - } else if (isStored(uuid)) - update("UPDATE {table} SET Data='" + data.toJson() + "', Updated='" + System.currentTimeMillis() + "' WHERE UUID='" + uuid + "';"); - else - update("INSERT INTO {table}(UUID, Name, Data, Updated) VALUES ('" + uuid + "', '" + name + "', '" + data.toJson() + "', '" + System.currentTimeMillis() + "');"); - - } catch (final Throwable ex) { - Common.error(ex, - "Failed to save data to MySQL!", - "UUID: " + uuid, - "Error: %error"); - - } finally { - isQuerying = false; - - logPerformance("saving"); - } - } - - /** - * Utility method to finish LagCatcher mysql measure and log - * if there was some lag, or if we detected mysql being run - * from the main thread. - * - * @param operation - */ - private void logPerformance(final String operation) { - final boolean isMainThread = Bukkit.isPrimaryThread(); - - LagCatcher.end("mysql", isMainThread ? 10 : MathUtil.atLeast(200, SimpleSettings.LAG_THRESHOLD_MILLIS), - WordUtils.capitalize(operation) + " data to MySQL took {time} ms" + (isMainThread ? " - To prevent slowing the server, " + operation + " can be made async (carefully)" : "")); - } - - /** - * Checks if the given unique id is stored in the database - * - * @param uuid - * @return - * @throws SQLException - */ - private boolean isStored(@NonNull final UUID uuid) throws SQLException { - final ResultSet resultSet = query("SELECT * FROM {table} WHERE UUID= '" + uuid.toString() + "'"); - - if (resultSet == null) - return false; - - if (resultSet.next()) - return resultSet.getString("UUID") != null; - - return false; - } - - /** - * Your method to save the data for the given unique ID and his cache - * <p> - * Return an empty data to delete the row - * - * @param data - * @return - */ - protected abstract SerializedMap onSave(T data); -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/debug/Debugger.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/debug/Debugger.java deleted file mode 100644 index 70bb465292bccca34ee2ba2196ea3e086b8d83d7..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/debug/Debugger.java +++ /dev/null @@ -1,350 +0,0 @@ -package org.mineacademy.fo.debug; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang.StringUtils; -import org.bukkit.Bukkit; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.FileUtil; -import org.mineacademy.fo.TimeUtil; -import org.mineacademy.fo.constants.FoConstants; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.settings.SimpleSettings; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.NonNull; - -/** - * Utility class for solving problems and errors - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class Debugger { - - /** - * Stores messages to be printed out at once at the end, - * the key is the debug section and the list contains messages that will be connected - * and printed. - */ - private static final Map<String, ArrayList<String>> pendingMessages = new HashMap<>(); - - /** - * The debug mode is automatically detected when the debug.lock file is present in the plugin folder - */ - @Getter - private static boolean debugModeEnabled = false; - - /** - * Loads debug mode, called automatically in {@link SimplePlugin} - */ - public static void detectDebugMode() { - if (new File(SimplePlugin.getData(), "debug.lock").exists()) { - debugModeEnabled = true; - - Bukkit.getLogger().info("Detected debug.lock file, debug features enabled!"); - - } else - debugModeEnabled = false; - } - - /** - * Prints a debug messages to the console if the given section is being debugged - * <p> - * You can set if the section is debugged by setting it in "Debug" key in your settings.yml, - * by default your class extending {@link SimpleSettings} - * - * @param section - * @param messages - */ - public static void debug(String section, String... messages) { - if (isDebugged(section)) { - for (final String message : messages) - if (SimplePlugin.hasInstance()) - Common.log("[" + section + "] " + message); - else - System.out.println("[" + section + "] " + message); - } - } - - /** - * Puts a message for the specific section into the queue. These are stored there until - * you call {@link #push(String)} and then put together and printed. - * - * @param section - * @param message - */ - public static void put(String section, String message) { - if (!isDebugged(section)) - return; - - final ArrayList<String> list = pendingMessages.getOrDefault(section, new ArrayList<String>()); - list.add(message); - - pendingMessages.put(section, list); - } - - /** - * Puts the message at the end of the pending message queue and pushes the final log - * to the console - * - * @param section - * @param message - */ - public static void push(String section, String message) { - put(section, message); - push(section); - } - - /** - * Clears all pending messages from {@link #put(String, String)}, puts them together - * and prints them into your console - * - * @param section - */ - public static void push(String section) { - if (!isDebugged(section)) - return; - - final List<String> parts = pendingMessages.remove(section); - - if (parts == null) - return; - - final String whole = StringUtils.join(parts, ""); - - for (final String message : whole.split("\n")) - debug(section, message); - } - - /** - * Get if the given section is being debugged - * <p> - * You can set if the section is debugged by setting it in "Debug" key in your settings.yml, - * by default your class extending {@link SimpleSettings} - * <p> - * If you set Debug to ["*"] this will always return true - * - * @param section - * @return - */ - public static boolean isDebugged(String section) { - return SimpleSettings.DEBUG_SECTIONS.contains(section) || SimpleSettings.DEBUG_SECTIONS.contains("*"); - } - - // ---------------------------------------------------------------------------------------------------- - // Saving errors to file - // ---------------------------------------------------------------------------------------------------- - - /** - * Logs the error in the console and writes all details into the errors.log file - * - * @param t - * @param messages - */ - public static void saveError(Throwable t, String... messages) { - if (Bukkit.getServer() == null) // Instance not set, e.g. when not using Bukkit - return; - - final List<String> lines = new ArrayList<>(); - final String header = SimplePlugin.getNamed() + " " + SimplePlugin.getVersion() + " encountered " + Common.article(t.getClass().getSimpleName()); - - // Write out header and server info - fill(lines, - "------------------------------------[ " + TimeUtil.getFormattedDate() + " ]-----------------------------------", - header, - "Running " + Bukkit.getName() + " " + Bukkit.getBukkitVersion() + " and Java " + System.getProperty("java.version"), - "Plugins: " + StringUtils.join(Bukkit.getPluginManager().getPlugins(), ", "), - "----------------------------------------------------------------------------------------------"); - - // Write additional data - if (messages != null && !StringUtils.join(messages, "").isEmpty()) { - fill(lines, "\nMore Information: "); - fill(lines, messages); - } - - { // Write the stack trace - - do { - // Write the error header - fill(lines, t == null ? "Unknown error" : t.getClass().getSimpleName() + " " + Common.getOrDefault(t.getMessage(), Common.getOrDefault(t.getLocalizedMessage(), "(Unknown cause)"))); - - int count = 0; - - for (final StackTraceElement el : t.getStackTrace()) { - count++; - - final String trace = el.toString(); - - if (trace.contains("sun.reflect")) - continue; - - if (count > 6 && trace.startsWith("net.minecraft.server")) - break; - - fill(lines, "\t at " + el.toString()); - } - } while ((t = t.getCause()) != null); - } - - fill(lines, "----------------------------------------------------------------------------------------------", System.lineSeparator()); - - // Log to the console - Common.log(header + "! Please check your error.log and report this issue with the information in that file."); - - // Finally, save the error file - FileUtil.write(FoConstants.File.ERRORS, lines); - } - - private static void fill(List<String> list, String... messages) { - list.addAll(Arrays.asList(messages)); - } - - // ---------------------------------------------------------------------------------------------------- - // Utility methods - // ---------------------------------------------------------------------------------------------------- - - /** - * Print out where your method is being called from - * Such as: YourClass > YourMainClass > MinecraftServer > Thread - * <p> - * Also can print line numbers YourClass#LineNumber - * - * @param trackLineNumbers - * @return - */ - public static List<String> traceRoute(boolean trackLineNumbers) { - final Exception exception = new RuntimeException("I love horses"); - final List<String> paths = new ArrayList<>(); - - for (final StackTraceElement el : exception.getStackTrace()) { - final String[] classNames = el.getClassName().split("\\."); - final String className = classNames[classNames.length - 1]; - final String line = el.toString(); - - if (line.contains("net.minecraft.server") || line.contains("org.bukkit.craftbukkit")) - break; - - if (line.contains("org.bukkit.plugin.java.JavaPluginLoader") || line.contains("org.bukkit.plugin.SimplePluginManager") || line.contains("org.bukkit.plugin.JavaPlugin")) - continue; - - if (!paths.contains(className)) - paths.add(className + "#" + el.getMethodName() + (trackLineNumbers ? "(" + el.getLineNumber() + ")" : "")); - } - - // Remove call to self - if (!paths.isEmpty()) - paths.remove(0); - - return paths; - } - - /** - * Prints array values with their indexes on each line - * - * @param values - */ - public static void printValues(Object[] values) { - if (values != null) { - print(Common.consoleLine()); - print("Enumeration of " + Common.plural(values.length, values.getClass().getSimpleName().toLowerCase().replace("[]", ""))); - - for (int i = 0; i < values.length; i++) - print("&8[" + i + "] &7" + values[i]); - } else - print("Value are null"); - } - - /** - * Prints stack trace until we reach the native MC/Bukkit with a custom message - * - * @param message the message to wrap stack trace around - */ - public static void printStackTrace(String message) { - final StackTraceElement[] trace = new Exception().getStackTrace(); - - print("!----------------------------------------------------------------------------------------------------------!"); - print(message); - print("!----------------------------------------------------------------------------------------------------------!"); - - for (int i = 1; i < trace.length; i++) { - final String line = trace[i].toString(); - - if (canPrint(line)) - print("\tat " + line); - } - - print("--------------------------------------------------------------------------------------------------------end-"); - } - - /** - * Prints a Throwable's first line and stack traces. - * <p> - * Ignores the native Bukkit/Minecraft server. - * - * @param throwable the throwable to print - */ - public static void printStackTrace(@NonNull Throwable throwable) { - - // Load all causes - final List<Throwable> causes = new ArrayList<>(); - - if (throwable.getCause() != null) { - Throwable cause = throwable.getCause(); - - do - causes.add(cause); - while ((cause = cause.getCause()) != null); - } - - if (throwable instanceof FoException && !causes.isEmpty()) { - // Do not print parent exception if we are only wrapping it, saves console spam - print(throwable.getMessage()); - - } else { - print(throwable.toString()); - - printStackTraceElements(throwable); - } - - if (!causes.isEmpty()) { - final Throwable lastCause = causes.get(causes.size() - 1); - - print(lastCause.toString()); - printStackTraceElements(lastCause); - } - } - - private static void printStackTraceElements(Throwable throwable) { - for (final StackTraceElement element : throwable.getStackTrace()) { - final String line = element.toString(); - - if (canPrint(line)) - print("\tat " + line); - } - } - - /** - * Returns whether a line is suitable for printing as an error line - we ignore stuff from NMS and OBF as this is not needed - * - * @param message - * @return - */ - private static boolean canPrint(String message) { - return !message.contains("net.minecraft") && !message.contains("org.bukkit.craftbukkit") && !message.contains("nashorn") && !message.contains("javax.script") && !message.contains("org.yaml.snakeyaml"); - } - - // Print a simple console message - private static void print(String message) { - if (SimplePlugin.hasInstance()) - Common.logNoPrefix(message); - else - System.out.println(message); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/debug/LagCatcher.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/debug/LagCatcher.java deleted file mode 100644 index 345020a0800a542f1cb900c24f8222e781186bcf..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/debug/LagCatcher.java +++ /dev/null @@ -1,200 +0,0 @@ -package org.mineacademy.fo.debug; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MathUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.settings.SimpleSettings; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; - -/** - * A simple yet effective way to calculate duration - * between two points in code - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class LagCatcher { - - /** - * Stores sections with the time time they started to be measured - */ - private static volatile Map<String, Long> startTimesMap = new HashMap<>(); - - /** - * Stores sections with a list of lag durations for each section - */ - private static volatile Map<String, List<Long>> durationsMap = new HashMap<>(); - - /** - * Puts the code section with the current ms time to the timings map - * - * @param section - */ - public static void start(String section) { - if (SimpleSettings.LAG_THRESHOLD_MILLIS == -1) - return; - - startTimesMap.put(section, System.nanoTime()); - } - - /** - * Stops measuring time in a code section and print a console message - * when it took over the threshold set in {@link SimpleSettings} - * - * @param section - */ - public static void end(String section) { - end(section, false); - } - - /** - * Stops measuring time in a code section and print a console message - * when it took over the threshold. Rapid means we always log how long it took, - * false means we log it if took over the limit set in {@link SimpleSettings} - * - * @param section - * @param rapid - */ - public static void end(String section, boolean rapid) { - end(section, rapid ? 0 : SimpleSettings.LAG_THRESHOLD_MILLIS, "{section} took {time} ms"); - } - - /** - * Stops measuring time in a code section and print a custom console message - * when it took over the given threshold - * <p> - * Use {section} and {time} to replace the debugged section and how long it took - * - * @param section - * @param thresholdMs - * @param message - */ - public static void end(String section, int thresholdMs, String message) { - final double lag = finishAndCalculate(section); - - if (lag > thresholdMs && SimpleSettings.LAG_THRESHOLD_MILLIS != -1) { - message = (SimplePlugin.hasInstance() ? "[" + SimplePlugin.getNamed() + " " + SimplePlugin.getVersion() + "] " : "") + message - .replace("{section}", section) - .replace("{time}", MathUtil.formatTwoDigits(lag)); - - System.out.println(message); - } - } - - /** - * Attempts to run the given code the given amount of cycles rapidly - * after each other, compounding the lag time together to see how long the - * execution takes when it is multiplied - * - * @param cycles - * @param name the lag section name - * @param code - */ - public static void performanceTest(int cycles, String name, Runnable code) { - Valid.checkBoolean(cycles > 0, "Cycles must be above 0"); - - LagCatcher.start(name + "-whole"); - - final List<Double> lagMap = new ArrayList<>(); - - for (int i = 0; i < cycles; i++) { - LagCatcher.start(name); - code.run(); - lagMap.add(finishAndCalculate(name)); - } - - System.out.println("Test '" + name + "' took " + MathUtil.formatTwoDigits(finishAndCalculate(name + "-whole")) + " ms. Average " + MathUtil.average(lagMap) + " ms"); - - // Measure individual sub sections of the performance test - if (!durationsMap.isEmpty()) { - for (final Map.Entry<String, List<Long>> entry : durationsMap.entrySet()) { - final String section = entry.getKey(); - long duration = 0; - - for (final long sectionDuration : entry.getValue()) - duration += sectionDuration; - - System.out.println("\tSection '" + section + "' took " + MathUtil.formatTwoDigits(duration / 1_000_000D)); - } - - System.out.println("Section measurement ended."); - - durationsMap.clear(); - } - } - - /** - * Work like {@link #start(String)} method except that this will accumulate every time - * you call it and show in {@link #performanceTest(int, String, Runnable)}! - * - * @param section - */ - public static void performancePartStart(String section) { - List<Long> sectionDurations = durationsMap.get(section); - - if (sectionDurations == null) { - sectionDurations = new ArrayList<>(); - - durationsMap.put(section, sectionDurations); - } - - // Do not calculate duration, just append last time at the end - sectionDurations.add(System.nanoTime()); - } - - /** - * Work like {@link #start(String)} method except that this will accumulate every time - * you call it and show in {@link #performanceTest(int, String, Runnable)}! - * - * This will catch the duration of the last {@link #performancePartStart(String)} call - * and put the lag to the map shown after performance test has ended. - * - * @param section - */ - public static void performancePartSnap(String section) { - Valid.checkBoolean(durationsMap.containsKey(section), "Section " + section + " is not measured! Are you calling it from performanceTest?"); - - final List<Long> sectionDurations = durationsMap.get(section); - - final int index = sectionDurations.size() - 1; - final long nanoTime = sectionDurations.get(index); - final long duration = System.nanoTime() - nanoTime; - - sectionDurations.set(index, duration); - } - - /** - * Calculates how long a section took (in ms) but does not remove it from the map - * it will continue being measure - * - * @param section - * @return - */ - public static void took(String section) { - final Long nanoTime = startTimesMap.get(section); - final String message = section + " took " + MathUtil.formatTwoDigits(nanoTime == null ? 0D : (System.nanoTime() - nanoTime) / 1_000_000D) + " ms"; - - if (SimplePlugin.hasInstance()) - Common.logNoPrefix("[{plugin_name} {plugin_version}] " + message); - else - System.out.println("[LagCatcher] " + message); - } - - /** - * Calculates how long a section took (in ms) and removes it from the timings map - * - * @param section - * @return - */ - private static double finishAndCalculate(String section) { - final Long nanoTime = startTimesMap.remove(section); - - return nanoTime == null ? 0D : (System.nanoTime() - nanoTime) / 1_000_000D; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/MenuOpenEvent.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/MenuOpenEvent.java deleted file mode 100644 index 6b12339dba8ef6178d486cfb01f305a229549582..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/MenuOpenEvent.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.mineacademy.fo.event; - -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.HandlerList; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.model.InventoryDrawer; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; - -/** - * Triggered when a menu is opened for a player - */ -@Getter -@RequiredArgsConstructor -public final class MenuOpenEvent extends SimpleEvent implements Cancellable { - - private static final HandlerList handlers = new HandlerList(); - - /** - * The menu. Use {@link #getDrawer()} to edit how menu items will look like. - */ - private final Menu menu; - - /** - * The drawer that contains prepared items to render for the player - * Use this to edit how the menu will look like - */ - private final InventoryDrawer drawer; - - /** - * The player - */ - private final Player player; - - /** - * Should we prevent to display this menu? - */ - @Setter - private boolean cancelled; - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/RegionScanCompleteEvent.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/RegionScanCompleteEvent.java deleted file mode 100644 index 3c1feddc1312153c174cc317a777104df2c7156b..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/RegionScanCompleteEvent.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.mineacademy.fo.event; - -import org.bukkit.World; -import org.bukkit.event.HandlerList; -import org.mineacademy.fo.model.OfflineRegionScanner; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * Triggered when {@link OfflineRegionScanner} finishes scanning all offline regions on your disk - */ -@Getter -@RequiredArgsConstructor -public final class RegionScanCompleteEvent extends SimpleEvent { - - private static final HandlerList handlers = new HandlerList(); - - /** - * The world this scanner operated in - */ - private final World world; - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/RocketExplosionEvent.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/RocketExplosionEvent.java deleted file mode 100644 index a1e2a778a36a6f002a949ff5d3df6f793fa74b54..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/RocketExplosionEvent.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.mineacademy.fo.event; - -import org.bukkit.entity.Projectile; -import org.bukkit.event.Cancellable; -import org.bukkit.event.HandlerList; -import org.mineacademy.fo.menu.tool.Rocket; - -import lombok.Getter; -import lombok.Setter; - -/** - * The event that is triggered when a {@link Rocket} explodes. - */ -@Getter -public final class RocketExplosionEvent extends SimpleEvent implements Cancellable { - - private static final HandlerList handlers = new HandlerList(); - - /** - * The rocket - */ - private final Rocket rocket; - - /** - * The projectile - */ - private final Projectile projectile; - - /** - * The power of this explosion - */ - @Setter - private float power; - - /** - * Should this explosion break blocks? - */ - @Setter - private boolean breakBlocks; - - /** - * Is the event cancelled? - */ - @Setter - private boolean cancelled; - - public RocketExplosionEvent(Rocket rocket, Projectile projectile, float power, boolean breakBlocks) { - this.rocket = rocket; - this.projectile = projectile; - this.power = power; - this.breakBlocks = breakBlocks; - } - - @Override - public HandlerList getHandlers() { - return handlers; - } - - public static HandlerList getHandlerList() { - return handlers; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/SimpleCancellableEvent.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/SimpleCancellableEvent.java deleted file mode 100644 index 4496432f9dcd321f6a01f68be2d7fd72b448f7c5..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/SimpleCancellableEvent.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.mineacademy.fo.event; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * An extension of {@link SimpleEvent} which also makes your custom events - * cancellable. - */ -@Getter -@Setter -@NoArgsConstructor(access = AccessLevel.PROTECTED) -public abstract class SimpleCancellableEvent extends SimpleEvent { - - /** - * Is the event cancelled? - */ - private boolean cancelled; - - /** - * Create a new event indicating whether it is run from - * the primary Minecraft server thread or not - * - * @param async - */ - protected SimpleCancellableEvent(boolean async) { - super(async); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/SimpleEvent.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/SimpleEvent.java deleted file mode 100644 index 0f79f74c266e86511e1d5a94f96e701bbdd7bf05..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/SimpleEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.mineacademy.fo.event; - -import org.bukkit.Bukkit; -import org.bukkit.event.Event; - -/** - * A simple extension of the Bukkit event class to support additional functions, - * currently: - * <ul> - * <li>Make events work for both sync and async scenarious without errors</li> - * </ul> - */ -public abstract class SimpleEvent extends Event { - - protected SimpleEvent() { - // Since 1.14 Spigot has implemented a safety checks for events - // and will throw errors when an event is fired async and not declared so - // - // This will automatically declare the event sync/async based off what thread it is fired from - // see https://github.com/PaperMC/Paper/issues/2099 - super(!Bukkit.isPrimaryThread()); - } - - /** - * Create a new event indicating whether it is run from - * the primary Minecraft server thread or not - * - * @param async - */ - protected SimpleEvent(boolean async) { - super(async); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/SimpleListener.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/SimpleListener.java deleted file mode 100644 index 2fe1109de7a17bfbee9230598b61a3bf32dd2398..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/event/SimpleListener.java +++ /dev/null @@ -1,232 +0,0 @@ -package org.mineacademy.fo.event; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.Event; -import org.bukkit.event.EventException; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerEvent; -import org.bukkit.plugin.EventExecutor; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Messenger; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.debug.LagCatcher; -import org.mineacademy.fo.exception.EventHandledException; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.Variables; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.settings.SimpleLocalization; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * A simply way of allowing plugin to change the event listening priority - * - * @param <T> the event we are listening for - */ -@RequiredArgsConstructor -public abstract class SimpleListener<T extends Event> implements Listener, EventExecutor { - - /** - * The event we are listening to - */ - private final Class<T> eventClass; - - /** - * The event priority - */ - private final EventPriority priority; - - /** - * Shall we ignore cancelled events down the pipeline? - */ - private final boolean ignoreCancelled; - - /** - * The run event temporary placeholder - */ - @Getter(value = AccessLevel.PROTECTED) - private T event; - - /** - * Creates a new listener using the normal priority - * and ignoring cancelled - * - * @param event - */ - public SimpleListener(Class<T> event) { - this(event, EventPriority.NORMAL); - } - - /** - * Creates a new listener ignoring cancelled - * - * @param event - * @param priority - */ - public SimpleListener(Class<T> event, EventPriority priority) { - this(event, priority, true); - } - - @Override - public final void execute(Listener listener, Event event) throws EventException { - - if (!event.getClass().equals(this.eventClass)) - return; - - final String logName = listener.getClass().getSimpleName() + " listening to " + event.getEventName() + " at " + priority + " priority"; - - LagCatcher.start(logName); - - try { - this.event = this.eventClass.cast(event); - - execute((T) event); - - } catch (final EventHandledException ex) { - final String[] messages = ex.getMessages(); - final boolean cancelled = ex.isCancelled(); - - final Player player = findPlayer(); - - if (messages != null && player != null) - for (String message : messages) { - message = Variables.replace(message, player); - - if (Messenger.ENABLED) - Messenger.error(player, message); - else - Common.tell(player, "&c" + message); - } - - if (cancelled && event instanceof Cancellable) - ((Cancellable) event).setCancelled(true); - - } catch (final Throwable t) { - Common.error(t, "Unhandled exception listening to " + this.eventClass.getSimpleName()); - - } finally { - LagCatcher.end(logName); - - // Do not null the event since this breaks findPlayer for any scheduled tasks - //this.event = null; - } - } - - /** - * Executes when the event is run - * - * @param event - */ - protected abstract void execute(T event); - - /** - * Return a player from this event, null if none, - * used for messaging - * - * @return - */ - protected Player findPlayer() { - Valid.checkNotNull(this.event, "Called findPlayer for null event!"); - - if (this.event instanceof PlayerEvent) - return ((PlayerEvent) this.event).getPlayer(); - - throw new FoException("Called findPlayer but not method not implemented for event " + this.event); - } - - /** - * If the object is null, stop your code from further execution, cancel the event and - * send the player a null message (see {@link #findPlayer(Event)}) - * - * @param toCheck - * @param falseMessages - */ - protected final void checkNotNull(Object toCheck, String... nullMessages) { - checkBoolean(toCheck != null, nullMessages); - } - - /** - * If the condition is false, stop your code from further execution, cancel the event and - * send the player a false message (see {@link #findPlayer(Event)}) - * - * @param condition - * @param falseMessages - */ - protected final void checkBoolean(boolean condition, String... falseMessages) { - if (!condition) - throw new EventHandledException(true, falseMessages); - } - - /** - * Stop code from executing and send the player a message (see {@link #findPlayer(Event)}) - * when he lacks the given permission - * - * @param permission - */ - protected final void checkPerm(String permission) { - checkPerm(permission, SimpleLocalization.NO_PERMISSION); - } - - /** - * Return if the {@link #findPlayer(Event)} player has the given permission; - * - * @param permission - * @return - */ - protected final boolean hasPerm(String permission) { - return PlayerUtil.hasPerm(findPlayer(), permission); - } - - /** - * Stop code from executing and send the player a message (see {@link #findPlayer(Event)}) - * when he lacks the given permission - * - * @param permission - * @param falseMessage - */ - protected final void checkPerm(String permission, String falseMessage) { - final Player player = findPlayer(); - Valid.checkNotNull(player, "Player cannot be null for " + this.event + "!"); - - if (!PlayerUtil.hasPerm(player, permission)) - throw new EventHandledException(true, falseMessage.replace("{permission}", permission)); - } - - /** - * Cancel the event and send the player a message (see {@link #findPlayer(Event)}) - * - * @param messages - */ - protected final void cancel(String... messages) { - throw new EventHandledException(true, messages); - } - - /** - * Cancel this event - */ - protected final void cancel() { - throw new EventHandledException(true); - } - - /** - * Return code execution and send messages - * - * @param messages - */ - protected final void returnTell(String... messages) { - throw new EventHandledException(false, messages); - } - - /** - * A shortcut for registering this event in Bukkit - */ - public final void register() { - Bukkit.getPluginManager().registerEvent(eventClass, this, priority, this, SimplePlugin.getInstance(), ignoreCancelled); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/CommandException.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/CommandException.java deleted file mode 100644 index 45aa9620529b0e9929772f2f5cc4e552d5b4786b..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/CommandException.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.mineacademy.fo.exception; - -import lombok.Getter; - -/** - * Represents a silent exception thrown then handling commands, - * this will only send the command sender a message - */ -public class CommandException extends RuntimeException { - - private static final long serialVersionUID = 1L; - - /** - * The messages to send to the command sender - */ - @Getter - private final String[] messages; - - /** - * Create a new command exception with messages for the command sender - * - * @param messages - */ - public CommandException(String... messages) { - super(""); - - this.messages = messages; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/EventHandledException.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/EventHandledException.java deleted file mode 100644 index 81f5bf1bf7231e981c0677cf73bc2da28147c567..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/EventHandledException.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.mineacademy.fo.exception; - -import lombok.Getter; - -/** - * Represents a silent exception thrown then handling events, - * this will only send the event player a message - */ -public final class EventHandledException extends CommandException { - - private static final long serialVersionUID = 1L; - - /** - * Should we cancel this event? - */ - @Getter - private final boolean cancelled; - - public EventHandledException() { - this(true); - } - - /** - * Create a new command exception with messages for the command sender - * - * @param messages - */ - public EventHandledException(boolean cancelled, String... messages) { - super(messages); - - this.cancelled = cancelled; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/FoException.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/FoException.java deleted file mode 100644 index d5e95e262e2828e407380070fe8fc1a38cba181d..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/FoException.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.mineacademy.fo.exception; - -import org.mineacademy.fo.debug.Debugger; - -/** - * Represents our core exception. All exceptions of this - * kind are logged automatically to the error.log file - */ -public class FoException extends RuntimeException { - - private static final long serialVersionUID = 1L; - - /** - * Create a new exception and logs it - * - * @param t - */ - public FoException(Throwable t) { - super(t); - - Debugger.saveError(t); - } - - /** - * Create a new exception and logs it - * - * @param message - */ - public FoException(String message) { - super(message); - - Debugger.saveError(this, message); - } - - /** - * Create a new exception and logs it - * - * @param message - * @param t - */ - public FoException(Throwable t, String message) { - super(message, t); - - Debugger.saveError(t, message); - } - - /** - * Create a new exception and logs it - */ - public FoException() { - Debugger.saveError(this); - } - - @Override - public String getMessage() { - return "Report: " + super.getMessage(); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/InvalidCommandArgException.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/InvalidCommandArgException.java deleted file mode 100644 index 7a1ec919b6ce1eb0dcbbe45022d5c93fa1ade6bb..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/InvalidCommandArgException.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.mineacademy.fo.exception; - -/** - * Thrown when a command has invalid argument - */ -public final class InvalidCommandArgException extends CommandException { - - private static final long serialVersionUID = 1L; - - public InvalidCommandArgException() { - super(); - } - - public InvalidCommandArgException(String message) { - super(message); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/InvalidWorldException.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/InvalidWorldException.java deleted file mode 100644 index 5f2c2da2b6618f5482bd9fbd31d30b70fc35cdfe..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/InvalidWorldException.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.mineacademy.fo.exception; - -import lombok.Getter; - -/** - * Thrown when we load data from data.db but they have a location with a world - * that no longer exists - */ -public final class InvalidWorldException extends RuntimeException { - - private static final long serialVersionUID = 1L; - - /** - * The world that was invali - */ - @Getter - private final String world; - - public InvalidWorldException(String message, String world) { - super(message); - - this.world = world; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/RegexTimeoutException.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/RegexTimeoutException.java deleted file mode 100644 index c3d56139cabd9f47ed39f2d69006b49d82f052d4..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/exception/RegexTimeoutException.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.mineacademy.fo.exception; - -import lombok.Getter; - -/** - * Thrown when we check a regex, see {@link org.mineacademy.fo.Common#regExMatch(java.util.regex.Matcher)} - * and the evaluation takes over the given limit - */ -@Getter -public final class RegexTimeoutException extends RuntimeException { - - private static final long serialVersionUID = 1L; - - /** - * The message that was being checked - */ - private final String checkedMessage; - - /** - * The execution limit in miliseconds - */ - private final long executionLimit; - - public RegexTimeoutException(CharSequence checkedMessage, long timeoutLimit) { - this.checkedMessage = checkedMessage.toString(); - this.executionLimit = timeoutLimit; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONArray.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONArray.java deleted file mode 100644 index c37a88bd618f9dae570dabc6dadaa05f7c9ac9e4..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONArray.java +++ /dev/null @@ -1,983 +0,0 @@ -/* - * Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "{}" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright {yyyy} {name of copyright owner} - * - * 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 - * - * http://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. - */ -package org.mineacademy.fo.jsonsimple; - -import java.io.IOException; -import java.io.Reader; -import java.io.StringWriter; -import java.io.Writer; -import java.lang.reflect.Array; -import java.text.DateFormat; -import java.text.ParseException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Date; -import java.util.Map; - -/** - * Represents a JSON array. - * - * @author FangYidong(fangyidong @ yahoo.com.cn) - * @author Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - * @version 2.0.0 - * @since 1.0.0 - */ -public class JSONArray extends ArrayList<Object> { - - // ==== 11.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // - Removed the interfaces JSONAware and JSONStreamAware - // - Moved all static "writeJSONString" methods to the Util class - // - Removed all "toJSONString" methods - // - Renamed the "writeJSONString" method to simply "write" - // - Updated documentation - // ==== - - private static final long serialVersionUID = 3957988303675231981L; - - /** - * Constructs an empty {@linkplain JSONArray}. - * - * @since 1.0.0 - */ - public JSONArray() { - } - - /** - * Constructs a {@linkplain JSONArray} with the elements of the given {@linkplain Collection}. - * - * @param collection the {@linkplain Collection} - * @since 1.0.0 - */ - public JSONArray(Collection<?> collection) { - - super(collection); - } - - /** - * Constructs a {@linkplain JSONArray} with the elements of the given array. - * - * @param array the array - * @param <T> the array type - * @since 1.0.0 - */ - public <T> JSONArray(T[] array) { - - for (final T element : array) - this.add(element); - } - - /** - * Constructs a {@linkplain JSONArray} with the elements of the given array. - * - * @param array the array - * @since 1.0.0 - */ - public JSONArray(byte[] array) { - - for (final byte element : array) - this.add(element); - } - - /** - * Constructs a {@linkplain JSONArray} with the elements of the given array. - * - * @param array the array - * @since 1.0.0 - */ - public JSONArray(boolean[] array) { - - for (final boolean element : array) - this.add(element); - } - - /** - * Constructs a {@linkplain JSONArray} with the elements of the given array. - * - * @param array the array - * @since 1.0.0 - */ - public JSONArray(char[] array) { - - for (final char element : array) - this.add(element); - } - - /** - * Constructs a {@linkplain JSONArray} with the elements of the given array. - * - * @param array the array - * @since 1.0.0 - */ - public JSONArray(short[] array) { - - for (final short element : array) - this.add(element); - } - - /** - * Constructs a {@linkplain JSONArray} with the elements of the given array. - * - * @param array the array - * @since 1.0.0 - */ - public JSONArray(int[] array) { - - for (final int element : array) - this.add(element); - } - - /** - * Constructs a {@linkplain JSONArray} with the elements of the given array. - * - * @param array the array - * @since 1.0.0 - */ - public JSONArray(long[] array) { - - for (final long element : array) - this.add(element); - } - - /** - * Constructs a {@linkplain JSONArray} with the elements of the given array. - * - * @param array the array - * @since 1.0.0 - */ - public JSONArray(float[] array) { - - for (final float element : array) - this.add(element); - } - - /** - * Constructs a {@linkplain JSONArray} with the elements of the given array. - * - * @param array the array - * @since 1.0.0 - */ - public JSONArray(double[] array) { - - for (final double element : array) - this.add(element); - } - - /** - * Constructs a {@linkplain JSONArray} with the elements of the given array. - * This constructor is a little slower than the others because it uses the Reflection API. - * - * @param array the array - * @since 1.0.0 - */ - public JSONArray(Object array) { - - // ==== 11.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // - Will no longer throw an exception if an object that isn't an array is given. - // An empty array will be constructed instead. - // ==== - - if (array != null && array.getClass().isArray()) { - - final int length = Array.getLength(array); - - for (int index = 0; index < length; index++) - this.add(Array.get(array, index)); - } - } - - /** - * Constructs a {@linkplain JSONArray} from a JSON string. - * - * @param json the JSON string - * @throws JSONParseException if the JSON is invalid - * @since 1.0.0 - */ - public JSONArray(String json) throws JSONParseException { - - super((JSONArray) new JSONParser().parse(json)); - } - - /** - * Constructs a {@linkplain JSONArray} from JSON data read from a {@linkplain Reader}. - * - * @param reader the {@linkplain Reader} - * @throws JSONParseException if the JSON is invalid - * @throws IOException if an I/O error occurred - * @since 1.0.0 - */ - public JSONArray(Reader reader) throws JSONParseException, IOException { - - super((JSONArray) new JSONParser().parse(reader)); - } - - /** - * Writes this {@linkplain JSONArray} as a JSON string on the given {@linkplain Writer}. - * - * @param writer the {@linkplain Writer} - * @throws IOException if an I/O error occurred - * @since 1.0.0 - */ - public void write(Writer writer) throws IOException { - - JsonSimpleUtil.write(this, writer); - } - - /** - * Converts this {@linkplain JSONArray} to a JSON string. - * - * @return this {@linkplain JSONArray} as a JSON string - * @since 1.0.0 - */ - @Override - public String toString() { - - try (StringWriter writer = new StringWriter()) { - - JsonSimpleUtil.write(this, writer); - return writer.toString(); - - } catch (final IOException exception) { - - // WILL NEVER HAPPEN! - // DO NOTHING! - } - - return null; - } - - @Override - public boolean equals(Object object) { - - if (object != null) - if (object instanceof Collection) { - - final Collection<?> collection = (Collection<?>) object; - - if (collection.size() == this.size()) { - - int index = 0; - - for (final Object element : collection) { - - if (!(element == null && this.get(index) == null || this.get(index).equals(element))) - return false; - - index++; - } - - return true; - } - - } else if (object.getClass().isArray()) { - - final int length = Array.getLength(object); - - if (length == this.size()) { - - for (int index = 0; index < length; index++) { - - final Object element = Array.get(object, index); - - if (!(element == null && this.get(index) == null || element.equals(this.get(index)))) - return false; - } - - return true; - } - } - - return false; - } - - /** - * If the value is a {@linkplain JSONObject} already, it will be casted and returned. - * If the value is a {@linkplain Map}, it will be wrapped in a {@linkplain JSONObject}. The wrapped {@linkplain JSONObject} will be returned. - * In any other case this method returns {@code null}. - * - * @param index index of the value - * @return a {@code JSONObject} or {@code null} - * @since 1.0.0 - */ - public JSONObject getObject(int index) { - - return JsonSimpleUtil.getObject(this.get(index)); - } - - /** - * If the value already is a {@linkplain JSONArray}, it will be casted and returned. - * If the value is an array or {@linkplain Collection}, it will be wrapped in a {@linkplain JSONArray}. - * The {@linkplain JSONArray} will be returned. - * In any other case this method returns {@code null}. - * - * @param index index of the value - * @return a {@linkplain JSONArray} or {@code null} - * @since 1.0.0 - */ - public JSONArray getArray(int index) { - - return JsonSimpleUtil.getArray(this.get(index)); - } - - /** - * If the value is already a {@linkplain Boolean}, it will be casted and returned. - * If the value is a {@linkplain String}, it will be parsed. The result is returned. - * If the value is a {@linkplain Number}, this method will return {@code true} in case its {@code long} value is {@code 1}. - * It will return {@code false} if it is a number but the {@code long} value is <u>not</u> {@code 1}. - * In any other case this method returns {@code null}. - * - * @param index index of the value - * @return a {@linkplain Boolean} or {@code null} - * @since 1.0.0 - */ - public Boolean getBoolean(int index) { - - return JsonSimpleUtil.getBoolean(this.get(index)); - } - - /** - * If the value is a {@linkplain Number}, its {@code byte} value is returned. - * If the value is a {@linkplain String}, it will be parsed. The result is returned. - * If the value is a {@linkplain Boolean}, this method returns {@code 1} in case the value is {@code true} otherwise {@code 0}. - * In any other case this method returns {@code null}. - * - * @param index index of the value - * @return a {@linkplain Byte} or {@code null} - * @since 1.0.0 - */ - public Byte getByte(int index) { - - return JsonSimpleUtil.getByte(this.get(index)); - } - - /** - * If the value is a {@linkplain Number}, its {@code short} value is returned. - * If the value is a {@linkplain String}, it will be parsed. The result is returned. - * If the value is a {@linkplain Boolean}, this method returns {@code 1} in case the value is {@code true} otherwise {@code 0}. - * In any other case this method returns {@code null}. - * - * @param index index of the value - * @return a {@linkplain Short} or {@code null} - * @since 1.0.0 - */ - public Short getShort(int index) { - - return JsonSimpleUtil.getShort(this.get(index)); - } - - /** - * If the value is a {@linkplain Number}, its {@code int} value is returned. - * If the value is a {@linkplain String}, it will be parsed. The result is returned. - * If the value is a {@linkplain Boolean}, this method returns {@code 1} in case the value is {@code true} otherwise {@code 0}. - * In any other case this method returns {@code null}. - * - * @param index index of the value - * @return a {@linkplain Integer} or {@code null} - * @since 1.0.0 - */ - public Integer getInteger(int index) { - - return JsonSimpleUtil.getInteger(this.get(index)); - } - - /** - * If the value is a {@linkplain Number}, its {@code long} value is returned. - * If the value is a {@linkplain String}, it will be parsed. The result is returned. - * If the value is a {@linkplain Boolean}, this method returns {@code 1} in case the value is {@code true} otherwise {@code 0}. - * In any other case this method returns {@code null}. - * - * @param index index of the value - * @return a {@linkplain Long} or {@code null} - * @since 1.0.0 - */ - public Long getLong(int index) { - - return JsonSimpleUtil.getLong(this.get(index)); - } - - /** - * If the value is a {@linkplain Number}, its {@code float} value is returned. - * If the value is a {@linkplain String}, it will be parsed. The result is returned. - * If the value is a {@linkplain Boolean}, this method returns {@code 1} in case the value is {@code true} otherwise {@code 0}. - * In any other case this method returns {@code null}. - * - * @param index index of the value - * @return a {@linkplain Float} or {@code null} - * @since 1.0.0 - */ - public Float getFloat(int index) { - - return JsonSimpleUtil.getFloat(this.get(index)); - } - - /** - * If the value is a {@linkplain Number}, its {@code double} value is returned. - * If the value is a {@linkplain String}, it will be parsed. The result is returned. - * If the value is a {@linkplain Boolean}, this method returns {@code 1} in case the value is {@code true} otherwise {@code 0}. - * In any other case this method returns {@code null}. - * - * @param index index of the value - * @return a {@linkplain Double} or {@code null} - * @since 1.0.0 - */ - public Double getDouble(int index) { - - return JsonSimpleUtil.getDouble(this.get(index)); - } - - /** - * Returns the same as the value's {@link Object#toString()} method. - * If the actual value is {@code null}, this method will return {@code null}. - * - * @param index index of the value - * @return a {@linkplain String} or {@code null} - * @since 1.0.0 - */ - public String getString(int index) { - - return JsonSimpleUtil.getString(this.get(index)); - } - - /** - * If the value already is a {@linkplain Date}, it will be casted and returned. - * Otherwise the result of the value's {@link Object#toString()} will be parsed by the given - * {@linkplain DateFormat}. The result is returned. - * If the actual value is {@code null}, this method will return {@code null}. - * - * @param index index of the value - * @param format the {@linkplain DateFormat} used to parse the date - * @return a {@linkplain Date} or {@code null} - * @throws ParseException if the date could not be parsed - * @since 1.0.0 - */ - public Date getDate(int index, DateFormat format) throws ParseException { - - return JsonSimpleUtil.getDate(this.get(index), format); - } - - /** - * If the {@linkplain String} representation of the value equals the name of the enum constant - * in the given enum type, it will return the enum constant. - * In any other case this method returns {@code null}. - * - * @param index index of the value - * @param type the enum type - * @param <T> the return type - * @return an {@linkplain Enum} or {@code null} - * @since 1.0.0 - */ - public <T extends Enum<T>> T getEnum(int index, Class<T> type) { - - return JsonSimpleUtil.getEnum(this.get(index), type); - } - - /** - * Converts this {@linkplain JSONArray} into an array of {@linkplain Boolean}s using the {@link #getBoolean(int)} method. - * - * @return an array {@linkplain Boolean}s - * @since 1.0.0 - */ - public Boolean[] toBooleanArray() { - - final Boolean[] array = new Boolean[this.size()]; - - for (int index = 0; index < array.length; index++) - array[index] = this.getBoolean(index); - - return array; - } - - /** - * Converts this {@linkplain JSONArray} into an array of {@linkplain Byte}s using the {@link #getByte(int)} method. - * - * @return an array of {@linkplain Byte}s - * @since 1.0.0 - */ - public Byte[] toByteArray() { - - final Byte[] array = new Byte[this.size()]; - - for (int index = 0; index < array.length; index++) - array[index] = this.getByte(index); - - return array; - } - - /** - * Converts this {@linkplain JSONArray} into an array of {@linkplain Short}s using the {@link #getShort(int)} method. - * - * @return an array of {@linkplain Short}s - * @since 1.0.0 - */ - public Short[] toShortArray() { - - final Short[] array = new Short[this.size()]; - - for (int index = 0; index < array.length; index++) - array[index] = this.getShort(index); - - return array; - } - - /** - * Converts this {@linkplain JSONArray} into an array of {@linkplain Integer}s using the {@link #getInteger(int)} method. - * - * @return an array of {@linkplain Integer}s - * @since 1.0.0 - */ - public Integer[] toIntegerArray() { - - final Integer[] array = new Integer[this.size()]; - - for (int index = 0; index < array.length; index++) - array[index] = this.getInteger(index); - - return array; - } - - /** - * Converts this {@linkplain JSONArray} into an array of {@linkplain Long}s using the {@link #getLong(int)} method. - * - * @return an array of {@linkplain Long}s - * @since 1.0.0 - */ - public Long[] toLongArray() { - - final Long[] array = new Long[this.size()]; - - for (int index = 0; index < array.length; index++) - array[index] = this.getLong(index); - - return array; - } - - /** - * Converts this {@linkplain JSONArray} into an array of {@linkplain Float}s using the {@link #getFloat(int)} method. - * - * @return an array of {@linkplain Float}s - * @since 1.0.0 - */ - public Float[] toFloatArray() { - - final Float[] array = new Float[this.size()]; - - for (int index = 0; index < array.length; index++) - array[index] = this.getFloat(index); - - return array; - } - - /** - * Converts this {@linkplain JSONArray} into an array of {@linkplain Double}s using the {@link #getDouble(int)} method. - * - * @return an array of {@linkplain Double}s - * @since 1.0.0 - */ - public Double[] toDoubleArray() { - - final Double[] array = new Double[this.size()]; - - for (int index = 0; index < array.length; index++) - array[index] = this.getDouble(index); - - return array; - } - - /** - * Converts this {@linkplain JSONArray} into an array of {@linkplain String}s using the {@link #getString(int)} method. - * - * @return an array of {@linkplain String}s - * @since 1.0.0 - */ - public String[] toStringArray() { - - final String[] array = new String[this.size()]; - - for (int index = 0; index < array.length; index++) - array[index] = this.getString(index); - - return array; - } - - /** - * Converts this {@linkplain JSONArray} into an array of {@linkplain JSONObject}s using the {@link #getObject(int)} method. - * - * @return an array of {@linkplain JSONObject}s - * @since 1.0.0 - */ - public JSONObject[] toObjectArray() { - - final JSONObject[] array = new JSONObject[this.size()]; - - for (int index = 0; index < array.length; index++) - array[index] = this.getObject(index); - - return array; - } - - /** - * Converts this {@linkplain JSONArray} into an array of {@linkplain JSONArray}s using the {@link #getArray(int)} method. - * - * @return an array of {@linkplain JSONArray}s. - * @since 1.0.0 - */ - public JSONArray[] toArrayArray() { - - final JSONArray[] array = new JSONArray[this.size()]; - - for (int index = 0; index < array.length; index++) - array[index] = this.getArray(index); - - return array; - } - - /** - * Converts this {@linkplain JSONArray} to a primitive {@code byte} array. - * - * @return a primitive {@code byte} array - * @since 2.0.0 - */ - public byte[] toPrimitiveByteArray() { - - final byte[] array = new byte[this.size()]; - - for (int index = 0; index < array.length; index++) - array[index] = this.getByte(index); - - return array; - } - - /** - * Converts this {@linkplain JSONArray} to a primitive {@code short} array. - * - * @return a primitive {@code short} array - * @since 2.0.0 - */ - public short[] toPrimitiveShortArray() { - - final short[] array = new short[this.size()]; - - for (int index = 0; index < array.length; index++) - array[index] = this.getShort(index); - - return array; - } - - /** - * Converts this {@linkplain JSONArray} to a primitive {@code int} array. - * - * @return a primitive {@code int} array - * @since 2.0.0 - */ - public int[] toPrimitiveIntArray() { - - final int[] array = new int[this.size()]; - - for (int index = 0; index < array.length; index++) - array[index] = this.getInteger(index); - - return array; - } - - /** - * Converts this {@linkplain JSONArray} to a primitive {@code long} array. - * - * @return a primitive {@code long} array - * @since 2.0.0 - */ - public long[] toPrimitiveLongArray() { - - final long[] array = new long[this.size()]; - - for (int index = 0; index < array.length; index++) - array[index] = this.getLong(index); - - return array; - } - - /** - * Converts this {@linkplain JSONArray} to a primitive {@code float} array. - * - * @return a primitive {@code float} array - * @since 2.0.0 - */ - public float[] toPrimitiveFloatArray() { - - final float[] array = new float[this.size()]; - - for (int index = 0; index < array.length; index++) - array[index] = this.getFloat(index); - - return array; - } - - /** - * Converts this {@linkplain JSONArray} to a primitive {@code double} array. - * - * @return a primitive {@code double} array - * @since 2.0.0 - */ - public double[] toPrimitiveDoubleArray() { - - final double[] array = new double[this.size()]; - - for (int index = 0; index < array.length; index++) - array[index] = this.getDouble(index); - - return array; - } - - /** - * Converts this {@linkplain JSONArray} to a primitive {@code boolean} array. - * - * @return a primitive {@code boolean} array - * @since 2.0.0 - */ - public boolean[] toPrimitiveBooleanArray() { - - final boolean[] array = new boolean[this.size()]; - - for (int index = 0; index < array.length; index++) - array[index] = this.getBoolean(index); - - return array; - } - - /** - * Converts this {@linkplain JSONArray} to a XML string. - * - * @param rootName name of the root element - * @return this JSON array as a XML string - * @since 1.1.0 - */ - public String toXML(String rootName) { - - final StringBuilder builder = new StringBuilder(); - builder.append('<'); - builder.append(rootName); - builder.append(" length="); - builder.append(this.size()); - builder.append('>'); - - for (final Object element : this) - if (element instanceof JSONObject) - builder.append(((JSONObject) element).toXML("item")); - else if (element instanceof JSONArray) - builder.append(((JSONArray) element).toXML("item")); - else { - - builder.append("<item>"); - - if (element != null) - builder.append(String.valueOf(element)); - - builder.append("</item>"); - } - - builder.append("</"); - builder.append(rootName); - builder.append('>'); - - return builder.toString(); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONContentHandler.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONContentHandler.java deleted file mode 100644 index 63cd378cc05e719cb32cdf3edd8ff8c8d49d6c10..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONContentHandler.java +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "{}" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright {yyyy} {name of copyright owner} - * - * 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 - * - * http://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. - */ -package org.mineacademy.fo.jsonsimple; - -import java.io.IOException; - -/** - * A simplified and stoppable SAX-like content handler for stream processing of JSON text. - * - * @author FangYidong(fangyidong @ yahoo.com.cn) - * @version 1.0.0 - * @see org.xml.sax.ContentHandler - * @see org.mineacademy.fo.jsonsimple.JSONParser#parse(java.io.Reader, JSONContentHandler, boolean) - * @since 1.0.0 - */ -public interface JSONContentHandler { - /** - * Receives a notification when the JSON processing begins. - * The {@linkplain JSONParser} will invoke this method only once. - * - * @throws JSONParseException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @throws IOException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @since 1.0.0 - */ - void startJSON() throws JSONParseException, IOException; - - /** - * Receives a notification when the JSON processing ends. - * - * @throws JSONParseException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @throws IOException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @since 1.0.0 - */ - void endJSON() throws JSONParseException, IOException; - - /** - * Receives a notification when a JSON object begins. - * - * @return {@code false} if the {@linkplain JSONContentHandler} wants to stop parsing after return - * @throws JSONParseException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @throws IOException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @see #endJSON - * @since 1.0.0 - */ - boolean startObject() throws JSONParseException, IOException; - - /** - * Receives a notification when a JSON object ends. - * - * @return {@code false} if the {@linkplain JSONContentHandler} wants to stop parsing after return - * @throws JSONParseException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @throws IOException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @see #startObject - * @since 1.0.0 - */ - boolean endObject() throws JSONParseException, IOException; - - /** - * Receives a notification when a JSON object entry begins. - * - * @param key name of the object entry - * @return {@code false} if the {@linkplain JSONContentHandler} wants to stop parsing after return - * @throws JSONParseException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @throws IOException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @see #endObjectEntry - * @since 1.0.0 - */ - boolean startObjectEntry(String key) throws JSONParseException, IOException; - - /** - * Receives a notification when a JSON entry ends. - * - * @return {@code false} if the {@linkplain JSONContentHandler} wants to stop parsing after return - * @throws JSONParseException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @throws IOException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @see #startObjectEntry - */ - boolean endObjectEntry() throws JSONParseException, IOException; - - /** - * Receives a notification when a JSON array begins. - * - * @return {@code false} if the {@linkplain JSONContentHandler} wants to stop parsing after return - * @throws JSONParseException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @throws IOException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @see #endArray - * @since 1.0.0 - */ - boolean startArray() throws JSONParseException, IOException; - - /** - * Receives a notification when a JSON array ends. - * - * @return {@code false} if the {@linkplain JSONContentHandler} wants to stop parsing after return - * @throws JSONParseException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @throws IOException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @see #startArray - * @since 1.0.0 - */ - boolean endArray() throws JSONParseException, IOException; - - /** - * Receives a notification when a primitive JSON value is reached: - * <ul> - * <li>{@linkplain String}</li> - * <li>{@linkplain Number}</li> - * <li>{@linkplain Boolean}</li> - * <li>{@code null}</li> - * </ul> - * - * @param value the primitive JSON value - * @return {@code false} if the {@linkplain JSONContentHandler} wants to stop parsing after return - * @throws JSONParseException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @throws IOException {@linkplain JSONParser} will stop and throw the same {@linkplain Exception} to the caller when receiving this {@linkplain Exception}. - * @since 1.0.0 - */ - boolean primitive(Object value) throws JSONParseException, IOException; -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONFormatter.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONFormatter.java deleted file mode 100644 index cf280db5a029daca638e136c7683af7dac181a2f..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONFormatter.java +++ /dev/null @@ -1,462 +0,0 @@ -/* - * Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "{}" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright {yyyy} {name of copyright owner} - * - * 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 - * - * http://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. - */ -package org.mineacademy.fo.jsonsimple; - -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.io.StringWriter; -import java.io.Writer; - -/** - * Can format and minimize JSON data. - * - * @author Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - * @version 2.0.0 - * @since 1.0.0 - */ -public class JSONFormatter { - - private static final String CRLF = "\r\n"; - private static final String LF = "\n"; - - // ==== 10.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // - Refactored some of the parameter names from "jsonReader" to "reader" - // and from "formattedWriter" and "minimizedWriter" to "writer" - // - Decided that it would be better to not make this class static. The formatting has some flags that would be better - // as class attributes. It is a pain in the ass to always give the methods 4 or more parameters. - // - Updated the documentation - // ==== - - private int indent; - private char indentCharacter; - private String lineBreak; - - /** - * Constructs a new {@linkplain JSONFormatter}. - * Default indent is {@code 1} and tabulators will be used for the indent. - * - * @since 2.0.0 - */ - public JSONFormatter() { - - this.indent = 1; - this.lineBreak = JSONFormatter.LF; - this.setUseTabs(true); - } - - private final void writeIndent(int level, Writer writer) throws IOException { - - for (int currentLevel = 0; currentLevel < level; currentLevel++) - for (int indent = 0; indent < this.indent; indent++) - writer.write(this.indentCharacter); - } - - /** - * Sets whether a CRLF or a LF line break should be used. - * - * @param crlf {@code true} = CRLF, {@code false} = LF - * @since 2.0.0 - */ - public void setUseCRLF(boolean crlf) { - - this.lineBreak = crlf ? JSONFormatter.CRLF : JSONFormatter.LF; - } - - /** - * Sets whether a tabulator or space should be used for the indent. - * - * @param tabs {@code true} = tabulator, {@code false} = space - * @since 2.0.0 - */ - public void setUseTabs(boolean tabs) { - - this.indentCharacter = tabs ? '\t' : ' '; - } - - /** - * Sets the indent. - * - * @param indent the indent - * @since 2.0.0 - */ - public void setIndent(int indent) { - - this.indent = indent; - } - - /** - * Formats minimized JSON data. Do not try to format already formatted JSON. The result does not look good. - * - * @param reader the {@linkplain Reader} with the JSON data - * @param writer the {@linkplain Writer} on which the formatted JSON data should be written - * @throws IOException if an I/O error occurs - * @since 1.0.0 - */ - public void format(Reader reader, Writer writer) throws IOException { - - int level = 0; - boolean inString = false; - int read = -1; - char lastChar = '\0'; - - while ((read = reader.read()) != -1) { - - final char character = (char) read; - - if (character == '"') - inString = !(inString && lastChar != '\\'); - - if (!inString) - if (character == '{' || character == '[') { - - writer.write(character); - writer.write(this.lineBreak); - level++; - this.writeIndent(level, writer); - continue; - - } else if (character == '}' || character == ']') { - - writer.write(this.lineBreak); - level--; - this.writeIndent(level, writer); - writer.write(character); - continue; - - } else if (character == ',') { - - writer.write(character); - writer.write(this.lineBreak); - this.writeIndent(level, writer); - continue; - - } else if (character == ':') { - - writer.write(character); - writer.write(' '); - continue; - } - - writer.write(character); - lastChar = character; - } - } - - /** - * Formats minimized JSON data. Do not try to format already formatted JSON. The result does not look good. - * - * @param json the JSON data that should be formatted - * @return the formatted JSON data - * @since 1.0.0 - */ - public String format(String json) { - - // ==== 10.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // Method now calls #format(Reader,Writer) because it is less code to maintain - // ==== - - try (StringReader reader = new StringReader(json); StringWriter writer = new StringWriter()) { - - this.format(reader, writer); - return writer.toString(); - - } catch (final IOException exception) { - - // WILL NEVER HAPPEN! - // DO NOTHING! - } - - return null; - } - - /** - * Minimizes formatted JSON data. - * - * @param reader the {@linkplain Reader} with the formatted JSON data - * @param writer the {@linkplain Writer} on which the minimized JSON data should be written - * @throws IOException if an I/O error occurs - * @since 1.0.0 - */ - public void minimize(Reader reader, Writer writer) throws IOException { - - // ==== 10.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // Forgot to remove \r from the JSON - // ==== - - boolean inString = false; - char lastChar = '\0'; - int read = -1; - - while ((read = reader.read()) != -1) { - - final char character = (char) read; - - if (character != '\n' && character != '\t' && character != '\r' && character != '\b' && character != '\0' && character != '\f') { - - if (character == '"') - inString = !(inString && lastChar != '\\'); - - if (!(character == ' ' && !inString)) - writer.write(character); - } - - lastChar = character; - } - } - - /** - * Minimizes formatted JSON data. - * - * @param json the formatted JSON data - * @return the minimized JSON data - * @since 1.0.0 - */ - public String minimize(String json) { - - // ==== 10.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // Method now calls #minimize(Reader,Writer) because it is less code to maintain - // ==== - - try (StringReader reader = new StringReader(json); StringWriter writer = new StringWriter()) { - - this.minimize(reader, writer); - return writer.toString(); - - } catch (final IOException exception) { - - // WILL NEVER HAPPEN! - // DO NOTHING! - } - - return null; - } - - /** - * @return {@code true} when CRLF line breaks are used for formatting, else {@code false} - * @since 2.0.0 - */ - public boolean usesCRLF() { - - return JSONFormatter.CRLF.equals(this.lineBreak); - } - - /** - * @return {@code true} if tabulators are used for the indent, else {@code false} - * @since 2.0.0 - */ - public boolean usesTabs() { - - return this.indentCharacter == '\t'; - } - - /** - * @return the indent - * @since 2.0.0 - */ - public int getIndent() { - - return this.indent; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONObject.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONObject.java deleted file mode 100644 index e0c00ef05cfd6422a3b16578c6f3334bd09b98c2..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONObject.java +++ /dev/null @@ -1,578 +0,0 @@ -/* - * Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "{}" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright {yyyy} {name of copyright owner} - * - * 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 - * - * http://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. - */ -package org.mineacademy.fo.jsonsimple; - -import java.io.IOException; -import java.io.Reader; -import java.io.StringWriter; -import java.io.Writer; -import java.text.DateFormat; -import java.text.ParseException; -import java.util.Collection; -import java.util.Date; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * Represents a JSON object. - * - * @author FangYidong(fangyidong @ yahoo.com.cn) - * @author Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - * @version 2.0.0 - * @since 1.0.0 - */ -public class JSONObject extends LinkedHashMap<Object, Object> { - - // ==== 11.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // - Removed the interfaces JSONAware and JSONStreamAware - // - Renamed the "writeJSONString" method to simply "write" - // ==== - - private static final long serialVersionUID = -503443796854799292L; - - /** - * Constructs an empty {@linkplain JSONObject} - * - * @since 1.0.0 - */ - public JSONObject() { - } - - /** - * Allows creation of a {@linkplain JSONObject} from a {@linkplain Map}. After that, both the - * generated {@linkplain JSONObject} and the {@linkplain Map} can be modified independently. - * - * @param map the {@linkplain Map} from which the {@linkplain JSONObject} should be created - * @since 1.0.0 - */ - public JSONObject(Map<?, ?> map) { - - super(map); - } - - /** - * Constructs a {@linkplain JSONObject} from JSON data. - * - * @param json the JSON data - * @throws JSONParseException if the JSON data is invalid - * @since 1.0.0 - */ - public JSONObject(String json) throws JSONParseException { - - super((JSONObject) new JSONParser().parse(json)); - } - - /** - * Constructs a {@linkplain JSONObject} with JSON data from a {@linkplain Reader}. - * - * @param reader the {@linkplain Reader} with the JSON data - * @throws IOException if an I/O error occurred - * @throws JSONParseException if the JSON is invalid - * @since 1.0.0 - */ - public JSONObject(Reader reader) throws IOException, JSONParseException { - - super((JSONObject) new JSONParser().parse(reader)); - } - - /** - * Writes this {@linkplain JSONObject} on a given {@linkplain Writer}. - * - * @param writer the {@linkplain Writer} - * @throws IOException if an I/O error occurred - * @since 1.0.0 - */ - public void write(Writer writer) throws IOException { - - JsonSimpleUtil.write(this, writer); - } - - /** - * @return a new {@linkplain JSONObject} without any {@code null} values - * @since 1.1.0 - */ - public JSONObject compact() { - - final JSONObject object = new JSONObject(); - - this.forEach((key, value) -> { - - if (value != null) - object.put(key, value); - }); - - return object; - } - - /** - * If the value is a {@linkplain JSONObject} already, it will be casted and returned. - * If the value is a {@linkplain Map}, it will be wrapped in a {@linkplain JSONObject}. The wrapped {@linkplain Map} will be returned. - * In any other case this method returns {@code null}. - * - * @param key key of the value - * @return a {@linkplain JSONObject} or {@code null} - * @since 1.0.0 - */ - public JSONObject getObject(String key) { - - return JsonSimpleUtil.getObject(this.get(key)); - } - - /** - * If the value already is a {@linkplain JSONArray}, it will be casted and returned. - * If the value is an array or {@linkplain Collection}, it will be wrapped in a {@linkplain JSONArray}. - * The result is returned. - * In any other case this method returns {@code null}. - * - * @param key key of the value - * @return a {@linkplain JSONArray} or {@code null} - * @since 1.0.0 - */ - public JSONArray getArray(String key) { - - return JsonSimpleUtil.getArray(this.get(key)); - } - - /** - * If the value is already a {@linkplain Boolean}, it will be casted and returned. - * If the value is a {@linkplain String}, it will be parsed. The result is returned. - * If the value is a {@linkplain Number}, this method will return {@code true} in case its {@code long} value is {@code 1}. - * In any other case this method returns {@code null}. - * - * @param key key of the value - * @return a {@linkplain Boolean} or {@code null} - * @since 1.0.0 - */ - public Boolean getBoolean(String key) { - - return JsonSimpleUtil.getBoolean(this.get(key)); - } - - /** - * If the value is a {@linkplain Number}, its {@code byte} value is returned. - * If the value is a {@linkplain String}, it will be parsed. The result is returned. - * If the value is a {@linkplain Boolean}, this method returns {@code 1} in case the value is {@code true} otherwise {@code 0}. - * In any other case this method returns {@code null}. - * - * @param key key of the value - * @return a {@linkplain Byte} or {@code null} - * @since 1.0.0 - */ - public Byte getByte(String key) { - - return JsonSimpleUtil.getByte(this.get(key)); - } - - /** - * If the value is a {@linkplain Number}, its {@code short} value is returned. - * If the value is a {@linkplain String}, it will be parsed. The result is returned. - * If the value is a {@linkplain Boolean}, this method returns {@code 1} in case the value is {@code true} otherwise {@code 0}. - * In any other case this method returns {@code null}. - * - * @param key key of the value - * @return a {@linkplain Short} or {@code null} - * @since 1.0.0 - */ - public Short getShort(String key) { - - return JsonSimpleUtil.getShort(this.get(key)); - } - - /** - * If the value is a {@linkplain Number}, its {@code int} value is returned. - * If the value is a {@linkplain String}, it will be parsed. The result is returned. - * If the value is a {@linkplain Boolean}, this method returns {@code 1} in case the value is {@code true} otherwise {@code 0}. - * In any other case this method returns {@code null}. - * - * @param key key of the value - * @return a {@linkplain Integer} or {@code null} - * @since 1.0.0 - */ - public Integer getInteger(String key) { - - return JsonSimpleUtil.getInteger(this.get(key)); - } - - /** - * If the value is a {@linkplain Number}, its {@code long} value is returned. - * If the value is a {@linkplain String}, it will be parsed. The result is returned. - * If the value is a {@linkplain Boolean}, this method returns {@code 1} in case the value is {@code true} otherwise {@code 0}. - * In any other case this method returns {@code null}. - * - * @param key key of the value - * @return a {@linkplain Long} or {@code null} - * @since 1.0.0 - */ - public Long getLong(String key) { - - return JsonSimpleUtil.getLong(this.get(key)); - } - - /** - * If the value is a {@linkplain Number}, its {@code float} value is returned. - * If the value is a {@linkplain String}, it will be parsed. The result is returned. - * If the value is a {@linkplain Boolean}, this method returns {@code 1} in case the value is {@code true} otherwise {@code 0}. - * In any other case this method returns {@code null}. - * - * @param key key of the value - * @return a {@linkplain Float} or {@code null} - * @since 1.0.0 - */ - public Float getFloat(String key) { - - return JsonSimpleUtil.getFloat(this.get(key)); - } - - /** - * If the value is a {@linkplain Number}, its {@code double} value is returned. - * If the value is a {@linkplain String}, it will be parsed. The result is returned. - * If the value is a {@linkplain Boolean}, this method returns {@code 1} in case the value is {@code true} otherwise {@code 0}. - * In any other case this method returns {@code null}. - * - * @param key key of the value - * @return a {@linkplain Double} or {@code null} - * @since 1.0.0 - */ - public Double getDouble(String key) { - - return JsonSimpleUtil.getDouble(this.get(key)); - } - - /** - * Returns the same as the value's {@link Object#toString()} method. - * If the actual value is {@code null}, this method will return {@code null}. - * - * @param key key of the value - * @return a {@linkplain String} or {@code null} - * @since 1.0.0 - */ - public String getString(String key) { - - return JsonSimpleUtil.getString(this.get(key)); - } - - /** - * If the value already is a {@linkplain Date}, it will be casted and returned. - * Otherwise the result of the value's {@link Object#toString()} will be parsed by the given - * {@linkplain DateFormat}. The result is returned. - * If the actual value is {@code null}, this method will return {@code null}. - * - * @param key key of the value - * @param format the {@linkplain DateFormat} to parse the date with - * @return a {@linkplain Date} or {@code null} - * @throws ParseException if the date could not be parsed - * @since 1.0.0 - */ - public Date getDate(String key, DateFormat format) throws ParseException { - - return JsonSimpleUtil.getDate(this.get(key), format); - } - - /** - * If the {@linkplain String} representation of the value equals the name of the enum constant - * in the given enum type, it will return the enum constant. - * In any other case this method returns {@code null}. - * - * @param key key of the value - * @param type the enum type - * @param <T> the generic return type - * @return an {@linkplain Enum} or {@code null} - * @since 1.0.0 - */ - public <T extends Enum<T>> T getEnum(String key, Class<T> type) { - - return JsonSimpleUtil.getEnum(this.get(key), type); - } - - /** - * @return a {@linkplain String} representation of this {@linkplain JSONObject}. - * @since 1.0.0 - */ - @Override - public String toString() { - - try (StringWriter writer = new StringWriter()) { - - JsonSimpleUtil.write(this, writer); - return writer.toString(); - - } catch (final IOException exception) { - - // WILL NEVER HAPPEN! - // DO NOTHING! - } - - return null; - } - - @Override - public boolean equals(Object object) { - - // ==== 17.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // - Fixed some weird behavior - // ==== - - if (object != null && object instanceof Map) { - - final Map<?, ?> map = (Map<?, ?>) object; - - if (this.size() == map.size()) { - - for (final Map.Entry<Object, Object> thisEntry : this.entrySet()) { - - final Object key = thisEntry.getKey(); - final Object value = thisEntry.getValue(); - - if (!map.containsKey(key) || !value.equals(map.get(key))) - return false; - } - - return true; - } - } - - return false; - } - - /** - * @param rootName the name of the root element - * @return this JSON Object in XML - * @since 1.1.0 - */ - public String toXML(String rootName) { - - final StringBuilder builder = new StringBuilder(); - - builder.append('<'); - builder.append(rootName); - builder.append('>'); - - this.forEach((key, value) -> { - - if (value instanceof JSONObject) - builder.append(((JSONObject) value).toXML(key.toString())); - else if (value instanceof JSONArray) - builder.append(((JSONArray) value).toXML(key.toString())); - else { - - builder.append('<'); - builder.append(key); - builder.append('>'); - - if (value != null) - builder.append(String.valueOf(value)); - - builder.append("</"); - builder.append(key); - builder.append('>'); - } - }); - - builder.append("</"); - builder.append(rootName); - builder.append('>'); - - return builder.toString(); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONParseException.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONParseException.java deleted file mode 100644 index 7fce14dcb747292e78b7dcb2b24c934fcd56ca03..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONParseException.java +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "{}" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright {yyyy} {name of copyright owner} - * - * 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 - * - * http://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. - */ -package org.mineacademy.fo.jsonsimple; - -/** - * Is thrown when an error occurs while parsing JSON data. - * Explains what the problem is. - * - * @author FangYidong(fangyidong @ yahoo.com.cn) - * @author Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - * @version 2.0.0 - * @since 1.0.0 - */ -public class JSONParseException extends Exception { - - // ==== 11.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // - Updated the documentation - // ==== - - private static final long serialVersionUID = -7880698968187728547L; - - /** - * @since 1.0.0 - */ - public static final int ERROR_UNEXPECTED_CHAR = 0; - /** - * @since 1.0.0 - */ - public static final int ERROR_UNEXPECTED_TOKEN = 1; - /** - * @since 1.0.0 - */ - public static final int ERROR_UNEXPECTED_EXCEPTION = 2; - - private final int errorType; - private final Object unexpectedObject; - private final int position; - - /** - * @param errorType the error type - * @since 1.0.0 - */ - public JSONParseException(int errorType) { - - this(-1, errorType, null); - } - - /** - * @param errorType the error type - * @param unexpectedObject the object that represents what was unexpected - * @since 1.0.0 - */ - public JSONParseException(int errorType, Object unexpectedObject) { - - this(-1, errorType, unexpectedObject); - } - - /** - * @param position the character position (starting with 0) of the input where the error occurred - * @param errorType the error type - * @param unexpectedObject the object that represents what was unexpected - * @since 1.0.0 - */ - public JSONParseException(int position, int errorType, Object unexpectedObject) { - - this.position = position; - this.errorType = errorType; - this.unexpectedObject = unexpectedObject; - } - - /** - * @return the error type - * @since 1.0.0 - */ - public int getErrorType() { - - return errorType; - } - - /** - * @return the character position (starting with 0) of the input where the error occurred - * @since 1.0.0 - */ - public int getPosition() { - - return this.position; - } - - /** - * @return one of the following base on the value of errorType: - * <table border=1> - * <tr> - * <th>error type</th> - * <th>object type</th> - * </tr> - * <tr> - * <td>{@link #ERROR_UNEXPECTED_CHAR}</td> - * <td>{@linkplain Character}</td> - * </tr> - * <tr> - * <td>{@link #ERROR_UNEXPECTED_TOKEN}</td> - * <td>{@linkplain Yytoken}</td> - * </tr> - * <tr> - * <td>{@link #ERROR_UNEXPECTED_EXCEPTION}</td> - * <td>{@linkplain Exception}</td> - * </tr> - * </table> - * @since 1.0.0 - */ - public Object getUnexpectedObject() { - - return this.unexpectedObject; - } - - @Override - public String getMessage() { - - final StringBuilder builder = new StringBuilder(); - - switch (this.errorType) { - - case ERROR_UNEXPECTED_CHAR: - builder.append("Unexpected character (").append(this.unexpectedObject).append(") at position ").append(this.position).append("."); - break; - - case ERROR_UNEXPECTED_TOKEN: - builder.append("Unexpected token ").append(this.unexpectedObject).append(" at position ").append(this.position).append("."); - break; - - case ERROR_UNEXPECTED_EXCEPTION: - builder.append("Unexpected exception at position ").append(this.position).append(": ").append(this.unexpectedObject); - break; - - default: - builder.append("Unkown error at position ").append(this.position).append("."); - break; - } - - return builder.toString(); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONParser.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONParser.java deleted file mode 100644 index 534a3786af7d3170d6ef17ed4ca54bca5ed50d62..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONParser.java +++ /dev/null @@ -1,764 +0,0 @@ -/* - * Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "{}" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright {yyyy} {name of copyright owner} - * - * 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 - * - * http://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. - */ -package org.mineacademy.fo.jsonsimple; - -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; -import java.util.List; -import java.util.Map; -import java.util.Stack; - -import org.mineacademy.fo.exception.FoException; - -import lombok.Getter; - -/** - * Parses JSON data (<u>not</u> thread-safe). - * - * @author FangYidong(fangyidong @ yahoo.com.cn) - * @author Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - * @version 2.0.0 - * @since 1.0.0 - */ -public class JSONParser { - - // ==== 11.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // - Removed the ContainerFactory - // - Updated the documentation - // ==== - - @Getter - private static final JSONParser instance = new JSONParser(); - - private static final int S_INIT = 0; - private static final int S_IN_FINISHED_VALUE = 1; - private static final int S_IN_OBJECT = 2; - private static final int S_IN_ARRAY = 3; - private static final int S_PASSED_PAIR_KEY = 4; - private static final int S_IN_PAIR_VALUE = 5; - private static final int S_END = 6; - private static final int S_IN_ERROR = -1; - - private Stack<Object> handlerStatusStack; - private final Yylex lexer = new Yylex((Reader) null); - private Yytoken token; - private int status = JSONParser.S_INIT; - - private final void nextToken() throws JSONParseException, IOException { - - this.token = this.lexer.yylex(); - - if (this.token == null) - this.token = new Yytoken(Yytoken.TYPE_EOF, null); - } - - private final void init(Stack<Object> statusStack, Stack<Object> valueStack) { - - if (this.token.type == Yytoken.TYPE_VALUE) { - - this.status = JSONParser.S_IN_FINISHED_VALUE; - statusStack.push(this.status); - valueStack.push(this.token.value); - - } else if (this.token.type == Yytoken.TYPE_LEFT_BRACE) { - - this.status = JSONParser.S_IN_OBJECT; - statusStack.push(this.status); - valueStack.push(new JSONObject()); - - } else if (this.token.type == Yytoken.TYPE_LEFT_SQUARE) { - - this.status = JSONParser.S_IN_ARRAY; - statusStack.push(this.status); - valueStack.push(new JSONArray()); - - } else - this.status = JSONParser.S_IN_ERROR; - } - - private final Object inFinishedValue(Stack<Object> valueStack) throws JSONParseException { - - if (this.token.type == Yytoken.TYPE_EOF) - return valueStack.pop(); - else - throw new JSONParseException(this.getPosition(), JSONParseException.ERROR_UNEXPECTED_TOKEN, this.token); - } - - private final void inObject(Stack<Object> statusStack, Stack<Object> valueStack) { - - if (this.token.type == Yytoken.TYPE_VALUE) { - - if (this.token.value instanceof String) { - - final String key = (String) this.token.value; - valueStack.push(key); - this.status = JSONParser.S_PASSED_PAIR_KEY; - statusStack.push(this.status); - - } else - this.status = S_IN_ERROR; - - } else if (this.token.type == Yytoken.TYPE_RIGHT_BRACE) { - - if (valueStack.size() > 1) { - - statusStack.pop(); - valueStack.pop(); - this.status = (int) statusStack.peek(); - - } else - this.status = JSONParser.S_IN_FINISHED_VALUE; - - } else if (this.token.type != Yytoken.TYPE_COMMA) - this.status = JSONParser.S_IN_ERROR; - } - - private final void inPassedPairKey(Stack<Object> statusStack, Stack<Object> valueStack) { - - if (this.token.type == Yytoken.TYPE_VALUE) { - - statusStack.pop(); - final String key = (String) valueStack.pop(); - final Map<Object, Object> parent = (Map<Object, Object>) valueStack.peek(); - parent.put(key, this.token.value); - this.status = (int) statusStack.peek(); - - } else if (this.token.type == Yytoken.TYPE_LEFT_SQUARE) { - - statusStack.pop(); - final String key = (String) valueStack.pop(); - final Map<Object, Object> parent = (Map<Object, Object>) valueStack.peek(); - final List<Object> newArray = new JSONArray(); - parent.put(key, newArray); - this.status = JSONParser.S_IN_ARRAY; - statusStack.push(this.status); - valueStack.push(newArray); - - } else if (this.token.type == Yytoken.TYPE_LEFT_BRACE) { - - statusStack.pop(); - final String key = (String) valueStack.pop(); - final Map<Object, Object> parent = (Map<Object, Object>) valueStack.peek(); - final Map<Object, Object> newObject = new JSONObject(); - parent.put(key, newObject); - this.status = JSONParser.S_IN_OBJECT; - statusStack.push(this.status); - valueStack.push(newObject); - - } else if (this.token.type != Yytoken.TYPE_COLON) - this.status = JSONParser.S_IN_ERROR; - } - - private final void inArray(Stack<Object> statusStack, Stack<Object> valueStack) { - - if (this.token.type == Yytoken.TYPE_VALUE) { - - final List<Object> val = (List<Object>) valueStack.peek(); - val.add(this.token.value); - - } else if (this.token.type == Yytoken.TYPE_RIGHT_SQUARE) { - - if (valueStack.size() > 1) { - - statusStack.pop(); - valueStack.pop(); - this.status = (int) statusStack.peek(); - - } else - this.status = JSONParser.S_IN_FINISHED_VALUE; - - } else if (this.token.type == Yytoken.TYPE_LEFT_BRACE) { - - final List<Object> val = (List<Object>) valueStack.peek(); - final Map<Object, Object> newObject = new JSONObject(); - val.add(newObject); - this.status = JSONParser.S_IN_OBJECT; - statusStack.push(this.status); - valueStack.push(newObject); - - } else if (this.token.type == Yytoken.TYPE_LEFT_SQUARE) { - - final List<Object> val = (List<Object>) valueStack.peek(); - final List<Object> newArray = new JSONArray(); - val.add(newArray); - this.status = JSONParser.S_IN_ARRAY; - statusStack.push(this.status); - valueStack.push(newArray); - - } else if (this.token.type != Yytoken.TYPE_COMMA) - this.status = JSONParser.S_IN_ERROR; - } - - /** - * Resets the parser to the initial state without resetting the underlying reader. - * - * @since 1.0.0 - */ - public void reset() { - - this.token = null; - this.status = JSONParser.S_INIT; - this.handlerStatusStack = null; - } - - /** - * Resets the parser to the initial state with a new character reader. - * - * @param reader the new character reader - * @since 1.0.0 - */ - public void reset(Reader reader) { - - this.lexer.yyreset(reader); - this.reset(); - } - - /** - * @return the position where the current token begins - * @since 1.0.0 - */ - public int getPosition() { - - return this.lexer.getPosition(); - } - - /** - * Parses JSON data. - * - * @param json the JSON data - * @return An instance of: - * <ul> - * <li>{@linkplain JSONObject}</li> - * <li>{@linkplain JSONArray}</li> - * <li>{@linkplain String}</li> - * <li>{@linkplain Number}</li> - * <li>{@linkplain Boolean}</li> - * <li>{@code null}</li> - * </ul> - * @throws JSONParseException if the JSON is invalid - * @since 1.0.0 - */ - public Object parse(String json) throws JSONParseException { - - try (StringReader reader = new StringReader(json)) { - - return this.parse(reader); - - } catch (final IOException exception) { - - // WILL NEVER HAPPEN! - throw new FoException(exception); - } - } - - /** - * Parses JSON data from a {@linkplain Reader}. - * - * @param reader the {@linkplain Reader} - * @return An instance of: - * <ul> - * <li>{@linkplain JSONObject}</li> - * <li>{@linkplain JSONArray}</li> - * <li>{@linkplain String}</li> - * <li>{@linkplain Number}</li> - * <li>{@linkplain Boolean}</li> - * <li>{@code null}</li> - * </ul> - * @throws IOException if an I/O error occurs - * @throws JSONParseException if the JSON is invalid - * @since 1.0.0 - */ - public Object parse(Reader reader) throws IOException, JSONParseException { - - // ==== 11.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // - Removed the unnecessary try-catch block - // ==== - - this.reset(reader); - final Stack<Object> statusStack = new Stack<>(); - final Stack<Object> valueStack = new Stack<>(); - - do { - - this.nextToken(); - - if (this.status == JSONParser.S_INIT) - this.init(statusStack, valueStack); - else if (this.status == JSONParser.S_IN_FINISHED_VALUE) - return this.inFinishedValue(valueStack); - else if (this.status == JSONParser.S_IN_OBJECT) - this.inObject(statusStack, valueStack); - else if (this.status == JSONParser.S_PASSED_PAIR_KEY) - this.inPassedPairKey(statusStack, valueStack); - else if (this.status == JSONParser.S_IN_ARRAY) - this.inArray(statusStack, valueStack); - - if (this.status == JSONParser.S_IN_ERROR) - throw new JSONParseException(getPosition(), JSONParseException.ERROR_UNEXPECTED_TOKEN, token); - - } while (this.token.type != Yytoken.TYPE_EOF); - - throw new JSONParseException(this.getPosition(), JSONParseException.ERROR_UNEXPECTED_TOKEN, this.token); - } - - /** - * Goes over a JSON string step by step using a {@linkplain JSONContentHandler}. - * - * @param string the JSON string - * @param contentHandler the {@linkplain JSONContentHandler} - * @throws JSONParseException if the JSON is invalid or the {@linkplain JSONContentHandler} throws it - * @since 1.0.0 - */ - public void parse(String string, JSONContentHandler contentHandler) throws JSONParseException { - - this.parse(string != null ? string.trim() : null, contentHandler, false); - } - - /** - * Goes over a JSON string step by step using a {@linkplain JSONContentHandler}. - * - * @param string the JSON string - * @param contentHandler the {@linkplain JSONContentHandler} - * @param resume Indicates if the previous parsing operation should be continued. - * @throws JSONParseException if the JSON is invalid or the {@linkplain JSONContentHandler} throws it - * @since 1.0.0 - */ - public void parse(String string, JSONContentHandler contentHandler, boolean resume) throws JSONParseException { - - try (StringReader reader = new StringReader(string != null ? string.trim() : null)) { - - this.parse(reader, contentHandler, resume); - - } catch (final IOException exception) { - - throw new JSONParseException(-1, JSONParseException.ERROR_UNEXPECTED_EXCEPTION, exception); - } - } - - /** - * Goes over JSON data step by step using a {@linkplain JSONContentHandler}. - * - * @param reader the {@linkplain Reader} - * @param contentHandler the {@linkplain JSONContentHandler} - * @throws IOException if an I/O error occurs or the {@linkplain JSONContentHandler} throws it - * @throws JSONParseException if the JSON is invalid or the {@linkplain JSONContentHandler} throws it - * @since 1.0.0 - */ - public void parse(Reader reader, JSONContentHandler contentHandler) throws IOException, JSONParseException { - - this.parse(reader, contentHandler, false); - } - - /** - * Goes over JSON data step by step using a {@linkplain JSONContentHandler}. - * - * @param reader the {@linkplain Reader} - * @param contentHandler the {@linkplain JSONContentHandler} - * @param resume Indicates if the previous parsing operation should be continued. - * @throws IOException if an I/O error occurs or the {@linkplain JSONContentHandler} throws it - * @throws JSONParseException if the JSON is invalid or the {@linkplain JSONContentHandler} throws it - * @see JSONContentHandler - * @since 1.0.0 - */ - public void parse(Reader reader, JSONContentHandler contentHandler, boolean resume) throws IOException, JSONParseException { - - if (!resume) { - - this.reset(reader); - this.handlerStatusStack = new Stack<>(); - - } else if (this.handlerStatusStack == null) { - - this.reset(reader); - this.handlerStatusStack = new Stack<>(); - } - - final Stack<Object> statusStack = this.handlerStatusStack; - - try { - - do { - - if (this.status == JSONParser.S_INIT) { - - contentHandler.startJSON(); - this.nextToken(); - - if (this.token.type == Yytoken.TYPE_VALUE) { - - this.status = JSONParser.S_IN_FINISHED_VALUE; - statusStack.push(this.status); - - if (!contentHandler.primitive(this.token.value)) - return; - - } else if (this.token.type == Yytoken.TYPE_LEFT_BRACE) { - - this.status = JSONParser.S_IN_OBJECT; - statusStack.push(this.status); - - if (!contentHandler.startObject()) - return; - - } else if (this.token.type == Yytoken.TYPE_LEFT_SQUARE) { - - this.status = JSONParser.S_IN_ARRAY; - statusStack.push(this.status); - - if (!contentHandler.startArray()) - return; - - } else - this.status = JSONParser.S_IN_ERROR; - - } else if (this.status == JSONParser.S_IN_FINISHED_VALUE) { - - this.nextToken(); - - if (this.token.type == Yytoken.TYPE_EOF) { - - contentHandler.endJSON(); - status = JSONParser.S_END; - return; - - } else - this.status = JSONParser.S_IN_ERROR; - - } else if (this.status == JSONParser.S_IN_OBJECT) { - - this.nextToken(); - - if (this.token.type == Yytoken.TYPE_VALUE) { - - if (this.token.value instanceof String) { - - final String key = (String) this.token.value; - this.status = JSONParser.S_PASSED_PAIR_KEY; - statusStack.push(this.status); - - if (!contentHandler.startObjectEntry(key)) - return; - - } else - this.status = JSONParser.S_IN_ERROR; - - } else if (this.token.type == Yytoken.TYPE_RIGHT_BRACE) { - - if (statusStack.size() > 1) { - - statusStack.pop(); - this.status = (int) statusStack.peek(); - - } else - this.status = JSONParser.S_IN_FINISHED_VALUE; - - if (!contentHandler.endObject()) - return; - - } else if (this.token.type != Yytoken.TYPE_COMMA) - this.status = JSONParser.S_IN_ERROR; - - } else if (this.status == JSONParser.S_PASSED_PAIR_KEY) { - - this.nextToken(); - - if (this.token.type == Yytoken.TYPE_VALUE) { - - statusStack.pop(); - this.status = (int) statusStack.peek(); - - if (!contentHandler.primitive(this.token.value) || !contentHandler.endObjectEntry()) - return; - - } else if (this.token.type == Yytoken.TYPE_LEFT_SQUARE) { - - statusStack.pop(); - statusStack.push(JSONParser.S_IN_PAIR_VALUE); - this.status = JSONParser.S_IN_ARRAY; - statusStack.push(this.status); - - if (!contentHandler.startArray()) - return; - - } else if (this.token.type == Yytoken.TYPE_LEFT_BRACE) { - - statusStack.pop(); - statusStack.push(JSONParser.S_IN_PAIR_VALUE); - this.status = JSONParser.S_IN_OBJECT; - statusStack.push(this.status); - - if (!contentHandler.startObject()) - return; - - } else if (this.token.type != Yytoken.TYPE_COLON) - this.status = JSONParser.S_IN_ERROR; - - } else if (this.status == JSONParser.S_IN_PAIR_VALUE) { - - statusStack.pop(); - this.status = (int) statusStack.peek(); - - if (!contentHandler.endObjectEntry()) - return; - - } else if (this.status == JSONParser.S_IN_ARRAY) { - - this.nextToken(); - - if (this.token.type == Yytoken.TYPE_VALUE) { - - if (!contentHandler.primitive(this.token.value)) - return; - - } else if (this.token.type == Yytoken.TYPE_RIGHT_SQUARE) { - - if (statusStack.size() > 1) { - - statusStack.pop(); - this.status = (int) statusStack.peek(); - - } else - this.status = JSONParser.S_IN_FINISHED_VALUE; - - if (!contentHandler.endArray()) - return; - - } else if (this.token.type == Yytoken.TYPE_LEFT_BRACE) { - - this.status = JSONParser.S_IN_OBJECT; - statusStack.push(this.status); - - if (!contentHandler.startObject()) - return; - - } else if (this.token.type == Yytoken.TYPE_LEFT_SQUARE) { - - this.status = JSONParser.S_IN_ARRAY; - statusStack.push(this.status); - - if (!contentHandler.startArray()) - return; - - } else if (this.token.type != Yytoken.TYPE_COMMA) - this.status = JSONParser.S_IN_ERROR; - - } else if (this.status == JSONParser.S_END) - return; - - if (this.status == JSONParser.S_IN_ERROR) - throw new JSONParseException(this.getPosition(), JSONParseException.ERROR_UNEXPECTED_TOKEN, this.token); - - } while (this.token.type != Yytoken.TYPE_EOF); - - } catch (IOException | JSONParseException | RuntimeException | Error exception) { - - this.status = JSONParser.S_IN_ERROR; - throw exception; - } - - this.status = JSONParser.S_IN_ERROR; - throw new JSONParseException(this.getPosition(), JSONParseException.ERROR_UNEXPECTED_TOKEN, this.token); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONSerializer.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONSerializer.java deleted file mode 100644 index 0e41cf35ccc7c7c72893845d10e1b7fdb1efb01d..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONSerializer.java +++ /dev/null @@ -1,781 +0,0 @@ -/* - * Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "{}" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright {yyyy} {name of copyright owner} - * - * 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 - * - * http://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. - */ -package org.mineacademy.fo.jsonsimple; - -import java.lang.reflect.Array; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.Collection; -import java.util.Iterator; -import java.util.Map; - -import org.mineacademy.fo.jsonsimple.annotation.JSONAttribute; -import org.mineacademy.fo.jsonsimple.annotation.JSONRoot; - -/** - * Provides static methods which allow you to convert Java objects into {@linkplain JSONObject}s - * and the other way around. - * - * @author Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - * @version 2.0.0 - * @since 1.0.0 - */ -public final class JSONSerializer { - - private JSONSerializer() { - } - - /** - * Transfers the data of {@linkplain JSONObject} into a Java object. - * - * @param json the JSON object containing the data - * @param object the body of the Java object that should be filled - * @throws Exception if an error occurs - * @since 1.0.0 - */ - public static void deserialize(JSONObject json, Object object) throws Exception { - - final Class<?> clazz = object.getClass(); - final Field[] fields = clazz.getFields(); - final Method[] methods = clazz.getMethods(); - - for (final Field field : fields) { - - final JSONAttribute annotation = field.getAnnotation(JSONAttribute.class); - - if (!Modifier.isTransient(field.getModifiers()) && annotation != null && JSONSerializer.contains(JSONAttribute.Type.SETTER, annotation)) { - - final Class<?> targetType = field.getType(); - final Object value = json.get(annotation.name()); - - if (value != null) - if (float.class.isAssignableFrom(targetType) || Float.class.isAssignableFrom(targetType)) - field.set(object, ((Number) value).floatValue()); - else if (double.class.isAssignableFrom(targetType) || Double.class.isAssignableFrom(targetType)) - field.set(object, ((Number) value).doubleValue()); - else if (byte.class.isAssignableFrom(targetType) || Byte.class.isAssignableFrom(targetType)) - field.set(object, ((Number) value).byteValue()); - else if (short.class.isAssignableFrom(targetType) || Short.class.isAssignableFrom(targetType)) - field.set(object, ((Number) value).shortValue()); - else if (int.class.isAssignableFrom(targetType) || Integer.class.isAssignableFrom(targetType)) - field.set(object, ((Number) value).intValue()); - else if (long.class.isAssignableFrom(targetType) || Long.class.isAssignableFrom(targetType)) - field.set(object, ((Number) value).longValue()); - else if (String.class.isAssignableFrom(targetType) || Number.class.isAssignableFrom(targetType) || Boolean.class.isAssignableFrom(targetType) || boolean.class.isAssignableFrom(targetType)) - field.set(object, value); - else if (Enum.class.isAssignableFrom(targetType)) { - - for (final Object constant : targetType.getEnumConstants()) - if (((Enum<?>) constant).name().equals(value.toString())) { - - field.set(object, constant); - break; - } - - } else if (targetType.getAnnotation(JSONRoot.class) != null) { - - final Object newObject = targetType.getDeclaredConstructor().newInstance(); - JSONSerializer.deserialize((JSONObject) value, newObject); - field.set(object, newObject); - - } else if (Map.class.isAssignableFrom(targetType)) { - - final Map<Object, Object> map = (Map<Object, Object>) targetType.getDeclaredConstructor().newInstance(); - JSONSerializer.deserialize(clazz, object, map, (JSONObject) value); - field.set(object, map); - - } else if (Collection.class.isAssignableFrom(targetType)) { - - final Collection<Object> collection = (Collection<Object>) targetType.getDeclaredConstructor().newInstance(); - JSONSerializer.deserialize(clazz, object, collection, (JSONArray) value); - field.set(object, collection); - - } else if (targetType.isArray()) { - - final Object newArray = Array.newInstance(targetType.getComponentType(), ((JSONArray) value).size()); - JSONSerializer.deserialize(clazz, object, newArray, (JSONArray) value); - field.set(object, newArray); - - } else if (JSONTypeSerializationHandler.class.isAssignableFrom(clazz)) - field.set(object, ((JSONTypeSerializationHandler) object).deserialize(targetType, value)); - } - } - - for (final Method method : methods) { - - final JSONAttribute annotation = method.getAnnotation(JSONAttribute.class); - - if (!Modifier.isTransient(method.getModifiers()) && annotation != null && JSONSerializer.contains(JSONAttribute.Type.SETTER, annotation)) { - - final Class<?> targetType = method.getParameterTypes()[0]; - - if (targetType.isInterface()) - throw new Exception("Cannot deserialize an interface! Method: " + method.getName() + ", Interface: " + targetType.getName()); - - final Object value = json.get(annotation.name()); - - if (value != null) - if (float.class.isAssignableFrom(targetType) || Float.class.isAssignableFrom(targetType)) - method.invoke(object, ((Number) value).floatValue()); - else if (double.class.isAssignableFrom(targetType) || Double.class.isAssignableFrom(targetType)) - method.invoke(object, ((Number) value).doubleValue()); - else if (byte.class.isAssignableFrom(targetType) || Byte.class.isAssignableFrom(targetType)) - method.invoke(object, ((Number) value).byteValue()); - else if (short.class.isAssignableFrom(targetType) || Short.class.isAssignableFrom(targetType)) - method.invoke(object, ((Number) value).shortValue()); - else if (int.class.isAssignableFrom(targetType) || Integer.class.isAssignableFrom(targetType)) - method.invoke(object, ((Number) value).intValue()); - else if (long.class.isAssignableFrom(targetType) || Long.class.isAssignableFrom(targetType)) - method.invoke(object, ((Number) value).longValue()); - else if (String.class.isAssignableFrom(targetType) || Number.class.isAssignableFrom(targetType) || Boolean.class.isAssignableFrom(targetType) || boolean.class.isAssignableFrom(targetType)) - method.invoke(object, value); - else if (Enum.class.isAssignableFrom(targetType)) { - - for (final Object constant : targetType.getEnumConstants()) - if (((Enum<?>) constant).name().equals(value.toString())) { - - method.invoke(object, constant); - break; - } - - } else if (targetType.getAnnotation(JSONRoot.class) != null) { - - final Object newObject = targetType.getDeclaredConstructor().newInstance(); - JSONSerializer.deserialize((JSONObject) value, newObject); - method.invoke(object, newObject); - - } else if (Map.class.isAssignableFrom(targetType)) { - - final Map<Object, Object> map = (Map<Object, Object>) targetType.getDeclaredConstructor().newInstance(); - JSONSerializer.deserialize(clazz, object, map, (JSONObject) value); - method.invoke(object, map); - - } else if (Collection.class.isAssignableFrom(targetType)) { - - final Collection<Object> collection = (Collection<Object>) targetType.getDeclaredConstructor().newInstance(); - JSONSerializer.deserialize(clazz, object, collection, (JSONArray) value); - method.invoke(object, collection); - - } else if (targetType.isArray()) { - - final Object newArray = Array.newInstance(targetType.getComponentType(), ((JSONArray) value).size()); - JSONSerializer.deserialize(clazz, object, newArray, (JSONArray) value); - method.invoke(object, newArray); - - } else if (JSONTypeSerializationHandler.class.isAssignableFrom(clazz)) - method.invoke(object, ((JSONTypeSerializationHandler) object).deserialize(targetType, value)); - } - } - } - - private static void deserialize(Class<?> clazz, Object classObject, Collection<Object> collection, JSONArray json) throws Exception { - - for (final Object value : json) - if (value != null) { - - final Class<?> type = value.getClass(); - - if (type.isInterface()) - throw new Exception("Cannot deserialize an interface! Interface: " + type.getName()); - - if (float.class.isAssignableFrom(type) || Float.class.isAssignableFrom(type)) - collection.add(((Number) value).floatValue()); - else if (double.class.isAssignableFrom(type) || Double.class.isAssignableFrom(type)) - collection.add(((Number) value).doubleValue()); - else if (byte.class.isAssignableFrom(type) || Byte.class.isAssignableFrom(type)) - collection.add(((Number) value).byteValue()); - else if (short.class.isAssignableFrom(type) || Short.class.isAssignableFrom(type)) - collection.add(((Number) value).shortValue()); - else if (int.class.isAssignableFrom(type) || Integer.class.isAssignableFrom(type)) - collection.add(((Number) value).intValue()); - else if (long.class.isAssignableFrom(type) || Long.class.isAssignableFrom(type)) - collection.add(((Number) value).longValue()); - else if (String.class.isAssignableFrom(type) || Number.class.isAssignableFrom(type) || Boolean.class.isAssignableFrom(type) || boolean.class.isAssignableFrom(type)) - collection.add(value); - else if (Enum.class.isAssignableFrom(type)) { - - for (final Object constant : type.getEnumConstants()) - if (((Enum<?>) constant).name().equals(value.toString())) { - - collection.add(constant); - break; - } - - } else if (type.getAnnotation(JSONRoot.class) != null) { - - final Object newObject = type.getDeclaredConstructor().newInstance(); - JSONSerializer.deserialize((JSONObject) value, newObject); - collection.add(newObject); - - } else if (Map.class.isAssignableFrom(type)) { - - final Map<Object, Object> newMap = (Map<Object, Object>) type.getDeclaredConstructor().newInstance(); - JSONSerializer.deserialize(clazz, classObject, newMap, (JSONObject) value); - collection.add(newMap); - - } else if (Collection.class.isAssignableFrom(type)) { - - final Collection<Object> newCollection = (Collection<Object>) type.getDeclaredConstructor().newInstance(); - JSONSerializer.deserialize(clazz, classObject, newCollection, (JSONArray) value); - collection.add(newCollection); - - } else if (type.isArray()) { - - final Object newArray = Array.newInstance(type.getComponentType(), ((JSONArray) value).size()); - JSONSerializer.deserialize(clazz, classObject, newArray, (JSONArray) value); - collection.add(newArray); - - } else if (JSONTypeSerializationHandler.class.isAssignableFrom(clazz)) - collection.add(((JSONTypeSerializationHandler) classObject).deserialize(type, value)); - - } else - collection.add(value); - } - - private static void deserialize(Class<?> clazz, Object classObject, Map<Object, Object> map, JSONObject json) throws Exception { - - for (final Object jsonEntry : json.entrySet()) { - - final Map.Entry<?, ?> entry = (Map.Entry<?, ?>) jsonEntry; - final Object value = entry.getValue(); - - if (value != null) { - - final Class<?> type = value.getClass(); - - if (type.isInterface()) - throw new Exception("Cannot deserialize an interface! Interface: " + type.getName()); - - if (float.class.isAssignableFrom(type) || Float.class.isAssignableFrom(type)) - map.put(entry.getKey(), ((Number) value).floatValue()); - else if (double.class.isAssignableFrom(type) || Double.class.isAssignableFrom(type)) - map.put(entry.getKey(), ((Number) value).doubleValue()); - else if (byte.class.isAssignableFrom(type) || Byte.class.isAssignableFrom(type)) - map.put(entry.getKey(), ((Number) value).byteValue()); - else if (short.class.isAssignableFrom(type) || Short.class.isAssignableFrom(type)) - map.put(entry.getKey(), ((Number) value).shortValue()); - else if (int.class.isAssignableFrom(type) || Integer.class.isAssignableFrom(type)) - map.put(entry.getKey(), ((Number) value).intValue()); - else if (long.class.isAssignableFrom(type) || Long.class.isAssignableFrom(type)) - map.put(entry.getKey(), ((Number) value).longValue()); - else if (String.class.isAssignableFrom(type) || Number.class.isAssignableFrom(type) || Boolean.class.isAssignableFrom(type) || boolean.class.isAssignableFrom(type)) - map.put(entry.getKey(), value); - else if (Enum.class.isAssignableFrom(type)) { - - for (final Object constant : type.getEnumConstants()) - if (((Enum<?>) constant).name().equals(value.toString())) { - - map.put(entry.getKey(), constant); - break; - } - - } else if (type.getAnnotation(JSONRoot.class) != null) { - - final Object newObject = type.getDeclaredConstructor().newInstance(); - JSONSerializer.deserialize((JSONObject) value, newObject); - map.put(entry.getKey(), newObject); - - } else if (Map.class.isAssignableFrom(type)) { - - final Map<Object, Object> newMap = (Map<Object, Object>) type.getDeclaredConstructor().newInstance(); - JSONSerializer.deserialize(clazz, classObject, newMap, (JSONObject) value); - map.put(entry.getKey(), newMap); - - } else if (Collection.class.isAssignableFrom(type)) { - - final Collection<Object> collection = (Collection<Object>) type.getDeclaredConstructor().newInstance(); - JSONSerializer.deserialize(clazz, classObject, collection, (JSONArray) value); - map.put(entry.getKey(), collection); - - } else if (type.isArray()) { - - final Object newArray = Array.newInstance(type.getComponentType(), ((JSONArray) value).size()); - JSONSerializer.deserialize(clazz, classObject, newArray, (JSONArray) value); - map.put(entry.getKey(), newArray); - - } else if (JSONTypeSerializationHandler.class.isAssignableFrom(clazz)) - map.put(entry.getKey(), ((JSONTypeSerializationHandler) classObject).deserialize(type, value)); - - } else - map.put(entry.getKey(), value); - } - } - - private static void deserialize(Class<?> clazz, Object classObject, Object targetObject, JSONArray json) throws Exception { - - final Class<?> type = targetObject.getClass().getComponentType(); - - if (type.isInterface()) - throw new Exception("Cannot deserialize an interface! Interface: " + type.getName()); - - for (int index = 0; index < json.size(); index++) { - - final Object value = json.get(index); - - if (float.class.isAssignableFrom(type) || Float.class.isAssignableFrom(type)) - Array.set(targetObject, index, ((Number) value).floatValue()); - else if (double.class.isAssignableFrom(type) || Double.class.isAssignableFrom(type)) - Array.set(targetObject, index, ((Number) value).doubleValue()); - else if (byte.class.isAssignableFrom(type) || Byte.class.isAssignableFrom(type)) - Array.set(targetObject, index, ((Number) value).byteValue()); - else if (short.class.isAssignableFrom(type) || Short.class.isAssignableFrom(type)) - Array.set(targetObject, index, ((Number) value).shortValue()); - else if (int.class.isAssignableFrom(type) || Integer.class.isAssignableFrom(type)) - Array.set(targetObject, index, ((Number) value).intValue()); - else if (long.class.isAssignableFrom(type) || Long.class.isAssignableFrom(type)) - Array.set(targetObject, index, ((Number) value).longValue()); - else if (String.class.isAssignableFrom(type) || Number.class.isAssignableFrom(type) || Boolean.class.isAssignableFrom(type) || boolean.class.isAssignableFrom(type)) - Array.set(targetObject, index, value); - else if (Enum.class.isAssignableFrom(type)) { - - for (final Object constant : type.getEnumConstants()) - if (((Enum<?>) constant).name().equals(value.toString())) { - - Array.set(targetObject, index, constant); - break; - } - - } else if (type.getAnnotation(JSONRoot.class) != null) { - - final Object newObject = type.getDeclaredConstructor().newInstance(); - JSONSerializer.deserialize((JSONObject) value, newObject); - Array.set(targetObject, index, newObject); - - } else if (Map.class.isAssignableFrom(type)) { - - final Map<Object, Object> map = (Map<Object, Object>) type.getDeclaredConstructor().newInstance(); - JSONSerializer.deserialize(clazz, classObject, map, (JSONObject) value); - Array.set(targetObject, index, map); - - } else if (Collection.class.isAssignableFrom(type)) { - - final Collection<Object> collection = (Collection<Object>) type.getDeclaredConstructor().newInstance(); - JSONSerializer.deserialize(clazz, classObject, collection, (JSONArray) value); - Array.set(targetObject, index, collection); - - } else if (type.isArray()) { - - final Object newArray = Array.newInstance(type.getComponentType(), ((JSONArray) value).size()); - JSONSerializer.deserialize(clazz, classObject, newArray, (JSONArray) value); - Array.set(targetObject, index, newArray); - - } else if (JSONTypeSerializationHandler.class.isAssignableFrom(clazz)) - Array.set(targetObject, index, ((JSONTypeSerializationHandler) classObject).deserialize(type, value)); - } - } - - /** - * Converts a Java object into a {@linkplain JSONObject}. - * - * @param object the Java object you want to convert - * @return the resulting {@linkplain JSONObject} - * @throws Exception if an error occurs - * @since 1.0.0 - */ - public static JSONObject serialize(Object object) throws Exception { - - final Class<?> clazz = object.getClass(); - final Field[] fields = clazz.getFields(); - final Method[] methods = clazz.getMethods(); - final JSONObject json = new JSONObject(); - - for (final Field field : fields) { - - final JSONAttribute annotation = field.getAnnotation(JSONAttribute.class); - - if (!Modifier.isTransient(field.getModifiers()) && annotation != null && JSONSerializer.contains(JSONAttribute.Type.GETTER, annotation)) - JSONSerializer.serialize(json, clazz, object, field.getType(), field.get(object), annotation); - } - - for (final Method method : methods) { - - final JSONAttribute annotation = method.getAnnotation(JSONAttribute.class); - - if (!Modifier.isTransient(method.getModifiers()) && annotation != null && JSONSerializer.contains(JSONAttribute.Type.GETTER, annotation)) - JSONSerializer.serialize(json, clazz, object, method.getReturnType(), method.invoke(object), annotation); - } - - return json; - } - - private static void serialize(JSONObject json, Class<?> clazz, Object classObject, Class<?> type, Object value, JSONAttribute annotation) throws Exception { - - // ==== 17.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // - Numbers now always get converted to longs - // ==== - - if (value instanceof String || value instanceof Boolean) - json.put(annotation.name(), value); - else if (value instanceof Number) - json.put(annotation.name(), value != null ? ((Number) value).longValue() : null); - else if (value instanceof boolean[]) - json.put(annotation.name(), new JSONArray((boolean[]) value)); - else if (value instanceof byte[]) - json.put(annotation.name(), new JSONArray((byte[]) value)); - else if (value instanceof short[]) - json.put(annotation.name(), new JSONArray((short[]) value)); - else if (value instanceof int[]) - json.put(annotation.name(), new JSONArray((int[]) value)); - else if (value instanceof long[]) - json.put(annotation.name(), new JSONArray((long[]) value)); - else if (value instanceof float[]) - json.put(annotation.name(), new JSONArray((float[]) value)); - else if (value instanceof double[]) - json.put(annotation.name(), new JSONArray((double[]) value)); - else if (value != null && value.getClass().isArray()) - json.put(annotation.name(), JSONSerializer.serializeArray(value, clazz, classObject)); - else if (value != null && value.getClass().getAnnotation(JSONRoot.class) != null) - json.put(annotation.name(), JSONSerializer.serialize(value)); - else if (value instanceof Collection) - json.put(annotation.name(), JSONSerializer.serializeArray((Collection<?>) value, clazz, classObject)); - else if (value instanceof Map) - json.put(annotation.name(), JSONSerializer.serializeObject((Map<?, ?>) value, clazz, classObject)); - else if (value instanceof Enum) - json.put(annotation.name(), ((Enum<?>) value).name()); - else if (JSONTypeSerializationHandler.class.isAssignableFrom(clazz)) - json.put(annotation.name(), ((JSONTypeSerializationHandler) classObject).serialize(type, value)); - else - json.put(annotation.name(), value); - } - - private static JSONObject serializeObject(Map<?, ?> map, Class<?> clazz, Object classObject) throws Exception { - - final JSONObject json = new JSONObject(); - - for (final Map.Entry<?, ?> entry : map.entrySet()) { - - final Object value = entry.getValue(); - - if (value instanceof boolean[]) - json.put(entry.getKey(), new JSONArray((boolean[]) value)); - else if (value instanceof byte[]) - json.put(entry.getKey(), new JSONArray((byte[]) value)); - else if (value instanceof short[]) - json.put(entry.getKey(), new JSONArray((short[]) value)); - else if (value instanceof int[]) - json.put(entry.getKey(), new JSONArray((int[]) value)); - else if (value instanceof long[]) - json.put(entry.getKey(), new JSONArray((long[]) value)); - else if (value instanceof float[]) - json.put(entry.getKey(), new JSONArray((float[]) value)); - else if (value instanceof double[]) - json.put(entry.getKey(), new JSONArray((double[]) value)); - else if (value != null && value.getClass().getAnnotation(JSONRoot.class) != null) - json.put(entry.getKey(), JSONSerializer.serialize(value)); - else if (value instanceof Map) - json.put(entry.getKey(), JSONSerializer.serializeObject((Map<?, ?>) value, clazz, classObject)); - else if (value instanceof Collection) - json.put(entry.getKey(), JSONSerializer.serializeArray((Collection<?>) value, clazz, classObject)); - else if (value != null && value.getClass().isArray()) - json.put(entry.getKey(), JSONSerializer.serializeArray(value, clazz, classObject)); - else if (value instanceof Enum) - json.put(entry.getKey(), ((Enum<?>) value).name()); - else if (value instanceof String || value instanceof Boolean || value instanceof Number) - json.put(entry.getKey(), value); - else if (value != null && JSONTypeSerializationHandler.class.isAssignableFrom(clazz)) - json.put(entry.getKey(), ((JSONTypeSerializationHandler) classObject).serialize(value.getClass(), value)); - else - json.put(entry.getKey(), value); - } - - return json; - } - - private static JSONArray serializeArray(Collection<?> collection, Class<?> clazz, Object classObject) throws Exception { - - final JSONArray json = new JSONArray(); - final Iterator<?> iterator = collection.iterator(); - - while (iterator.hasNext()) { - - final Object value = iterator.next(); - - if (value instanceof boolean[]) - json.add(new JSONArray((boolean[]) value)); - else if (value instanceof byte[]) - json.add(new JSONArray((byte[]) value)); - else if (value instanceof short[]) - json.add(new JSONArray((short[]) value)); - else if (value instanceof int[]) - json.add(new JSONArray((int[]) value)); - else if (value instanceof long[]) - json.add(new JSONArray((long[]) value)); - else if (value instanceof float[]) - json.add(new JSONArray((float[]) value)); - else if (value instanceof double[]) - json.add(new JSONArray((double[]) value)); - else if (value != null && value.getClass().getAnnotation(JSONRoot.class) != null) - json.add(JSONSerializer.serialize(value)); - else if (value instanceof Map) - json.add(JSONSerializer.serializeObject((Map<?, ?>) value, clazz, classObject)); - else if (value instanceof Collection) - json.add(JSONSerializer.serializeArray((Collection<?>) value, clazz, classObject)); - else if (value != null && value.getClass().isArray()) - json.add(JSONSerializer.serializeArray(value, clazz, classObject)); - else if (value instanceof Enum) - json.add(((Enum<?>) value).name()); - else if (value instanceof String || value instanceof Boolean || value instanceof Number) - json.add(value); - else if (value != null && JSONTypeSerializationHandler.class.isAssignableFrom(clazz)) - ((JSONTypeSerializationHandler) classObject).serialize(value.getClass(), value); - else - json.add(value); - } - - return json; - } - - private static JSONArray serializeArray(Object array, Class<?> clazz, Object classObject) throws Exception { - - final JSONArray json = new JSONArray(); - - for (int index = 0; index < Array.getLength(array); index++) { - - final Object value = Array.get(array, index); - - if (value instanceof boolean[]) - json.add(new JSONArray((boolean[]) value)); - else if (value instanceof byte[]) - json.add(new JSONArray((byte[]) value)); - else if (value instanceof short[]) - json.add(new JSONArray((short[]) value)); - else if (value instanceof int[]) - json.add(new JSONArray((int[]) value)); - else if (value instanceof long[]) - json.add(new JSONArray((long[]) value)); - else if (value instanceof float[]) - json.add(new JSONArray((float[]) value)); - else if (value instanceof double[]) - json.add(new JSONArray((double[]) value)); - else if (value != null && value.getClass().getAnnotation(JSONRoot.class) != null) - json.add(JSONSerializer.serialize(value)); - else if (value instanceof Map) - json.add(JSONSerializer.serializeObject((Map<?, ?>) value, clazz, classObject)); - else if (value instanceof Collection) - json.add(JSONSerializer.serializeArray((Collection<?>) value, clazz, classObject)); - else if (value != null && value.getClass().isArray()) - json.add(JSONSerializer.serializeArray(value, clazz, classObject)); - else if (value instanceof Enum) - json.add(((Enum<?>) value).name()); - else if (value instanceof String || value instanceof Boolean || value instanceof Number) - json.add(value); - else if (value != null && JSONTypeSerializationHandler.class.isAssignableFrom(clazz)) - json.add(((JSONTypeSerializationHandler) classObject).serialize(value.getClass(), value)); - else - json.add(value); - } - - return json; - } - - private static boolean contains(JSONAttribute.Type type, JSONAttribute attribute) { - - for (final JSONAttribute.Type value : attribute.type()) - if (value.equals(type)) - return true; - - return false; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONTypeSerializationHandler.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONTypeSerializationHandler.java deleted file mode 100644 index 76e6b896d59399052142bbf95b1f42d54733c359..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONTypeSerializationHandler.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "{}" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright {yyyy} {name of copyright owner} - * - * 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 - * - * http://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. - */ -package org.mineacademy.fo.jsonsimple; - -/** - * Is needed to manage none-JSON types when serializing or deserializing objects. - * - * @author Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - * @version 2.0.0 - * @since 1.0.0 - */ -public interface JSONTypeSerializationHandler { - - /** - * Is called when an object is being serialized and a none-JSON type is reached. - * - * @param type the none-JSON type - * @param value the value - * @return a JSON type value that will be written into the object - * @since 1.0.0 - */ - Object serialize(Class<?> type, Object value); - - /** - * Is called when the needed type is a none-JSON type. - * - * @param type the needed type - * @param value the value from the {@linkplain JSONObject} - * @return the value to which the Java object attribute will be set - * @since 1.0.0 - */ - Object deserialize(Class<?> type, Object value); -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONUtil.java deleted file mode 100644 index fda3db27181febcaf0505b6166fea706f5431e0b..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JSONUtil.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "{}" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright {yyyy} {name of copyright owner} - * - * 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 - * - * http://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. - */ -package org.mineacademy.fo.jsonsimple; - -import java.util.Collection; -import java.util.Map; - -/** - * Contains some utility methods for JSON related stuff. - * - * @author Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - * @version 2.0.0 - * @since 2.0.0 - */ -public final class JSONUtil { - - private JSONUtil() { - } - - /** - * Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F). - * - * @param string the {@linkplain String} you want to escape - * @return the escaped {@linkplain String} - * @since 1.0.0 - */ - public static String escape(String string) { - - if (string != null) { - - final StringBuilder builder = new StringBuilder(); - JsonSimpleUtil.escape(string, builder); - return builder.toString(); - } - - return null; - } - - /** - * Checks if a value is a JSON compatible type. - * - * @param value the value that should be checked - * @return {@code true} if the given value is a JSON compatible type, else {@code false} - * @since 2.0.0 - */ - public static boolean isJSONType(Object value) { - - return value == null || - value instanceof Number || - value instanceof String || - value instanceof Boolean || - value instanceof Collection || - value instanceof Map || - value.getClass().isArray(); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JsonSimpleUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JsonSimpleUtil.java deleted file mode 100644 index 6b05729d7a3d88bb5be940aae0580763daa2df57..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/JsonSimpleUtil.java +++ /dev/null @@ -1,933 +0,0 @@ -/* - * Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "{}" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright {yyyy} {name of copyright owner} - * - * 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 - * - * http://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. - */ -package org.mineacademy.fo.jsonsimple; - -import java.io.IOException; -import java.io.Writer; -import java.text.DateFormat; -import java.text.ParseException; -import java.util.Collection; -import java.util.Date; -import java.util.Iterator; -import java.util.Map; - -/** - * Contains a few static methods for JSON values. - * - * @author FangYidong(fangyidong @ yahoo.com.cn) - * @author Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - * @version 2.0.0 - * @since 1.0.0 - */ -public final class JsonSimpleUtil { - - // ==== 11.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // - Removed the "toJSONString" method because it was dead code - // - Moved the method "escape(String)" to the class "JSONUtil" - // - Renamed all "writeJSONString" methods to simply "write" - // ==== - - private JsonSimpleUtil() { - } - - /** - * Encode an array into JSON text and write it to a {@linkplain Writer}. - * - * @param array the array which should be written on the {@linkplain Writer} - * @param writer the {@linkplain Writer} to write to - * @throws IOException if an I/O error occurs - * @see #write(Object, Writer) - * @since 1.0.0 - */ - public static void write(byte[] array, Writer writer) throws IOException { - - if (array == null) - writer.write("null"); - else if (array.length == 0) - writer.write("[]"); - else { - - writer.write("["); - writer.write("" + array[0]); - - for (int index = 1; index < array.length; index++) { - - writer.write(","); - writer.write("" + array[index]); - } - - writer.write("]"); - } - } - - /** - * Encode an array into JSON text and write it to a {@linkplain Writer}. - * - * @param array the array which should be written on the {@linkplain Writer} - * @param writer the {@linkplain Writer} to write to - * @throws IOException if an I/O error occurs - * @see #write(Object, Writer) - * @since 1.0.0 - */ - public static void write(short[] array, Writer writer) throws IOException { - - if (array == null) - writer.write("null"); - else if (array.length == 0) - writer.write("[]"); - else { - - writer.write("["); - writer.write("" + array[0]); - - for (int index = 1; index < array.length; index++) { - - writer.write(","); - writer.write("" + array[index]); - } - - writer.write("]"); - } - } - - /** - * Encode an array into JSON text and write it to a {@linkplain Writer}. - * - * @param array the array which should be written on the {@linkplain Writer} - * @param writer the {@linkplain Writer} to write to - * @throws IOException if an I/O error occurs - * @see #write(Object, Writer) - * @since 1.0.0 - */ - public static void write(int[] array, Writer writer) throws IOException { - - if (array == null) - writer.write("null"); - else if (array.length == 0) - writer.write("[]"); - else { - - writer.write("["); - writer.write("" + array[0]); - - for (int index = 1; index < array.length; index++) { - - writer.write(","); - writer.write("" + array[index]); - } - - writer.write("]"); - } - } - - /** - * Encode an array into JSON text and write it to a {@linkplain Writer}. - * - * @param array the array which should be written on the {@linkplain Writer} - * @param writer the {@linkplain Writer} to write to - * @throws IOException if an I/O error occurs - * @see #write(Object, Writer) - * @since 1.0.0 - */ - public static void write(long[] array, Writer writer) throws IOException { - - if (array == null) - writer.write("null"); - else if (array.length == 0) - writer.write("[]"); - else { - - writer.write("["); - writer.write("" + array[0]); - - for (int index = 1; index < array.length; index++) { - - writer.write(","); - writer.write("" + array[index]); - } - - writer.write("]"); - } - } - - /** - * Encode an array into JSON text and write it to a {@linkplain Writer}. - * - * @param array the array which should be written on the {@linkplain Writer} - * @param writer the {@linkplain Writer} to write to - * @throws IOException if an I/O error occurs - * @see #write(Object, Writer) - * @since 1.0.0 - */ - public static void write(float[] array, Writer writer) throws IOException { - - if (array == null) - writer.write("null"); - else if (array.length == 0) - writer.write("[]"); - else { - - writer.write("["); - writer.write("" + array[0]); - - for (int index = 1; index < array.length; index++) { - - writer.write(","); - writer.write("" + array[index]); - } - - writer.write("]"); - } - } - - /** - * Encode an array into JSON text and write it to a {@linkplain Writer}. - * - * @param array the array which should be written on the {@linkplain Writer} - * @param writer the {@linkplain Writer} to write to - * @throws IOException if an I/O error occurs - * @see #write(Object, Writer) - * @since 1.0.0 - */ - public static void write(double[] array, Writer writer) throws IOException { - - if (array == null) - writer.write("null"); - else if (array.length == 0) - writer.write("[]"); - else { - - writer.write("["); - writer.write("" + array[0]); - - for (int index = 1; index < array.length; index++) { - - writer.write(","); - writer.write("" + array[index]); - } - - writer.write("]"); - } - } - - /** - * Encode an array into JSON text and write it to a {@linkplain Writer}. - * - * @param array the array which should be written on the {@linkplain Writer} - * @param writer the {@linkplain Writer} to write to - * @throws IOException if an I/O error occurs - * @see #write(Object, Writer) - * @since 1.0.0 - */ - public static void write(boolean[] array, Writer writer) throws IOException { - - if (array == null) - writer.write("null"); - else if (array.length == 0) - writer.write("[]"); - else { - - writer.write("["); - writer.write("" + array[0]); - - for (int index = 1; index < array.length; index++) { - - writer.write(","); - writer.write("" + array[index]); - } - - writer.write("]"); - } - } - - /** - * Encode an array into JSON text and write it to a {@linkplain Writer}. - * - * @param array the array which should be written on the {@linkplain Writer} - * @param writer the {@linkplain Writer} to write to - * @throws IOException if an I/O error occurs - * @see #write(Object, Writer) - * @since 1.0.0 - */ - public static void write(char[] array, Writer writer) throws IOException { - - if (array == null) - writer.write("null"); - else if (array.length == 0) - writer.write("[]"); - else { - - writer.write("["); - writer.write("" + array[0]); - - for (int index = 1; index < array.length; index++) { - - writer.write(","); - writer.write("" + array[index]); - } - - writer.write("]"); - } - } - - /** - * Encode an array into JSON text and write it to a {@linkplain Writer}. - * - * @param array the array which should be written on the {@linkplain Writer} - * @param writer the {@linkplain Writer} to write to - * @param <T> type of the array - * @throws IOException if an I/O error occurs - * @see #write(Object, Writer) - * @since 1.0.0 - */ - public static <T> void write(T[] array, Writer writer) throws IOException { - - if (array == null) - writer.write("null"); - else if (array.length == 0) - writer.write("[]"); - else { - - writer.write("["); - JsonSimpleUtil.write(array[0], writer); - - for (int i = 1; i < array.length; i++) { - - writer.write(","); - JsonSimpleUtil.write(array[i], writer); - } - - writer.write("]"); - } - } - - /** - * Encode a {@linkplain Collection} into JSON text and write it to a {@linkplain Writer}. - * - * @param collection the {@linkplain Collection} which should be written on the {@linkplain Writer} - * @param writer the {@linkplain Writer} to write to - * @throws IOException if an I/O error occurs - * @since 1.0.0 - */ - public static void write(Collection<?> collection, Writer writer) throws IOException { - - if (collection != null) { - - boolean first = true; - final Iterator<?> iterator = collection.iterator(); - writer.write('['); - - while (iterator.hasNext()) { - - if (first) - first = false; - else - writer.write(','); - - final Object value = iterator.next(); - - if (value == null) - writer.write("null"); - else - JsonSimpleUtil.write(value, writer); - } - - writer.write(']'); - - } else - writer.write("null"); - } - - /** - * Convert a {@linkplain Map} to a JSON string and write it on a {@linkplain Writer}. This method will not close or flush the given {@linkplain Writer}! - * - * @param map the {@linkplain Map} to write - * @param writer the {@linkplain Writer} to which the {@linkplain Map} should be written to - * @throws IOException if an I/O error occurs - * @since 1.0.0 - */ - public static void write(Map<?, ?> map, Writer writer) throws IOException { - - if (map != null) { - - boolean first = true; - writer.write('{'); - - for (final Map.Entry<?, ?> entry : map.entrySet()) { - - if (first) - first = false; - else - writer.write(','); - - writer.write('\"'); - writer.write(JSONUtil.escape(String.valueOf(entry.getKey()))); - writer.write('\"'); - writer.write(':'); - - JsonSimpleUtil.write(entry.getValue(), writer); - } - - writer.write('}'); - - } else - writer.write("null"); - } - - /** - * Encode an {@linkplain Object} into JSON text and write it to a {@linkplain Writer}. - * - * @param value the {@linkplain Object} to write on the {@linkplain Writer} - * @param writer the {@linkplain Writer} to write on. - * @throws IOException if an I/O error occurs - * @since 1.0.0 - */ - public static void write(Object value, Writer writer) throws IOException { - - // ==== 11.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // - Made this method final - // ==== - - if (value == null) - writer.write("null"); - else if (value instanceof String) { - - writer.write('\"'); - writer.write(JSONUtil.escape((String) value)); - writer.write('\"'); - - } else if (value instanceof Double) - writer.write(((Double) value).isInfinite() || ((Double) value).isNaN() ? "null" : value.toString()); - else if (value instanceof Float) - writer.write(((Float) value).isInfinite() || ((Float) value).isNaN() ? "null" : value.toString()); - else if (value instanceof Number) - writer.write(value.toString()); - else if (value instanceof Boolean) - writer.write(value.toString()); - else if (value instanceof JSONObject) - ((JSONObject) value).write(writer); - else if (value instanceof JSONArray) - ((JSONArray) value).write(writer); - else if (value instanceof Map) - JsonSimpleUtil.write((Map<Object, Object>) value, writer); - else if (value instanceof Collection) - JsonSimpleUtil.write((Collection<Object>) value, writer); - else if (value instanceof byte[]) - JsonSimpleUtil.write((byte[]) value, writer); - else if (value instanceof short[]) - JsonSimpleUtil.write((short[]) value, writer); - else if (value instanceof int[]) - JsonSimpleUtil.write((int[]) value, writer); - else if (value instanceof long[]) - JsonSimpleUtil.write((long[]) value, writer); - else if (value instanceof float[]) - JsonSimpleUtil.write((float[]) value, writer); - else if (value instanceof double[]) - JsonSimpleUtil.write((double[]) value, writer); - else if (value instanceof boolean[]) - JsonSimpleUtil.write((boolean[]) value, writer); - else if (value instanceof char[]) - JsonSimpleUtil.write((char[]) value, writer); - else if (value.getClass().isArray()) - JsonSimpleUtil.write((Object[]) value, writer); - else { - - writer.write('"'); - writer.write(JSONUtil.escape(value.toString())); - writer.write('"'); - } - } - - /** - * Tries to parse a value to an instance of {@linkplain JSONObject}. - * - * @param value the value that should be parsed - * @return the parsed value, or {@code null} if it could not be parsed - * @since 1.0.0 - */ - public static JSONObject getObject(Object value) { - - if (value != null) - if (value instanceof JSONObject) - return (JSONObject) value; - else if (value instanceof Map) - return new JSONObject((Map<?, ?>) value); - - return null; - } - - /** - * Tries to parse a value to an instance of {@linkplain JSONArray}. - * - * @param value the value that should be parsed - * @return the parsed value, or {@code null} if it could not be parsed - * @since 1.0.0 - */ - public static JSONArray getArray(Object value) { - - if (value != null) - if (value instanceof JSONArray) - return (JSONArray) value; - else if (value instanceof boolean[]) - return new JSONArray((boolean[]) value); - else if (value instanceof byte[]) - return new JSONArray((byte[]) value); - else if (value instanceof char[]) - return new JSONArray((char[]) value); - else if (value instanceof short[]) - return new JSONArray((short[]) value); - else if (value instanceof int[]) - return new JSONArray((int[]) value); - else if (value instanceof long[]) - return new JSONArray((long[]) value); - else if (value instanceof float[]) - return new JSONArray((float[]) value); - else if (value instanceof double[]) - return new JSONArray((double[]) value); - else if (value instanceof Collection) - return new JSONArray((Collection<?>) value); - else if (value.getClass().isArray()) - return new JSONArray(value); - - return null; - } - - /** - * Tries to parse a value to an instance of {@linkplain Boolean}. - * - * @param value the value that should be parsed - * @return the parsed value, or {@code null} if it could not be parsed - * @since 1.0.0 - */ - public static Boolean getBoolean(Object value) { - - if (value != null) - if (value instanceof Boolean) - return (boolean) value; - else if (value instanceof String) - return Boolean.parseBoolean((String) value); - else if (value instanceof Number) - return ((Number) value).longValue() == 1L; - - return null; - } - - /** - * Tries to parse a value to an instance of {@linkplain Byte}. - * - * @param value the value that should be parsed - * @return the parsed value, or {@code null} if it could not be parsed - * @since 1.0.0 - */ - public static Byte getByte(Object value) { - - if (value != null) - if (value instanceof Number) - return ((Number) value).byteValue(); - else if (value instanceof String) - return Byte.parseByte((String) value); - else if (value instanceof Boolean) - return (boolean) value ? (byte) 1 : (byte) 0; - - return null; - } - - /** - * Tries to parse a value to an instance of {@linkplain Short}. - * - * @param value the value that should be parsed - * @return the parsed value, or {@code null} if it could not be parsed - * @since 1.0.0 - */ - public static Short getShort(Object value) { - - if (value != null) - if (value instanceof Number) - return ((Number) value).shortValue(); - else if (value instanceof String) - return Short.parseShort((String) value); - else if (value instanceof Boolean) - return (boolean) value ? (short) 1 : (short) 0; - - return null; - } - - /** - * Tries to parse a value to an instance of {@linkplain Integer}. - * - * @param value the value that should be parsed - * @return the parsed value, or {@code null} if it could not be parsed - * @since 1.0.0 - */ - public static Integer getInteger(Object value) { - - if (value != null) - if (value instanceof Number) - return ((Number) value).intValue(); - else if (value instanceof String) - return Integer.parseInt((String) value); - else if (value instanceof Boolean) - return (boolean) value ? 1 : 0; - - return null; - } - - /** - * Tries to parse a value to an instance of {@linkplain Long}. - * - * @param value the value that should be parsed - * @return the parsed value, or {@code null} if it could not be parsed - * @since 1.0.0 - */ - public static Long getLong(Object value) { - - if (value != null) - if (value instanceof Number) - return ((Number) value).longValue(); - else if (value instanceof String) - return Long.parseLong((String) value); - else if (value instanceof Boolean) - return (boolean) value ? 1L : 0L; - - return null; - } - - /** - * Tries to parse a value to an instance of {@linkplain Float}. - * - * @param value the value that should be parsed - * @return the parsed value, or {@code null} if it could not be parsed - * @since 1.0.0 - */ - public static Float getFloat(Object value) { - - if (value != null) - if (value instanceof Number) - return ((Number) value).floatValue(); - else if (value instanceof String) - return Float.parseFloat((String) value); - else if (value instanceof Boolean) - return (boolean) value ? 1F : 0F; - - return null; - } - - /** - * Tries to parse a value to an instance of {@linkplain Double}. - * - * @param value the value that should be parsed - * @return the parsed value, or {@code null} if it could not be parsed - * @since 1.0.0 - */ - public static Double getDouble(Object value) { - - if (value != null) - if (value instanceof Number) - return ((Number) value).doubleValue(); - else if (value instanceof String) - return Double.parseDouble((String) value); - else if (value instanceof Boolean) - return (boolean) value ? 1D : 0D; - - return null; - } - - /** - * Tries to parse a value to an instance of {@linkplain String}. - * - * @param value the value that should be parsed - * @return the parsed value, or {@code null} if it could not be parsed - * @since 1.0.0 - */ - public static String getString(Object value) { - - if (value != null) - return value.toString(); - - return null; - } - - /** - * Tries to parse a value to an instance of {@linkplain Date}. - * - * @param value the value that should be parsed - * @param format the {@linkplain DateFormat} that should be used to parse the value - * @return an instance of {@linkplain Date} or {@code null} if the input value was already {@code null} - * @throws ParseException if the value could not be parsed to an instance of {@linkplain Date} - * @since 1.0.0 - */ - public static Date getDate(Object value, DateFormat format) throws ParseException { - - if (value != null) - return value instanceof Date ? (Date) value : format.parse(value.toString()); - - return null; - } - - /** - * Tries to parse a value to an enum. - * - * @param value the value that should be parsed - * @param type the enum class - * @param <T> the enum type - * @return the enum or {@code null} if the value could not be parsed - * @since 1.0.0 - */ - public static <T extends Enum<T>> T getEnum(Object value, Class<T> type) { - - if (value != null) - for (final Object enumConstant : type.getEnumConstants()) - if (((T) enumConstant).name().equals(value.toString())) - return (T) enumConstant; - - return null; - } - - /** - * Escapes a string according to the <a href="https://tools.ietf.org/html/rfc7159#section-8.1">JSON specification</a>. - * - * @param string the string which should be escaped - * @param builder the {@linkplain StringBuilder} on which the result will be written - * @since 1.0.0 - */ - public static void escape(String string, StringBuilder builder) { - - for (int index = 0; index < string.length(); index++) { - - final char character = string.charAt(index); - - // If is faster than Switch - if (character == '"') - builder.append("\\\""); - else if (character == '\\') - builder.append("\\\\"); - else if (character == '\b') - builder.append("\\b"); - else if (character == '\f') - builder.append("\\f"); - else if (character == '\n') - builder.append("\\n"); - else if (character == '\r') - builder.append("\\r"); - else if (character == '\t') - builder.append("\\t"); - else if (character == '/') - builder.append("\\/"); - else if (character >= '\u0000' && character <= '\u001F' || - character >= '\u007F' && character <= '\u009F' || - character >= '\u2000' && character <= '\u20FF') { - - final String hex = Integer.toHexString(character); - builder.append("\\u"); - - for (int k = 0; k < 4 - hex.length(); k++) - builder.append('0'); - - builder.append(hex.toUpperCase()); - - } else - builder.append(character); - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/Yylex.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/Yylex.java deleted file mode 100644 index 57b3ad6a3abaae1596a4f2bac92cc7d37a7da7ea..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/Yylex.java +++ /dev/null @@ -1,705 +0,0 @@ -/* - * Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "{}" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright {yyyy} {name of copyright owner} - * - * 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 - * - * http://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. - */ -package org.mineacademy.fo.jsonsimple; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; - -/* The following code was generated by JFlex 1.4.2 */ - -/** - * @author FangYidong(fangyidong @ yahoo.com.cn) - * @author Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - * @version 2.0.0 - * @since 1.0.0 - */ -public class Yylex { - - // ==== 11.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // - Properly formatted this class - // - Replaced switch-case block with if-else blocks because they are faster - // ==== - - public static final int YYINITIAL = 0; - public static final int STRING_BEGIN = 2; - public static final int YYEOF = -1; - - private static final int ZZ_BUFFERSIZE = 16384; - private static final int ZZ_LEXSTATE[] = { 0, 0, 1, 1 }; - private static final String ZZ_CMAP_PACKED = "\11\0\1\7\1\7\2\0\1\7\22\0\1\7\1\0\1\11\10\0\1\6\1\31\1\2\1\4\1\12\12\3\1\32\6\0\4\1\1\5\1\1\24\0\1\27\1\10\1\30\3\0\1\22\1\13\2\1\1\21\1\14\5\0\1\23\1\0\1\15\3\0\1\16\1\24\1\17\1\20\5\0\1\25\1\0\1\26\uff82\0"; - private static final char[] ZZ_CMAP = Yylex.zzUnpackCMap(Yylex.ZZ_CMAP_PACKED); - private static final int[] ZZ_ACTION = Yylex.zzUnpackAction(); - private static final String ZZ_ACTION_PACKED_0 = "\2\0\2\1\1\2\1\3\1\4\3\1\1\5\1\6\1\7\1\10\1\11\1\12\1\13\1\14\1\15\5\0\1\14\1\16\1\17\1\20\1\21\1\22\1\23\1\24\1\0\1\25\1\0\1\25\4\0\1\26\1\27\2\0\1\30"; - private static final int[] ZZ_ROWMAP = Yylex.zzUnpackRowMap(); - private static final String ZZ_ROWMAP_PACKED_0 = "\0\0\0\33\0\66\0\121\0\154\0\207\0\66\0\242\0\275\0\330\0\66\0\66\0\66\0\66\0\66\0\66\0\363\0\u010e\0\66\0\u0129\0\u0144\0\u015f\0\u017a\0\u0195\0\66\0\66\0\66\0\66\0\66\0\66\0\66\0\66\0\u01b0\0\u01cb\0\u01e6\0\u01e6\0\u0201\0\u021c\0\u0237\0\u0252\0\66\0\66\0\u026d\0\u0288\0\66"; - private static final int ZZ_UNKNOWN_ERROR = 0; - private static final int ZZ_NO_MATCH = 1; - private static final int ZZ_PUSHBACK_2BIG = 2; - private static final String[] ZZ_ERROR_MSG = { "Unkown internal scanner error", "Error: could not match input", "Error: pushback value was too large" }; - private static final int[] ZZ_ATTRIBUTE = Yylex.zzUnpackAttribute(); - private static final String ZZ_ATTRIBUTE_PACKED_0 = "\2\0\1\11\3\1\1\11\3\1\6\11\2\1\1\11\5\0\10\11\1\0\1\1\1\0\1\1\4\0\2\11\2\0\1\11"; - private static final int[] ZZ_TRANS = { - - 2, 2, 3, 4, 2, 2, 2, 5, 2, 6, - 2, 2, 7, 8, 2, 9, 2, 2, 2, 2, - 2, 10, 11, 12, 13, 14, 15, 16, 16, 16, - 16, 16, 16, 16, 16, 17, 18, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 4, 19, 20, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 20, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 5, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 16, 16, 16, 16, 16, 16, 16, - 16, -1, -1, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - -1, -1, -1, -1, -1, -1, -1, -1, 24, 25, - 26, 27, 28, 29, 30, 31, 32, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 34, 35, -1, -1, - 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 37, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 38, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 39, -1, 39, -1, 39, -1, -1, - -1, -1, -1, 39, 39, -1, -1, -1, -1, 39, - 39, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 33, -1, 20, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 35, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 38, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 42, -1, 42, -1, 42, - -1, -1, -1, -1, -1, 42, 42, -1, -1, -1, - -1, 42, 42, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 43, -1, 43, -1, 43, -1, -1, -1, - -1, -1, 43, 43, -1, -1, -1, -1, 43, 43, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, - -1, 44, -1, 44, -1, -1, -1, -1, -1, 44, - 44, -1, -1, -1, -1, 44, 44, -1, -1, -1, - -1, -1, -1, -1, -1, - }; - - private Reader zzReader; - private int zzLexicalState = Yylex.YYINITIAL; - private char zzBuffer[] = new char[Yylex.ZZ_BUFFERSIZE]; - private int zzMarkedPos; - private int zzCurrentPos; - private int zzStartRead; - private int zzEndRead; - private int yychar; - private boolean zzAtEOF; - private StringBuffer sb = new StringBuffer(); - - private static int[] zzUnpackAction() { - - final int[] result = new int[45]; - int offset = 0; - offset = Yylex.zzUnpackAction(Yylex.ZZ_ACTION_PACKED_0, offset, result); - return result; - } - - private static int zzUnpackAction(String packed, int offset, int[] result) { - - int i = 0; - int j = offset; - final int l = packed.length(); - - while (i < l) { - - int count = packed.charAt(i++); - final int value = packed.charAt(i++); - - do - result[j++] = value; - while (--count > 0); - } - - return j; - } - - private static int[] zzUnpackRowMap() { - - final int[] result = new int[45]; - int offset = 0; - offset = Yylex.zzUnpackRowMap(Yylex.ZZ_ROWMAP_PACKED_0, offset, result); - return result; - } - - private static int zzUnpackRowMap(String packed, int offset, int[] result) { - - int i = 0; - int j = offset; - final int l = packed.length(); - - while (i < l) { - - final int high = packed.charAt(i++) << 16; - result[j++] = high | packed.charAt(i++); - } - - return j; - } - - private static int[] zzUnpackAttribute() { - - final int[] result = new int[45]; - int offset = 0; - offset = Yylex.zzUnpackAttribute(Yylex.ZZ_ATTRIBUTE_PACKED_0, offset, result); - return result; - } - - private static int zzUnpackAttribute(String packed, int offset, int[] result) { - - int i = 0; - int j = offset; - final int l = packed.length(); - - while (i < l) { - - int count = packed.charAt(i++); - final int value = packed.charAt(i++); - - do - result[j++] = value; - while (--count > 0); - } - - return j; - } - - public int getPosition() { - - return this.yychar; - } - - public Yylex(Reader in) { - - this.zzReader = in; - } - - public Yylex(InputStream in) { - - this(new InputStreamReader(in)); - } - - private static char[] zzUnpackCMap(String packed) { - - final char[] map = new char[0x10000]; - int i = 0; - int j = 0; - - while (i < 90) { - - int count = packed.charAt(i++); - final char value = packed.charAt(i++); - - do - map[j++] = value; - while (--count > 0); - } - - return map; - } - - private boolean zzRefill() throws IOException { - - if (this.zzStartRead > 0) { - - System.arraycopy(this.zzBuffer, this.zzStartRead, this.zzBuffer, 0, this.zzEndRead - this.zzStartRead); - - this.zzEndRead -= this.zzStartRead; - this.zzCurrentPos -= this.zzStartRead; - this.zzMarkedPos -= this.zzStartRead; - this.zzStartRead = 0; - } - - if (this.zzCurrentPos >= this.zzBuffer.length) { - - final char[] newBuffer = new char[this.zzCurrentPos * 2]; - System.arraycopy(this.zzBuffer, 0, newBuffer, 0, this.zzBuffer.length); - this.zzBuffer = newBuffer; - } - - final int numRead = this.zzReader.read(this.zzBuffer, this.zzEndRead, this.zzBuffer.length - this.zzEndRead); - - if (numRead > 0) { - - this.zzEndRead += numRead; - return false; - } - - if (numRead == 0) { - - final int c = this.zzReader.read(); - - if (c == -1) - return true; - else { - - this.zzBuffer[this.zzEndRead++] = (char) c; - return false; - } - } - - return true; - } - - public final void yyclose() throws IOException { - - this.zzAtEOF = true; // indicate end of file - this.zzEndRead = this.zzStartRead; // invalidate buffer - - if (this.zzReader != null) - this.zzReader.close(); - } - - public final void yyreset(Reader reader) { - - this.zzReader = reader; - this.zzAtEOF = false; - this.zzEndRead = this.zzStartRead = 0; - this.zzCurrentPos = this.zzMarkedPos = 0; - this.yychar = 0; - this.zzLexicalState = Yylex.YYINITIAL; - } - - public final int yystate() { - - return this.zzLexicalState; - } - - public final void yybegin(int newState) { - - this.zzLexicalState = newState; - } - - public final String yytext() { - - return new String(this.zzBuffer, this.zzStartRead, this.zzMarkedPos - this.zzStartRead); - } - - public final char yycharat(int pos) { - - return this.zzBuffer[this.zzStartRead + pos]; - } - - public final int yylength() { - - return this.zzMarkedPos - this.zzStartRead; - } - - private void zzScanError(int errorCode) { - - String message; - - try { - - message = Yylex.ZZ_ERROR_MSG[errorCode]; - - } catch (final ArrayIndexOutOfBoundsException exception) { - - message = Yylex.ZZ_ERROR_MSG[Yylex.ZZ_UNKNOWN_ERROR]; - } - - // ==== 17.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // DO NOT CHANGE! - // Even if Codacy says so. - // ==== - - throw new Error(message); - } - - public void yypushback(int number) { - - if (number > yylength()) - this.zzScanError(Yylex.ZZ_PUSHBACK_2BIG); - - this.zzMarkedPos -= number; - } - - public Yytoken yylex() throws IOException, JSONParseException { - - int zzInput; - int zzAction; - int zzCurrentPosL; - int zzMarkedPosL; - int zzEndReadL = this.zzEndRead; - char[] zzBufferL = this.zzBuffer; - final char[] zzCMapL = Yylex.ZZ_CMAP; - final int[] zzTransL = Yylex.ZZ_TRANS; - final int[] zzRowMapL = Yylex.ZZ_ROWMAP; - final int[] zzAttrL = Yylex.ZZ_ATTRIBUTE; - - while (true) { - - zzMarkedPosL = this.zzMarkedPos; - this.yychar += zzMarkedPosL - this.zzStartRead; - zzAction = -1; - zzCurrentPosL = this.zzCurrentPos = this.zzStartRead = zzMarkedPosL; - int zzState = Yylex.ZZ_LEXSTATE[this.zzLexicalState]; - - zzForAction: - { - - while (true) { - - if (zzCurrentPosL < zzEndReadL) - zzInput = zzBufferL[zzCurrentPosL++]; - else if (this.zzAtEOF) { - - zzInput = Yylex.YYEOF; - break zzForAction; - - } else { - - // store back cached positions - this.zzCurrentPos = zzCurrentPosL; - this.zzMarkedPos = zzMarkedPosL; - final boolean eof = this.zzRefill(); - - // get translated positions and possibly new buffer - zzCurrentPosL = this.zzCurrentPos; - zzMarkedPosL = this.zzMarkedPos; - zzBufferL = this.zzBuffer; - zzEndReadL = this.zzEndRead; - - if (eof) { - - zzInput = Yylex.YYEOF; - break zzForAction; - - } else - zzInput = zzBufferL[zzCurrentPosL++]; - } - - final int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]]; - - if (zzNext == -1) - break zzForAction; - - zzState = zzNext; - - final int zzAttributes = zzAttrL[zzState]; - - if ((zzAttributes & 1) == 1) { - - zzAction = zzState; - zzMarkedPosL = zzCurrentPosL; - - if ((zzAttributes & 8) == 8) - break zzForAction; - } - } - } - - // store back cached position - this.zzMarkedPos = zzMarkedPosL; - final int value = zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]; - - if (value < 25 || value > 48) - if (value == 11) - this.sb.append(this.yytext()); - else if (value == 4) { - - this.sb = new StringBuffer(); - this.yybegin(Yylex.STRING_BEGIN); - - } else if (value == 16) - this.sb.append('\b'); - else if (value == 6) - return new Yytoken(Yytoken.TYPE_RIGHT_BRACE, null); - else if (value == 23) - return new Yytoken(Yytoken.TYPE_VALUE, Boolean.valueOf(this.yytext())); - else if (value == 22) - return new Yytoken(Yytoken.TYPE_VALUE, null); - else if (value == 13) { - - this.yybegin(Yylex.YYINITIAL); - return new Yytoken(Yytoken.TYPE_VALUE, this.sb.toString()); - - } else if (value == 12) - this.sb.append('\\'); - else if (value == 21) - return new Yytoken(Yytoken.TYPE_VALUE, Double.valueOf(yytext())); - else if (value == 1) - throw new JSONParseException(this.yychar, JSONParseException.ERROR_UNEXPECTED_CHAR, this.yycharat(0)); - else if (value == 8) - return new Yytoken(Yytoken.TYPE_RIGHT_SQUARE, null); - else if (value == 19) - this.sb.append('\r'); - else if (value == 15) - this.sb.append('/'); - else if (value == 10) - return new Yytoken(Yytoken.TYPE_COLON, null); - else if (value == 14) - this.sb.append('"'); - else if (value == 5) - return new Yytoken(Yytoken.TYPE_LEFT_BRACE, null); - else if (value == 17) - this.sb.append('\f'); - else if (value == 24) - try { - - final int ch = Integer.parseInt(this.yytext().substring(2), 16); - this.sb.append((char) ch); - - } catch (final Exception exception) { - - throw new JSONParseException(this.yychar, JSONParseException.ERROR_UNEXPECTED_EXCEPTION, exception); - } - else if (value == 20) - this.sb.append('\t'); - else if (value == 7) - return new Yytoken(Yytoken.TYPE_LEFT_SQUARE, null); - else if (value == 2) - return new Yytoken(Yytoken.TYPE_VALUE, Long.valueOf(this.yytext())); - else if (value == 18) - this.sb.append('\n'); - else if (value == 9) - return new Yytoken(Yytoken.TYPE_COMMA, null); - else if (value == 3) { - - } else if (zzInput == Yylex.YYEOF && this.zzStartRead == this.zzCurrentPos) { - - this.zzAtEOF = true; - return null; - - } else - this.zzScanError(Yylex.ZZ_NO_MATCH); - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/Yytoken.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/Yytoken.java deleted file mode 100644 index ca17dcd7da4fcc6c24bbf778f4762e376b40596e..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/Yytoken.java +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "{}" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright {yyyy} {name of copyright owner} - * - * 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 - * - * http://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. - */ -package org.mineacademy.fo.jsonsimple; - -/** - * Represents a token. - * - * @author FangYidong(fangyidong @ yahoo.com.cn) - * @author Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - * @version 2.0.0 - * @since 1.0.0 - */ -public class Yytoken { - - /** - * @since 1.0.0 - */ - public static final int TYPE_VALUE = 0; - /** - * @since 1.0.0 - */ - public static final int TYPE_LEFT_BRACE = 1; - /** - * @since 1.0.0 - */ - public static final int TYPE_RIGHT_BRACE = 2; - /** - * @since 1.0.0 - */ - public static final int TYPE_LEFT_SQUARE = 3; - /** - * @since 1.0.0 - */ - public static final int TYPE_RIGHT_SQUARE = 4; - /** - * @since 1.0.0 - */ - public static final int TYPE_COMMA = 5; - /** - * @since 1.0.0 - */ - public static final int TYPE_COLON = 6; - /** - * @since 1.0.0 - */ - public static final int TYPE_EOF = -1; - - public int type; - public Object value; - - /** - * @param type the token type - * @param value the value of this token - * @since 1.0.0 - */ - public Yytoken(int type, Object value) { - - this.type = type; - this.value = value; - } - - // ==== 17.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // Since this is an internal class and no classes inside this library use this method, it is dead code. - // ==== - - /*@Override - public String toString() { - - StringBuilder builder = new StringBuilder(); - - // ==== 01.03.2018 | Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - // Replaced switch-case with if-else because if-else is faster - // ==== - - if(this.type == Yytoken.TYPE_VALUE) {builder.append("VALUE(").append(this.value).append(")"); - } else if(this.type == Yytoken.TYPE_LEFT_BRACE) {builder.append("LEFT BRACE({)"); - } else if(this.type == Yytoken.TYPE_RIGHT_BRACE) {builder.append("RIGHT BRACE(})"); - } else if(this.type == Yytoken.TYPE_LEFT_SQUARE) {builder.append("LEFT SQUARE([)"); - } else if(this.type == Yytoken.TYPE_RIGHT_SQUARE) {builder.append("RIGHT SQUARE(])"); - } else if(this.type == Yytoken.TYPE_COMMA) {builder.append("COMMA(,)"); - } else if(this.type == Yytoken.TYPE_COLON) {builder.append("COLON(:)"); - } else if(this.type == Yytoken.TYPE_EOF) {builder.append("END OF FILE"); - } - - return builder.toString(); - }*/ -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/annotation/JSONAttribute.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/annotation/JSONAttribute.java deleted file mode 100644 index 39662ccf3019fe1632fe2cf03e42f8b91ec5085f..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/annotation/JSONAttribute.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "{}" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright {yyyy} {name of copyright owner} - * - * 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 - * - * http://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. - */ -package org.mineacademy.fo.jsonsimple.annotation; - -import java.lang.annotation.Annotation; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Marks a JSON attribute for serialization. - * - * @author Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - * @version 2.0.0 - * @since 1.0.0 - */ -@Retention(RetentionPolicy.RUNTIME) -@Target({ ElementType.FIELD, ElementType.METHOD }) -public @interface JSONAttribute { - - /** - * @return the name of the attribute - * @since 1.0.0 - */ - public String name(); - - /** - * {@link Type#GETTER} is used for serializing an object. If it is used on a method, it is not allowed to have any parameters! - * {@link Type#SETTER} is used for deserializing an object. If it is used on a method, it can only have one parameter! - * If this {@linkplain Annotation} is used on a field, it has to be accessible! - * - * @return the attribute type - * @since 1.0.0 - */ - public Type[] type() default { Type.GETTER, Type.SETTER }; - - /** - * Represents the type of an attribute. Not the data type but more if it's read only or not. - * - * @author Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - * @version 1.0.0 - * @since 1.0.0 - */ - public static enum Type { - - /** - * Marks the attribute for reading. - * - * @since 1.0.0 - */ - GETTER, - - /** - * Marks the attribute for writing. - * - * @since 1.0.0 - */ - SETTER; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/annotation/JSONRoot.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/annotation/JSONRoot.java deleted file mode 100644 index 59b03d0187aeea6034e21a823b79853b97fee904..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/jsonsimple/annotation/JSONRoot.java +++ /dev/null @@ -1,221 +0,0 @@ -/* - * Apache License - * Version 2.0, January 2004 - * http://www.apache.org/licenses/ - * - * TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - * - * 1. Definitions. - * - * "License" shall mean the terms and conditions for use, reproduction, - * and distribution as defined by Sections 1 through 9 of this document. - * - * "Licensor" shall mean the copyright owner or entity authorized by - * the copyright owner that is granting the License. - * - * "Legal Entity" shall mean the union of the acting entity and all - * other entities that control, are controlled by, or are under common - * control with that entity. For the purposes of this definition, - * "control" means (i) the power, direct or indirect, to cause the - * direction or management of such entity, whether by contract or - * otherwise, or (ii) ownership of fifty percent (50%) or more of the - * outstanding shares, or (iii) beneficial ownership of such entity. - * - * "You" (or "Your") shall mean an individual or Legal Entity - * exercising permissions granted by this License. - * - * "Source" form shall mean the preferred form for making modifications, - * including but not limited to software source code, documentation - * source, and configuration files. - * - * "Object" form shall mean any form resulting from mechanical - * transformation or translation of a Source form, including but - * not limited to compiled object code, generated documentation, - * and conversions to other media types. - * - * "Work" shall mean the work of authorship, whether in Source or - * Object form, made available under the License, as indicated by a - * copyright notice that is included in or attached to the work - * (an example is provided in the Appendix below). - * - * "Derivative Works" shall mean any work, whether in Source or Object - * form, that is based on (or derived from) the Work and for which the - * editorial revisions, annotations, elaborations, or other modifications - * represent, as a whole, an original work of authorship. For the purposes - * of this License, Derivative Works shall not include works that remain - * separable from, or merely link (or bind by name) to the interfaces of, - * the Work and Derivative Works thereof. - * - * "Contribution" shall mean any work of authorship, including - * the original version of the Work and any modifications or additions - * to that Work or Derivative Works thereof, that is intentionally - * submitted to Licensor for inclusion in the Work by the copyright owner - * or by an individual or Legal Entity authorized to submit on behalf of - * the copyright owner. For the purposes of this definition, "submitted" - * means any form of electronic, verbal, or written communication sent - * to the Licensor or its representatives, including but not limited to - * communication on electronic mailing lists, source code control systems, - * and issue tracking systems that are managed by, or on behalf of, the - * Licensor for the purpose of discussing and improving the Work, but - * excluding communication that is conspicuously marked or otherwise - * designated in writing by the copyright owner as "Not a Contribution." - * - * "Contributor" shall mean Licensor and any individual or Legal Entity - * on behalf of whom a Contribution has been received by Licensor and - * subsequently incorporated within the Work. - * - * 2. Grant of Copyright License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * copyright license to reproduce, prepare Derivative Works of, - * publicly display, publicly perform, sublicense, and distribute the - * Work and such Derivative Works in Source or Object form. - * - * 3. Grant of Patent License. Subject to the terms and conditions of - * this License, each Contributor hereby grants to You a perpetual, - * worldwide, non-exclusive, no-charge, royalty-free, irrevocable - * (except as stated in this section) patent license to make, have made, - * use, offer to sell, sell, import, and otherwise transfer the Work, - * where such license applies only to those patent claims licensable - * by such Contributor that are necessarily infringed by their - * Contribution(s) alone or by combination of their Contribution(s) - * with the Work to which such Contribution(s) was submitted. If You - * institute patent litigation against any entity (including a - * cross-claim or counterclaim in a lawsuit) alleging that the Work - * or a Contribution incorporated within the Work constitutes direct - * or contributory patent infringement, then any patent licenses - * granted to You under this License for that Work shall terminate - * as of the date such litigation is filed. - * - * 4. Redistribution. You may reproduce and distribute copies of the - * Work or Derivative Works thereof in any medium, with or without - * modifications, and in Source or Object form, provided that You - * meet the following conditions: - * - * (a) You must give any other recipients of the Work or - * Derivative Works a copy of this License; and - * - * (b) You must cause any modified files to carry prominent notices - * stating that You changed the files; and - * - * (c) You must retain, in the Source form of any Derivative Works - * that You distribute, all copyright, patent, trademark, and - * attribution notices from the Source form of the Work, - * excluding those notices that do not pertain to any part of - * the Derivative Works; and - * - * (d) If the Work includes a "NOTICE" text file as part of its - * distribution, then any Derivative Works that You distribute must - * include a readable copy of the attribution notices contained - * within such NOTICE file, excluding those notices that do not - * pertain to any part of the Derivative Works, in at least one - * of the following places: within a NOTICE text file distributed - * as part of the Derivative Works; within the Source form or - * documentation, if provided along with the Derivative Works; or, - * within a display generated by the Derivative Works, if and - * wherever such third-party notices normally appear. The contents - * of the NOTICE file are for informational purposes only and - * do not modify the License. You may add Your own attribution - * notices within Derivative Works that You distribute, alongside - * or as an addendum to the NOTICE text from the Work, provided - * that such additional attribution notices cannot be construed - * as modifying the License. - * - * You may add Your own copyright statement to Your modifications and - * may provide additional or different license terms and conditions - * for use, reproduction, or distribution of Your modifications, or - * for any such Derivative Works as a whole, provided Your use, - * reproduction, and distribution of the Work otherwise complies with - * the conditions stated in this License. - * - * 5. Submission of Contributions. Unless You explicitly state otherwise, - * any Contribution intentionally submitted for inclusion in the Work - * by You to the Licensor shall be under the terms and conditions of - * this License, without any additional terms or conditions. - * Notwithstanding the above, nothing herein shall supersede or modify - * the terms of any separate license agreement you may have executed - * with Licensor regarding such Contributions. - * - * 6. Trademarks. This License does not grant permission to use the trade - * names, trademarks, service marks, or product names of the Licensor, - * except as required for reasonable and customary use in describing the - * origin of the Work and reproducing the content of the NOTICE file. - * - * 7. Disclaimer of Warranty. Unless required by applicable law or - * agreed to in writing, Licensor provides the Work (and each - * Contributor provides its Contributions) on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - * implied, including, without limitation, any warranties or conditions - * of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - * PARTICULAR PURPOSE. You are solely responsible for determining the - * appropriateness of using or redistributing the Work and assume any - * risks associated with Your exercise of permissions under this License. - * - * 8. Limitation of Liability. In no event and under no legal theory, - * whether in tort (including negligence), contract, or otherwise, - * unless required by applicable law (such as deliberate and grossly - * negligent acts) or agreed to in writing, shall any Contributor be - * liable to You for damages, including any direct, indirect, special, - * incidental, or consequential damages of any character arising as a - * result of this License or out of the use or inability to use the - * Work (including but not limited to damages for loss of goodwill, - * work stoppage, computer failure or malfunction, or any and all - * other commercial damages or losses), even if such Contributor - * has been advised of the possibility of such damages. - * - * 9. Accepting Warranty or Additional Liability. While redistributing - * the Work or Derivative Works thereof, You may choose to offer, - * and charge a fee for, acceptance of support, warranty, indemnity, - * or other liability obligations and/or rights consistent with this - * License. However, in accepting such obligations, You may act only - * on Your own behalf and on Your sole responsibility, not on behalf - * of any other Contributor, and only if You agree to indemnify, - * defend, and hold each Contributor harmless for any liability - * incurred by, or claims asserted against, such Contributor by reason - * of your accepting any such warranty or additional liability. - * - * END OF TERMS AND CONDITIONS - * - * APPENDIX: How to apply the Apache License to your work. - * - * To apply the Apache License to your work, attach the following - * boilerplate notice, with the fields enclosed by brackets "{}" - * replaced with your own identifying information. (Don't include - * the brackets!) The text should be enclosed in the appropriate - * comment syntax for the file format. We also recommend that a - * file or class name and description of purpose be included on the - * same "printed page" as the copyright notice for easier - * identification within third-party archives. - * - * Copyright {yyyy} {name of copyright owner} - * - * 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 - * - * http://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. - */ -package org.mineacademy.fo.jsonsimple.annotation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Marks an class for serialization. - * - * @author Ralph Niemitz/RalleYTN(ralph.niemitz@gmx.de) - * @version 2.0.0 - * @since 1.0.0 - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -public @interface JSONRoot { -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/Menu.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/Menu.java deleted file mode 100644 index 3ad37a5eabcb7039195e2105cb0a6868b2fc3bcf..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/Menu.java +++ /dev/null @@ -1,980 +0,0 @@ -package org.mineacademy.fo.menu; - -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.event.inventory.InventoryAction; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.metadata.FixedMetadataValue; -import org.bukkit.scheduler.BukkitRunnable; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.ItemUtil; -import org.mineacademy.fo.Messenger; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.constants.FoConstants; -import org.mineacademy.fo.event.MenuOpenEvent; -import org.mineacademy.fo.exception.EventHandledException; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.button.Button.DummyButton; -import org.mineacademy.fo.menu.button.ButtonReturnBack; -import org.mineacademy.fo.menu.model.InventoryDrawer; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.menu.model.MenuClickLocation; -import org.mineacademy.fo.model.SimpleSound; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.CompSound; -import org.mineacademy.fo.settings.SimpleLocalization; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NonNull; -import lombok.Setter; - -/** - * The core class of Menu. Represents a simple menu. - * - * <p> - * This is the recommended menu class for all plugins having menus. It offers - * having a parent menu, a return button and an info button explaining the - * purpose of the menu to the user. - * - * <p> - * HOW TO GET STARTED: Place final {@link Button} fields in your menu class and - * make a instatiate when in constructor. Those will be registered as clickable - * automatically. To render them, override {@link #getItemAt(int)} and make them - * return at your desired positions. - */ -public abstract class Menu { - - // -------------------------------------------------------------------------------- - // Static - // -------------------------------------------------------------------------------- - - /** - * The default sound when switching between menus. - */ - @Getter - @Setter - private static SimpleSound sound = new SimpleSound(CompSound.NOTE_STICKS.getSound(), .4F); - - /** - * Should we animate menu titles? - */ - @Getter - @Setter - private static boolean titleAnimationEnabled = true; - - /** - * The default duration of the new animated title before - * it is reverted back to the old one - * <p> - * Used in {@link #updateInventoryTitle(Menu, Player, String, String)} - */ - @Setter - private static int titleAnimationDurationTicks = 20; - - /** - * A placeholder to represent that no item should be displayed/returned - */ - protected static final ItemStack NO_ITEM = null; - - // -------------------------------------------------------------------------------- - // Actual class - // -------------------------------------------------------------------------------- - - /** - * Automatically registered Buttons in this menu (using reflection) - */ - private final List<Button> registeredButtons = new ArrayList<>(); - - /** - * The registrator responsible for scanning the class and making buttons - * function - */ - private boolean buttonsRegistered = false; - - /** - * Parent menu - */ - private final Menu parent; - - /** - * The return button to the previous menu, null if none - */ - private final Button returnButton; - - // -------------------------------------------------------------------------------- - // Other constructors - // -------------------------------------------------------------------------------- - - /** - * The inventory title of the menu, colors & are supported - */ - private String title = "&0Menu"; - - /** - * The size of the menu - */ - private Integer size = 9 * 3; - - /** - * The description of the menu - */ - @Getter(value = AccessLevel.PROTECTED) - private String[] info = null; - - /** - * The viewer of this menu, is null until {@link #displayTo(Player)} is called - */ - private Player viewer; - - /** - * Debug option to render empty spaces as glass panel having the slot id visible - */ - private boolean slotNumbersVisible; - - /** - * A one way boolean indicating this menu has been opened at least once - */ - private boolean opened = false; - - /** - * A one way boolean set to true in {@link #handleClose(Inventory)} - */ - private boolean closed = false; - - /** - * Create a new menu without parent menu with the size of 9*3 - * - * <p> - * You are encouraged to change the size and title of this menu in your - * constructor by calling {@link #setTitle(String)} and - * {@link #setSize(Integer)} - * - * <p> - * NB: The {@link #getViewer()} of this menu is yet null! - */ - protected Menu() { - this(null); - } - - /** - * Create a new menu with parent menu with the size of 9*3 - * - * <p> - * You are encouraged to change the size and title of this menu in your - * constructor by calling {@link #setTitle(String)} and - * {@link #setSize(Integer)} - * - * <p> - * NB: The {@link #getViewer()} of this menu is yet null! - * - * @param parent the parent menu - */ - protected Menu(final Menu parent) { - this(parent, false); - } - - /** - * Create a new menu with parent menu with the size of 9*3 - * - * <p> - * You are encouraged to change the size and title of this menu in your - * constructor by calling {@link #setTitle(String)} and - * {@link #setSize(Integer)} - * - * <p> - * NB: The {@link #getViewer()} of this menu is yet null! - * - * @param parent the parent - * @param returnMakesNewInstance should we re-instatiate the parent menu when - * returning to it? - */ - protected Menu(final Menu parent, final boolean returnMakesNewInstance) { - this.parent = parent; - this.returnButton = parent != null ? new ButtonReturnBack(parent, returnMakesNewInstance) : Button.makeEmpty(); - } - - /** - * Returns the current menu for player - * - * @param player the player - * @return the menu, or null if none - */ - public static final Menu getMenu(final Player player) { - return getMenu0(player, FoConstants.NBT.TAG_MENU_CURRENT); - } - - /** - * Returns the previous menu for player - * - * @param player the player - * @return the menu, or none - */ - public static final Menu getPreviousMenu(final Player player) { - return getMenu0(player, FoConstants.NBT.TAG_MENU_PREVIOUS); - } - - // Returns the menu associated with the players metadata, or null - private static Menu getMenu0(final Player player, final String tag) { - if (player.hasMetadata(tag)) { - final Menu menu = (Menu) player.getMetadata(tag).get(0).value(); - Valid.checkNotNull(menu, "Menu missing from " + player.getName() + "'s metadata '" + tag + "' tag!"); - - return menu; - } - - return null; - } - - // -------------------------------------------------------------------------------- - // Reflection to make life easier - // -------------------------------------------------------------------------------- - - /** - * Scans the menu class this menu extends and registers buttons - * - * @deprecated internal use only - */ - @Deprecated - protected final void registerButtons() { - registeredButtons.clear(); - - // Register buttons explicitly given - { - final List<Button> buttons = getButtonsToAutoRegister(); - - if (buttons != null) - registeredButtons.addAll(buttons); - } - - // Register buttons declared as fields - { - Class<?> lookup = getClass(); - - do - for (final Field f : lookup.getDeclaredFields()) - registerButton0(f); - while (Menu.class.isAssignableFrom(lookup = lookup.getSuperclass())); - } - } - - // Scans the class and register fields that extend Button class - private void registerButton0(final Field field) { - field.setAccessible(true); - - final Class<?> type = field.getType(); - - if (Button.class.isAssignableFrom(type)) { - final Button button = (Button) ReflectionUtil.getFieldContent(field, this); - - Valid.checkNotNull(button, "Null button field named " + field.getName() + " in " + this); - registeredButtons.add(button); - - } else if (Button[].class.isAssignableFrom(type)) { - Valid.checkBoolean(Modifier.isFinal(field.getModifiers()), "Report / Button[] field must be final: " + field); - final Button[] buttons = (Button[]) ReflectionUtil.getFieldContent(field, this); - - Valid.checkBoolean(buttons != null && buttons.length > 0, "Null " + field.getName() + "[] in " + this); - registeredButtons.addAll(Arrays.asList(buttons)); - } - } - - /* - * Utility method to register buttons if they yet have not been registered - * - * This method will only register them once until the server is reset - */ - private final void registerButtonsIfHasnt() { - if (!buttonsRegistered) { - registerButtons(); - - buttonsRegistered = true; - } - } - - /** - * Returns a list of buttons that should be registered manually. - * - * NOTICE: Button fields in your class are registered automatically, do not add - * them here - * - * @return button list, null by default - */ - protected List<Button> getButtonsToAutoRegister() { - return null; - } - - /** - * Attempts to find a clickable registered button in this menu having the same - * icon as the given item stack - * - * @param fromItem the itemstack to compare to - * @return the buttor or null if not found - */ - protected final Button getButton(final ItemStack fromItem) { - registerButtonsIfHasnt(); - - if (fromItem != null) - for (final Button button : registeredButtons) { - Valid.checkNotNull(button, "Menu button is null at " + getClass().getSimpleName()); - Valid.checkNotNull(button.getItem(), "Menu " + getTitle() + " contained button " + button + " with empty item!"); - - if (ItemUtil.isSimilar(fromItem, button.getItem())) - return button; - } - - return null; - } - - /** - * Return a new instance of this menu - * - * <p> - * You must override this in certain cases - * - * @return the new instance, of null - * @throws if new instance could not be made, for example when the menu is - * taking constructor params - */ - public Menu newInstance() { - try { - return ReflectionUtil.instantiate(getClass()); - } catch (final Throwable t) { - try { - final Object parent = getClass().getMethod("getParent").invoke(getClass()); - - if (parent != null) - return ReflectionUtil.instantiate(getClass(), parent); - } catch (final Throwable tt) { - } - - t.printStackTrace(); - } - - throw new FoException("Could not instantiate menu of " + getClass() + ", override the method 'newInstance()' or ensure you have a public constructor which takes only one parameter "); - } - - // -------------------------------------------------------------------------------- - // Rendering the menu - // -------------------------------------------------------------------------------- - - /** - * Display this menu to the player - * - * @param player the player - */ - public final void displayTo(final Player player) { - Valid.checkNotNull(this.size, "Size not set in " + this + " (call setSize in your constructor)"); - Valid.checkNotNull(this.title, "Title not set in " + this + " (call setTitle in your constructor)"); - Valid.checkBoolean(!this.closed, "One menu instance can be shown to one player only, " + this + " is already visible for " + this.viewer); - - viewer = player; - registerButtonsIfHasnt(); - - // Draw the menu - final InventoryDrawer drawer = InventoryDrawer.of(size, title); - - // Compile bottom bar - compileBottomBar0().forEach((slot, item) -> drawer.setItem(slot, item)); - - // Set items defined by classes upstream - for (int i = 0; i < drawer.getSize(); i++) { - final ItemStack item = getItemAt(i); - - if (item != null && !drawer.isSet(i)) - drawer.setItem(i, item); - } - - // Allow last minute modifications - onDisplay(drawer); - - // Render empty slots as slot numbers if enabled - debugSlotNumbers(drawer); - - // Call event after items have been set to allow to get them - if (!Common.callEvent(new MenuOpenEvent(this, drawer, player))) - return; - - // Prevent menu in conversation - if (player.isConversing()) { - player.sendRawMessage(Common.colorize(SimpleLocalization.Menu.CANNOT_OPEN_DURING_CONVERSATION)); - - return; - } - - // Play the pop sound - sound.play(player); - - // Register previous menu if exists - { - final Menu previous = getMenu(player); - - if (previous != null) - player.setMetadata(FoConstants.NBT.TAG_MENU_PREVIOUS, new FixedMetadataValue(SimplePlugin.getInstance(), previous)); - } - - // Register current menu - Common.runLater(1, () -> { - drawer.display(player); - - player.setMetadata(FoConstants.NBT.TAG_MENU_CURRENT, new FixedMetadataValue(SimplePlugin.getInstance(), Menu.this)); - - opened = true; - }); - } - - /** - * Sets all empty slots to light gray pane or adds a slot number to existing - * items lores if {@link #slotNumbersVisible} is true - * - * @param drawer - */ - private void debugSlotNumbers(final InventoryDrawer drawer) { - if (slotNumbersVisible) - for (int slot = 0; slot < drawer.getSize(); slot++) { - final ItemStack item = drawer.getItem(slot); - - if (item == null) - drawer.setItem(slot, ItemCreator.of(CompMaterial.LIGHT_GRAY_STAINED_GLASS_PANE, "Slot " + slot).build().make()); - } - } - - /** - * Called automatically before the menu is displayed but after all items have - * been drawed - * - * <p> - * Override for custom last-minute modifications - * - * @param drawer the drawer - */ - protected void onDisplay(final InventoryDrawer drawer) { - } - - /** - * Redraws and refreshes all buttons - */ - public final void restartMenu() { - restartMenu(null); - } - - /** - * Redraws and re-register all buttons while sending a title animation to the - * player - * - * @param animatedTitle the animated title - */ - public final void restartMenu(final String animatedTitle) { - registerButtons(); - redraw(); - - if (animatedTitle != null) - animateTitle(animatedTitle); - } - - /** - * Redraws the bottom bar and updates inventory - */ - protected final void redraw() { - final Inventory inv = getViewer().getOpenInventory().getTopInventory(); - Valid.checkBoolean(inv.getType() == InventoryType.CHEST, getViewer().getName() + "'s inventory closed in the meanwhile (now == " + inv.getType() + ")."); - - for (int i = 0; i < size; i++) { - final ItemStack item = getItemAt(i); - - Valid.checkBoolean(i < inv.getSize(), "Item (" + (item != null ? item.getType() : "null") + ") position (" + i + ") > inv size (" + inv.getSize() + ")"); - inv.setItem(i, item); - } - - compileBottomBar0().forEach((slot, item) -> inv.setItem(slot, item)); - getViewer().updateInventory(); - } - - /** - * Draws the bottom bar for the player inventory - * - * @return - */ - private Map<Integer, ItemStack> compileBottomBar0() { - final Map<Integer, ItemStack> items = new HashMap<>(); - - if (addInfoButton() && getInfo() != null) - items.put(getInfoButtonPosition(), Button.makeInfo(getInfo()).getItem()); - - if (addReturnButton() && !(returnButton instanceof DummyButton)) - items.put(getReturnButtonPosition(), returnButton.getItem()); - - return items; - } - - // -------------------------------------------------------------------------------- - // Convenience messenger functions - // -------------------------------------------------------------------------------- - - /** - * Send a message to the {@link #getViewer()} - * - * @param messages - */ - public final void tell(String... messages) { - Common.tell(this.viewer, messages); - } - - /** - * Send a message to the {@link #getViewer()} - * - * @param message - */ - public final void tellInfo(String message) { - Messenger.info(this.viewer, message); - } - - /** - * Send a message to the {@link #getViewer()} - * - * @param message - */ - public final void tellSuccess(String message) { - Messenger.success(this.viewer, message); - } - - /** - * Send a message to the {@link #getViewer()} - * - * @param message - */ - public final void tellWarn(String message) { - Messenger.warn(this.viewer, message); - } - - /** - * Send a message to the {@link #getViewer()} - * - * @param message - */ - public final void tellError(String message) { - Messenger.error(this.viewer, message); - } - - /** - * Send a message to the {@link #getViewer()} - * - * @param message - */ - public final void tellQuestion(String message) { - Messenger.question(this.viewer, message); - } - - /** - * Send a message to the {@link #getViewer()} - * - * @param message - */ - public final void tellAnnounce(String message) { - Messenger.announce(this.viewer, message); - } - - // -------------------------------------------------------------------------------- - // Animations - // -------------------------------------------------------------------------------- - - /** - * Animate the title of this menu - * - * <p> - * Automatically reverts back to the old title after 1 second - * - * @param title the title to animate - */ - public final void animateTitle(final String title) { - if (titleAnimationEnabled) - PlayerUtil.updateInventoryTitle(this, getViewer(), title, getTitle(), titleAnimationDurationTicks); - } - - protected final void animate(int periodTicks, MenuRunnable task) { - Common.runTimer(2, periodTicks, this.wrapAnimation(task)); - } - - /** - * Start a repetitive task with the given period in ticks, - * that is automatically stopped if the viewer no longer sees this menu. - * - * @param periodTicks - * @param task - */ - protected final void animateAsync(int periodTicks, MenuRunnable task) { - Common.runTimerAsync(2, periodTicks, this.wrapAnimation(task)); - } - - /* - * Helper method to create a bukkit runnable - */ - private BukkitRunnable wrapAnimation(MenuRunnable task) { - return new BukkitRunnable() { - - @Override - public void run() { - - if (Menu.this.closed) { - this.cancel(); - - return; - } - - try { - task.run(); - - } catch (final EventHandledException ex) { - this.cancel(); - } - } - }; - } - - /** - * A special wrapper for animating menus - */ - @FunctionalInterface - public interface MenuRunnable extends Runnable { - - /** - * Cancel the menu animation - */ - default void cancel() { - throw new EventHandledException(); - } - } - - // -------------------------------------------------------------------------------- - // Menu functions - // -------------------------------------------------------------------------------- - - /** - * Returns the item at a certain slot - * - * @param slot the slow - * @return the item, or null if no icon at the given slot (default) - */ - public ItemStack getItemAt(final int slot) { - return NO_ITEM; - } - - /** - * Get the info button position - * - * @return the slot which info buttons is located on - */ - protected int getInfoButtonPosition() { - return size - 9; - } - - /** - * Should we automatically add the return button to the bottom left corner? - * - * @return true if the return button should be added, true by default - */ - protected boolean addReturnButton() { - return true; - } - - /** - * Should we automatically add an info button {@link #getInfo()} at the - * {@link #getInfoButtonPosition()} ? - * - * @return - */ - protected boolean addInfoButton() { - return true; - } - - /** - * Get the return button position - * - * @return the slot which return buttons is located on - */ - protected int getReturnButtonPosition() { - return size - 1; - } - - /** - * Calculates the center slot of this menu - * - * <p> - * Credits to Gober at - * https://www.spigotmc.org/threads/get-the-center-slot-of-a-menu.379586/ - * - * @return the estimated center slot - */ - protected final int getCenterSlot() { - final int pos = size / 2; - - return size % 2 == 1 ? pos : pos - 5; - } - - /** - * Should we prevent the click or drag? - * - * @param location the click location - * @param slot the slot - * @param clicked the clicked item - * @param cursor the cursor - * @return if the action is cancelled in the {@link InventoryClickEvent}, false - * by default - * - * @deprecated sometimes does not work correctly due to flaws in server to - * client packet communication - do not rely on this - */ - @Deprecated - protected boolean isActionAllowed(final MenuClickLocation location, final int slot, final ItemStack clicked, final ItemStack cursor) { - return false; - } - - /** - * The title of this menu - * - * @return the menu title - */ - public final String getTitle() { - return title; - } - - /** - * Sets the title of this inventory, this change is reflected - * when this menu is already displayed to a given player. - * - * @param title the new title - */ - protected final void setTitle(final String title) { - this.title = title; - - if (this.viewer != null && this.opened) - PlayerUtil.updateInventoryTitle(this.viewer, title); - } - - /** - * Return the parent menu or null - * - * @return - */ - public final Menu getParent() { - return parent; - } - - /** - * Get the size of this menu - * - * @return - */ - public final Integer getSize() { - return size; - } - - /** - * Sets the size of this menu (without updating the player container - if you - * want to update it call {@link #restartMenu()}) - * - * @param size - */ - protected final void setSize(final Integer size) { - this.size = size; - } - - /** - * Set the menu's description - * - * <p> - * Used to create an info bottom in bottom left corner, see - * {@link Button#makeInfo(String...)} - * - * @param info the info to set - */ - protected final void setInfo(final String... info) { - this.info = info; - } - - /** - * Get the viewer that this instance of this menu is associated with - * - * @return the viewer of this instance, or null - */ - protected final Player getViewer() { - return viewer; - } - - /** - * Sets the viewer for this instance of this menu - * - * @param viewer - */ - protected final void setViewer(@NonNull final Player viewer) { - this.viewer = viewer; - } - - /** - * Return the top opened inventory if viewer exists - * - * @return - */ - protected final Inventory getInventory() { - Valid.checkNotNull(viewer, "Cannot get inventory when there is no viewer!"); - - final Inventory topInventory = viewer.getOpenInventory().getTopInventory(); - Valid.checkNotNull(topInventory, "Top inventory is null!"); - - return topInventory; - } - - /** - * Get the open inventory content to match the array length, cloning items - * preventing ID mismatch in yaml files - * - * @param from - * @param to - * @return - */ - protected final ItemStack[] getContent(final int from, final int to) { - final ItemStack[] content = getInventory().getContents(); - final ItemStack[] copy = new ItemStack[content.length]; - - for (int i = from; i < copy.length; i++) { - final ItemStack item = content[i]; - - copy[i] = item != null ? item.clone() : null; - } - - return Arrays.copyOfRange(copy, from, to); - } - - /** - * Updates a slot in this menu - * - * @param slot - * @param item - */ - protected final void setItem(int slot, ItemStack item) { - final Inventory inventory = this.getInventory(); - - inventory.setItem(slot, item); - } - - /** - * If you wonder what slot numbers does each empty slot in your menu has then - * set this to true in your constructor - * - * <p> - * Only takes change when used in constructor or before calling - * {@link #displayTo(Player)} and cannot be updated in {@link #restartMenu()} - * - * @param visible - */ - protected final void setSlotNumbersVisible() { - this.slotNumbersVisible = true; - } - - /** - * Return if the given player is still viewing this menu, we compare - * the menu class of the menu the player is viewing and return true if both equal. - * - * @param player - * @return - */ - public final boolean isViewing(Player player) { - final Menu menu = Menu.getMenu(player); - - return menu != null && menu.getClass().getName().equals(this.getClass().getName()); - } - - // -------------------------------------------------------------------------------- - // Events - // -------------------------------------------------------------------------------- - - /** - * Called automatically when the menu is clicked. - * - * <p> - * By default we call the shorter {@link #onMenuClick(Player, int, ItemStack)} - * method. - * - * @param player the player - * @param slot the slot - * @param action the action - * @param click the click - * @param cursor the cursor - * @param clicked the item clicked - * @param cancelled is the event cancelled? - */ - protected void onMenuClick(final Player player, final int slot, final InventoryAction action, final ClickType click, final ItemStack cursor, final ItemStack clicked, final boolean cancelled) { - this.onMenuClick(player, slot, clicked); - } - - /** - * Called automatically when the menu is clicked - * - * @param player the player - * @param slot the slot - * @param clicked the item clicked - */ - protected void onMenuClick(final Player player, final int slot, final ItemStack clicked) { - } - - /** - * Called automatically when a registered button is clicked - * - * <p> - * By default this method parses the click into - * {@link Button#onClickedInMenu(Player, Menu, ClickType)} - * - * @param player the player - * @param slot the slot - * @param action the action - * @param click the click - * @param button the button - */ - protected void onButtonClick(final Player player, final int slot, final InventoryAction action, final ClickType click, final Button button) { - button.onClickedInMenu(player, this, click); - } - - /** - * Handles the menu close, this does not close the inventory, only cleans up internally, - * do not use. - * - * @deprecated internal use only - * @param inventory - */ - @Deprecated - protected final void handleClose(Inventory inventory) { - this.viewer.removeMetadata(FoConstants.NBT.TAG_MENU_CURRENT, SimplePlugin.getInstance()); - this.closed = true; - - this.onMenuClose(this.viewer, inventory); - } - - /** - * Called automatically when the menu is closed - * - * @param player the player - * @param inventory the menu inventory that is being closed - */ - protected void onMenuClose(final Player player, final Inventory inventory) { - } - - @Override - public String toString() { - return getClass().getSimpleName() + "{}"; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/MenuListener.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/MenuListener.java deleted file mode 100644 index 7075bac85c21461ecd25771a526571914cc26b30..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/MenuListener.java +++ /dev/null @@ -1,95 +0,0 @@ -package org.mineacademy.fo.menu; - -import org.bukkit.entity.Player; -import org.bukkit.event.Event.Result; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.inventory.InventoryAction; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.inventory.InventoryCloseEvent; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.model.MenuClickLocation; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.fo.settings.SimpleLocalization; - -/** - * The bukkit listener responsible for menus to function. - */ -public final class MenuListener implements Listener { - - /** - * Handles closing menus - * - * @param event the event - */ - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) - public void onMenuClose(final InventoryCloseEvent event) { - if (!(event.getPlayer() instanceof Player)) - return; - - final Player player = (Player) event.getPlayer(); - final Menu menu = Menu.getMenu(player); - - if (menu != null) - menu.handleClose(event.getInventory()); - } - - /** - * Handles clicking in menus - * - * @param event the event - */ - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onMenuClick(final InventoryClickEvent event) { - if (!(event.getWhoClicked() instanceof Player)) - return; - - final Player player = (Player) event.getWhoClicked(); - final Menu menu = Menu.getMenu(player); - - if (menu != null) { - final ItemStack slotItem = event.getCurrentItem(); - final ItemStack cursor = event.getCursor(); - final Inventory clickedInv = Remain.getClickedInventory(event); - - final InventoryAction action = event.getAction(); - final MenuClickLocation whereClicked = clickedInv != null ? clickedInv.getType() == InventoryType.CHEST ? MenuClickLocation.MENU : MenuClickLocation.PLAYER_INVENTORY : MenuClickLocation.OUTSIDE; - - final boolean allowed = menu.isActionAllowed(whereClicked, event.getSlot(), slotItem, cursor); - - if (action.toString().contains("PICKUP") || action.toString().contains("PLACE") || action.toString().equals("SWAP_WITH_CURSOR") || action == InventoryAction.CLONE_STACK) { - if (whereClicked == MenuClickLocation.MENU) - try { - final Button button = menu.getButton(slotItem); - - if (button != null) - menu.onButtonClick(player, event.getSlot(), action, event.getClick(), button); - else - menu.onMenuClick(player, event.getSlot(), action, event.getClick(), cursor, slotItem, !allowed); - - } catch (final Throwable t) { - Common.tell(player, SimpleLocalization.Menu.ERROR); - player.closeInventory(); - - Common.error(t, "Error clicking in menu " + menu); - } - - if (!allowed) { - event.setResult(Result.DENY); - - player.updateInventory(); - } - - } else if (action == InventoryAction.MOVE_TO_OTHER_INVENTORY || whereClicked != MenuClickLocation.PLAYER_INVENTORY) { - event.setResult(Result.DENY); - - player.updateInventory(); - } - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/MenuPagged.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/MenuPagged.java deleted file mode 100644 index 47bc8f60deb6c2ee0f44d767af478966ec08e23b..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/MenuPagged.java +++ /dev/null @@ -1,412 +0,0 @@ -package org.mineacademy.fo.menu; - -import java.util.List; -import java.util.Map; - -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.event.inventory.InventoryAction; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MathUtil; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.model.InventoryDrawer; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.settings.SimpleLocalization; - -import lombok.Getter; -import lombok.Setter; -import lombok.val; - -/** - * An advanced menu listing items with automatic page support - * - * @param <T> the item that each page consists of - */ -public abstract class MenuPagged<T> extends Menu { - - /** - * The active page button material, used in buttons to previous/next pages - * when they can be clicked (such as to go to the next/previous page) - * - * Defaults to lime dye - */ - @Getter - @Setter - private static CompMaterial activePageButton = CompMaterial.LIME_DYE; - - /** - * The inactive page button material, used in buttons to previous/next - * pages when they cannot be clicked (i.e. on the first/last page) - * - * Defaults to gray dye - */ - @Getter - @Setter - private static CompMaterial inactivePageButton = CompMaterial.GRAY_DYE; - - /** - * The pages by the page number, containing a list of items - */ - @Getter - private final Map<Integer, List<T>> pages; - - /** - * The current page - */ - @Getter - private int currentPage = 1; - - /** - * The next button automatically generated - */ - private Button nextButton; - - /** - * The "go to previous page" button automatically generated - */ - private Button prevButton; - - /** - * Create a new paged menu where each page has 3 rows + 1 bottom bar - * - * @param pages the pages - */ - protected MenuPagged(final Iterable<T> pages) { - this(null, pages); - } - - /** - * Create a new paged menu - * - * @param parent the parent menu - * @param pages the pages the pages - */ - protected MenuPagged(final Menu parent, final Iterable<T> pages) { - this(null, parent, pages, false); - } - - /** - * Create a new paged menu - * - * @param parent - * @param pages - * @param returnMakesNewInstance - */ - protected MenuPagged(final Menu parent, final Iterable<T> pages, final boolean returnMakesNewInstance) { - this(null, parent, pages, returnMakesNewInstance); - } - - /** - * Create a new paged menu - * - * @param pageSize size of the menu, a multiple of 9 (keep in mind we already add - * 1 row there) - * @param pages the pages - * @deprecated we recommend you don't set the page size for the menu to - * autocalculate - */ - @Deprecated - protected MenuPagged(final int pageSize, final Iterable<T> pages) { - this(pageSize, null, pages); - } - - /** - * Create a new paged menu - * - * @param pageSize size of the menu, a multiple of 9 (keep in mind we already add - * 1 row there) - * @param parent the parent menu - * @param pages the pages the pages - * @deprecated we recommend you don't set the page size for the menu to - * autocalculate - */ - @Deprecated - protected MenuPagged(final int pageSize, final Menu parent, final Iterable<T> pages) { - this(pageSize, parent, pages, false); - } - - /** - * Create a new paged menu - * - * @param pageSize - * @param parent - * @param pages - * @param returnMakesNewInstance * - * @deprecated we recommend you don't set the page size for the menu to - * autocalculate - */ - @Deprecated - protected MenuPagged(final int pageSize, final Menu parent, final Iterable<T> pages, final boolean returnMakesNewInstance) { - this((Integer) pageSize, parent, pages, returnMakesNewInstance); - } - - /** - * Create a new paged menu - * - * @param pageSize size of the menu, a multiple of 9 (keep in mind we already add - * 1 row there) - * @param parent the parent menu - * @param pages the pages the pages - * @param returnMakesNewInstance should we re-instatiate the parent menu when returning to it? - */ - private MenuPagged(final Integer pageSize, final Menu parent, final Iterable<T> pages, final boolean returnMakesNewInstance) { - super(parent, returnMakesNewInstance); - - final int items = getItemAmount(pages); - final int autoPageSize = pageSize != null ? pageSize : items <= 9 ? 9 * 1 : items <= 9 * 2 ? 9 * 2 : items <= 9 * 3 ? 9 * 3 : items <= 9 * 4 ? 9 * 4 : 9 * 5; - - this.currentPage = 1; - this.pages = Common.fillPages(autoPageSize, pages); - - setSize(9 + autoPageSize); - setButtons(); - } - - @SuppressWarnings("unused") - private int getItemAmount(final Iterable<T> pages) { - int amount = 0; - - for (final T t : pages) - amount++; - - return amount; - } - - // Render the next/prev buttons - private void setButtons() { - final boolean hasPages = pages.size() > 1; - - // Set previous button - prevButton = hasPages ? formPreviousButton() : Button.makeEmpty(); - - // Set next page button - nextButton = hasPages ? formNextButton() : Button.makeEmpty(); - } - - /** - * Return the button to list the previous page, - * override to customize it. - * - * @return - */ - public Button formPreviousButton() { - return new Button() { - final boolean canGo = currentPage > 1; - - @Override - public void onClickedInMenu(final Player pl, final Menu menu, final ClickType click) { - if (canGo) { - currentPage = MathUtil.range(currentPage - 1, 1, pages.size()); - - updatePage(); - } - } - - @Override - public ItemStack getItem() { - final int previousPage = currentPage - 1; - - return ItemCreator - .of(canGo ? activePageButton : inactivePageButton) - .name(previousPage == 0 ? SimpleLocalization.Menu.PAGE_FIRST : SimpleLocalization.Menu.PAGE_PREVIOUS.replace("{page}", String.valueOf(previousPage))) - .build().make(); - } - }; - } - - /** - * Return the button to list the next page, - * override to customize it. - * - * @return - */ - public Button formNextButton() { - return new Button() { - final boolean canGo = currentPage < pages.size(); - - @Override - public void onClickedInMenu(final Player pl, final Menu menu, final ClickType click) { - if (canGo) { - currentPage = MathUtil.range(currentPage + 1, 1, pages.size()); - - updatePage(); - } - } - - @Override - public ItemStack getItem() { - final boolean lastPage = currentPage == pages.size(); - - return ItemCreator - .of(canGo ? activePageButton : inactivePageButton) - .name(lastPage ? SimpleLocalization.Menu.PAGE_LAST : SimpleLocalization.Menu.PAGE_NEXT.replace("{page}", String.valueOf(currentPage + 1))) - .build().make(); - } - }; - } - - // Reinits the menu and plays the anvil sound - private void updatePage() { - setButtons(); - redraw(); - registerButtons(); - - Menu.getSound().play(getViewer()); - PlayerUtil.updateInventoryTitle(getViewer(), compileTitle0()); - } - - // Compile title and page numbers - private String compileTitle0() { - final boolean canAddNumbers = addPageNumbers() && pages.size() > 1; - - return getTitle() + (canAddNumbers ? " &8" + currentPage + "/" + pages.size() : ""); - } - - /** - * Automatically prepend the title with page numbers - * <p> - * Override for a custom last-minute implementation, but - * ensure to call the super method otherwise no title will - * be set in {@link InventoryDrawer} - * - * @param - */ - @Override - protected final void onDisplay(final InventoryDrawer drawer) { - drawer.setTitle(compileTitle0()); - } - - /** - * Return the {@link ItemStack} representation of an item on a certain page - * <p> - * Use {@link ItemCreator} for easy creation. - * - * @param item the given object, for example Arena - * @return the itemstack, for example diamond sword having arena name - */ - protected abstract ItemStack convertToItemStack(T item); - - /** - * Called automatically when an item is clicked - * - * @param player the player who clicked - * @param item the clicked item - * @param click the click type - */ - protected abstract void onPageClick(Player player, T item, ClickType click); - - /** - * Utility: Shall we send update packet when the menu is clicked? - * - * @return true by default - */ - protected boolean updateButtonOnClick() { - return true; - } - - /** - * Return true if you want our system to add page/totalPages suffix after - * your title, true by default - * - * @return - */ - protected boolean addPageNumbers() { - return true; - } - - /** - * Return if there are no items at all - * - * @return - */ - protected boolean isEmpty() { - return pages.isEmpty() || pages.get(0).isEmpty(); - } - - /** - * Automatically get the correct item from the actual page, including - * prev/next buttons - * - * @param slot the slot - * @return the item, or null - */ - @Override - public ItemStack getItemAt(final int slot) { - if (slot < getCurrentPageItems().size()) { - final T object = getCurrentPageItems().get(slot); - - if (object != null) - return convertToItemStack(object); - } - - if (slot == this.getPreviousButtonPosition()) - return prevButton.getItem(); - - if (slot == this.getNextButtonPosition()) - return nextButton.getItem(); - - return null; - } - - /** - * Override to edit where the button to previous page is, - * defaults to "size of the menu - 6" - * - * @return - */ - protected int getPreviousButtonPosition() { - return this.getSize() - 6; - } - - /** - * Override to edit where the button to next page is, - * defaults to "size of the menu - 4" - * - * @return - */ - protected int getNextButtonPosition() { - return this.getSize() - 4; - } - - /** - * {@inheritDoc} - */ - @Override - public final void onMenuClick(final Player player, final int slot, final InventoryAction action, final ClickType click, final ItemStack cursor, final ItemStack clicked, final boolean cancelled) { - if (slot < getCurrentPageItems().size()) { - final T obj = getCurrentPageItems().get(slot); - - if (obj != null) { - final val prevType = player.getOpenInventory().getType(); - onPageClick(player, obj, click); - - if (updateButtonOnClick() && prevType == player.getOpenInventory().getType()) - player.getOpenInventory().getTopInventory().setItem(slot, getItemAt(slot)); - } - } - } - - // Do not allow override - @Override - public final void onButtonClick(final Player player, final int slot, final InventoryAction action, final ClickType click, final Button button) { - super.onButtonClick(player, slot, action, click, button); - } - - // Do not allow override - @Override - public final void onMenuClick(final Player player, final int slot, final ItemStack clicked) { - throw new FoException("Simplest click unsupported"); - } - - // Get all items in a page - private List<T> getCurrentPageItems() { - Valid.checkBoolean(pages.containsKey(currentPage - 1), "The menu has only " + pages.size() + " pages, not " + currentPage + "!"); - - return pages.get(currentPage - 1); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/MenuQuantitable.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/MenuQuantitable.java deleted file mode 100644 index 08daa2fa5696cf905b03740c9ab2bacc5ee62f0f..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/MenuQuantitable.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.mineacademy.fo.menu; - -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.menu.model.MenuQuantity; -import org.mineacademy.fo.remain.CompMaterial; - -/** - * Advanced menu concept allowing to change quality of an item by more than 1 on - * a single click. - * <p> - * For example: You want to chance the spawn percentage from 1% to 100% so you - * set the editing quantity to 20 and you only need to click the item 5 times - * instead of 99 times. - * <p> - * We added this as an interface so you can extend all other kinds of menus - */ -public interface MenuQuantitable { - - /** - * Get the current quantity of editing - * - * @return the quantity edit - */ - MenuQuantity getQuantity(); - - /** - * Set a new quantity of editing - * - * @param newQuantity the new quantity - */ - void setQuantity(MenuQuantity newQuantity); - - /** - * Get the next edit quantity from click - * - * @param clickType the click type - * @return the next quantity (higher or lower depending on the click) - */ - default int getNextQuantity(ClickType clickType) { - return clickType == ClickType.LEFT ? -+getQuantity().getAmount() : getQuantity().getAmount(); - } - - /** - * Get the button that is responsible for setting the quantity edit - * Implemented by default. - * - * @param menu the menu - * @return the button that is responsible for setting the quantity edit - */ - default Button getEditQuantityButton(Menu menu) { - return new Button() { - - @Override - public final void onClickedInMenu(Player pl, Menu clickedMenu, ClickType click) { - setQuantity(click == ClickType.LEFT ? getQuantity().previous() : getQuantity().next()); - menu.redraw(); - - menu.animateTitle("&9Editing quantity set to " + getQuantity().getAmount()); - } - - @Override - public ItemStack getItem() { - return ItemCreator - .of( - CompMaterial.STRING, - "Edit Quantity: &7" + getQuantity().getAmount(), - "", - "&8< &7Left click to decrease", - "&8> &7Right click to increase") - .build().make(); - } - }; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/MenuTools.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/MenuTools.java deleted file mode 100644 index 0c16bb542faa24aceb45ed6bee98e2418cfb405a..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/MenuTools.java +++ /dev/null @@ -1,263 +0,0 @@ -package org.mineacademy.fo.menu; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.event.inventory.InventoryAction; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.PlayerInventory; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.menu.tool.Tool; -import org.mineacademy.fo.model.SimpleEnchant; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompItemFlag; -import org.mineacademy.fo.settings.SimpleLocalization; - -/** - * A standardized menu to display a list of tools player can toggle to get in - * his inventory - */ -public abstract class MenuTools extends Menu { - - /** - * The list of tools - */ - private final List<ToggleableTool> tools; - - /** - * Make a new tools menu - */ - protected MenuTools() { - this(null); - } - - /** - * Make a new tools menu with parent - * - * @param parent - */ - protected MenuTools(final Menu parent) { - super(parent); - - this.tools = compile0(compileTools()); - - final int items = tools.size(); - final int pages = items < 9 ? 9 * 1 : items < 9 * 2 ? 9 * 2 : items < 9 * 3 ? 9 * 3 : items < 9 * 4 ? 9 * 4 : 9 * 5; - - setSize(pages); - setTitle(SimpleLocalization.Menu.TITLE_TOOLS); - } - - /** - * Attempts to automatically compile a set of tools Accepts an array containing - * {@link Button}, {@link ItemStack} or enter 0 for air. - * - * @return the array of items in this menu - */ - protected abstract Object[] compileTools(); - - /** - * Helper method you can use directly in your {@link #compileTools()} method - * that will automatically scan all classes in your plugin that extend the given - * class and return those who contain the given field: - * <p> - * public static Tool instance = new X() (X = the class) - * - * @param extendingClass - * @return - */ - protected Object[] lookupTools(final Class<? extends Tool> extendingClass) { - final List<Object> instances = new ArrayList<>(); - - for (final Class<?> clazz : ReflectionUtil.getClasses(SimplePlugin.getInstance(), extendingClass)) - try { - final Object instance = ReflectionUtil.getFieldContent(clazz, "instance", null); - - instances.add(instance); - - } catch (final Throwable ex) { - // continue, unsupported tool. It must have an "instance" static - // field with its instance - } - - return instances.toArray(); - } - - // Compiles the given tools from makeTools() - private final List<ToggleableTool> compile0(final Object... tools) { - final List<ToggleableTool> list = new ArrayList<>(); - - if (tools != null) - for (final Object tool : tools) - list.add(new ToggleableTool(tool)); - - return list; - } - - /** - * Returns the {@link #compileTools()} at their respective positions for each - * slot - * - * @param slot the slot - * @return the tool or null - */ - @Override - public final ItemStack getItemAt(final int slot) { - return slot < tools.size() ? tools.get(slot).get(getViewer()) : null; - } - - /** - * {@inheritDoc} - */ - @Override - public final void onMenuClick(final Player pl, final int slot, final InventoryAction action, final ClickType click, final ItemStack cursor, final ItemStack item, final boolean cancelled) { - final ItemStack it = getItemAt(slot); - final ToggleableTool tool = it != null ? findTool(it) : null; - - if (tool != null) { - tool.giveOrTake(pl); - - redraw(); - } - } - - // Converts the clicked item into a toggleable tool - private final ToggleableTool findTool(final ItemStack item) { - for (final ToggleableTool h : tools) - if (h.equals(item)) - return h; - - return null; - } - - @Override - protected int getInfoButtonPosition() { - return getSize() - 1; - } - - /** - * Compiles an automated tools menu. - * - * @param pluginToolClasses We will scan your plugin for this kind of class and - * all classes extending it will be loaded into the - * menu - * @param description the menu description - * @return - */ - public static final MenuTools of(final Class<? extends Tool> pluginToolClasses, final String... description) { - return new MenuTools() { - - @Override - protected Object[] compileTools() { - return lookupTools(pluginToolClasses); - } - - @Override - protected String[] getInfo() { - return description; - } - }; - } -} - -/** - * Represents a tool that can be "toggled", meaning the player can only have 1 - * of the tool in their inventory that is either taken or given on click. - */ -final class ToggleableTool { - - /** - * The item representation - */ - private final ItemStack item; - - /** - * Internal flag representing if the player had the tool, since we last checked - */ - private boolean playerHasTool = false; - - /** - * Create a new tool - * - * @param unparsed the object to parse, see {@link MenuTools#compileTools()} - */ - ToggleableTool(final Object unparsed) { - if (unparsed != null) { - if (unparsed instanceof ItemStack) - this.item = (ItemStack) unparsed; - - else if (unparsed instanceof Tool) - this.item = ((Tool) unparsed).getItem(); - - else if (unparsed instanceof Number && ((Number) unparsed).intValue() == 0) - this.item = new ItemStack(Material.AIR); - - else - throw new FoException("Unknown tool: " + unparsed + " (we only accept ItemStack, Tool's instance or 0 for air)"); - - } else - this.item = new ItemStack(Material.AIR); - } - - /** - * Returns the itemstack automatically, different if the player has or does not - * have it already - * - * @param player - * @return the item - */ - ItemStack get(final Player player) { - update(player); - - return playerHasTool ? getToolWhenHas() : getToolWhenHasnt(); - } - - private void update(final Player pl) { - playerHasTool = pl.getOpenInventory().getBottomInventory().containsAtLeast(item, 1); - } - - // Return the dummy placeholder tool when the player already has it - private ItemStack getToolWhenHas() { - return ItemCreator.of(item).enchant(new SimpleEnchant(Enchantment.ARROW_INFINITE, 1)).flag(CompItemFlag.HIDE_ENCHANTS).lores(Arrays.asList("", "&cYou already have this item.", "&7Click to take it away.")).build().make(); - } - - // Return the actual working tool in case player does not have it yet - private ItemStack getToolWhenHasnt() { - return item; - } - - /** - * Gives or takes the tool for the player depending on {@link #playerHasTool} - * - * @param player the player - */ - void giveOrTake(final Player player) { - final PlayerInventory inv = player.getInventory(); - - if (playerHasTool = !playerHasTool) - inv.addItem(item); - - else - inv.removeItem(item); - } - - boolean equals(final ItemStack item) { - return getToolWhenHas().isSimilar(item) || getToolWhenHasnt().isSimilar(item); - } - - /** - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "Toggleable{" + item.getType() + "}"; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/button/Button.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/button/Button.java deleted file mode 100644 index 9caade41f7ae5a9f0eceac1ce2951fc80169da86..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/button/Button.java +++ /dev/null @@ -1,248 +0,0 @@ -package org.mineacademy.fo.menu.button; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.BiConsumer; -import java.util.function.Consumer; - -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.conversation.SimpleDecimalPrompt; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.settings.SimpleLocalization; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; - -/** - * Represents a clickable button in menu - */ -public abstract class Button { - - /** - * The material representing info button, see {@link #makeInfo(String...)} - */ - @Setter - private static CompMaterial infoButtonMaterial = CompMaterial.NETHER_STAR; - - /** - * The title of the info button, see {@link #makeInfo(String...)} - * <p> - * Colorized automatically. - */ - @Setter - private static String infoButtonTitle = SimpleLocalization.Menu.TOOLTIP_INFO; - - // ---------------------------------------------------------------- - // Button functions - // ---------------------------------------------------------------- - - /** - * Called automatically from the button is clicked - * - * @param player - * @param menu - * @param click - */ - public abstract void onClickedInMenu(Player player, Menu menu, ClickType click); - - /** - * The item representing this button. Tip: Use {@link ItemCreator} to create it. - * - * @return the item for this button - */ - public abstract ItemStack getItem(); - - // ---------------------------------------------------------------- - // Static methods - // ---------------------------------------------------------------- - - /** - * Creates a new Nether Star button has no action on clicking - * and it is used purely to display informative text. - * <p> - * Each description line starts with gray color by default and has colors replaced. - * <p> - * Use {@link #setInfoButtonMaterial(CompMaterial)} and {@link #setInfoButtonTitle(String)} to customize it. - * - * @param description the description of the button - * @return the button - */ - public static final DummyButton makeInfo(final String... description) { - final List<String> lores = new ArrayList<>(); - lores.add(" "); - - for (final String line : description) - lores.add("&7" + line); - - return makeDummy(ItemCreator.of(infoButtonMaterial).name(infoButtonTitle).hideTags(true).lores(lores)); - } - - /** - * Create a new empty button (air) - * - * @return a new dummy air button - */ - public static final DummyButton makeEmpty() { - return makeDummy(ItemCreator.of(CompMaterial.AIR)); - } - - /** - * Creates a dummy button that does nothing when clicked - * - * @param builder the icon builder - * @return the button - */ - public static final DummyButton makeDummy(final ItemCreator.ItemCreatorBuilder builder) { - return makeDummy(builder.build()); - } - - /** - * Creates a dummy button that does nothing when clicked - * - * @param creator the icon creator - * @return the button - */ - public static final DummyButton makeDummy(final ItemCreator creator) { - return makeDummy(creator.makeMenuTool()); - } - - /** - * Creates a dummy button that does nothing when clicked - * - * @param item the item - * @return the button - */ - public static final DummyButton makeDummy(final ItemStack item) { - return new DummyButton(item); - } - - /** - * Creates a lazy button having the given icon, title, label (the second lore row) and the click function - * taking in the player who damn clicked - * - * @param icon - * @param title - * @param label - * @param onClickFunction - * @return - */ - public static final Button makeSimple(final CompMaterial icon, final String title, final String label, final Consumer<Player> onClickFunction) { - return new Button() { - - @Override - public ItemStack getItem() { - return ItemCreator.of(icon, title, "", label).build().makeMenuTool(); - } - - @Override - public void onClickedInMenu(final Player player, final Menu menu, final ClickType click) { - onClickFunction.accept(player); - } - }; - } - - /** - * Creates a lazy button with the given builder and action when clicked - * - * @param builder - * @param onClickFunction - * @return - */ - public static final Button makeSimple(ItemCreator.ItemCreatorBuilder builder, final Consumer<Player> onClickFunction) { - return new Button() { - - @Override - public ItemStack getItem() { - return builder.build().makeMenuTool(); - } - - @Override - public void onClickedInMenu(final Player player, final Menu menu, final ClickType click) { - onClickFunction.accept(player); - } - }; - } - - /** - * Creates a lazy button having the given icon, title, label (the second lore row) and the click function - * taking in the player and the click type - * - * @param icon - * @param title - * @param label - * @param onClickFunction - * @return - */ - public static final Button makeSimple(final CompMaterial icon, final String title, final String label, final BiConsumer<Player, ClickType> onClickFunction) { - return new Button() { - - @Override - public ItemStack getItem() { - return ItemCreator.of(icon, title, "", label).build().makeMenuTool(); - } - - @Override - public void onClickedInMenu(final Player player, final Menu menu, final ClickType click) { - onClickFunction.accept(player, click); - } - }; - } - - /** - * Create a button that shows the decimal prompt to the player when clicked - * - * @param question - * @param successAction - */ - public static Button makeDecimalPrompt(final ItemCreator.ItemCreatorBuilder builder, final String question, final Consumer<Double> successAction) { - return new Button() { - - @Override - public ItemStack getItem() { - return builder.build().make(); - } - - @Override - public void onClickedInMenu(final Player player, final Menu menu, final ClickType click) { - SimpleDecimalPrompt.show(player, question, successAction); - } - }; - } - - @Override - public final String toString() { - final ItemStack item = getItem(); - - return getClass().getSimpleName() + "{" + (item != null ? item.getType() : "null") + "}"; - } - - // ---------------------------------------------------------------- - // Helper classes methods - // ---------------------------------------------------------------- - - /** - * The button that doesn't do anything when clicked. - */ - @RequiredArgsConstructor(access = AccessLevel.PRIVATE) - public static final class DummyButton extends Button { - - /** - * The icon for this button - */ - @Getter - private final ItemStack item; - - /** - * Do nothing when clicked - */ - @Override - public void onClickedInMenu(final Player player, final Menu menu, final ClickType click) { - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/button/ButtonConversation.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/button/ButtonConversation.java deleted file mode 100644 index 42ce1f8b8b2a07ad01e34bef34ee6c803743c413..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/button/ButtonConversation.java +++ /dev/null @@ -1,119 +0,0 @@ -package org.mineacademy.fo.menu.button; - -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.conversation.SimpleConversation; -import org.mineacademy.fo.conversation.SimplePrompt; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompMaterial; - -import lombok.Getter; - -/** - * A button that runs a server conversation - */ -public final class ButtonConversation extends Button { - - /** - * The server conversation to launch, or null if {@link SimplePrompt} is set - */ - private final SimpleConversation conversation; - - /** - * The prompt to show, null if {@link #conversation} is set - */ - private final SimplePrompt prompt; - - /** - * The item representing this button - */ - @Getter - private final ItemStack item; - - /** - * Convenience shortcut for {@link ItemCreator#of(CompMaterial, String, String...)} - * - * @param convo - * @param material - * @param title - * @param lore - */ - public ButtonConversation(SimpleConversation convo, CompMaterial material, String title, String... lore) { - this(convo, ItemCreator.of(material, title, lore)); - } - - /** - * Create a new button that starts a server conversation when clicked - * - * @param convo - * @param item - */ - public ButtonConversation(SimpleConversation convo, ItemCreator.ItemCreatorBuilder item) { - this(convo, null, item.hideTags(true).build().make()); - } - - /** - * Create a new button that starts a server conversation when clicked - * - * @param convo - * @param item - */ - public ButtonConversation(SimpleConversation convo, ItemCreator item) { - this(convo, null, item.make()); - } - - /** - * Convenience shortcut for {@link ItemCreator#of(CompMaterial, String, String...)} - * - * @param prompt - * @param material - * @param title - * @param lore - */ - public ButtonConversation(SimplePrompt prompt, CompMaterial material, String title, String... lore) { - this(prompt, ItemCreator.of(material, title, lore)); - } - - /** - * Create a new conversation from a single prompt - * - * @param prompt - * @param item - */ - public ButtonConversation(SimplePrompt prompt, ItemCreator item) { - this(null, prompt, item.make()); - } - - /** - * Create a new conversation from a single prompt - * - * @param prompt - * @param item - */ - public ButtonConversation(SimplePrompt prompt, ItemCreator.ItemCreatorBuilder item) { - this(null, prompt, item.hideTags(true).build().make()); - } - - private ButtonConversation(SimpleConversation conversation, SimplePrompt prompt, ItemStack item) { - this.conversation = conversation; - this.prompt = prompt; - this.item = item; - } - - @Override - public void onClickedInMenu(Player player, Menu menu, ClickType click) { - Valid.checkBoolean(conversation != null || prompt != null, "Conversation and prompt cannot be null!"); - - if (conversation != null) { - conversation.setMenuToReturnTo(menu); - - conversation.start(player); - - } else - prompt.show(player); - - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/button/ButtonMenu.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/button/ButtonMenu.java deleted file mode 100644 index 90d4624e83e44dcdcf0a0f586ffa3996dc97edda..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/button/ButtonMenu.java +++ /dev/null @@ -1,151 +0,0 @@ -package org.mineacademy.fo.menu.button; - -import java.util.concurrent.Callable; - -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompMaterial; - -import lombok.Getter; - -/** - * A button that opens another menu - */ -public final class ButtonMenu extends Button { - - /** - * Sometimes you need to allocate data when you create the button, - * but these data are not yet available when you make new instance of this button - * <p> - * Use this helper to set them right before showing the button - */ - private final Callable<Menu> menuLateBind; - - /** - * The menu this button opens - */ - private final Menu menuToOpen; - - /** - * The icon of this button - */ - @Getter - private final ItemStack item; - - /** - * Create a new instanceof using {@link Menu#newInstance()} when showing the menu? - */ - private final boolean newInstance; - - /** - * Create a new button that triggers another menu - * - * @param menuClass - * @param material - * @param name - * @param lore - */ - public ButtonMenu(final Class<? extends Menu> menuClass, final CompMaterial material, final String name, final String... lore) { - this(null, () -> ReflectionUtil.instantiate(menuClass), ItemCreator.of(material, name, lore).hideTags(true).build().make(), false); - } - - /** - * Create a new button that triggers another menu - * - * @param menuLateBind - * @param item - */ - public ButtonMenu(final Callable<Menu> menuLateBind, final ItemCreator.ItemCreatorBuilder item) { - this(null, menuLateBind, item.hideTags(true).build().make(), false); - } - - /** - * Create a new button that triggers another menu - * - * @param menuLateBind - * @param item - */ - public ButtonMenu(final Callable<Menu> menuLateBind, final ItemStack item) { - this(null, menuLateBind, item, false); - } - - /** - * Create a new button that triggers another menu - * - * @param menu - * @param material - * @param name - * @param lore - */ - public ButtonMenu(final Menu menu, final CompMaterial material, final String name, final String... lore) { - this(menu, ItemCreator.of(material, name, lore)); - } - - /** - * Create a new button that triggers another menu - * - * @param menu - * @param item - */ - public ButtonMenu(final Menu menu, final ItemCreator.ItemCreatorBuilder item) { - this(menu, null, item.hideTags(true).build().make(), false); - } - - /** - * Create a new button that triggers another menu - * - * @param menu - * @param item - */ - public ButtonMenu(final Menu menu, final ItemStack item) { - this(menu, null, item, false); - } - - public ButtonMenu(final Menu menu, final ItemStack item, final boolean newInstance) { - this(menu, null, item, newInstance); - } - - // Private constructor - private ButtonMenu(final Menu menuToOpen, final Callable<Menu> menuLateBind, final ItemStack item, final boolean newInstance) { - this.menuToOpen = menuToOpen; - this.menuLateBind = menuLateBind; - this.item = item; - this.newInstance = newInstance; - } - - /** - * Automatically display another menu when the button is clicked - */ - @Override - public void onClickedInMenu(final Player pl, final Menu menu, final ClickType click) { - if (menuLateBind != null) { - Menu menuToOpen = null; - - try { - menuToOpen = menuLateBind.call(); - } catch (final Exception ex) { - ex.printStackTrace(); - - return; - } - - if (newInstance) - menuToOpen = menuToOpen.newInstance(); - - menuToOpen.displayTo(pl); - - } else { - Valid.checkNotNull(menuToOpen, "Report / ButtonTrigger requires either 'late bind menu' or normal menu to be set!"); - - if (newInstance) - menuToOpen.newInstance().displayTo(pl); - else - menuToOpen.displayTo(pl); - } - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/button/ButtonRemove.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/button/ButtonRemove.java deleted file mode 100644 index 1eddd2baaf0432ffde569f530b3f68e2bf76a756..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/button/ButtonRemove.java +++ /dev/null @@ -1,195 +0,0 @@ -package org.mineacademy.fo.menu.button; - -import java.util.Arrays; - -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompColor; -import org.mineacademy.fo.remain.CompItemFlag; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.settings.SimpleLocalization; - -import lombok.AccessLevel; -import lombok.RequiredArgsConstructor; - -/** - * Represents a standardized remove button that opens the remove confirmation dialog. - * <p> - * Typically we use this to remove an arena, class, upgrade etc. - */ -@RequiredArgsConstructor -public class ButtonRemove extends Button { - - /** - * The parent menu - */ - private final Menu parentMenu; - - /** - * The type of the object to remove, for example class, upgrade, arena - */ - private final String toRemoveType; - - /** - * The name of the object to remove, for example "Warrior" for class - */ - private final String toRemoveName; - - /** - * The action that triggers when the object is removed - */ - private final ButtonRemoveAction removeAction; - - /** - * The icon for this button - */ - @Override - public ItemStack getItem() { - return ItemCreator - - .of(CompMaterial.LAVA_BUCKET) - .name("&4&lRemove " + toRemoveName) - - .lores(Arrays.asList( - "&r", - "&7The selected " + toRemoveType + " will", - "&7be removed permanently.")) - - .flag(CompItemFlag.HIDE_ATTRIBUTES) - .build().make(); - } - - public ItemStack getRemoveConfirmItem() { - return ItemCreator - - .ofWool(CompColor.RED) - .name("&6&lRemove " + toRemoveName) - - .lores(Arrays.asList( - "&r", - "&7Confirm that this " + toRemoveType + " will", - "&7be removed permanently.", - "&cCannot be undone.")) - - .flag(CompItemFlag.HIDE_ATTRIBUTES) - .build().make(); - } - - public String getMenuTitle() { - return "&0Confirm removal"; - } - - /** - * Open the confirm dialog when clicked - */ - @Override - public void onClickedInMenu(final Player pl, final Menu menu, final ClickType click) { - new MenuDialogRemove(parentMenu, new RemoveConfirmButton()).displayTo(pl); - } - - /** - * The button that when clicked, actually removes the object - */ - @RequiredArgsConstructor(access = AccessLevel.PRIVATE) - final class RemoveConfirmButton extends Button { - - @Override - public ItemStack getItem() { - return getRemoveConfirmItem(); - } - - /** - * Remove the object using {@link ButtonRemove#removeAction} - */ - @Override - public void onClickedInMenu(final Player player, final Menu menu, final ClickType click) { - player.closeInventory(); - removeAction.remove(toRemoveName); - - Common.tell(player, SimpleLocalization.Menu.ITEM_DELETED.replace("{item}", (!toRemoveType.isEmpty() ? toRemoveType + " " : "") + toRemoveName)); - } - } - - /** - * Fires the action to remove the object - */ - - @FunctionalInterface - public interface ButtonRemoveAction { - - /** - * Remove the object - * - * @param object the object's name, for example "Warrior" for class - */ - void remove(String object); - } - - /** - * A prepared menu to allow two-step object removal with a confirmation step - */ - final class MenuDialogRemove extends Menu { - - /** - * The confirmation button that triggers the removal - */ - private final Button confirmButton; - - /** - * The return button - */ - private final Button returnButton; - - /** - * Create a new confirmation remove dialog - * - * @param parentMenu the parent menu - * @param confirmButton the remove button - */ - public MenuDialogRemove(final Menu parentMenu, final RemoveConfirmButton confirmButton) { - super(parentMenu); - - this.confirmButton = confirmButton; - returnButton = new ButtonReturnBack(parentMenu); - - setSize(9 * 3); - setTitle(getMenuTitle()); - } - - /** - * Returns the proper item at the correct slot - * - * @param slot the slot - * @return the item or null - */ - @Override - public ItemStack getItemAt(final int slot) { - if (slot == 9 + 3) - return confirmButton.getItem(); - - if (slot == 9 + 5) - return returnButton.getItem(); - - return null; - } - - /** - * Do not add twice return buttons - * - * @see org.mineacademy.fo.menu.Menu#addReturnButton() - */ - @Override - protected boolean addReturnButton() { - return false; - } - - @Override - protected String[] getInfo() { - return null; - } - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/button/ButtonReturnBack.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/button/ButtonReturnBack.java deleted file mode 100644 index dee47919106fcc0bed557fb2b6ddc74bd13e9d1e..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/button/ButtonReturnBack.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.mineacademy.fo.menu.button; - -import java.util.Arrays; -import java.util.List; - -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.settings.SimpleLocalization; - -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NonNull; -import lombok.RequiredArgsConstructor; -import lombok.Setter; - -/** - * Represents a standardized button that will return back to the parent menu - */ -@RequiredArgsConstructor -@AllArgsConstructor -public final class ButtonReturnBack extends Button { - - /** - * The material for this button, door by default - */ - @Getter - @Setter - private static CompMaterial material = CompMaterial.OAK_DOOR; - - /** - * The title of this button - */ - @Getter - @Setter - private static String title = SimpleLocalization.Menu.BUTTON_RETURN_TITLE; - - /** - * The lore of this button - */ - @Getter - @Setter - private static List<String> lore = Arrays.asList(SimpleLocalization.Menu.BUTTON_RETURN_LORE); - - /** - * The parent menu - */ - @NonNull - private final Menu parentMenu; - - /** - * Should we make a new instance of the parent menu? - * <p> - * False by default. - */ - private boolean makeNewInstance = false; - - /** - * The icon for this button - */ - @Override - public ItemStack getItem() { - return ItemCreator.of(material).name(title).lores(lore).build().make(); - } - - /** - * Open the parent menu when clicked - */ - @Override - public void onClickedInMenu(Player pl, Menu menu, ClickType click) { - if (makeNewInstance) - parentMenu.newInstance().displayTo(pl); - - else - parentMenu.displayTo(pl); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/model/InventoryDrawer.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/model/InventoryDrawer.java deleted file mode 100644 index 43299a836ecd703003545f363c530a82a769ce80..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/model/InventoryDrawer.java +++ /dev/null @@ -1,176 +0,0 @@ -package org.mineacademy.fo.menu.model; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.InventoryHolder; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.remain.CompMaterial; - -import lombok.Getter; - -/** - * Represents a way to render the inventory to the player - * using Bukkit/Spigot native methods. - * <p> - * This is also handy if you simply want to show - * a certain inventory without creating the full menu. - */ -public final class InventoryDrawer { - - /** - * The size of the inventory. - */ - @Getter - private final int size; - - /** - * The inventory title - */ - private String title; - - /** - * The items in this inventory - */ - private final ItemStack[] content; - - /** - * Create a new inventory drawer, see {@link #of(int, String)} - * - * @param size the size - * @param title the title - */ - private InventoryDrawer(int size, String title) { - this.size = size; - this.title = title; - - this.content = new ItemStack[size]; - } - - /** - * Adds the item at the first empty slot starting from the 0 slot - * <p> - * If the inventory is full, we add it on the last slot replacing existing item - * - * @param item the item - */ - public void pushItem(ItemStack item) { - boolean added = false; - - for (int i = 0; i < content.length; i++) { - final ItemStack currentItem = content[i]; - - if (currentItem == null) { - content[i] = item; - added = true; - - break; - } - } - - if (!added) - content[size - 1] = item; - } - - /** - * Is the current slot occupied by a non-null {@link ItemStack}? - * - * @param slot the slot - * @return true if the slot is occupied - */ - public boolean isSet(int slot) { - return getItem(slot) != null; - } - - /** - * Get an item at the slot, or null if slot overflown or item not set - * - * @param slot - * @return - */ - public ItemStack getItem(int slot) { - return slot < content.length ? content[slot] : null; - } - - /** - * Set an item at the certain slot - * - * @param slot - * @param item - */ - public void setItem(int slot, ItemStack item) { - content[slot] = item; - } - - /** - * Set the full content of this inventory - * <p> - * If the given content is shorter, all additional inventory slots are replaced with air - * - * @param newContent the new content - */ - public void setContent(ItemStack[] newContent) { - for (int i = 0; i < content.length; i++) - content[i] = i < newContent.length ? newContent[i] : new ItemStack(CompMaterial.AIR.getMaterial()); - } - - /** - * Set the title of this inventory drawer, not updating the inventory if it is being viewed - * - * @param title - */ - public void setTitle(String title) { - this.title = title; - } - - /** - * Display this inventory to the player, closing older inventory if already opened - * - * @param player - */ - public void display(Player player) { - final Inventory inv = this.build(player); - - // Before opening make sure we close his old inventory if exist - if (player.getOpenInventory() != null) - player.closeInventory(); - - player.openInventory(inv); - } - - /** - * Builds the inventory - * - * @return - */ - public Inventory build() { - return this.build(null); - } - - /** - * Builds the inventory for the given holder - * - * @param holder - * @return - */ - public Inventory build(InventoryHolder holder) { - // Automatically append the black color in the menu, can be overriden by colors - final Inventory inv = Bukkit.createInventory(holder, size, Common.colorize("&0" + title)); - - inv.setContents(content); - - return inv; - } - - /** - * Make a new inventory drawer - * - * @param size the size - * @param title the title, colors will be replaced - * @return the inventory drawer - */ - public static InventoryDrawer of(int size, String title) { - return new InventoryDrawer(size, title); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/model/ItemCreator.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/model/ItemCreator.java deleted file mode 100644 index 66c8a41814fcdfed41166f29e4a5e2c27af915a0..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/model/ItemCreator.java +++ /dev/null @@ -1,502 +0,0 @@ -package org.mineacademy.fo.menu.model; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemFlag; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.BookMeta; -import org.bukkit.inventory.meta.EnchantmentStorageMeta; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.LeatherArmorMeta; -import org.bukkit.inventory.meta.SkullMeta; -import org.bukkit.material.MaterialData; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.menu.button.Button; -import org.mineacademy.fo.menu.button.Button.DummyButton; -import org.mineacademy.fo.model.SimpleEnchant; -import org.mineacademy.fo.model.SimpleEnchantment; -import org.mineacademy.fo.remain.CompColor; -import org.mineacademy.fo.remain.CompItemFlag; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.CompMetadata; -import org.mineacademy.fo.remain.CompMonsterEgg; -import org.mineacademy.fo.remain.CompProperty; - -import lombok.Builder; -import lombok.NonNull; -import lombok.Singular; - -/** - * Our core class for easy and comfortable item creation. - * <p> - * You can use this to make named items with incredible speed and quality. - */ -final @Builder public class ItemCreator { - - /** - * The initial item stack - */ - private final ItemStack item; - - /** - * The initial material - */ - private final CompMaterial material; - - /** - * The amount of the item - */ - @Builder.Default - private final int amount = 1; - - /** - * The item damage - */ - @Builder.Default - private final int damage = -1; - - /** - * The item name, colors are replaced - */ - private final String name; - - /** - * The lore for this item, colors are replaced - */ - @Singular - private final List<String> lores; - - /** - * The enchants applied for the item - */ - @Singular - private final List<SimpleEnchant> enchants; - - /** - * The item flags - */ - @Singular - private List<CompItemFlag> flags; - - /** - * Is the item unbreakable? - */ - private Boolean unbreakable; - - /** - * The dye color in case your item is compatible - */ - private final CompColor color; - - /** - * Should we hide all tags from the item (enchants, etc.)? - */ - @Builder.Default - private boolean hideTags = false; - - /** - * Should we add glow to the item? (adds a fake enchant and uses - * {@link ItemFlag} to hide it) - * <p> - * The enchant is visible on older MC versions. - */ - private final boolean glow; - - /** - * The skull owner, in case it applies - */ - private final String skullOwner; - - /** - * The list of NBT tags with their key-value pairs - */ - @Singular - private final Map<String, String> tags; - - /** - * If this is a book, you can set its new pages here - */ - @Singular - private final List<String> bookPages; - - /** - * If this a book, you can set its author here - */ - private final String bookAuthor; - - /** - * If this a book, you can set its title here - */ - private final String bookTitle; - - /** - * The item meta, overriden by other fields - */ - private final ItemMeta meta; - - // ---------------------------------------------------------------------------------------- - // Convenience give methods - // ---------------------------------------------------------------------------------------- - - /** - * Convenience method for quickly adding this item into a players inventory - * - * @param player - */ - public void give(final Player player) { - player.getInventory().addItem(this.make()); - } - - // ---------------------------------------------------------------------------------------- - // Constructing items - // ---------------------------------------------------------------------------------------- - - /** - * Constructs a new {@link DummyButton} from this item - * - * @return a new dummy button - */ - public DummyButton makeButton() { - return Button.makeDummy(this); - } - - /** - * Make an unbreakable item with all attributes hidden, suitable for menu use. - * - * @return the new menu tool, unbreakable with all attributes hidden - */ - public ItemStack makeMenuTool() { - unbreakable = true; - hideTags = true; - - return make(); - } - - /** - * @deprecated pending removal, this simply calls {@link #make()} - * - * @return - */ - @Deprecated - public ItemStack makeSurvival() { - return make(); - } - - /** - * Construct a valid {@link ItemStack} from all parameters above. - * - * @return the finished item - */ - public ItemStack make() { - // - // First, make sure the ItemStack is not null (it can be null if you create this class only using material) - // - Valid.checkBoolean(material != null || item != null, "Material or item must be set!"); - - if (material != null) - Valid.checkNotNull(material.getMaterial(), "Material#getMaterial cannot be null for " + material); - - final ItemStack compiledItem = item != null ? item.clone() : material.toItem(amount); - ItemMeta compiledMeta = meta != null ? meta.clone() : compiledItem.getItemMeta(); - - // Skip if air - if (CompMaterial.isAir(compiledItem.getType())) - return compiledItem; - - // Override with given material - if (material != null) { - compiledItem.setType(material.getMaterial()); - - if (MinecraftVersion.olderThan(V.v1_13)) - compiledItem.setData(new MaterialData(material.getMaterial(), material.getData())); - } - - // Apply specific material color if possible - color: - if (color != null) { - - if (compiledItem.getType().toString().contains("LEATHER")) { - if (MinecraftVersion.atLeast(V.v1_4)) { - Valid.checkBoolean(compiledMeta instanceof LeatherArmorMeta, "Expected a leather item, cannot apply color to " + compiledItem); - - ((LeatherArmorMeta) compiledMeta).setColor(color.getColor()); - } - } - - else { - - // Hack: If you put WHITE_WOOL and a color, we automatically will change the material to the colorized version - if (MinecraftVersion.atLeast(V.v1_13)) { - final String dye = color.getDye().toString(); - final List<String> colorableMaterials = Arrays.asList("BANNER", "BED", "CARPET", "CONCRETE", "GLAZED_TERRACOTTA", "SHULKER_BOX", "STAINED_GLASS", - "STAINED_GLASS_PANE", "TERRACOTTA", "WALL_BANNER", "WOOL"); - - for (final String material : colorableMaterials) { - final String suffix = "_" + material; - - if (compiledItem.getType().toString().endsWith(suffix)) { - compiledItem.setType(Material.valueOf(dye + suffix)); - - break color; - } - } - } - - else { - final byte dataValue = color.getDye().getWoolData(); - - compiledItem.setData(new MaterialData(compiledItem.getType(), dataValue)); - compiledItem.setDurability(dataValue); - } - } - } - - // Fix monster eggs - if (compiledItem.getType().toString().endsWith("SPAWN_EGG") || compiledItem.getType().toString().equals("MONSTER_EGG")) { - - EntityType entity = null; - - if (MinecraftVersion.olderThan(V.v1_13)) { // Try to find it if already exists - CompMonsterEgg.acceptUnsafeEggs = true; - final EntityType pre = CompMonsterEgg.getEntity(compiledItem); - CompMonsterEgg.acceptUnsafeEggs = false; - - if (pre != null && pre != EntityType.UNKNOWN) - entity = pre; - } - - if (entity == null) { - final String itemName = compiledItem.getType().toString(); - - String entityRaw = itemName.replace("_SPAWN_EGG", ""); - - if (entityRaw.equals("MONSTER_EGG") && material != null && material.toString().endsWith("SPAWN_EGG")) - entityRaw = material.toString().replace("_SPAWN_EGG", ""); - - if ("MOOSHROOM".equals(entityRaw)) - entityRaw = "MUSHROOM_COW"; - - else if ("ZOMBIE_PIGMAN".equals(entityRaw)) - entityRaw = "PIG_ZOMBIE"; - - try { - entity = EntityType.valueOf(entityRaw); - - } catch (final Throwable t) { - - // Probably version incompatible - Common.log("The following item could not be transformed into " + entityRaw + " egg, item: " + compiledItem); - } - } - - if (entity != null) - compiledMeta = CompMonsterEgg.setEntity(compiledItem, entity).getItemMeta(); - } - - flags = new ArrayList<>(Common.getOrDefault(flags, new ArrayList<>())); - - if (damage != -1) { - - try { - ReflectionUtil.invoke("setDurability", compiledItem, (short) damage); - } catch (final Throwable t) { - } - - try { - if (compiledMeta instanceof org.bukkit.inventory.meta.Damageable) - ((org.bukkit.inventory.meta.Damageable) compiledMeta).setDamage(damage); - } catch (final Throwable t) { - } - } - - if (color != null && compiledItem.getType().toString().contains("LEATHER")) - ((LeatherArmorMeta) compiledMeta).setColor(color.getColor()); - - if (skullOwner != null && compiledMeta instanceof SkullMeta) - ((SkullMeta) compiledMeta).setOwner(skullOwner); - - if (compiledMeta instanceof BookMeta) { - final BookMeta bookMeta = (BookMeta) compiledMeta; - - if (bookPages != null) - bookMeta.setPages(Common.colorize(bookPages)); - - if (bookMeta.getAuthor() == null) - bookMeta.setAuthor(Common.getOrEmpty(bookAuthor)); - - if (bookMeta.getTitle() == null) - bookMeta.setTitle(Common.getOrEmpty(bookTitle)); - } - - if (glow) { - compiledMeta.addEnchant(Enchantment.DURABILITY, 1, true); - - flags.add(CompItemFlag.HIDE_ENCHANTS); - } - - if (enchants != null) - for (final SimpleEnchant ench : enchants) - if (compiledMeta instanceof EnchantmentStorageMeta) - ((EnchantmentStorageMeta) compiledMeta).addStoredEnchant(ench.getEnchant(), ench.getLevel(), true); - else - compiledMeta.addEnchant(ench.getEnchant(), ench.getLevel(), true); - - if (name != null && !"".equals(name)) - compiledMeta.setDisplayName(Common.colorize("&r&f" + name)); - - if (lores != null && !lores.isEmpty()) { - final List<String> coloredLores = new ArrayList<>(); - - for (final String lore : lores) - coloredLores.add(Common.colorize("&7" + lore)); - - compiledMeta.setLore(coloredLores); - } - - if (unbreakable != null) { - flags.add(CompItemFlag.HIDE_ATTRIBUTES); - flags.add(CompItemFlag.HIDE_UNBREAKABLE); - - CompProperty.UNBREAKABLE.apply(compiledMeta, true); - } - - if (hideTags) - for (final CompItemFlag f : CompItemFlag.values()) - if (!flags.contains(f)) - flags.add(f); - - for (final CompItemFlag flag : flags) - try { - compiledMeta.addItemFlags(ItemFlag.valueOf(flag.toString())); - } catch (final Throwable t) { - } - - // Apply Bukkit metadata - compiledItem.setItemMeta(compiledMeta); - - // - // From now on we have to re-set the item - // - - // Apply custom enchantment lores - ItemStack finalItem = compiledItem; - final ItemStack enchantedIs = SimpleEnchantment.addEnchantmentLores(compiledItem); - - if (enchantedIs != null) - finalItem = enchantedIs; - - // Apply NBT tags - if (tags != null) - if (MinecraftVersion.atLeast(V.v1_8)) - for (final Entry<String, String> entry : tags.entrySet()) - finalItem = CompMetadata.setMetadata(finalItem, entry.getKey(), entry.getValue()); - - else if (!tags.isEmpty() && item != null) - Common.log("Item had unsupported tags " + tags + " that are not supported on MC " + MinecraftVersion.getServerVersion() + " Item: " + finalItem); - - return finalItem; - } - - // ---------------------------------------------------------------------------------------- - // Static access - // ---------------------------------------------------------------------------------------- - - /** - * Convenience method to get a new item creator with material, name and lore set - * - * @param material - * @param name - * @param lore - * @return - */ - public static ItemCreatorBuilder of(final CompMaterial material, final String name, @NonNull final Collection<String> lore) { - return of(material, name, lore.toArray(new String[0])); - } - - /** - * Convenience method to get a new item creator with material, name and lore set - * - * @param material - * @param name - * @param lore - * @return - */ - public static ItemCreatorBuilder of(final String material, final String name, @NonNull final Collection<String> lore) { - return of(CompMaterial.valueOf(material), name, lore.toArray(new String[0])); - } - - /** - * Convenience method to get a new item creator with material, name and lore set - * - * @param material - * @param name - * @param lore - * @return new item creator - */ - public static ItemCreatorBuilder of(final CompMaterial material, final String name, @NonNull final String... lore) { - return ItemCreator.builder().material(material).name("&r" + name).lores(Arrays.asList(lore)).hideTags(true); - } - - /** - * Convenience method to get a new item creator with material, name and lore set - * - * @param material - * @param name - * @param lore - * @return new item creator - */ - public static ItemCreatorBuilder of(final String material, final String name, @NonNull final String... lore) { - return ItemCreator.builder().material(CompMaterial.valueOf(material)).name("&r" + name).lores(Arrays.asList(lore)).hideTags(true); - } - - /** - * Convenience method to get a wool - * - * @param color the wool color - * @return the new item creator - */ - public static ItemCreatorBuilder ofWool(final CompColor color) { - return of(CompMaterial.makeWool(color, 1)).color(color); - } - - /** - * Convenience method to get the creator of an existing itemstack - * - * @param item existing itemstack - * @return the new item creator - */ - public static ItemCreatorBuilder of(final ItemStack item) { - final ItemCreatorBuilder builder = ItemCreator.builder(); - final ItemMeta meta = item.getItemMeta(); - - if (meta != null && meta.getLore() != null) - builder.lores(meta.getLore()); - - return builder.item(item); - } - - /** - * Get a new item creator from material - * - * @param mat existing material - * @return the new item creator - */ - public static ItemCreatorBuilder of(final CompMaterial mat) { - Valid.checkNotNull(mat, "Material cannot be null!"); - - return ItemCreator.builder().material(mat); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/model/MenuClickLocation.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/model/MenuClickLocation.java deleted file mode 100644 index 9b567fc60b0f0e7f56a27cbdc4cb43562796029d..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/model/MenuClickLocation.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.mineacademy.fo.menu.model; - -/** - * Represents a click location while the menu is opened - */ -public enum MenuClickLocation { - - /** - * The upper menu was clicked - */ - MENU, - - /** - * The bottom player inventory was clicked - */ - PLAYER_INVENTORY, - - /** - * The arena out of GUI was clicked - */ - OUTSIDE -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/model/MenuQuantity.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/model/MenuQuantity.java deleted file mode 100644 index 2c6975ef3cbb6c1a8250d4597188f00b64687e60..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/model/MenuQuantity.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.mineacademy.fo.menu.model; - -import org.mineacademy.fo.menu.MenuQuantitable; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * Represents how much we should change an - * ItemStack's size upon clicking the item in the menu. - * <p> - * For example use, see {@link MenuQuantitable} - */ -@RequiredArgsConstructor -@Getter -public enum MenuQuantity { - - /** - * Change ItemStack size by 1 - */ - ONE(1), - - /** - * Change ItemStack size by 2 - */ - TWO(2), - - /** - * Change ItemStack size by 5 - */ - FIVE(5), - - /** - * Change ItemStack size by 10 - */ - TEN(10), - - /** - * Change ItemStack size by 20 - */ - TWENTY(20); - - /** - * The amount to change - */ - private final int amount; - - /** - * Rotates the enum backwards - * - * @return the previous enum ordinal, or last if overflows - */ - public final MenuQuantity previous() { - final int next = ordinal() - 1; - final MenuQuantity[] values = MenuQuantity.values(); - - return next >= 0 ? values[next] : values[values.length - 1]; - } - - /** - * Rotates the enum forward - * - * @return the next enum ordinal, or first if overflows - */ - public final MenuQuantity next() { - final int next = ordinal() + 1; - final MenuQuantity[] values = MenuQuantity.values(); - - return next >= values.length ? values[0] : values[next]; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/model/SkullCreator.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/model/SkullCreator.java deleted file mode 100644 index ca8f2d3f197cb6c25f5b8c29cebcc2d85927da9d..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/model/SkullCreator.java +++ /dev/null @@ -1,294 +0,0 @@ -package org.mineacademy.fo.menu.model; - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Base64; -import java.util.UUID; - -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.SkullMeta; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.remain.Remain; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.NonNull; - -/** - * A library for the Bukkit API to create player skulls - * from names, base64 strings, and texture URLs. - * <p> - * Does not use any NMS code, and should work across all versions. - * - * @author Dean B on 12/28/2016. - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public class SkullCreator { - - // some reflection stuff to be used when setting a skull's profile - private static Field blockProfileField; - private static Method metaSetProfileMethod; - private static Field metaProfileField; - - /** - * Creates a player skull, should work in both legacy and new Bukkit APIs. - */ - public static ItemStack createSkull() { - try { - return new ItemStack(Material.valueOf("PLAYER_HEAD")); - - } catch (final IllegalArgumentException e) { - return new ItemStack(Material.valueOf("SKULL_ITEM"), 1, (byte) 3); - } - } - - /** - * Creates a player skull item with the skin based on a player's name. - * - * @param name The Player's name. - * @return The head of the Player. - * - */ - public static ItemStack itemFromName(String name) { - return itemWithName(createSkull(), name); - } - - /** - * Creates a player skull item with the skin based on a player's UUID. - * - * @param id The Player's UUID. - * @return The head of the Player. - */ - public static ItemStack itemFromUuid(UUID id) { - return itemWithUuid(createSkull(), id); - } - - /** - * Creates a player skull item with the skin at a Mojang URL. - * - * @param url The Mojang URL. - * @return The head of the Player. - */ - public static ItemStack itemFromUrl(String url) { - return itemWithUrl(createSkull(), url); - } - - /** - * Creates a player skull item with the skin based on a base64 string. - * - * @param base64 The Mojang URL. - * @return The head of the Player. - */ - public static ItemStack itemFromBase64(String base64) { - return itemWithBase64(createSkull(), base64); - } - - /** - * Modifies a skull to use the skin of the player with a given name. - * - * @param item The item to apply the name to. Must be a player skull. - * @param name The Player's name. - * @return The head of the Player. - */ - public static ItemStack itemWithName(@NonNull ItemStack item, @NonNull String name) { - final SkullMeta meta = (SkullMeta) item.getItemMeta(); - - meta.setOwner(name); - item.setItemMeta(meta); - - return item; - } - - /** - * Modifies a skull to use the skin of the player with a given UUID. - * - * @param item The item to apply the name to. Must be a player skull. - * @param id The Player's UUID. - * @return The head of the Player. - */ - public static ItemStack itemWithUuid(@NonNull ItemStack item, @NonNull UUID id) { - final SkullMeta meta = (SkullMeta) item.getItemMeta(); - - try { - meta.setOwningPlayer(Remain.getOfflinePlayerByUUID(id)); - - } catch (final Throwable t) { - meta.setOwner(Remain.getOfflinePlayerByUUID(id).getName()); - } - - item.setItemMeta(meta); - - return item; - } - - /** - * Modifies a skull to use the skin at the given Mojang URL. - * - * @param item The item to apply the skin to. Must be a player skull. - * @param url The URL of the Mojang skin. - * @return The head associated with the URL. - */ - public static ItemStack itemWithUrl(@NonNull ItemStack item, @NonNull String url) { - return itemWithBase64(item, urlToBase64(url)); - } - - /** - * Modifies a skull to use the skin based on the given base64 string. - * - * @param item The ItemStack to put the base64 onto. Must be a player skull. - * @param base64 The base64 string containing the texture. - * @return The head with a custom texture. - */ - public static ItemStack itemWithBase64(@NonNull ItemStack item, @NonNull String base64) { - if (!(item.getItemMeta() instanceof SkullMeta)) - return null; - - final SkullMeta meta = (SkullMeta) item.getItemMeta(); - - mutateItemMeta(meta, base64); - - item.setItemMeta(meta); - - return item; - } - - /** - * Sets the block to a skull with the given UUID. - * - * @param block The block to set. - * @param id The player to set it to. - */ - public static void blockWithUuid(@NonNull Block block, @NonNull UUID id) { - setToSkull(block); - - final Skull state = (Skull) block.getState(); - - try { - state.setOwningPlayer(Remain.getOfflinePlayerByUUID(id)); - - } catch (final Throwable t) { - state.setOwner(Remain.getOfflinePlayerByUUID(id).getName()); - } - - state.update(false, false); - } - - /** - * Sets the block to a skull with the skin found at the provided mojang URL. - * - * @param block The block to set. - * @param url The mojang URL to set it to use. - */ - public static void blockWithUrl(@NonNull Block block, @NonNull String url) { - blockWithBase64(block, urlToBase64(url)); - } - - /** - * Sets the block to a skull with the skin for the base64 string. - * - * @param block The block to set. - * @param base64 The base64 to set it to use. - */ - public static void blockWithBase64(@NonNull Block block, @NonNull String base64) { - setToSkull(block); - - final Skull state = (Skull) block.getState(); - mutateBlockState(state, base64); - - state.update(false, false); - } - - private static void setToSkull(Block block) { - - try { - block.setType(Material.valueOf("PLAYER_HEAD"), false); - - } catch (final IllegalArgumentException e) { - block.setType(Material.valueOf("SKULL"), false); - final Skull state = (Skull) block.getState(); - state.setSkullType(SkullType.PLAYER); - state.update(false, false); - } - } - - private static String urlToBase64(String url) { - - URI actualUrl; - try { - actualUrl = new URI(url); - } catch (final URISyntaxException e) { - throw new RuntimeException(e); - } - final String toEncode = "{\"textures\":{\"SKIN\":{\"url\":\"" + actualUrl.toString() + "\"}}}"; - return Base64.getEncoder().encodeToString(toEncode.getBytes()); - } - - private static Object makeProfile(String b64) { - // random uuid based on the b64 string - final UUID id = new UUID( - b64.substring(b64.length() - 20).hashCode(), - b64.substring(b64.length() - 10).hashCode()); - - try { - final Class<?> gameProfileClass = ReflectionUtil.lookupClass("com.mojang.authlib.GameProfile"); - - final Object profile = ReflectionUtil.instantiate(gameProfileClass.getConstructor(UUID.class, String.class), id, "aaaaa"); - - final Class<?> propertyClass = ReflectionUtil.lookupClass("com.mojang.authlib.properties.Property"); - final Object property = ReflectionUtil.instantiate(propertyClass.getConstructor(String.class, String.class), "textures", b64); - final Object propertyMap = ReflectionUtil.invoke("getProperties", profile); - - ReflectionUtil.invoke("put", propertyMap, "textures", property); - - return profile; - - } catch (final ReflectiveOperationException ex) { - Common.throwError(ex); - - return null; - } - } - - 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", ReflectionUtil.lookupClass("com.mojang.authlib.GameProfile")); - metaSetProfileMethod.setAccessible(true); - } - metaSetProfileMethod.invoke(meta, makeProfile(b64)); - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) { - // if in an older API where there is no setProfile method, - // we set the profile field directly. - try { - if (metaProfileField == null) { - metaProfileField = meta.getClass().getDeclaredField("profile"); - metaProfileField.setAccessible(true); - } - metaProfileField.set(meta, makeProfile(b64)); - - } catch (NoSuchFieldException | IllegalAccessException ex2) { - ex2.printStackTrace(); - } - } - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/tool/BlockTool.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/tool/BlockTool.java deleted file mode 100644 index 0d323172a04d20c3593b1794730cb6445c3d66f7..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/tool/BlockTool.java +++ /dev/null @@ -1,73 +0,0 @@ -package org.mineacademy.fo.menu.tool; - -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.block.Action; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.event.player.PlayerInteractEvent; - -import lombok.AccessLevel; -import lombok.Getter; - -/** - * A helper class for tools that may only be used on blocks - */ -public abstract class BlockTool extends Tool { - - /** - * The click event involved with this tool - */ - @Getter(value = AccessLevel.PROTECTED) - private PlayerInteractEvent event; - - @Override - protected final void onBlockClick(final PlayerInteractEvent event) { - this.event = event; - - final Player player = event.getPlayer(); - final Block block = event.getClickedBlock(); - - final Action action = event.getAction(); - - if (action == Action.RIGHT_CLICK_BLOCK) - onBlockClick(player, ClickType.RIGHT, block); - - else if (action == Action.LEFT_CLICK_BLOCK) - onBlockClick(player, ClickType.LEFT, block); - - else if (action == Action.RIGHT_CLICK_AIR) - onAirClick(player, ClickType.RIGHT); - - else if (action == Action.LEFT_CLICK_AIR) - onAirClick(player, ClickType.LEFT); - } - - /** - * Called automatically when a player holding this tool clicks - * a block. The {@link ClickType} can only be RIGHT or LEFT here. - * - * @param player - * @param click - * @param block - */ - protected abstract void onBlockClick(Player player, ClickType click, Block block); - - /** - * Called automatically when a player clicks the air - * - * @param player - * @param click - */ - protected void onAirClick(final Player player, final ClickType click) { - } - - /** - * Listen for air clicking to invoike {@link #onAirClick(Player, ClickType, Block)} - * - * @see org.mineacademy.fo.menu.tool.Tool#ignoreCancelled() - */ - @Override - protected final boolean ignoreCancelled() { - return false; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/tool/Rocket.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/tool/Rocket.java deleted file mode 100644 index 6e229bf7292a7c33c6b07d7e58d726ea507d2f07..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/tool/Rocket.java +++ /dev/null @@ -1,173 +0,0 @@ -package org.mineacademy.fo.menu.tool; - -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.event.player.PlayerInteractEvent; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.event.RocketExplosionEvent; - -import lombok.Getter; - -/** - * A rocket is an extended {@link Tool} - * that explodes when hit the ground. - * <p> - * Please use {@link #explode(Projectile, Location, float, boolean)} for calling - * the explosion or call the {@link RocketExplosionEvent} manually. - */ -@Getter -public abstract class Rocket extends Tool { - - /** - * The projectile that is being shot - */ - private final Class<? extends Projectile> projectile; - - /** - * The flying speed with which we shot the projectile - */ - private final float flightSpeed; - - /** - * The explosion power, recommended: 2 - 15 - */ - private final float explosionPower; - - /** - * Should the explosion break blocks? - */ - private final boolean breakBlocks; - - /** - * Create a new rocket with the flying speed to 1.5F (slightly above normal) and - * explosion power at 5F (TNT is 4F) - * - * @param projectile - * @param flightSpeed - */ - protected Rocket(Class<? extends Projectile> projectile) { - this(projectile, 1.5F); - } - - /** - * Create a new rocket with the explosion power of 5F (TNT is 4F) - * - * @param projectile - * @param flightSpeed - */ - protected Rocket(Class<? extends Projectile> projectile, float flightSpeed) { - this(projectile, flightSpeed, 5F); - } - - /** - * Create a new rocket that destroys blocks - * - * @param projectile - * @param flightSpeed - * @param explosionPower - */ - protected Rocket(Class<? extends Projectile> projectile, float flightSpeed, float explosionPower) { - this(projectile, flightSpeed, explosionPower, true); - } - - /** - * Create a new rocket with the given projectile and its speed (1=normal, 5=insane, 10=max,buggy) - * as well as the explosion power (1-30 although it bugs over 15 already) and if it should break blocks - * <p> - * For explosion powers see https://minecraft.gamepedia.com/Explosion - * - * @param projectile - * @param flightSpeed - */ - protected Rocket(Class<? extends Projectile> projectile, float flightSpeed, float explosionPower, boolean breakBlocks) { - Valid.checkBoolean(flightSpeed <= 10F, "Rocket cannot have speed over 10"); - Valid.checkBoolean(explosionPower <= 30F, "Rocket cannot have explosion power over 30"); - - this.projectile = projectile; - this.flightSpeed = flightSpeed; - this.explosionPower = explosionPower; - this.breakBlocks = breakBlocks; - } - - /** - * {@inheritDoc} - */ - @Override - protected void onBlockClick(PlayerInteractEvent e) { - } - - /** - * Return true if this rocket can be shot in the given location. - * We use this for example to check if the shooter player is within an arena - * - * @param shooter - * @param location - * @return - */ - protected boolean canLaunch(Player shooter, Location location) { - return true; - } - - /** - * Called automatically when this rocket is being shot - * - * @param projectile - * @param shooter - */ - protected void onLaunch(Projectile projectile, Player shooter) { - } - - /** - * From when you launch the projectile till the moment it hits the ground - * there is a timer task going on for each server tick calling this method - * <p> - * TIP: You can spawn special flying particles here - * - * @param projectile - * @param shooter - */ - protected void onFlyTick(Projectile projectile, Player shooter) { - } - - /** - * Check if the rocket can explode, if false we simply remove the entity - * - * @param projectile - * @param shooter - * @return - */ - protected boolean canExplode(Projectile projectile, Player shooter) { - return true; - } - - /** - * Called automatically when this rocket hits the ground. - * <p> - * TIP: Call {@link #explode(Projectile, float, boolean)} - * - * @param projectile - * @param shooter - * @param location - */ - protected void onExplode(Projectile projectile, Player shooter) { - } - - /** - * Also shoot rockets when clicking the air (Bukkit cancels the event so) - * - * @return true - */ - @Override - protected boolean ignoreCancelled() { - return false; - } - - /** - * Automatically cancel the click event to launch the rocket - */ - @Override - protected boolean autoCancel() { - return true; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/tool/Tool.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/tool/Tool.java deleted file mode 100644 index 83fba53af292774eda85d9959e73508b01278cc2..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/tool/Tool.java +++ /dev/null @@ -1,150 +0,0 @@ -package org.mineacademy.fo.menu.tool; - -import org.bukkit.entity.Player; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.ItemUtil; -import org.mineacademy.fo.menu.model.ItemCreator; - -/** - * Represents a tool. A tool is a simple ItemStack that is registered within the - * plugin and fires automatic events - */ -public abstract class Tool { - - /** - * Create a new tool - */ - protected Tool() { - - // A hacky way of automatically registering it AFTER the parent constructor, assuming all went okay - new Thread(() -> { - - try { - Thread.sleep(3); - } catch (final InterruptedException e) { - e.printStackTrace(); - } - - final Tool instance = Tool.this; - - if (!ToolRegistry.isRegistered(instance)) - ToolRegistry.register(instance); - }).start(); - } - - /** - * Evaluates the given itemstack whether it is this tool - * - * @param item the itemstack - * @return true if this tool is the given itemstack - */ - public boolean isTool(final ItemStack item) { - return ItemUtil.isSimilar(getItem(), item); - } - - /** - * Return true if the given player holds this tool in his main hand - * - * @param player - * @return - */ - public boolean hasToolInHand(final Player player) { - return isTool(player.getItemInHand()); - } - - /** - * Get the tool item - * <p> - * TIP: Use {@link ItemCreator} - * - * @return the tool item - */ - public abstract ItemStack getItem(); - - /** - * Called automatically when the tool is clicked - * - * @param event the event - */ - protected void onBlockClick(PlayerInteractEvent event) { - } - - /** - * Called automatically when a block is placed using this tool - * - * @param event - */ - protected void onBlockPlace(BlockPlaceEvent event) { - } - - /** - * Called when the player swap items in their hotbar and the new slot matches - * this tool. - * - * @param player the player - */ - protected void onHotbarFocused(final Player player) { - } - - /** - * Called when the player the tool is out of focus at hotbar - * - * @param player the player - */ - protected void onHotbarDefocused(final Player player) { - } - - /** - * Should we fire {@link #onBlockClick(PlayerInteractEvent)} even on cancelled - * events? - * <p> - * True by default. Set to false if you want to catch clicking air. - * - * @return true if we should ignore the click event if it was cancelled - */ - protected boolean ignoreCancelled() { - return true; - } - - /** - * A convenience method, should we automatically cancel the - * {@link PlayerInteractEvent} ? - * - * @return true if the interact event should be cancelled automatically false by - * default - */ - protected boolean autoCancel() { - return false; - } - - /** - * Convenience method for quickly setting this tool to a specific slot of players inventory - * - * @param player - */ - public final void give(final Player player, final int slot) { - player.getInventory().setItem(slot, getItem()); - } - - /** - * Convenience method for quickly adding this tool into a players inventory - * - * @param player - */ - public final void give(final Player player) { - player.getInventory().addItem(getItem()); - } - - /** - * Returns true if the compared object is a tool with the same {@link #getItem()} - * - * @param obj - * @return - */ - @Override - public final boolean equals(final Object obj) { - return obj instanceof Tool && ((Tool) obj).getItem().equals(getItem()); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/tool/ToolRegistry.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/tool/ToolRegistry.java deleted file mode 100644 index 13068b0980585c49baf0b89185cccede695b2a11..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/tool/ToolRegistry.java +++ /dev/null @@ -1,66 +0,0 @@ -package org.mineacademy.fo.menu.tool; - -import java.util.Collection; -import java.util.concurrent.ConcurrentLinkedQueue; - -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.Valid; - -/** - * Represents the tool registry holding all registered items - * <p> - * The items are added here automatically upon calling the constructor of {@link Tool} - */ -public final class ToolRegistry { - - /** - * The registered tools - */ - private static final Collection<Tool> tools = new ConcurrentLinkedQueue<>(); - - /** - * Add a new tool to register. - * <p> - * Called automatically. - * - * @param tool the tool - */ - static synchronized void register(Tool tool) { - Valid.checkBoolean(!isRegistered(tool), "Tool with itemstack " + tool.getItem() + " already registered"); - - tools.add(tool); - } - - /** - * Checks if the tool is registered - * - * @param tool the tool - * @return true if the tool is registered - */ - static synchronized boolean isRegistered(Tool tool) { - return getTool(tool.getItem()) != null; - } - - /** - * Attempts to find a registered tool from given itemstack - * - * @param item the item - * @return the corresponding tool, or null - */ - public static Tool getTool(ItemStack item) { - for (final Tool t : tools) - if (t.isTool(item)) - return t; - - return null; - } - - /** - * Get all tools - * - * @return the registered tools array - */ - public static Tool[] getTools() { - return tools.toArray(new Tool[tools.size()]); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/tool/ToolsListener.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/tool/ToolsListener.java deleted file mode 100644 index a9eb810aaf6e5d5a76dfa7546ff0192ad423cb3e..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/menu/tool/ToolsListener.java +++ /dev/null @@ -1,281 +0,0 @@ -package org.mineacademy.fo.menu.tool; - -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.entity.EnderPearl; -import org.bukkit.entity.Player; -import org.bukkit.entity.Projectile; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockPlaceEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.event.player.PlayerItemHeldEvent; -import org.bukkit.scheduler.BukkitRunnable; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.event.RocketExplosionEvent; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.fo.settings.SimpleLocalization; - -import lombok.Data; - -/** - * The event listener class responsible for firing events in tools - */ -public final class ToolsListener implements Listener { - - /** - * Stores rockets that were shot - */ - private final Map<UUID, ShotRocket> shotRockets = new HashMap<>(); - - /** - * Represents a shot rocket with the shooter - */ - @Data - private final class ShotRocket { - private final Player shooter; - private final Rocket rocket; - } - - // ------------------------------------------------------------------------------------------- - // Main tool listener - // ------------------------------------------------------------------------------------------- - - /** - * Handles clicking tools and shooting rocket - * - * @param event - */ - @EventHandler(priority = EventPriority.HIGH) - public void onToolClick(final PlayerInteractEvent event) { - if (!Remain.isInteractEventPrimaryHand(event)) - return; - - final Player player = event.getPlayer(); - final Tool tool = ToolRegistry.getTool(player.getItemInHand()); - - if (tool != null) - try { - if ((event.isCancelled() || !event.hasBlock()) && tool.ignoreCancelled()) - return; - - if (tool instanceof Rocket) { - final Rocket rocket = (Rocket) tool; - - if (rocket.canLaunch(player, player.getEyeLocation())) - player.launchProjectile(rocket.getProjectile(), player.getEyeLocation().getDirection().multiply(rocket.getFlightSpeed())); - else - event.setCancelled(true); - - } else - tool.onBlockClick(event); - - if (tool.autoCancel()) - event.setCancelled(true); - - } catch (final Throwable t) { - event.setCancelled(true); - - Common.tell(player, SimpleLocalization.Tool.ERROR); - Common.error(t, - "Failed to handle " + event.getAction() + " using tool: " + tool.getClass()); - } - } - - /** - * Handles block placing - * - * @param event - */ - @EventHandler(priority = EventPriority.HIGH) - public void onToolPlaceBlock(final BlockPlaceEvent event) { - - final Player player = event.getPlayer(); - final Tool tool = ToolRegistry.getTool(player.getItemInHand()); - - if (tool != null) - try { - if (event.isCancelled() && tool.ignoreCancelled()) - return; - - tool.onBlockPlace(event); - - if (tool.autoCancel()) - event.setCancelled(true); - - } catch (final Throwable t) { - event.setCancelled(true); - - Common.tell(player, SimpleLocalization.Tool.ERROR); - Common.error(t, - "Failed to handle placing " + event.getBlock() + " using tool: " + tool.getClass()); - } - } - - /** - * Handles hotbar focus/defocus for tools - */ - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onHeltItem(final PlayerItemHeldEvent event) { - final Player player = event.getPlayer(); - - final Tool current = ToolRegistry.getTool(player.getInventory().getItem(event.getNewSlot())); - final Tool previous = ToolRegistry.getTool(player.getInventory().getItem(event.getPreviousSlot())); - - // Player has attained focus - if (current != null) { - - if (previous != null) { - - // Not really - if (previous.equals(current)) - return; - - previous.onHotbarDefocused(player); - } - - current.onHotbarFocused(player); - } - // Player lost focus - else if (previous != null) - previous.onHotbarDefocused(player); - } - - // ------------------------------------------------------------------------------------------- - // Rockets - // ------------------------------------------------------------------------------------------- - - /** - * Handles launching a rocket - * - * @param event the event - */ - @EventHandler(priority = EventPriority.HIGHEST) - public void onRocketShoot(final ProjectileLaunchEvent event) { - final Projectile shot = event.getEntity(); - final Object /* 1.6.4 Comp */ shooter; - - try { - shooter = shot.getShooter(); - } catch (final NoSuchMethodError ex) { - if (MinecraftVersion.atLeast(V.v1_4)) - ex.printStackTrace(); - - return; - } - - if (!(shooter instanceof Player)) - return; - - if (shotRockets.containsKey(shot.getUniqueId())) - return; - - final Player player = (Player) shooter; - final Tool tool = ToolRegistry.getTool(player.getItemInHand()); - - if (tool instanceof Rocket) - try { - final Rocket rocket = (Rocket) tool; - - if (event.isCancelled() && tool.ignoreCancelled()) - return; - - if (!rocket.canLaunch(player, shot.getLocation())) { - event.setCancelled(true); - - return; - } - - if (tool.autoCancel() || shot instanceof EnderPearl) { - final World world = shot.getWorld(); - final Location loc = shot.getLocation(); - - Common.runLater(() -> shot.remove()); - - Common.runLater(1, () -> { - Valid.checkNotNull(shot, "shot = null"); - Valid.checkNotNull(world, "shot.world = null"); - Valid.checkNotNull(loc, "shot.location = null"); - - final Location directedLoc = player.getEyeLocation().add(player.getEyeLocation().getDirection().setY(0).normalize().multiply(1.05)).add(0, 0.2, 0); - - final Projectile copy = world.spawn(directedLoc, shot.getClass()); - copy.setVelocity(shot.getVelocity()); - - shotRockets.put(copy.getUniqueId(), new ShotRocket(player, rocket)); - rocket.onLaunch(copy, player); - - Common.runTimer(1, new BukkitRunnable() { - - private long elapsedTicks = 0; - - @Override - public void run() { - if (!copy.isValid() || copy.isOnGround() || elapsedTicks++ > 20 * 30 /*Remove after 30 seconds to reduce server strain*/) - cancel(); - - else - rocket.onFlyTick(copy, player); - } - }); - }); - - } else { - shotRockets.put(shot.getUniqueId(), new ShotRocket(player, rocket)); - rocket.onLaunch(shot, player); - } - - } catch (final Throwable t) { - event.setCancelled(true); - - Common.tell(player, SimpleLocalization.Tool.ERROR); - Common.error(t, - "Failed to shoot rocket " + tool.getClass()); - } - } - - /** - * Handles rockets on impacts - * - * @param event - */ - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onRocketHit(final ProjectileHitEvent event) { - final Projectile projectile = event.getEntity(); - final ShotRocket shot = shotRockets.remove(projectile.getUniqueId()); - - if (shot != null) { - final Rocket rocket = shot.getRocket(); - final Player shooter = shot.getShooter(); - - try { - if (rocket.canExplode(projectile, shooter)) { - final RocketExplosionEvent rocketEvent = new RocketExplosionEvent(rocket, projectile, rocket.getExplosionPower(), rocket.isBreakBlocks()); - - if (Common.callEvent(rocketEvent)) { - final Location location = projectile.getLocation(); - - shot.getRocket().onExplode(projectile, shot.getShooter()); - projectile.getWorld().createExplosion(location.getX(), location.getY(), location.getZ(), rocketEvent.getPower(), false, rocketEvent.isBreakBlocks()); - } - - } else - projectile.remove(); - } catch (final Throwable t) { - Common.tell(shooter, SimpleLocalization.Tool.ERROR); - Common.error(t, - "Failed to handle impact by rocket " + shot.getRocket().getClass()); - } - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/metrics/Metrics.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/metrics/Metrics.java deleted file mode 100644 index b5131aa6b92b7c9b955970911ea7067b766433ba..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/metrics/Metrics.java +++ /dev/null @@ -1,413 +0,0 @@ -package org.mineacademy.fo.metrics; - -import java.io.BufferedReader; -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.util.Collection; -import java.util.Timer; -import java.util.TimerTask; -import java.util.UUID; -import java.util.logging.Level; -import java.util.zip.GZIPOutputStream; - -import javax.net.ssl.HttpsURLConnection; - -import org.bukkit.Bukkit; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.RegisteredServiceProvider; -import org.bukkit.plugin.ServicePriority; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; - -/** - * bStats collects some data for plugin authors. - * <p> - * Check out https://bStats.org/ to learn more about bStats! - * - * ** IMPORTANT ** - * DO NOT MODIFY ANY PARTS OR SECTIONS OF THIS CLASS - * THIS IS TOTALLY UNSUPPORTED AND MAY LEAD TO YOUR BSTATS - * ACCOUNT GETTING SUSPENDED - * - * ** LEGAL DISCLAIMER ** - * The follow class is the works of Bastian Opperman and is included - * in good faith to help spread awareness of his amazing service - * and enable more people use bStats. - * - * See more at: https://bstats.org/getting-started/include-metrics - */ -public final class Metrics { - - static { - // You can use the property to disable the check in your test environment - if (System.getProperty("bstats.relocatecheck") == null || !System.getProperty("bstats.relocatecheck").equals("false")) { - // Maven's Relocate is clever and changes strings, too. So we have to use this little "trick" ... :D - final String defaultPackage = new String( - new byte[] { 'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's', '.', 'b', 'u', 'k', 'k', 'i', 't' }); - final String examplePackage = new String(new byte[] { 'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e' }); - // We want to make sure nobody just copy & pastes the example and use the wrong package names - if (Metrics.class.getPackage().getName().equals(defaultPackage) || Metrics.class.getPackage().getName().equals(examplePackage)) - throw new IllegalStateException("bStats Metrics class has not been relocated correctly!"); - } - } - - // The version of this bStats class - public static final int B_STATS_VERSION = 1; - - // The url to which the data is sent - private static final String URL = "https://bStats.org/submitData/bukkit"; - - // Is bStats enabled on this server? - private final boolean enabled; - - // Should failed requests be logged? - private static boolean logFailedRequests; - - // Should the sent data be logged? - private static boolean logSentData; - - // Should the response text be logged? - private static boolean logResponseStatusText; - - // The uuid of the server - private static String serverUUID; - - // The plugin - private final Plugin plugin; - - // The plugin id - private final int pluginId; - - /** - * Class constructor. - * - * ** IMPORTANT DEVELOPER NOTICE ** - * DO NOT MODIFY ANY PARTS OR SECTIONS OF THIS CLASS - * THIS IS TOTALLY UNSUPPORTED AND MAY LEAD TO YOUR BSTATS - * ACCOUNT GETTING SUSPENDED - * - * @param plugin The plugin which stats should be submitted. - * @param pluginId The id of the plugin. - * It can be found at <a href="https://bstats.org/what-is-my-plugin-id">What is my plugin id?</a> - */ - public Metrics(Plugin plugin, int pluginId) { - if (plugin == null) - throw new IllegalArgumentException("Plugin cannot be null!"); - this.plugin = plugin; - this.pluginId = pluginId; - - // Get the config file - final File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats"); - final File configFile = new File(bStatsFolder, "config.yml"); - final YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile); - - // Check if the config file exists - if (!config.isSet("serverUuid")) { - - // Add default values - config.addDefault("enabled", true); - // Every server gets it's unique random id. - config.addDefault("serverUuid", UUID.randomUUID().toString()); - // Should failed request be logged? - config.addDefault("logFailedRequests", false); - // Should the sent data be logged? - config.addDefault("logSentData", false); - // Should the response text be logged? - config.addDefault("logResponseStatusText", false); - - // Inform the server owners about bStats - config.options().header( - "bStats collects some data for plugin authors like how many servers are using their plugins.\n" + - "To honor their work, you should not disable it.\n" + - "This has nearly no effect on the server performance!\n" + - "Check out https://bStats.org/ to learn more :)") - .copyDefaults(true); - try { - config.save(configFile); - } catch (final IOException ignored) { - } - } - - // Load the data - serverUUID = config.getString("serverUuid"); - logFailedRequests = config.getBoolean("logFailedRequests", false); - enabled = config.getBoolean("enabled", true); - logSentData = config.getBoolean("logSentData", false); - logResponseStatusText = config.getBoolean("logResponseStatusText", false); - if (enabled) { - boolean found = false; - // Search for all other bStats Metrics classes to see if we are the first one - for (final Class<?> service : Bukkit.getServicesManager().getKnownServices()) - try { - service.getField("B_STATS_VERSION"); // Our identifier :) - found = true; // We aren't the first - break; - } catch (final NoSuchFieldException ignored) { - } - // Register our service - Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal); - if (!found) - // We are the first! - startSubmitting(); - } - } - - /** - * Checks if bStats is enabled. - * - * * ** IMPORTANT DEVELOPER NOTICE ** - * DO NOT MODIFY ANY PARTS OR SECTIONS OF THIS CLASS - * THIS IS TOTALLY UNSUPPORTED AND MAY LEAD TO YOUR BSTATS - * ACCOUNT GETTING SUSPENDED - * - * @return Whether bStats is enabled or not. - */ - public boolean isEnabled() { - return enabled; - } - - /** - * Starts the Scheduler which submits our data every 30 minutes. - * - * * ** IMPORTANT DEVELOPER NOTICE ** - * DO NOT MODIFY ANY PARTS OR SECTIONS OF THIS CLASS - * THIS IS TOTALLY UNSUPPORTED AND MAY LEAD TO YOUR BSTATS - * ACCOUNT GETTING SUSPENDED - */ - private void startSubmitting() { - final Timer timer = new Timer(true); // We use a timer cause the Bukkit scheduler is affected by server lags - timer.scheduleAtFixedRate(new TimerTask() { - @Override - public void run() { - if (!plugin.isEnabled()) { // Plugin was disabled - timer.cancel(); - return; - } - // Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler - // Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;) - Bukkit.getScheduler().runTask(plugin, () -> submitData()); - } - }, 1000 * 60 * 5, 1000 * 60 * 30); - // Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start - // WARNING: Changing the frequency has no effect but your plugin WILL be blocked/deleted! - // WARNING: Just don't do it! - } - - /** - * Gets the plugin specific data. - * This method is called using Reflection. - * - * * ** IMPORTANT DEVELOPER NOTICE ** - * DO NOT MODIFY ANY PARTS OR SECTIONS OF THIS CLASS - * THIS IS TOTALLY UNSUPPORTED AND MAY LEAD TO YOUR BSTATS - * ACCOUNT GETTING SUSPENDED - * - * @return The plugin specific data. - */ - public JsonObject getPluginData() { - final JsonObject data = new JsonObject(); - - final String pluginName = plugin.getDescription().getName(); - final String pluginVersion = plugin.getDescription().getVersion(); - - data.addProperty("pluginName", pluginName); // Append the name of the plugin - data.addProperty("id", pluginId); // Append the id of the plugin - data.addProperty("pluginVersion", pluginVersion); // Append the version of the plugin - data.add("customCharts", new JsonArray()); - - return data; - } - - /** - * Gets the server specific data. - * - * * ** IMPORTANT DEVELOPER NOTICE ** - * DO NOT MODIFY ANY PARTS OR SECTIONS OF THIS CLASS - * THIS IS TOTALLY UNSUPPORTED AND MAY LEAD TO YOUR BSTATS - * ACCOUNT GETTING SUSPENDED - * - * @return The server specific data. - */ - private JsonObject getServerData() { - // Minecraft specific data - int playerAmount; - try { - // Around MC 1.8 the return type was changed to a collection from an array, - // This fixes java.lang.NoSuchMethodError: org.bukkit.Bukkit.getOnlinePlayers()Ljava/util/Collection; - final Method onlinePlayersMethod = Class.forName("org.bukkit.Server").getMethod("getOnlinePlayers"); - playerAmount = onlinePlayersMethod.getReturnType().equals(Collection.class) - ? ((Collection<?>) onlinePlayersMethod.invoke(Bukkit.getServer())).size() - : ((Player[]) onlinePlayersMethod.invoke(Bukkit.getServer())).length; - } catch (final Exception e) { - playerAmount = Bukkit.getOnlinePlayers().size(); // Just use the new method if the Reflection failed - } - final int onlineMode = Bukkit.getOnlineMode() ? 1 : 0; - final String bukkitVersion = Bukkit.getVersion(); - final String bukkitName = Bukkit.getName(); - - // OS/Java specific data - final String javaVersion = System.getProperty("java.version"); - final String osName = System.getProperty("os.name"); - final String osArch = System.getProperty("os.arch"); - final String osVersion = System.getProperty("os.version"); - final int coreCount = Runtime.getRuntime().availableProcessors(); - - final JsonObject data = new JsonObject(); - - data.addProperty("serverUUID", serverUUID); - - data.addProperty("playerAmount", playerAmount); - data.addProperty("onlineMode", onlineMode); - data.addProperty("bukkitVersion", bukkitVersion); - data.addProperty("bukkitName", bukkitName); - - data.addProperty("javaVersion", javaVersion); - data.addProperty("osName", osName); - data.addProperty("osArch", osArch); - data.addProperty("osVersion", osVersion); - data.addProperty("coreCount", coreCount); - - return data; - } - - /** - * Collects the data and sends it afterwards. - * - * * ** IMPORTANT DEVELOPER NOTICE ** - * DO NOT MODIFY ANY PARTS OR SECTIONS OF THIS CLASS - * THIS IS TOTALLY UNSUPPORTED AND MAY LEAD TO YOUR BSTATS - * ACCOUNT GETTING SUSPENDED - */ - private void submitData() { - final JsonObject data = getServerData(); - - final JsonArray pluginData = new JsonArray(); - // Search for all other bStats Metrics classes to get their plugin data - for (final Class<?> service : Bukkit.getServicesManager().getKnownServices()) - try { - service.getField("B_STATS_VERSION"); // Our identifier :) - - for (final RegisteredServiceProvider<?> provider : Bukkit.getServicesManager().getRegistrations(service)) - try { - final Object plugin = provider.getService().getMethod("getPluginData").invoke(provider.getProvider()); - if (plugin instanceof JsonObject) - pluginData.add((JsonObject) plugin); - else - try { - final Class<?> jsonObjectJsonSimple = Class.forName("org.json.simple.JSONObject"); - if (plugin.getClass().isAssignableFrom(jsonObjectJsonSimple)) { - final Method jsonStringGetter = jsonObjectJsonSimple.getDeclaredMethod("toJSONString"); - jsonStringGetter.setAccessible(true); - final String jsonString = (String) jsonStringGetter.invoke(plugin); - final JsonObject object = new JsonParser().parse(jsonString).getAsJsonObject(); - pluginData.add(object); - } - } catch (final ClassNotFoundException e) { - // minecraft version 1.14+ - if (logFailedRequests) - this.plugin.getLogger().log(Level.SEVERE, "Encountered unexpected exception ", e); - } - } catch (NullPointerException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { - } - } catch (final NoSuchFieldException ignored) { - } - - data.add("plugins", pluginData); - - // Create a new thread for the connection to the bStats server - new Thread(() -> { - try { - // Send the data - sendData(plugin, data); - } catch (final Exception e) { - // Something went wrong! :( - if (logFailedRequests) - plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e); - } - }).start(); - } - - /** - * Sends the data to the bStats server. - * - * * ** IMPORTANT DEVELOPER NOTICE ** - * DO NOT MODIFY ANY PARTS OR SECTIONS OF THIS CLASS - * THIS IS TOTALLY UNSUPPORTED AND MAY LEAD TO YOUR BSTATS - * ACCOUNT GETTING SUSPENDED - * - * @param plugin Any plugin. It's just used to get a logger instance. - * @param data The data to send. - * @throws Exception If the request failed. - */ - private static void sendData(Plugin plugin, JsonObject data) throws Exception { - if (data == null) - throw new IllegalArgumentException("Data cannot be null!"); - if (Bukkit.isPrimaryThread()) - throw new IllegalAccessException("This method must not be called from the main thread!"); - if (logSentData) - plugin.getLogger().info("Sending data to bStats: " + data); - final HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection(); - - // Compress the data to save bandwidth - final byte[] compressedData = compress(data.toString()); - - // Add headers - connection.setRequestMethod("POST"); - connection.addRequestProperty("Accept", "application/json"); - connection.addRequestProperty("Connection", "close"); - connection.addRequestProperty("Content-Encoding", "gzip"); // We gzip our request - connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length)); - connection.setRequestProperty("Content-Type", "application/json"); // We send our data in JSON format - connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION); - - // Send data - connection.setDoOutput(true); - try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) { - outputStream.write(compressedData); - } - - final StringBuilder builder = new StringBuilder(); - try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { - String line; - while ((line = bufferedReader.readLine()) != null) - builder.append(line); - } - - if (logResponseStatusText) - plugin.getLogger().info("Sent data to bStats and received response: " + builder); - } - - /** - * Gzips the given String. - * - * * ** IMPORTANT DEVELOPER NOTICE ** - * DO NOT MODIFY ANY PARTS OR SECTIONS OF THIS CLASS - * THIS IS TOTALLY UNSUPPORTED AND MAY LEAD TO YOUR BSTATS - * ACCOUNT GETTING SUSPENDED - * - * @param str The string to gzip. - * @return The gzipped String. - * @throws IOException If the compression failed. - */ - private static byte[] compress(final String str) throws IOException { - if (str == null) - return null; - final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - try (GZIPOutputStream gzip = new GZIPOutputStream(outputStream)) { - gzip.write(str.getBytes(StandardCharsets.UTF_8)); - } - return outputStream.toByteArray(); - } - -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/BoxedMessage.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/BoxedMessage.java deleted file mode 100644 index aea24972dfdf1149989ee523fd9e299bf58c5f6c..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/BoxedMessage.java +++ /dev/null @@ -1,367 +0,0 @@ -package org.mineacademy.fo.model; - -import java.util.Arrays; -import java.util.Objects; - -import org.apache.commons.lang.StringUtils; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.mineacademy.fo.ChatUtil; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.remain.Remain; - -import lombok.RequiredArgsConstructor; - -/** - * Represents a chat message surrounded by chat-wide line on the top and bottom: - * <p> - * ----------------------------------- - * Hello this is a test! - * ----------------------------------- - * <p> - * You can also specify \<center\> in front of the text to center it. - */ -public final class BoxedMessage { - - /** - * The color of the top and bottom line - */ - public static ChatColor LINE_COLOR = ChatColor.DARK_GRAY; - - /** - * All message recipients - */ - private final Iterable<? extends CommandSender> recipients; - - /** - * The sender of the message - */ - private final Player sender; - - /** - * The messages to send - */ - private final String[] messages; - - /** - * Create a new boxed message from the given messages - * without sending it to any player - * - * @param messages - */ - public BoxedMessage(String... messages) { - this(null, null, messages); - } - - /** - * Create a new boxed message - * - * @param recipients - * @param sender - * @param messages - */ - private BoxedMessage(Iterable<? extends CommandSender> recipients, Player sender, String[] messages) { - this.recipients = recipients == null ? null : Common.toList(recipients); // Make a copy to prevent changes in the list on send - this.sender = sender; - this.messages = messages; - } - - // ------------------------------------------------------------------------------------------------------------ - // Helper methods - // ------------------------------------------------------------------------------------------------------------ - - private void launch() { - Common.runLater(2, () -> { - final boolean tellPrefixState = Common.ADD_TELL_PREFIX; - Common.ADD_TELL_PREFIX = false; - - sendFrame(); - - Common.ADD_TELL_PREFIX = tellPrefixState; - }); - } - - private void sendFrame() { - sendLine(); - sendFrameInternals0(); - sendLine(); - } - - private void sendFrameInternals0() { - for (int i = 0; i < getTopLines(); i++) - send("&r"); - - for (final String message : messages) - for (final String part : message.split("\n")) - send(part); - - for (int i = 0; i < getBottomLines(); i++) - send("&r"); - } - - private int getTopLines() { - switch (length()) { - case 1: - return 2; - case 2: - case 3: - case 4: - return 1; - - default: - return 0; - } - } - - private int getBottomLines() { - switch (length()) { - case 1: - case 2: - return 2; - case 3: - return 1; - - default: - return 0; - } - } - - private void sendLine() { - send(LINE_COLOR + Common.chatLineSmooth()); - } - - private int length() { - int length = 0; - - for (final String message : messages) - for (@SuppressWarnings("unused") - final String part : message.split("\n")) - length++; - - return length; - } - - private void send(String message) { - message = centerMessage0(message); - - if (recipients == null) - broadcast0(message); - - else - tell0(message); - } - - private String centerMessage0(String message) { - if (message.startsWith("<center>")) - return ChatUtil.center(message.replaceFirst("\\<center\\>(\\s|)", "")); - - return message; - } - - private void broadcast0(String message) { - if (sender != null) - Common.broadcast(message, sender); - else - Common.broadcastTo(Remain.getOnlinePlayers(), message); - } - - private void tell0(String message) { - if (sender != null) - message = message.replace("{player}", Common.resolveSenderName(sender)); - - Common.broadcastTo(recipients, message); - } - - /** - * Finds the given variables (you do not need to put {} brackets, we put them there) - * and replaces them with instances - * - * @param variables - * @return - */ - public Replacor find(String... variables) { - return new Replacor(variables); - } - - public String getMessage() { - return StringUtils.join(messages, "\n"); - } - - @Override - public String toString() { - return "Boxed{" + StringUtils.join(messages, ", ") + "}"; - } - - // ------------------------------------------------------------------------------------------------------------ - // Messaging - // ------------------------------------------------------------------------------------------------------------ - - /** - * Broadcast this message to everyone on the message - */ - public void broadcast() { - broadcast(null, messages); - } - - /** - * Broadcast this message to all players as the sender, - * replacing {player} with the sender name - * - * @param sender - */ - public void broadcastAs(Player sender) { - new BoxedMessage(null, sender, messages).launch(); - } - - /** - * Sends this message to the recipient - * - * @param recipient - */ - public void tell(CommandSender recipient) { - tell(null, Arrays.asList(recipient), messages); - } - - /** - * Sends this message to given recipients - * - * @param recipients - */ - public void tell(Iterable<? extends CommandSender> recipients) { - tell(null, recipients, messages); - } - - /** - * Sends this message to the given recipient - * replacing {player} with the sender name - * - * @param receiver - * @param sender - */ - public void tellAs(CommandSender receiver, Player sender) { - tell(sender, Arrays.asList(receiver), messages); - } - - /** - * Sends this message to the given recipients - * replacing {player} with the sender name - * - * @param receivers - * @param sender - */ - public void tellAs(Iterable<? extends CommandSender> receivers, Player sender) { - new BoxedMessage(receivers, sender, messages).launch(); - } - - // ------------------------------------------------------------------------------------------------------------ - // Static - // ------------------------------------------------------------------------------------------------------------ - - /** - * Send this message to everyone - * - * @param messages - */ - public static void broadcast(String... messages) { - broadcast(null, messages); - } - - /** - * Sends this message to the all players as the sender - * - * @param sender - * @param messages - */ - public static void broadcast(Player sender, String... messages) { - new BoxedMessage(null, sender, messages).launch(); - } - - /** - * Sends the message to the recipient - * - * @param recipient - * @param messages - */ - public static void tell(CommandSender recipient, String... messages) { - tell(null, Arrays.asList(recipient), messages); - } - - /** - * Sends the message to the given recipients - * - * @param recipients - * @param messages - */ - public static void tell(Iterable<? extends CommandSender> recipients, String... messages) { - tell(null, recipients, messages); - } - - /** - * Sends this message to a recipient as sender - * - * @param sender - * @param receiver - * @param messages - */ - public static void tell(Player sender, CommandSender receiver, String... messages) { - tell(sender, Arrays.asList(receiver), messages); - } - - /** - * Sends this message to recipients as sender - * - * @param sender - * @param receivers - * @param messages - */ - public static void tell(Player sender, Iterable<? extends CommandSender> receivers, String... messages) { - new BoxedMessage(receivers, sender, messages).launch(); - } - - // ------------------------------------------------------------------------------------------------------------ - // Replacor - // ------------------------------------------------------------------------------------------------------------ - - /** - * Utility class for quickly replacing variables - */ - @RequiredArgsConstructor - public class Replacor { - - /** - * The placeholder names to replace - */ - private final String[] variables; - - /** - * Replace {@link #variables} with the given object replacements - * - * @param replacements - * @return - */ - public final BoxedMessage replace(Object... replacements) { - String message = StringUtils.join(messages, "%delimiter%"); - - for (int i = 0; i < variables.length; i++) { - String find = variables[i]; - - { // Auto insert brackets - if (!find.startsWith("{")) - find = "{" + find; - - if (!find.endsWith("}")) - find = find + "}"; - } - - final Object rep = i < replacements.length ? replacements[i] : null; - - message = message.replace(find, rep != null ? Objects.toString(rep) : ""); - } - - final String[] copy = message.split("%delimiter%"); - - return new BoxedMessage(recipients, sender, copy); - } - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/ChatImage.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/ChatImage.java deleted file mode 100644 index 404d679d85899585b198dac62dd7a6396edd1f4a..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/ChatImage.java +++ /dev/null @@ -1,326 +0,0 @@ -package org.mineacademy.fo.model; - -import java.awt.Color; -import java.awt.geom.AffineTransform; -import java.awt.image.AffineTransformOp; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; - -import javax.imageio.ImageIO; - -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; -import org.bukkit.util.ChatPaginator; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.remain.CompChatColor; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.NonNull; - -/** - * Represents a way to show an image in chat - * - * @author bobacadodl and kangarko - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class ChatImage { - - /** - * Represents empty char - */ - private final static char TRANSPARENT_CHAR = ' '; - - /** - * Represents colors we can use for MC before 1.16 - */ - private final static Color[] LEGACY_COLORS = { - new Color(0, 0, 0), - new Color(0, 0, 170), - new Color(0, 170, 0), - new Color(0, 170, 170), - new Color(170, 0, 0), - new Color(170, 0, 170), - new Color(255, 170, 0), - new Color(170, 170, 170), - new Color(85, 85, 85), - new Color(85, 85, 255), - new Color(85, 255, 85), - new Color(85, 255, 255), - new Color(255, 85, 85), - new Color(255, 85, 255), - new Color(255, 255, 85), - new Color(255, 255, 255), - }; - - /** - * Represents the currently loaded lines - */ - @Getter - private String[] lines; - - /** - * Appends the given text next to the image - * - * @param text - * @return - */ - public ChatImage appendText(String... text) { - for (int y = 0; y < lines.length; y++) - if (text.length > y) { - final String line = text[y]; - - lines[y] += " " + line; - } - - return this; - } - - /** - * Appends the given text as centered, next to the image - * - * @param text - * @return - */ - public ChatImage appendCenteredText(String... text) { - for (int y = 0; y < lines.length; y++) - if (text.length > y) { - final int len = ChatPaginator.AVERAGE_CHAT_PAGE_WIDTH - lines[y].length(); - - lines[y] = lines[y] + center(text[y], len); - - } else - return this; - - return this; - } - - /* - * Centers the given message according to the given length - */ - private String center(String message, int length) { - if (message.length() > length) - return message.substring(0, length); - - else if (message.length() == length) - return message; - - else { - final int leftPadding = (length - message.length()) / 2; - final StringBuilder leftBuilder = new StringBuilder(); - - for (int i = 0; i < leftPadding; i++) - leftBuilder.append(" "); - - return leftBuilder.toString() + message; - } - } - - /** - * Sends this image to the given player - * - * @param sender - */ - public void sendToPlayer(CommandSender sender) { - for (final String line : lines) - sender.sendMessage(Variables.replace(line, sender)); - } - - /* ------------------------------------------------------------------------------- */ - /* Static */ - /* ------------------------------------------------------------------------------- */ - - /** - * Create an image to show in a chat message from the given path - * in your plugin's JAR, with the given height and the given character type. - * - * @param file - * @param height - * @param characterType - * @return - */ - public static ChatImage fromFile(@NonNull File file, int height, Type characterType) throws IOException { - Valid.checkBoolean(file.exists(), "Cannot load image from non existing file " + file.toPath()); - - final BufferedImage image = ImageIO.read(file); - - if (image == null) - throw new NullPointerException("Unable to load image size " + file.length() + " bytes from " + file.toPath()); - - final CompChatColor[][] chatColors = parseImage(image, height); - final ChatImage chatImage = new ChatImage(); - - chatImage.lines = parseColors(chatColors, characterType); - - return chatImage; - } - - /** - * Return a chat image from finished lines that were already created from {@link #fromFile(File, int, Type)} - * - * @param lines - * @return - */ - public static ChatImage fromLines(String[] lines) { - final ChatImage chatImage = new ChatImage(); - chatImage.lines = lines; - - return chatImage; - } - - /* - * Parse the given image into chat colors - */ - private static CompChatColor[][] parseImage(BufferedImage image, int height) { - final double ratio = (double) image.getHeight() / image.getWidth(); - int width = (int) (height / ratio); - - if (width > 10) - width = 10; - - final BufferedImage resized = resizeImage(image, (int) (height / ratio), height); - final CompChatColor[][] chatImg = new CompChatColor[resized.getWidth()][resized.getHeight()]; - - for (int x = 0; x < resized.getWidth(); x++) - for (int y = 0; y < resized.getHeight(); y++) { - final int rgb = resized.getRGB(x, y); - final CompChatColor closest = getClosestChatColor(new Color(rgb, true)); - - chatImg[x][y] = closest; - } - - return chatImg; - } - - /* - * Resize the given image - */ - private static BufferedImage resizeImage(BufferedImage originalImage, int width, int height) { - final AffineTransform af = new AffineTransform(); - - af.scale( - width / (double) originalImage.getWidth(), - height / (double) originalImage.getHeight()); - - final AffineTransformOp operation = new AffineTransformOp(af, AffineTransformOp.TYPE_NEAREST_NEIGHBOR); - - return operation.filter(originalImage, null); - } - - /* - * Returns the closes chat color from the given color - */ - private static CompChatColor getClosestChatColor(Color color) { - if (MinecraftVersion.olderThan(V.v1_16)) { - if (color.getAlpha() < 128) - return null; - - int index = 0; - double best = -1; - - for (int i = 0; i < LEGACY_COLORS.length; i++) - if (areSimilar(LEGACY_COLORS[i], color)) - return CompChatColor.getColors().get(i); - - for (int i = 0; i < LEGACY_COLORS.length; i++) { - final double distance = getDistance(color, LEGACY_COLORS[i]); - - if (distance < best || best == -1) { - best = distance; - index = i; - } - } - - return CompChatColor.getColors().get(index); - } - - return CompChatColor.of(color); - } - - /* - * Return if colors are nearly identical - */ - private static boolean areSimilar(Color first, Color second) { - return Math.abs(first.getRed() - second.getRed()) <= 5 && - Math.abs(first.getGreen() - second.getGreen()) <= 5 && - Math.abs(first.getBlue() - second.getBlue()) <= 5; - - } - - /* - * Returns how different two colors are - */ - private static double getDistance(Color first, Color second) { - final double rmean = (first.getRed() + second.getRed()) / 2.0; - final double r = first.getRed() - second.getRed(); - final double g = first.getGreen() - second.getGreen(); - final int b = first.getBlue() - second.getBlue(); - - final double weightR = 2 + rmean / 256.0; - final double weightG = 4.0; - final double weightB = 2 + (255 - rmean) / 256.0; - - return weightR * r * r + weightG * g * g + weightB * b * b; - } - - /* - * Parse the given 2D colors to fit lines - */ - private static String[] parseColors(CompChatColor[][] colors, Type imgchar) { - final String[] lines = new String[colors[0].length]; - - for (int y = 0; y < colors[0].length; y++) { - String line = ""; - - for (int x = 0; x < colors.length; x++) { - final CompChatColor color = colors[x][y]; - - line += (color != null) ? colors[x][y].toString() + imgchar : TRANSPARENT_CHAR; - } - - lines[y] = line + ChatColor.RESET; - } - - return lines; - } - - /* ------------------------------------------------------------------------------- */ - /* Classes */ - /* ------------------------------------------------------------------------------- */ - - /** - * Represents common image characters - * - * @author bobacadodl - */ - public enum Type { - BLOCK('\u2588'), - DARK_SHADE('\u2593'), - MEDIUM_SHADE('\u2592'), - LIGHT_SHADE('\u2591'); - - /** - * The character used to build the image - */ - @Getter - private char character; - - private Type(char c) { - this.character = c; - } - - /** - * Return the character - * - * @return - */ - @Override - public String toString() { - return String.valueOf(character); - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/ChatPaginator.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/ChatPaginator.java deleted file mode 100644 index b3fdcbd18b546bf4846f4bb9b2fb013f83cb9a18..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/ChatPaginator.java +++ /dev/null @@ -1,246 +0,0 @@ -package org.mineacademy.fo.model; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.metadata.FixedMetadataValue; -import org.bukkit.plugin.Plugin; -import org.mineacademy.fo.ChatUtil; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.command.PermsCommand; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.settings.SimpleLocalization; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * A draft API for enumerating chat messages into pages. - * - * See {@link PermsCommand} for an early implementation. - */ -@Getter -@RequiredArgsConstructor -public final class ChatPaginator { - - /** - * This is the height that will fill all chat lines (20) - * if you use {@link #setFoundationHeader(String)}. - * - * It is 17 because our header is 3 lines wide. - */ - public static final int FOUNDATION_HEIGHT = 15; - - /** - * How many lines per page? Maximum on screen is 20 minus header and footer. - */ - private final int linesPerPage; - - /** - * The color used in header and footer - */ - private final ChatColor themeColor; - - /** - * The header included on every page. - */ - private final List<SimpleComponent> header = new ArrayList<>(); - - /** - * The pages with their content. - */ - private final Map<Integer, List<SimpleComponent>> pages = new HashMap<>(); - - /** - * The footer included on every page. - */ - private final List<SimpleComponent> footer = new ArrayList<>(); - - /** - * Construct chat pages taking the entire visible - * chat portion when chat is maximize given {@link #setFoundationHeader(String)} - * is used and there is no footer. We use {@link #FOUNDATION_HEIGHT} for height - * and {@link SimpleLocalization.Commands#HEADER_COLOR} for color. - */ - public ChatPaginator() { - this(FOUNDATION_HEIGHT, SimpleLocalization.Commands.HEADER_COLOR); - } - - /** - * Construct chat pages taking the entire visible - * chat portion when chat is maximize given {@link #setFoundationHeader(String)} - * is used and there is no footer. We use {@link #FOUNDATION_HEIGHT} for height. - * - * @param color to use - */ - public ChatPaginator(ChatColor themeColor) { - this(FOUNDATION_HEIGHT, themeColor); - } - - /** - * Creates a paginator with the given lines per page. Maximum on screen is 20 minus header and footer. - * The {@link SimpleLocalization.Commands#HEADER_COLOR} color is used. - * - * @param linesPerPage - */ - public ChatPaginator(int linesPerPage) { - this(linesPerPage, SimpleLocalization.Commands.HEADER_COLOR); - } - - /** - * Sets the standard Foundation header used across plugins. - * ---------------- - * \<center\>title - * --------------- - * - * IMPORTANT: Use {@link #setThemeColor(ChatColor)} first if you want to use - * a custom theme color - * - * @param title - * @return - */ - public ChatPaginator setFoundationHeader(String title) { - return this.setHeader("&r", this.themeColor + "&m" + ChatUtil.center("&r" + this.themeColor + " " + title + " &m", '-', 150), "&r"); - } - - /** - * Set the content type - * - * @param components - * @return - */ - public ChatPaginator setHeader(SimpleComponent... components) { - for (final SimpleComponent component : components) - this.header.add(component); - - return this; - } - - /** - * Set the content type - * - * @param messages - * @return - */ - public ChatPaginator setHeader(String... messages) { - for (final String message : messages) - this.header.add(SimpleComponent.of(message)); - - return this; - } - - /** - * Set the content type - * - * @param components - * @return - */ - public ChatPaginator setPages(SimpleComponent... components) { - this.pages.clear(); - this.pages.putAll(Common.fillPages(this.linesPerPage, Arrays.asList(components))); - - return this; - } - - /** - * Set the content type - * - * @param messages - * @return - */ - public ChatPaginator setPages(String... messages) { - final List<SimpleComponent> pages = new ArrayList<>(); - - for (final String message : messages) - pages.add(SimpleComponent.of(message)); - - return this.setPages(pages); - } - - /** - * Set the content type - * - * @param components - * @return - */ - public ChatPaginator setPages(Collection<SimpleComponent> components) { - this.pages.clear(); - this.pages.putAll(Common.fillPages(this.linesPerPage, components)); - - return this; - } - - /** - * Set the content type - * - * @param components - * @return - */ - public ChatPaginator setFooter(SimpleComponent... components) { - for (final SimpleComponent component : components) - this.footer.add(component); - - return this; - } - - /** - * Set the content type - * - * @param messages - * @return - */ - public ChatPaginator setFooter(String... messages) { - for (final String message : messages) - this.footer.add(SimpleComponent.of(message)); - - return this; - } - - /** - * Show this page to the sender, either paginated or a full dumb when this is a console - * - * @param sender - */ - public void send(CommandSender sender) { - if (sender instanceof Player) { - final Player player = (Player) sender; - - // Remove old FoPages to prevent conflicts when two or more plugins use Foundation shaded - if (player.hasMetadata("FoPages")) { - final Plugin owningPlugin = player.getMetadata("FoPages").get(0).getOwningPlugin(); - - player.removeMetadata("FoPages", owningPlugin); - } - - player.setMetadata("FoPages", new FixedMetadataValue(SimplePlugin.getInstance(), SimplePlugin.getNamed())); - player.setMetadata(getPageNbtTag(), new FixedMetadataValue(SimplePlugin.getInstance(), this)); - - player.chat("/#flp 1"); - } - - else { - for (final SimpleComponent component : this.header) - component.send(sender); - - int amount = 1; - - for (final List<SimpleComponent> components : this.pages.values()) - for (final SimpleComponent component : components) - component.replace("{count}", amount++).send(sender); - - for (final SimpleComponent component : this.footer) - component.send(sender); - } - } - - public static String getPageNbtTag() { - return "FoPages_" + SimplePlugin.getNamed(); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/ChunkedTask.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/ChunkedTask.java deleted file mode 100644 index e30c7277dfd729a480f842b3491c38957a3f1782..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/ChunkedTask.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.mineacademy.fo.model; - -import org.mineacademy.fo.Common; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; - -/** - * Splits manipulating with large about of items in a list - * into smaller pieces - */ -@RequiredArgsConstructor -public abstract class ChunkedTask { - - /** - * How many ticks should we wait before processing the next bulk amount? - */ - @Setter - private int waitPeriodTicks = 20; - - /** - * How many items should we process at once? - */ - private final int processAmount; - - /* - * The current index where we are processing at, right now - */ - @Getter - private int currentIndex = 0; - - /** - * Start the chain, will run several sync tasks until done - */ - public final void startChain() { - Common.runLater(() -> { - final long now = System.currentTimeMillis(); - - boolean finished = false; - int processed = 0; - - for (int i = currentIndex; i < currentIndex + processAmount; i++) { - if (!canContinue(i)) { - finished = true; - - break; - } - - onProcess(i); - processed++; - } - - if (processed > 0 || !finished) - Common.log(getProcessMessage(now, processed)); - - if (!finished) { - currentIndex += processAmount; - - Common.runLaterAsync(waitPeriodTicks, this::startChain); - - } else - onFinish(); - }); - } - - /** - * Called when we process a single item - * - * @param item - */ - protected abstract void onProcess(int index); - - /** - * Return if the task may execute the next index - * - * @param index - * @return true if can continue - */ - protected abstract boolean canContinue(int index); - - /** - * Get the message to send to the console on each progress, or null if no message - * - * @param initialTime - * @param processed - * @return - */ - protected String getProcessMessage(long initialTime, int processed) { - return "Processed " + String.format("%,d", processed) + " " + getLabel() + ". Took " + (System.currentTimeMillis() - initialTime) + " ms"; - } - - /** - * Called when the processing is finished - */ - protected void onFinish() { - } - - /** - * Get the label for the process message - * "blocks" by default - * - * @return - */ - protected String getLabel() { - return "blocks"; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/ConfigItems.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/ConfigItems.java deleted file mode 100644 index 9c4e2c257d74081198508f1196199bfd5f1761cc..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/ConfigItems.java +++ /dev/null @@ -1,229 +0,0 @@ -package org.mineacademy.fo.model; - -import java.io.File; -import java.lang.reflect.Constructor; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.commons.lang.WordUtils; -import org.bukkit.configuration.file.YamlConfiguration; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.FileUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.settings.YamlConfig; - -import lombok.NonNull; - -/** - * A special class that can store loaded {@link YamlConfig} files - * - * DOES NOT INVOKE {@link YamlConfig#loadConfiguration(String, String)} - * for you, you must invoke it by yourself as you otherwise normally would! - * - * @param <T> - */ -public final class ConfigItems<T extends YamlConfig> { - - /** - * A list of all loaded items - */ - private volatile List<T> loadedItems = new ArrayList<>(); - - /** - * The item type this class stores, such as "variable, "format", or "arena class" - */ - private final String type; - - /** - * The folder name where the items are stored, this must be the same - * on both your JAR file and in your plugin folder, for example - * "classes/" in your JAR file and "classes/" in your plugin folder - */ - private final String folder; - - /** - * The class we are loading in the list - * <p> - * *MUST* have a private constructor without any arguments - */ - private final Class<T> prototypeClass; - - /** - * Are all items stored in a single file? - */ - private boolean singleFile = false; - - /** - * Create a new config items instance - * - * @param type - * @param folder - * @param prototypeClass - * @param hasDefaultPrototype - * @param singleFile - */ - private ConfigItems(String type, String folder, Class<T> prototypeClass, boolean singleFile) { - this.type = type; - this.folder = folder; - this.prototypeClass = prototypeClass; - this.singleFile = singleFile; - } - - /** - * Load items from the given folder - * - * @param <P> - * @param name - the name of what we are loading, used for error messages such as "class", "format" - * @param folder - * @param prototypeClass - * @return - */ - public static <P extends YamlConfig> ConfigItems<P> fromFolder(String name, String folder, Class<P> prototypeClass) { - return new ConfigItems<>(name, folder, prototypeClass, false); - } - - /** - * Load items from the given YAML file path - * - * @param <P> - * @param path - * @param file - * @param prototypeClass - * @return - */ - public static <P extends YamlConfig> ConfigItems<P> fromFile(String path, String file, Class<P> prototypeClass) { - return new ConfigItems<>(path, file, prototypeClass, true); - } - - /** - * Load all item classes by creating a new instance of them and copying their folder from JAR to disk - */ - public void loadItems() { - - // Clear old items - loadedItems.clear(); - - if (singleFile) { - final File file = FileUtil.extract(this.folder); - final YamlConfiguration config = YamlConfiguration.loadConfiguration(file); - Valid.checkBoolean(config.isSet(this.type), "Unable to locate configuration section " + this.type + " in " + file); - - for (final String name : config.getConfigurationSection(this.type).getKeys(false)) - loadOrCreateItem(name); - } - - else { - // Try copy items from our JAR - if (!FileUtil.getFile(folder).exists()) - FileUtil.extractFolderFromJar(folder + "/", folder); - - // Load items on our disk - final File[] files = FileUtil.getFiles(folder, "yml"); - - for (final File file : files) { - final String name = FileUtil.getFileName(file); - - loadOrCreateItem(name); - } - } - } - - /** - * Create the class (make new instance of) by the given name, - * the class must have a private constructor taking in the String (name) or nothing - * - * @param name - * @return - */ - public T loadOrCreateItem(final String name) { - - // Create a new instance of our item - T item = null; - - try { - Constructor<T> constructor; - boolean nameConstructor = true; - - try { - constructor = prototypeClass.getDeclaredConstructor(String.class); - - } catch (final Exception e) { - constructor = prototypeClass.getDeclaredConstructor(); - nameConstructor = false; - } - - Valid.checkBoolean(Modifier.isPrivate(constructor.getModifiers()), "Your class " + prototypeClass + " must have private constructor taking a String or nothing!"); - constructor.setAccessible(true); - - if (nameConstructor) - item = constructor.newInstance(name); - else - item = constructor.newInstance(); - - // Register - loadedItems.add(item); - - } catch (final Throwable t) { - Common.throwError(t, "Failed to load" + (type == null ? "" : " " + type) + " " + name + " from " + folder); - } - - Valid.checkNotNull(item, "Failed to initiliaze" + (type == null ? "" : " " + type) + " " + name + " from " + folder); - return item; - } - - /** - * Remove the given item by instance - * - * @param item - */ - public void removeItem(@NonNull final T item) { - Valid.checkBoolean(isItemLoaded(item.getName()), WordUtils.capitalize(type) + " " + item.getName() + " not loaded. Available: " + getItemNames()); - - item.delete(); - loadedItems.remove(item); - } - - /** - * Check if the given item by name is loaded - * - * @param name - * @return - */ - public boolean isItemLoaded(final String name) { - return findItem(name) != null; - } - - /** - * Return the item instance by name, or null if not loaded - * - * @param name - * @return - */ - public T findItem(@NonNull final String name) { - for (final T item : loadedItems) - if (item.getName().equalsIgnoreCase(name)) - return item; - - return null; - } - - /** - * Return all loaded items - * - * @return - */ - public List<T> getItems() { - return Collections.unmodifiableList(loadedItems); - } - - /** - * Return all loaded item names - * - * @return - */ - public List<String> getItemNames() { - return Common.convert(loadedItems, T::getName); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/ConfigSerializable.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/ConfigSerializable.java deleted file mode 100644 index 696f939b10aa69548818337ac717f8eb25b0eeb3..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/ConfigSerializable.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.mineacademy.fo.model; - -import org.mineacademy.fo.collection.SerializedMap; - -/** - * <p>Classes implementing this can be stored/loaded from a settings file</p> - * - * <p>** All classes must also implement the following: **</p> - * <p>public static T deserialize(SerializedMap map)</p> - */ -public interface ConfigSerializable { - - /** - * Creates a Map representation of this class that you can - * save in your settings yaml or json file. - * - * @return Map containing the current state of this class - */ - SerializedMap serialize(); -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Countdown.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Countdown.java deleted file mode 100644 index 9e1f8f088c44bb4cdeb20ba95da1eb8e2f1170fb..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Countdown.java +++ /dev/null @@ -1,172 +0,0 @@ -package org.mineacademy.fo.model; - -import org.bukkit.Bukkit; -import org.bukkit.scheduler.BukkitTask; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.plugin.SimplePlugin; - -import lombok.AccessLevel; -import lombok.Getter; - -/** - * Represents a runnable timer task that counts down to 0 and stops - */ -public abstract class Countdown implements Runnable { - - /** - * How long to wait before starting this countdown (in ticks)? - * <p> - * Set to 1 second. - */ - private static final int START_DELAY = 20; - - /** - * How long to wait before ticking the next count (in ticks)? - * <p> - * Set to 1 second. - */ - private static final int TICK_PERIOD = 20; - - /** - * The time in seconds we are counting down from - */ - @Getter - private final int countdownSeconds; - - /** - * How many seconds have passed since the start ? - */ - @Getter(AccessLevel.PROTECTED) - private int secondsSinceStart = 0; - - /** - * The internal task from Bukkit associated with this countdown - */ - private int taskId = -1; - - /** - * Create new countdown from the given time - * - * @param time - */ - protected Countdown(final SimpleTime time) { - this((int) time.getTimeSeconds()); - } - - /** - * Create new countdown - * - * @param countdownSeconds - */ - protected Countdown(final int countdownSeconds) { - this.countdownSeconds = countdownSeconds; - } - - @Override - public final void run() { - secondsSinceStart++; - - if (secondsSinceStart < countdownSeconds) - try { - onTick(); - - } catch (final Throwable t) { - try { - onTickError(t); - } catch (final Throwable tt) { - Common.log("Unable to handle onTickError, got " + t + ": " + tt.getMessage()); - } - - Common.error(t, - "Error in countdown!", - "Seconds since start: " + secondsSinceStart, - "Counting till: " + countdownSeconds, - "%error"); - } - else { - cancel(); - onEnd(); - } - } - - /** - * Called when this countdown is launched - */ - protected void onStart() { - } - - /** - * Called on each tick (by default each second) till we count down to 0 - */ - protected abstract void onTick(); - - /** - * Called when the clock hits the final 0 and stops. - */ - protected abstract void onEnd(); - - /** - * Called when the {@link #onTick()} method throws an error (we already log the error) - * - * @param t - */ - protected void onTickError(final Throwable t) { - } - - /** - * Return the time left in seconds - * - * @return - */ - public int getTimeLeft() { - return countdownSeconds - secondsSinceStart; - } - - /** - * Starts this countdown failing if it is already running - */ - public final void launch() { - Valid.checkBoolean(!isRunning(), "Task " + this + " already scheduled!"); - - final BukkitTask task = Bukkit.getScheduler().runTaskTimer(SimplePlugin.getInstance(), this, START_DELAY, TICK_PERIOD); - taskId = task.getTaskId(); - - onStart(); - } - - /** - * Cancels this countdown, failing if it is not scheduled (use {@link #isRunning()}) - */ - public final void cancel() { - Bukkit.getScheduler().cancelTask(getTaskId()); - - taskId = -1; - secondsSinceStart = 0; - } - - /** - * Return true if this countdown is running - * - * @return - */ - public final boolean isRunning() { - return taskId != -1; - } - - /** - * Return the bukkit task or fails if not running - * - * @return - */ - public final int getTaskId() { - Valid.checkBoolean(isRunning(), "Task " + this + " not scheduled yet"); - - return taskId; - } - - @Override - public final String toString() { - return getClass().getSimpleName() + "{" + countdownSeconds + ", id=" + taskId + "}"; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/DiscordListener.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/DiscordListener.java deleted file mode 100644 index 3189689addd39b852d882bda72742ac45e81c116..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/DiscordListener.java +++ /dev/null @@ -1,524 +0,0 @@ -package org.mineacademy.fo.model; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - -import org.bukkit.Bukkit; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.event.Listener; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.collection.StrictSet; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.Remain; - -import github.scarsz.discordsrv.DiscordSRV; -import github.scarsz.discordsrv.api.ListenerPriority; -import github.scarsz.discordsrv.api.Subscribe; -import github.scarsz.discordsrv.api.events.DiscordGuildMessagePreProcessEvent; -import github.scarsz.discordsrv.api.events.GameChatMessagePreProcessEvent; -import github.scarsz.discordsrv.dependencies.jda.api.JDA; -import github.scarsz.discordsrv.dependencies.jda.api.entities.Member; -import github.scarsz.discordsrv.dependencies.jda.api.entities.Message; -import github.scarsz.discordsrv.dependencies.jda.api.entities.MessageChannel; -import github.scarsz.discordsrv.dependencies.jda.api.entities.Role; -import github.scarsz.discordsrv.dependencies.jda.api.entities.TextChannel; -import github.scarsz.discordsrv.dependencies.jda.api.entities.User; -import github.scarsz.discordsrv.dependencies.jda.api.exceptions.ErrorResponseException; -import github.scarsz.discordsrv.dependencies.jda.api.exceptions.HierarchyException; -import github.scarsz.discordsrv.util.DiscordUtil; -import github.scarsz.discordsrv.util.WebhookUtil; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NoArgsConstructor; - -public abstract class DiscordListener implements Listener { - - /** - * Holds registered Discord listeners - */ - private static final StrictSet<DiscordListener> registeredListeners = new StrictSet<>(); - - /** - * Cleans all registered listeners - */ - public static final void clearRegisteredListeners() { - registeredListeners.clear(); - } - - /** - * Temporarily stores the latest received message - */ - private Message message; - - /** - * Used if you edit a message. This maps the old message id to the new one - * because when we edit a message, its ID is changed - */ - @Getter(value = AccessLevel.PROTECTED) - private final Map<Long, Long> editedMessages = new HashMap<>(); - - /** - * Create a new Discord listener for the DiscordSRV plugin - * - * @param channel - */ - protected DiscordListener() { - registeredListeners.add(this); - } - - /** - * Register for listening to events only if not already - */ - public void register() { - if (!registeredListeners.contains(this)) - registeredListeners.add(this); - } - - /** - * Called automatically when someone writes a message in a Discord channel - * - * @param event - */ - private final void handleMessageReceived(DiscordGuildMessagePreProcessEvent event) { - this.message = event.getMessage(); - - onMessageReceived(event); - } - - /** - * Override this to run code when someone writes a message in a Discord channel - * - * @param event - */ - protected abstract void onMessageReceived(DiscordGuildMessagePreProcessEvent event); - - /** - * Called automatically when someone writes a message in Minecraft and DiscordSRV - * automatically processes it -- if you are handling your message, we recommend - * canceling the event here to avoid double sending - * - * @param event - */ - protected void onMessageSent(GameChatMessagePreProcessEvent event) { - } - - /** - * Convenience method for finding players, will stop your code if the player - * is not online, see {@link #checkBoolean(boolean, String)} - * - * @param playerName - * @param offlineMessage - * @return - */ - protected final Player findPlayer(String playerName, String offlineMessage) { - final Player player = Bukkit.getPlayer(playerName); - - checkBoolean(player != null, offlineMessage); - return player; - } - - /** - * Retrieve a {@link TextChannel} from the given ID - * - * @param channelId - * @return - */ - protected final TextChannel findChannel(long channelId) { - final JDA jda = DiscordUtil.getJda(); - - // JDA can be null when server is starting or connecting - if (jda != null) - return jda.getTextChannelById(channelId); - - return null; - } - - /** - * Retrieve a {@link TextChannel} list matching the given name - * - * @param channelId - * @return - */ - protected final List<TextChannel> findChannels(String channelName) { - final JDA jda = DiscordUtil.getJda(); - - // JDA can be null when server is starting or connecting - if (jda != null) - return jda.getTextChannelsByName(channelName, true); - - return new ArrayList<>(); - } - - /** - * Checks if the given value is true, if not then sends a warning - * message to Discord and removes the received message - * <p> - * Your code will stop executing below if the boolean is false - * - * @param value - * @param warningMessage - * @throws RemovedMessageException - */ - protected final void checkBoolean(boolean value, String warningMessage) throws RemovedMessageException { - if (!value) - returnHandled(warningMessage); - } - - /** - * Remove the message, send a warning and stop executing your code below this - * - * @param message - */ - protected final void returnHandled(String message) { - removeAndWarn(message); - - throw new RemovedMessageException(); - } - - /** - * Removes the message received and sends a warning message from the bot - * shown for 2 seconds and then remove it. - * - * @param warningMessage - */ - protected final void removeAndWarn(String warningMessage) { - removeAndWarn(this.message, warningMessage); - } - - /** - * Removes the given message and sends a warning message from the bot - * shown for 2 seconds and then remove it. - * - * @param message - * @param warningMessage - */ - protected final void removeAndWarn(Message message, String warningMessage) { - removeAndWarn(message, warningMessage, 2); - } - - /** - * Removes the given message and sends a warning message from the bot - * shown for the given duration in seconds and then remove it. - * - * @param message - * @param warningMessage - * @param warningDurationSeconds how long to show the warning message - */ - protected final void removeAndWarn(Message message, String warningMessage, int warningDurationSeconds) { - message.delete().complete(); - - final MessageChannel channel = message.getChannel(); - final Message channelWarningMessage = channel.sendMessage(warningMessage).complete(); - - channel.deleteMessageById(channelWarningMessage.getIdLong()).completeAfter(warningDurationSeconds, TimeUnit.SECONDS); - } - - /** - * Return if the given member has the given role by name, - * case insensitive - * - * @param member - * @param roleName - * @return - */ - protected final boolean hasRole(Member member, String roleName) { - for (final Role role : member.getRoles()) - if (role.getName().equalsIgnoreCase(roleName)) - return true; - - return false; - } - - /** - * Convenience method for sending a message as the sender to a Discord channel - * <p> - * Enhanced functionality is available for the player - * - * @param sender - * @param channel - * @param message - */ - protected final void sendMessage(Player sender, String channel, String message) { - HookManager.sendDiscordMessage(sender, channel, message); - } - - /** - * Convenience method for sending a message to a Discord channel - * - * @param channel - * @param message - */ - protected final void sendMessage(String channel, String message) { - HookManager.sendDiscordMessage(channel, message); - } - - /** - * Sends a webhook message from the given sender in case he's a valid Player - * - * @param sender - * @param channelName - * @param message - */ - protected final void sendWebhookMessage(CommandSender sender, String channelName, String message) { - final List<TextChannel> channels = this.findChannels(channelName); - final TextChannel channel = channels.isEmpty() ? null : channels.get(0); - - if (channel == null) - return; - - // Send the message - Common.runAsync(() -> { - try { - Debugger.debug("discord", "[Minecraft > Discord] Send MC message from '" + channelName + "' to Discord's '" + channel.getName() + "' channel: " + message); - - // You can remove this if you don't want to use webhooks - if (sender instanceof Player) - WebhookUtil.deliverMessage(channel, (Player) sender, message); - - else - channel.sendMessage(message).complete(); - - } catch (final ErrorResponseException ex) { - Debugger.debug("discord", "Unable to send message to Discord channel " + channelName + ", message: " + message); - } - }); - } - - /** - * Send a message to the given channel for four seconds - * - * @param channel - * @param message - */ - protected final void flashMessage(TextChannel channel, String message) { - final String finalMessage = Common.stripColors(message); - - Common.runAsync(() -> { - final Message sentMessage = channel.sendMessage(finalMessage).complete(); - - Common.runLaterAsync(4 * 20, () -> { - try { - channel.deleteMessageById(sentMessage.getIdLong()).complete(); - - } catch (final github.scarsz.discordsrv.dependencies.jda.api.exceptions.ErrorResponseException ex) { - - // Silence if deleted already - if (!ex.getMessage().contains("Unknown Message")) - ex.printStackTrace(); - } - }); - }); - } - - /** - * Remove the given message by ID - * - * @param channel - * @param messageId - */ - protected final void deleteMessageById(TextChannel channel, long messageId) { - Common.runAsync(() -> { - - // Try updating the message ID in case it has been edited - final long latestMessageId = this.editedMessages.getOrDefault(messageId, messageId); - - try { - channel.deleteMessageById(latestMessageId).complete(); - - } catch (final Throwable t) { - - // ignore already deleted - if (!(t instanceof github.scarsz.discordsrv.dependencies.jda.api.exceptions.ErrorResponseException)) - t.printStackTrace(); - - else - Debugger.debug("discord", "Could not remove Discord message in channel '" + channel.getName() + "' id " + latestMessageId - + ", it was probably deleted otherwise or this is a bug."); - } - }); - } - - /** - * Edit the given message by ID - * - * @param channel - * @param messageId - * @param newMessage - */ - protected final void editMessageById(TextChannel channel, long messageId, String newMessage) { - Common.runAsync(() -> { - try { - final Message message = channel.retrieveMessageById(messageId).complete(); - - if (message != null) { - - // Remove old message - channel.deleteMessageById(messageId).complete(); - - // Send a new one - final Message newSentMessage = channel - .sendMessage(message.getAuthor().getName() + ": " + newMessage.replace("*", "\\*").replace("_", "\\_").replace("@", "\\@")) - .complete(); - - this.editedMessages.put(messageId, newSentMessage.getIdLong()); - } - - } catch (final Throwable t) { - if (!t.toString().contains("Unknown Message")) - t.printStackTrace(); - } - }); - } - - /** - * Attempt to parse the sender's name into his Minecraft name in case he linked it - * - * @param member - * @param author - * @return - */ - protected final String findPlayerName(Member member, User author) { - final String discordName = Common.getOrDefaultStrict(member.getNickname(), author.getName()); - final UUID linkedId = DiscordSRV.getPlugin().getAccountLinkManager().getUuid(author.getId()); - - final Player player; - - if (linkedId != null) - - // You could potentially look this in offline players too - // using an async callback to prevent lag if there's tons - // of players saved or in case of a HTTP request - player = Remain.getPlayerByUUID(linkedId); - - else - player = Bukkit.getPlayer(discordName); - - return player != null && player.isOnline() ? player.getName() : discordName; - } - - /** - * Attempt to kick the player name from the channel - * - * @param discordSender - * @param reason - */ - public final void kickMember(DiscordSender discordSender, String reason) { - Common.runAsync(() -> { - try { - final Member member = DiscordUtil.getMemberById(discordSender.getUser().getId()); - - if (member != null) - member.kick(reason).complete(); - - } catch (final HierarchyException ex) { - Common.log("Unable to kick " + discordSender.getName() + " because he appears to be Discord administrator"); - } - }); - } - - /** - * Convenience method for getting all linked DiscordSRV channels - * - * @return - */ - protected final Set<String> getChannels() { - return HookManager.getDiscordChannels(); - } - - /** - * Internal exception to prevent further code execution - */ - @NoArgsConstructor(access = AccessLevel.PRIVATE) - private static final class RemovedMessageException extends RuntimeException { - private static final long serialVersionUID = 1L; - } - - /** - * Distributes received Discord messages across all {@link DiscordListener} classes - * - * @deprecated internal use only - */ - @Deprecated - @NoArgsConstructor(access = AccessLevel.PRIVATE) - public static final class DiscordListenerImpl implements Listener { - - @Getter - private static volatile DiscordListenerImpl instance = new DiscordListenerImpl(); - - /** - * Reload the listener - */ - public void resubscribe() { - DiscordSRV.api.unsubscribe(this); - DiscordSRV.api.subscribe(this); - } - - /** - * Register plugin hook - * - * https://github.com/kangarko/ChatControl-Red/issues/703 - */ - public void registerHook() { - try { - DiscordSRV.getPlugin().getPluginHooks().add(SimplePlugin::getInstance); - - } catch (final Error err) { - // Support previous Discord versions - } - } - - /** - * Distribute this message evenly across all listeners - * - * @param event - */ - @Subscribe(priority = ListenerPriority.HIGHEST) - public void onMessageReceived(DiscordGuildMessagePreProcessEvent event) { - for (final DiscordListener listener : registeredListeners) - try { - listener.handleMessageReceived(event); - - } catch (final RemovedMessageException ex) { - // Fail through since we handled that - - } catch (final Throwable t) { - Common.error(t, - "Failed to handle DiscordSRV->Minecraft message!", - "Sender: " + event.getAuthor().getName(), - "Channel: " + event.getChannel().getName(), - "Message: " + event.getMessage().getContentDisplay()); - } - } - - /** - * Notify when DiscordSRV processes a Minecraft message and wants to - * send it to Discord - * - * @param event - */ - @Subscribe(priority = ListenerPriority.HIGHEST) - public void onMessageSend(GameChatMessagePreProcessEvent event) { - for (final DiscordListener listener : registeredListeners) - try { - listener.onMessageSent(event); - - } catch (final RemovedMessageException ex) { - // Fail through since we handled that - - } catch (final Throwable t) { - Common.error(t, - "Failed to handle Minecraft->DiscordSRV message!", - "Sender: " + event.getPlayer().getName(), - "Channel: " + event.getChannel(), - "Message: " + event.getMessage()); - } - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/DiscordSender.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/DiscordSender.java deleted file mode 100644 index 5df4ee3cb9e35bee56d1111c95ec017fb8851bdd..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/DiscordSender.java +++ /dev/null @@ -1,162 +0,0 @@ -package org.mineacademy.fo.model; - -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.TimeUnit; - -import org.bukkit.Bukkit; -import org.bukkit.Server; -import org.bukkit.command.CommandSender; -import org.bukkit.permissions.Permission; -import org.bukkit.permissions.PermissionAttachment; -import org.bukkit.permissions.PermissionAttachmentInfo; -import org.bukkit.plugin.Plugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.exception.FoException; - -import github.scarsz.discordsrv.dependencies.jda.api.entities.Message; -import github.scarsz.discordsrv.dependencies.jda.api.entities.MessageChannel; -import github.scarsz.discordsrv.dependencies.jda.api.entities.User; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * Represents a Discord command sender for Discord integration - */ -@Getter -@RequiredArgsConstructor -public final class DiscordSender implements CommandSender { - - private final String name; - private final User user; - private final MessageChannel channel; - private final Message message; - - @Override - public boolean isPermissionSet(String permission) { - throw unsupported("isPermissionSet"); - } - - @Override - public boolean isPermissionSet(Permission permission) { - throw unsupported("isPermissionSet"); - } - - @Override - public boolean hasPermission(String perm) { - return false; - } - - @Override - public boolean hasPermission(Permission perm) { - return false; - } - - @Override - public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) { - throw unsupported("addAttachment"); - } - - @Override - public PermissionAttachment addAttachment(Plugin plugin) { - throw unsupported("addAttachment"); - } - - @Override - public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) { - throw unsupported("addAttachment"); - } - - @Override - public PermissionAttachment addAttachment(Plugin plugin, int ticks) { - throw unsupported("addAttachment"); - } - - @Override - public void removeAttachment(PermissionAttachment attachment) { - throw unsupported("removeAttachment"); - } - - @Override - public void recalculatePermissions() { - throw unsupported("recalculatePermissions"); - } - - @Override - public Set<PermissionAttachmentInfo> getEffectivePermissions() { - throw unsupported("getEffectivePermissions"); - } - - @Override - public boolean isOp() { - throw unsupported("isOp"); - } - - @Override - public void setOp(boolean op) { - throw unsupported("setOp"); - } - - @Override - public void sendMessage(String... messages) { - for (final String message : messages) - sendMessage(message); - } - - @Override - public void sendMessage(String message) { - final String finalMessage = Common.stripColors(message); - - Common.runAsync(() -> { - final Message sentMessage = channel.sendMessage(finalMessage).complete(); - - try { - // Automatically remove after a short while - channel.deleteMessageById(sentMessage.getIdLong()).completeAfter(4, TimeUnit.SECONDS); - - } catch (final Throwable t) { - - // Ignore already deleted messages - if (!t.toString().contains("Unknown Message")) - t.printStackTrace(); - } - }); - } - - @Override - public String getName() { - return name; - } - - @Override - public Server getServer() { - return Bukkit.getServer(); - } - - @Override - public Spigot spigot() { - throw unsupported("spigot"); - } - - private FoException unsupported(String method) { - return new FoException("DiscordSender cannot invoke " + method + "()"); - } - - /** - * @see org.bukkit.command.CommandSender#sendMessage(java.util.UUID, java.lang.String) - */ - //@Override - Disable to prevent errors in older MC - @Override - public void sendMessage(UUID uuid, String message) { - this.sendMessage(message); - } - - /** - * @see org.bukkit.command.CommandSender#sendMessage(java.util.UUID, java.lang.String[]) - */ - //@Override - Disable to prevent errors in older MC - @Override - public void sendMessage(UUID uuid, String... messages) { - this.sendMessage(messages); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/EnchantmentListener.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/EnchantmentListener.java deleted file mode 100644 index 441d944ef4af82d1ce466957b2382b651ab199bc..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/EnchantmentListener.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.mineacademy.fo.model; - -import java.util.Map.Entry; -import java.util.function.BiConsumer; - -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.projectiles.ProjectileSource; -import org.mineacademy.fo.EntityUtil; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.remain.Remain; - -/** - * Listens and executes events for {@link SimpleEnchantment} - * <p> - * Internal use only! - */ -public final class EnchantmentListener implements Listener { - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onEntityDamage(EntityDamageByEntityEvent event) { - final Entity damager = event.getDamager(); - - if (damager instanceof LivingEntity) - execute((LivingEntity) damager, (enchant, level) -> enchant.onDamage(level, (LivingEntity) damager, event)); - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = false) - public void onInteract(PlayerInteractEvent event) { - execute(event.getPlayer(), (enchant, level) -> enchant.onInteract(level, event)); - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onBreakBlock(BlockBreakEvent event) { - execute(event.getPlayer(), (enchant, level) -> enchant.onBreakBlock(level, event)); - } - - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) - public void onShoot(ProjectileLaunchEvent event) { - try { - final ProjectileSource projectileSource = event.getEntity().getShooter(); - - if (projectileSource instanceof LivingEntity) { - final LivingEntity shooter = (LivingEntity) projectileSource; - - execute(shooter, (enchant, level) -> enchant.onShoot(level, shooter, event)); - EntityUtil.trackHit(event.getEntity(), hitEvent -> execute(shooter, (enchant, level) -> enchant.onHit(level, shooter, hitEvent))); - } - } catch (final NoSuchMethodError ex) { - if (MinecraftVersion.atLeast(V.v1_4)) - ex.printStackTrace(); - } - } - - private void execute(LivingEntity source, BiConsumer<SimpleEnchantment, Integer> executer) { - try { - final ItemStack hand = source instanceof Player ? ((Player) source).getItemInHand() : source.getEquipment().getItemInHand(); - - if (hand != null) - for (final Entry<SimpleEnchantment, Integer> e : SimpleEnchantment.findEnchantments(hand).entrySet()) - executer.accept(e.getKey(), e.getValue()); - - } catch (final NoSuchMethodError ex) { - if (Remain.hasItemMeta()) - ex.printStackTrace(); - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/FolderWatcher.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/FolderWatcher.java deleted file mode 100644 index 49ea9e4e651740a84dac2c6550c675955de5034b..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/FolderWatcher.java +++ /dev/null @@ -1,176 +0,0 @@ -package org.mineacademy.fo.model; - -import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; - -import java.io.File; -import java.nio.file.FileSystem; -import java.nio.file.Path; -import java.nio.file.WatchEvent; -import java.nio.file.WatchEvent.Kind; -import java.nio.file.WatchKey; -import java.nio.file.WatchService; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.bukkit.scheduler.BukkitTask; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.plugin.SimplePlugin; - -import lombok.AccessLevel; -import lombok.Getter; - -@Getter(value = AccessLevel.PROTECTED) -public abstract class FolderWatcher extends Thread { - - /** - * A list to help Foundation stop threads on reload - */ - private static volatile Set<FolderWatcher> activeThreads = new HashSet<>(); - - /** - * Stop all active threads - */ - public static void stopThreads() { - for (final FolderWatcher thread : activeThreads) - thread.stopWatching(); - - activeThreads.clear(); - } - - /** - * Workaround for duplicated values in the loop - */ - private final Map<String, BukkitTask> scheduledUpdates = new HashMap<>(); - - /** - * The folder that is being watched - */ - private final Path folder; - - /** - * A one-way flag used to stop the thread while loop deadlock - */ - @Getter - private boolean watching = true; - - /** - * Start a new file watcher and start watching the given folder - * - * @param folder - */ - public FolderWatcher(File folder) { - Valid.checkBoolean(folder.exists(), folder + " does not exists!"); - Valid.checkBoolean(folder.isDirectory(), folder + " must be a directory!"); - - this.folder = folder.toPath(); - this.start(); - - for (final FolderWatcher other : activeThreads) { - //Valid.checkBoolean(other.folder.toString().equals(this.folder.toString()), "Tried to add a duplicate file watcher for " + this.folder); - if (other.folder.toString().equals(this.folder.toString())) - Common.warning("A duplicate file watcher for '" + folder.getPath() + "' was added. This is untested and may causes fatal issues!"); - } - - activeThreads.add(this); - - Debugger.debug("upload", "Started folder watcher for " + folder + " in " + folder.getAbsolutePath() + " (path: " + this.folder + ")"); - } - - /** - * Starts watching the given folder and reporting changes - */ - @Override - public final void run() { - final FileSystem fileSystem = folder.getFileSystem(); - - try (WatchService service = fileSystem.newWatchService()) { - final WatchKey registration = folder.register(service, ENTRY_MODIFY); - - while (watching) { - //synchronized (activeThreads) { - try { - final WatchKey watchKey = service.take(); - - for (final WatchEvent<?> watchEvent : watchKey.pollEvents()) { - final Kind<?> kind = watchEvent.kind(); - - if (kind == ENTRY_MODIFY) { - final Path watchEventPath = (Path) watchEvent.context(); - final File fileModified = new File(SimplePlugin.getData(), watchEventPath.toFile().getName()); - - final String path = fileModified.getAbsolutePath(); - final BukkitTask pendingTask = scheduledUpdates.remove(path); - - // Cancel the old task and reschedule - if (pendingTask != null) - pendingTask.cancel(); - - // Force run sync -- reschedule five seconds later to ensure no further edits take place - scheduledUpdates.put(path, Common.runLater(10, () -> { - if (!watching) - return; - - try { - onModified(fileModified); - - scheduledUpdates.remove(path); - - } catch (final Throwable t) { - Common.error(t, "Error in calling onModified when watching changed file " + fileModified); - } - })); - - break; - } - } - - if (!watchKey.reset()) - Common.error(new FoException("Failed to reset watch key! Restarting sync engine..")); - - } catch (final Throwable t) { - Common.error(t, "Error in handling watching thread loop for folder " + this.getFolder()); - } - //} - } - - registration.cancel(); - - } catch (final Throwable t) { - Common.error(t, "Error in initializing watching thread loop for folder " + this.getFolder()); - } - - } - - /** - * Called automatically when the file gets modified - * - * @param file - */ - protected abstract void onModified(File file); - - /** - * Stops listening for folder changes - */ - public void stopWatching() { - Valid.checkBoolean(this.watching, "The folder watcher for folder " + folder + " is no longer watching!"); - - this.watching = false; - - for (final BukkitTask task : this.scheduledUpdates.values()) - try { - task.cancel(); - } catch (final Exception ex) { - // ignore - } - } - - @Override - public boolean equals(Object obj) { - return obj instanceof FolderWatcher && ((FolderWatcher) obj).folder.toString().equals(this.folder.toString()); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/HookManager.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/HookManager.java deleted file mode 100644 index db542dc71fff4199da2384e71b8bdc3e6dabdffe..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/HookManager.java +++ /dev/null @@ -1,3242 +0,0 @@ -package org.mineacademy.fo.model; - -import java.io.File; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Optional; -import java.util.Set; -import java.util.UUID; -import java.util.function.Function; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.annotation.Nullable; - -import org.apache.commons.lang.StringUtils; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Location; -import org.bukkit.OfflinePlayer; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.command.CommandSender; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; -import org.bukkit.event.Listener; -import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.RegisteredServiceProvider; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.scheduler.BukkitTask; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.region.Region; -import org.mineacademy.fo.remain.Remain; - -import com.Zrips.CMI.CMI; -import com.Zrips.CMI.Containers.CMIUser; -import com.Zrips.CMI.Modules.TabList.TabListManager; -import com.bekvon.bukkit.residence.Residence; -import com.bekvon.bukkit.residence.protection.ClaimedResidence; -import com.comphenix.protocol.ProtocolLibrary; -import com.comphenix.protocol.ProtocolManager; -import com.comphenix.protocol.events.PacketAdapter; -import com.comphenix.protocol.events.PacketContainer; -import com.comphenix.protocol.events.PacketListener; -import com.comphenix.protocol.injector.server.TemporaryPlayer; -import com.earth2me.essentials.CommandSource; -import com.earth2me.essentials.Essentials; -import com.earth2me.essentials.IUser; -import com.earth2me.essentials.User; -import com.earth2me.essentials.UserMap; -import com.gmail.nossr50.datatypes.chat.ChatChannel; -import com.gmail.nossr50.datatypes.party.Party; -import com.gmail.nossr50.datatypes.player.McMMOPlayer; -import com.gmail.nossr50.util.player.UserManager; -import com.griefcraft.lwc.LWC; -import com.griefcraft.model.Protection; -import com.massivecraft.factions.entity.BoardColl; -import com.massivecraft.factions.entity.Faction; -import com.massivecraft.factions.entity.MPlayer; -import com.massivecraft.massivecore.ps.PS; -import com.onarandombox.MultiverseCore.MultiverseCore; -import com.onarandombox.MultiverseCore.api.MultiverseWorld; -import com.palmergames.bukkit.towny.TownyUniverse; -import com.palmergames.bukkit.towny.object.Nation; -import com.palmergames.bukkit.towny.object.Resident; -import com.palmergames.bukkit.towny.object.Town; -import com.palmergames.bukkit.towny.object.TownBlock; -import com.palmergames.bukkit.towny.object.WorldCoord; -import com.sk89q.worldguard.protection.regions.ProtectedRegion; - -import fr.xephi.authme.api.v3.AuthMeApi; -import github.scarsz.discordsrv.DiscordSRV; -import github.scarsz.discordsrv.dependencies.jda.api.entities.TextChannel; -import github.scarsz.discordsrv.util.DiscordUtil; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.NonNull; -import me.angeschossen.lands.api.integration.LandsIntegration; -import me.angeschossen.lands.api.land.Land; -import me.clip.placeholderapi.PlaceholderAPI; -import me.clip.placeholderapi.PlaceholderHook; -import me.clip.placeholderapi.expansion.PlaceholderExpansion; -import me.clip.placeholderapi.expansion.Relational; -import net.citizensnpcs.api.CitizensAPI; -import net.citizensnpcs.api.npc.NPCRegistry; -import net.milkbowl.vault.chat.Chat; -import net.milkbowl.vault.economy.Economy; -import net.milkbowl.vault.permission.Permission; - -/** - * Our main class hooking into different plugins, providing you - * convenience access to their methods - */ -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public final class HookManager { - - // ------------------------------------------------------------------------------------------------------------ - // Store hook classes separately for below, avoiding no such method/field errors - // ------------------------------------------------------------------------------------------------------------ - - private static AuthMeHook authMeHook; - private static BanManagerHook banManagerHook; - private static BossHook bossHook; - private static CitizensHook citizensHook; - private static CMIHook CMIHook; - private static DiscordSRVHook discordSRVHook; - private static EssentialsHook essentialsHook; - private static FactionsHook factionsHook; - private static ItemsAdderHook itemsAdderHook; - private static LandsHook landsHook; - private static LiteBansHook liteBansHook; - private static LocketteProHook locketteProHook; - private static LWCHook lwcHook; - private static McMMOHook mcmmoHook; - private static MultiverseHook multiverseHook; - private static MVdWPlaceholderHook MVdWPlaceholderHook; - private static MythicMobsHook mythicMobsHook; - private static NickyHook nickyHook; - private static PlaceholderAPIHook placeholderAPIHook; - private static PlotSquaredHook plotSquaredHook; - private static ProtocolLibHook protocolLibHook; - private static ResidenceHook residenceHook; - private static TownyHook townyHook; - private static VaultHook vaultHook; - private static WorldEditHook worldeditHook; - private static WorldGuardHook worldguardHook; - - private static boolean nbtAPIDummyHook = false; - private static boolean nuVotifierDummyHook = false; - private static boolean townyChatDummyHook = false; - - // ------------------------------------------------------------------------------------------------------------ - // Main loading method - // ------------------------------------------------------------------------------------------------------------ - - /** - * Detect various plugins and load their methods into this library so you can use it later - */ - public static void loadDependencies() { - - if (Common.doesPluginExist("AuthMe")) - authMeHook = new AuthMeHook(); - - if (Common.doesPluginExist("BanManager")) - banManagerHook = new BanManagerHook(); - - if (Common.doesPluginExist("Boss")) - bossHook = new BossHook(); - - if (Common.doesPluginExist("Citizens")) - citizensHook = new CitizensHook(); - - if (Common.doesPluginExist("CMI")) - CMIHook = new CMIHook(); - - if (Common.doesPluginExist("DiscordSRV")) - try { - Class.forName("github.scarsz.discordsrv.dependencies.jda.api.entities.TextChannel"); - - discordSRVHook = new DiscordSRVHook(); - - } catch (final ClassNotFoundException ex) { - Common.error(ex, "&c" + SimplePlugin.getNamed() + " failed to hook DiscordSRV because the plugin is outdated (1.18.x is supported)!"); - } - - if (Common.doesPluginExist("Essentials")) - essentialsHook = new EssentialsHook(); - - // Various kinds of Faction plugins - final Plugin factions = Bukkit.getPluginManager().getPlugin("Factions"); - - if (Common.doesPluginExist("FactionsX") && factions == null) - Common.log("Note: If you want FactionX integration, install FactionsUUIDAPIProxy."); - - else if (factions != null) { - final String ver = factions.getDescription().getVersion(); - final String main = factions.getDescription().getMain(); - - if (ver.startsWith("1.6") || main.contains("FactionsUUIDAPIProxy")) { - factionsHook = new FactionsUUID(); - - } else if (ver.startsWith("2.")) { - Class<?> mplayer = null; - - try { - mplayer = Class.forName("com.massivecraft.factions.entity.MPlayer"); // only support the free version of the plugin - } catch (final ClassNotFoundException ex) { - } - - if (mplayer != null) { - factionsHook = new FactionsMassive(); - - } else - Common.warning("Recognized MCore Factions, but not hooked! Check if you have the latest version!"); - - } - } - - if (Common.doesPluginExist("ItemsAdder")) - itemsAdderHook = new ItemsAdderHook(); - - if (Common.doesPluginExist("Lands")) - landsHook = new LandsHook(); - - if (Common.doesPluginExist("LiteBans")) - liteBansHook = new LiteBansHook(); - - if (Common.doesPluginExist("Lockette")) - locketteProHook = new LocketteProHook(); - - if (Common.doesPluginExist("LWC")) - lwcHook = new LWCHook(); - - if (Common.doesPluginExist("mcMMO")) { - final String ver = Bukkit.getPluginManager().getPlugin("mcMMO").getDescription().getVersion(); - - if (ver.startsWith("2.")) - mcmmoHook = new McMMOHook(); - else - Common.warning("Could not hook into mcMMO, version 2.x required, you have " + ver); - } - - if (Common.doesPluginExist("Multiverse-Core")) - multiverseHook = new MultiverseHook(); - - if (Common.doesPluginExist("MVdWPlaceholderAPI")) - MVdWPlaceholderHook = new MVdWPlaceholderHook(); - - if (Common.doesPluginExist("MythicMobs")) - mythicMobsHook = new MythicMobsHook(); - - if (Common.doesPluginExist("Nicky")) - nickyHook = new NickyHook(); - - if (Common.doesPluginExist("PlaceholderAPI")) - placeholderAPIHook = new PlaceholderAPIHook(); - - if (Common.doesPluginExist("PlotSquared")) { - final String ver = Bukkit.getPluginManager().getPlugin("PlotSquared").getDescription().getVersion(); - - if (ver.startsWith("6.") || ver.startsWith("5.") || ver.startsWith("3.")) - plotSquaredHook = new PlotSquaredHook(); - else - Common.warning("Could not hook into PlotSquared, version 3.x, 5.x or 6.x required, you have " + ver); - } - - if (Common.doesPluginExist("ProtocolLib")) { - protocolLibHook = new ProtocolLibHook(); - - // Also check if the library is loaded properly - try { - if (MinecraftVersion.newerThan(V.v1_6)) - Class.forName("com.comphenix.protocol.wrappers.WrappedChatComponent"); - } catch (final Throwable t) { - protocolLibHook = null; - - Common.throwError(t, "You are running an old and unsupported version of ProtocolLib, please update it."); - } - } - - if (Common.doesPluginExist("Residence")) - residenceHook = new ResidenceHook(); - - if (Common.doesPluginExist("Towny")) - townyHook = new TownyHook(); - - if (Common.doesPluginExist("Vault")) - vaultHook = new VaultHook(); - - if (Common.doesPluginExist("WorldEdit") || Common.doesPluginExist("FastAsyncWorldEdit")) - worldeditHook = new WorldEditHook(); - - if (Common.doesPluginExist("WorldGuard")) - worldguardHook = new WorldGuardHook(worldeditHook); - - // Dummy hooks - - if (Common.doesPluginExist("NBTAPI")) - nbtAPIDummyHook = true; - - if (Common.doesPluginExist("Votifier")) - nuVotifierDummyHook = true; - - if (Common.doesPluginExist("TownyChat")) - townyChatDummyHook = true; - } - - /** - * Removes packet listeners from ProtocolLib for a plugin - * - * @param plugin - * - * @deprecated internal use only, please do not call - */ - @Deprecated - public static void unloadDependencies(final Plugin plugin) { - if (isProtocolLibLoaded()) - protocolLibHook.removePacketListeners(plugin); - - if (isPlaceholderAPILoaded()) - placeholderAPIHook.unregister(); - } - - // ------------------------------------------------------------------------------------------------------------ - // Methods for determining which plugins were loaded after you call the load method - // ------------------------------------------------------------------------------------------------------------ - - /** - * Is AuthMe Reloaded loaded? We only support the latest version - * - * @return - */ - public static boolean isAuthMeLoaded() { - return authMeHook != null; - } - - /** - * Return if BanManager plugin is detected - * - * @return - */ - public static boolean isBanManagerLoaded() { - return banManagerHook != null; - } - - /** - * Return if Boss plugin is detected - * - * @return - */ - public static boolean isBossLoaded() { - return bossHook != null; - } - - /** - * Is CMI loaded? - * - * @return - */ - public static boolean isCMILoaded() { - return CMIHook != null; - } - - /** - * Is Citizens loaded? - * - * @return - */ - public static boolean isCitizensLoaded() { - return citizensHook != null; - } - - /** - * Is DiscordSRV loaded? - * - * @return - */ - public static boolean isDiscordSRVLoaded() { - return discordSRVHook != null; - } - - /** - * Is EssentialsX loaded? - * - * @return - */ - public static boolean isEssentialsLoaded() { - return essentialsHook != null; - } - - /** - * Are Faction plugins loaded? We support UUID factions and free factions - * - * @return - */ - public static boolean isFactionsLoaded() { - return factionsHook != null; - } - - /** - * Is FastAsyncWorldEdit loaded? - * - * @return - */ - public static boolean isFAWELoaded() { - - // Check for FAWE directly - final Plugin fawe = Bukkit.getPluginManager().getPlugin("FastAsyncWorldEdit"); - - if (fawe != null && fawe.isEnabled()) - return true; - - // Check for legacy FAWE installations - final Plugin worldEdit = Bukkit.getPluginManager().getPlugin("WorldEdit"); - - if (worldEdit != null && worldEdit.isEnabled() && "Fast Async WorldEdit plugin".equals(worldEdit.getDescription().getDescription())) - return true; - - return false; - } - - /** - * Is ItemsAdder loaded as a plugin? - * - * @return - */ - public static boolean isItemsAdderLoaded() { - return itemsAdderHook != null; - } - - /** - * Is Lands loaded as a plugin? - * - * @return - */ - public static boolean isLandsLoaded() { - return landsHook != null; - } - - /** - * Is LiteBans loaded? - * - * @return - */ - public static boolean isLiteBansLoaded() { - return liteBansHook != null; - } - - /** - * Is Lockette Pro loaded - * - * @return - */ - public static boolean isLocketteProLoaded() { - return locketteProHook != null; - } - - /** - * Is LWC loaded? - * - * @return - */ - public static boolean isLWCLoaded() { - return lwcHook != null; - } - - /** - * Is mcMMO loaded? - * - * @return - */ - public static boolean isMcMMOLoaded() { - return mcmmoHook != null; - } - - /** - * Is Multiverse-Core loaded? - * - * @return - */ - public static boolean isMultiverseCoreLoaded() { - return multiverseHook != null; - } - - /** - * Is MVdWPlaceholderAPI loaded? - * - * @return - */ - public static boolean isMVdWPlaceholderAPILoaded() { - return MVdWPlaceholderHook != null; - } - - /** - * Is MythicMobs loaded? - * - * @return - */ - public static boolean isMythicMobsLoaded() { - return mythicMobsHook != null; - } - - /** - * Is NBTAPI loaded as a plugin? - * - * @return - */ - public static boolean isNbtAPILoaded() { - return nbtAPIDummyHook; - } - - /** - * Is Nicky loaded? - * - * @return - */ - public static boolean isNickyLoaded() { - return nickyHook != null; - } - - /** - * Is nuVotifier loaded as a plugin? - * - * @return - */ - public static boolean isNuVotifierLoaded() { - return nuVotifierDummyHook; - } - - /** - * Is PlaceholderAPI loaded? - * - * @return - */ - public static boolean isPlaceholderAPILoaded() { - return placeholderAPIHook != null; - } - - /** - * Is PlotSquared loaded? - * - * @return - */ - public static boolean isPlotSquaredLoaded() { - return plotSquaredHook != null; - } - - /** - * Is ProtocolLib loaded?¡ - * <p> - * This will not only check if the plugin is in plugins folder, but also if it's - * correctly loaded and working. (*Should* detect plugin's malfunction when - * out-dated.) - * - * @return - */ - public static boolean isProtocolLibLoaded() { - return protocolLibHook != null; - } - - /** - * Is Residence loaded? - * - * @return - */ - public static boolean isResidenceLoaded() { - return residenceHook != null; - } - - /** - * Is Towny loaded? - * - * @return - */ - public static boolean isTownyLoaded() { - return townyHook != null; - } - - /** - * Is TownyChat loaded? - * - * @return - */ - public static boolean isTownyChatLoaded() { - return townyHook != null && townyChatDummyHook; - } - - /** - * Is Vault loaded? - * - * @return - */ - public static boolean isVaultLoaded() { - return vaultHook != null; - } - - /** - * Is WorldEdit loaded? - * - * @return - */ - public static boolean isWorldEditLoaded() { - return worldeditHook != null || isFAWELoaded(); - } - - /** - * Is WorldGuard loaded? - * - * @return - */ - public static boolean isWorldGuardLoaded() { - return worldguardHook != null; - } - - // ------------------------------------------------------------------------------------------------------------ - // - // - // Delegate methods for use from other plugins - // - // - // ------------------------------------------------------------------------------------------------------------ - - // ------------------------------------------------------------------------------------------------------------ - // AuthMe - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return true if player is logged via AuthMe, or true if AuthMe is not installed - * - * @param player - * @return - */ - public static boolean isLogged(final Player player) { - return !isAuthMeLoaded() || authMeHook.isLogged(player); - } - - // ------------------------------------------------------------------------------------------------------------ - // Boss-related plugins - // ------------------------------------------------------------------------------------------------------------ - - /** - * Returns the Boss name from the given entity, if Boss plugin is installed and - * the given entity is a Boss, otherwise returns null. - * - * @param entity - * @return - */ - public static String getBossName(Entity entity) { - return isBossLoaded() ? bossHook.getBossName(entity) : null; - } - - /** - * Returns the name from the given entity, if MythicMobs plugin is installed and - * the given entity is a mythic mob, otherwise returns null. - * - * @param entity - * @return - */ - public static String getMythicMobName(Entity entity) { - return isMythicMobsLoaded() ? mythicMobsHook.getBossName(entity) : null; - } - - // ------------------------------------------------------------------------------------------------------------ - // Lands - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return lands players for the player's land, or empty list - * - * @param player - * @return - */ - public static Collection<Player> getLandPlayers(Player player) { - return isLandsLoaded() ? landsHook.getLandPlayers(player) : new ArrayList<>(); - } - - // ------------------------------------------------------------------------------------------------------------ - // EssentialsX or CMI - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return true if the given player is afk in EssentialsX or CMI, or false if neither plugin is present - * - * @param player - * @return - */ - public static boolean isAfk(final Player player) { - final boolean essAFK = isEssentialsLoaded() && essentialsHook.isAfk(player.getName()); - final boolean cmiAFK = isCMILoaded() && CMIHook.isAfk(player); - - return essAFK || cmiAFK; - } - - /** - * Return true if the given player is vanished in EssentialsX or CMI, or false if neither plugin is present - * - * @deprecated this does not call metadata check in most plugins, see {@link PlayerUtil#isVanished(Player)} - * @param player - * @return - */ - @Deprecated - public static boolean isVanished(final Player player) { - if (isEssentialsLoaded() && essentialsHook.isVanished(player.getName())) - return true; - - if (isCMILoaded() && CMIHook.isVanished(player)) - return true; - - return false; - } - - /** - * Return true if the player is muted in EssentialsX or CMI, or false if neither plugin is present - * - * @param player - * @return - */ - public static boolean isMuted(final Player player) { - - if (isEssentialsLoaded() && essentialsHook.isMuted(player.getName())) - return true; - - if (isCMILoaded() && CMIHook.isMuted(player)) - return true; - - if (isBanManagerLoaded() && banManagerHook.isMuted(player)) - return true; - - if (isLiteBansLoaded() && liteBansHook.isMuted(player)) - return true; - - return false; - } - - /** - * If litebans is loaded, mute player - this expects you having /lmute command installed! - * - * @param player - * @param durationTokenized - * @param reason - */ - public static void setLiteBansMute(Player player, String durationTokenized, String reason) { - if (isLiteBansLoaded()) - Common.dispatchCommand(player, "lmute {player} " + durationTokenized + (reason == null || reason.isEmpty() ? "" : " " + reason)); - } - - /** - * If litebans is loaded, unmute player - this expects you having /lunmute command installed! - * - * @param player - */ - public static void setLiteBansUnmute(Player player) { - if (isLiteBansLoaded()) - Common.dispatchCommand(player, "lunmute {player}"); - } - - /** - * Toggles a god mode for player from EssentialsX or CMI - * - * @param player - * @param godMode - */ - public static void setGodMode(final Player player, final boolean godMode) { - if (isEssentialsLoaded()) - essentialsHook.setGodMode(player, godMode); - - if (isCMILoaded()) - CMIHook.setGodMode(player, godMode); - } - - /** - * Sets the last /back location for both EssentialsX and CMI - * - * @param player - * @param location - */ - public static void setBackLocation(final Player player, final Location location) { - if (isEssentialsLoaded()) - essentialsHook.setBackLocation(player.getName(), location); - - if (isCMILoaded()) - CMIHook.setLastTeleportLocation(player, location); - } - - /** - * Set EssentialsX and CMI ignored player - * - * @param player - * @param who - * @param ignore - */ - public static void setIgnore(final UUID player, final UUID who, final boolean ignore) { - if (isEssentialsLoaded()) - essentialsHook.setIgnore(player, who, ignore); - - if (isCMILoaded()) - CMIHook.setIgnore(player, who, ignore); - } - - /** - * Return true if the player is ignoring another player in EssentialsX - * - * @param player - * @param who - * @return - */ - public static boolean isIgnoring(final UUID player, final UUID who) { - Valid.checkBoolean(player != null, "Player to check ignore from cannot be null/empty"); - Valid.checkBoolean(who != null, "Player to check ignore to cannot be null/empty"); - - return isEssentialsLoaded() ? essentialsHook.isIgnoring(player, who) : isCMILoaded() ? CMIHook.isIgnoring(player, who) : false; - } - - /** - * Returns the nick for the given recipient from Essentials or Nicky, or if it's a console, their name - * - * @param sender - * @return - */ - public static String getNickColored(final CommandSender sender) { - return getNick(sender, false); - } - - /** - * Returns the nick for the given recipient from Essentials or Nicky, or if it's a console, their name - * - * @param sender - * @return - */ - public static String getNickColorless(final CommandSender sender) { - return getNick(sender, true); - } - - /** - * Returns the nick for the given recipient from Essentials or Nicky, or if it's a console, their name - * - * @param sender - * @param stripColors - * - * @return - */ - private static String getNick(final CommandSender sender, boolean stripColors) { - final Player player = sender instanceof Player ? (Player) sender : null; - - if (player != null && isNPC(player)) { - Common.log("&eWarn: Called getNick for NPC " + player.getName() + "! Notify the developers to add an ignore check at " + Debugger.traceRoute(true)); - - return player.getName(); - } - - if (player == null) - return sender.getName(); - - final String nickyNick = isNickyLoaded() ? nickyHook.getNick(player) : null; - final String essNick = isEssentialsLoaded() ? essentialsHook.getNick(player.getName()) : null; - final String cmiNick = isCMILoaded() ? CMIHook.getNick(player) : null; - - final String nick = nickyNick != null ? nickyNick : cmiNick != null ? cmiNick : essNick != null ? essNick : sender.getName(); - - return stripColors ? Common.stripColors(Common.revertColorizing(nick).replace(ChatColor.COLOR_CHAR + "x", "")) : nick; - } - - /** - * Sets the nickname for Essentials and CMI if installed for the given target player - * - * @param playerId - * @param nick - */ - public static void setNick(@NonNull final UUID playerId, @Nullable String nick) { - if (isEssentialsLoaded()) - essentialsHook.setNick(playerId, nick); - - if (isCMILoaded()) - CMIHook.setNick(playerId, nick); - } - - /** - * Attempts to reverse lookup player name from his nick - * - * Only Essentials and CMI are supported - * - * @param nick - * @return - */ - public static String getNameFromNick(@NonNull String nick) { - final String essNick = isEssentialsLoaded() ? essentialsHook.getNameFromNick(nick) : nick; - final String cmiNick = isCMILoaded() ? CMIHook.getNameFromNick(nick) : nick; - - return !essNick.equals(nick) && !"".equals(essNick) ? essNick : !cmiNick.equals(nick) && !"".equals(cmiNick) ? cmiNick : nick; - } - - // ------------------------------------------------------------------------------------------------------------ - // EssentialsX - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return the reply recipient for the given player, or null if not exist - * - * @param player - * @return - */ - public static Player getReplyTo(final Player player) { - return isEssentialsLoaded() ? essentialsHook.getReplyTo(player.getName()) : null; - } - - // ------------------------------------------------------------------------------------------------------------ - // ItemsAdder - // ------------------------------------------------------------------------------------------------------------ - - /** - * Use ItemsAdder to replace font images in the message - * - * @param message - * @return - */ - public static String replaceFontImages(final String message) { - return replaceFontImages(null, message); - } - - /** - * Use ItemsAdder to replace font images in the message based on the player's permission - * - * @param player - * @param message - * @return - */ - public static String replaceFontImages(@Nullable Player player, final String message) { - return isItemsAdderLoaded() ? itemsAdderHook.replaceFontImages(player, message) : message; - } - - // ------------------------------------------------------------------------------------------------------------ - // Multiverse-Core - // ------------------------------------------------------------------------------------------------------------ - - /** - * Returns the world name alias from Multiverse-Core - * - * @param world - * @return - */ - public static String getWorldAlias(final World world) { - return isMultiverseCoreLoaded() ? multiverseHook.getWorldAlias(world.getName()) : world.getName(); - } - - // ------------------------------------------------------------------------------------------------------------ - // Towny - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return players nation from Towny, or null if not loaded - * - * @param player - * @return - */ - public static String getNation(final Player player) { - return isTownyLoaded() ? townyHook.getNationName(player) : null; - } - - /** - * Return players town name from Towny, or null if none - * - * @param player - * @return - */ - public static String getTownName(final Player player) { - return isTownyLoaded() ? townyHook.getTownName(player) : null; - } - - /** - * Return the online residents in players town, or an empty list - * - * @param player - * @return - */ - public static Collection<? extends Player> getTownResidentsOnline(final Player player) { - return isTownyLoaded() ? townyHook.getTownResidentsOnline(player) : new ArrayList<>(); - } - - /** - * Return the online nation players in players nation (Towny), or an empty list - * - * @param player - * @return - */ - public static Collection<? extends Player> getNationPlayersOnline(final Player player) { - return isTownyLoaded() ? townyHook.getNationPlayersOnline(player) : new ArrayList<>(); - } - - /** - * Return the online nation players in players ally (Towny), or an empty list - * - * @param player - * @return - */ - public static Collection<? extends Player> getAllyPlayersOnline(final Player player) { - return isTownyLoaded() ? townyHook.getAllyPlayersOnline(player) : new ArrayList<>(); - } - - /** - * Return the town owner name at the given location or null if none - * - * @param location - * @return - */ - public static String getTownOwner(final Location location) { - return isTownyLoaded() ? townyHook.getTownOwner(location) : null; - } - - /** - * Return the town name at the given location or null if none - * - * @param location - * @return - */ - public static String getTown(final Location location) { - return isTownyLoaded() ? townyHook.getTownName(location) : null; - } - - /** - * Return a list of all loaded towns, or an empty list if none - * - * @return - */ - public static List<String> getTowns() { - return isTownyLoaded() ? townyHook.getTowns() : new ArrayList<>(); - } - - // ------------------------------------------------------------------------------------------------------------ - // Vault - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return the Vault player prefix or empty if none - * - * @param player - * @return - */ - public static String getPlayerPrefix(final Player player) { - return isVaultLoaded() ? vaultHook.getPlayerPrefix(player) : ""; - } - - /** - * Return the Vault player suffix or empty if none - * - * @param player - * @return - */ - public static String getPlayerSuffix(final Player player) { - return isVaultLoaded() ? vaultHook.getPlayerSuffix(player) : ""; - } - - /** - * Return the Vault player permission group or empty if none - * - * @param player - * @return - */ - public static String getPlayerPermissionGroup(final Player player) { - return isVaultLoaded() ? vaultHook.getPlayerGroup(player) : ""; - } - - /** - * Return the players balance from Vault (hooks into your economy plugin) - * - * @param player - * @return - */ - public static double getBalance(final Player player) { - return isVaultLoaded() ? vaultHook.getBalance(player) : 0; - } - - /** - * Return the singular currency name, or null if not loaded - * - * @return - */ - public static String getCurrencySingular() { - return isVaultLoaded() ? vaultHook.getCurrencyNameSG() : null; - } - - /** - * Return the plural currency name, or null if not loaded - * - * @return - */ - public static String getCurrencyPlural() { - return isVaultLoaded() ? vaultHook.getCurrencyNamePL() : null; - } - - /** - * Takes money from the player if Vault is installed - * - * @param player - * @param amount - */ - public static void withdraw(final Player player, final double amount) { - if (isVaultLoaded()) - vaultHook.withdraw(player, amount); - } - - /** - * Gives money to the player if Vault is installed - * - * @param player - * @param amount - */ - public static void deposit(final Player player, final double amount) { - if (isVaultLoaded()) - vaultHook.deposit(player, amount); - } - - /** - * Checks if the given player has the given permission, safe to use - * for instances where the player may be a {@link TemporaryPlayer} from - * ProtocolLib where then we use Vault to check the players perm - * - * @param player - * @param perm - * @return - */ - public static boolean hasProtocolLibPermission(Player player, String perm) { - if (isProtocolLibLoaded() && protocolLibHook.isTemporaryPlayer(player)) - return hasVaultPermission(player, perm); - - return PlayerUtil.hasPerm(player, perm); - } - - /** - * Checks if the given player name has a certain permission using vault - * Or throws an error if Vault is not present - * - * @param offlinePlayer - * @param perm - * - * @return - */ - public static boolean hasVaultPermission(final OfflinePlayer offlinePlayer, final String perm) { - Valid.checkBoolean(isVaultLoaded(), "hasVaultPermission called - Please install Vault to enable this functionality!"); - - return vaultHook.hasPerm(offlinePlayer, perm); - } - - /** - * Returns the players primary permission group using Vault, or empty if none - * - * @param player - * @return - */ - public static String getPlayerPrimaryGroup(final Player player) { - return isVaultLoaded() ? vaultHook.getPrimaryGroup(player) : ""; - } - - /** - * Return true if Vault could find a suitable chat plugin to hook to - * - * @return - */ - public static boolean isChatIntegrated() { - return isVaultLoaded() ? vaultHook.isChatIntegrated() : false; - } - - /** - * Return true if Vault could find a suitable economy plugin to hook to - * - * @return - */ - public static boolean isEconomyIntegrated() { - return isVaultLoaded() ? vaultHook.isEconomyIntegrated() : false; - } - - /** - * Updates Vault service providers - * - * @deprecated internal use only - */ - @Deprecated - public static void updateVaultIntegration() { - if (isVaultLoaded()) - vaultHook.setIntegration(); - } - - // ------------------------------------------------------------------------------------------------------------ - // PlaceholderAPI / MVdWPlaceholderAPI - // ------------------------------------------------------------------------------------------------------------ - - /** - * Uses PlaceholderAPI and MVdWPlaceholderAPI to replace placeholders in a message - * - * @param player - * @param message - * @return - */ - public static String replacePlaceholders(final Player player, String message) { - if (message == null || "".equals(message.trim())) - return message; - - message = isPlaceholderAPILoaded() ? placeholderAPIHook.replacePlaceholders(player, message) : message; - message = isMVdWPlaceholderAPILoaded() ? MVdWPlaceholderHook.replacePlaceholders(player, message) : message; - - return message; - } - - /** - * Uses PlaceholderAPI to replace relation placeholders in a message - * - * @param one - * @param two - * @param message - * @return - */ - public static String replaceRelationPlaceholders(final Player one, final Player two, final String message) { - if (message == null || "".equals(message.trim())) - return message; - - return isPlaceholderAPILoaded() ? placeholderAPIHook.replaceRelationPlaceholders(one, two, message) : message; - } - - /** - * If PlaceholderAPI is loaded, registers a new placeholder within it - * with the given variable and value. - * <p> - * The variable is automatically prepended with your plugin name, lowercased + _, - * such as chatcontrol_ or boss_ + your variable. - * <p> - * Example if the variable is player health in ChatControl plugin: "chatcontrol_health" - * <p> - * The value will be called against the given player - * <p> - * - * * ATTENTION: We now have a new system where you register variables through {@link Variables#addExpansion(SimpleExpansion)} - * instead. It gives you better flexibility and, like PlaceholderAPI, you can replace different variables on the fly. - * - * @param variable - * @param value - */ - public static void addPlaceholder(final String variable, final Function<Player, String> value) { - Variables.addExpansion(new SimpleExpansion() { - - @Override - protected String onReplace(@NonNull CommandSender sender, String identifier) { - return variable.equalsIgnoreCase(identifier) && sender instanceof Player ? value.apply((Player) sender) : null; - } - }); - } - - // ------------------------------------------------------------------------------------------------------------ - // Factions - // ------------------------------------------------------------------------------------------------------------ - - /** - * Get all loaded Factions or null if none - * - * @return - */ - public static Collection<String> getFactions() { - return isFactionsLoaded() ? factionsHook.getFactions() : null; - } - - /** - * Return the players faction or null if none - * - * @param player - * @return - */ - public static String getFaction(final Player player) { - return isFactionsLoaded() ? factionsHook.getFaction(player) : null; - } - - /** - * Return players in players faction or empty if none - * - * @param player - * @return - */ - public static Collection<? extends Player> getOnlineFactionPlayers(final Player player) { - return isFactionsLoaded() ? factionsHook.getSameFactionPlayers(player) : new ArrayList<>(); - } - - /** - * Return a faction name at the given location, or null - * - * @param location - * @return - */ - public static String getFaction(final Location location) { - return isFactionsLoaded() ? factionsHook.getFaction(location) : null; - } - - /** - * Return the faction owner name at the given location, or null - * - * @param location - * @return - */ - public static String getFactionOwner(final Location location) { - return isFactionsLoaded() ? factionsHook.getFactionOwner(location) : null; - } - - // ------------------------------------------------------------------------------------------------------------ - // ProtocolLib - // ------------------------------------------------------------------------------------------------------------ - - /** - * Adds a {@link PacketAdapter} packet listener to ProtocolLib. - * <p> - * If the plugin is missing, an error will be thrown - * - * @param adapter - */ - public static void addPacketListener(/*Uses object to prevent errors if plugin is not installed*/final Object adapter) { - Valid.checkBoolean(isProtocolLibLoaded(), "Cannot add packet listeners if ProtocolLib isn't installed"); - - protocolLibHook.addPacketListener(adapter); - } - - /** - * Send a {@link PacketContainer} to the given player - * - * @param player - * @param packetContainer - */ - public static void sendPacket(final Player player, final Object packetContainer) { - Valid.checkBoolean(isProtocolLibLoaded(), "Sending packets requires ProtocolLib installed and loaded"); - - protocolLibHook.sendPacket(player, packetContainer); - } - - // ------------------------------------------------------------------------------------------------------------ - // LWC - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return the LWC owner of the block, or null - * - * @param block - * @return - */ - public static String getLWCOwner(final Block block) { - return isLWCLoaded() ? lwcHook.getOwner(block) : null; - } - - // ------------------------------------------------------------------------------------------------------------ - // Lockette Pro - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return if the given player owns the given block from Lockette Pro - * - * @param block - * @param player - * @return - */ - public static boolean isLocketteOwner(final Block block, final Player player) { - return isLocketteProLoaded() ? locketteProHook.isOwner(block, player) : false; - } - - // ------------------------------------------------------------------------------------------------------------ - // Residence - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return a list of Residence residences at the given location or an empty list - * - * @return - */ - public static Collection<String> getResidences() { - return isResidenceLoaded() ? residenceHook.getResidences() : new ArrayList<>(); - } - - /** - * Get the Residence name at the given location or null if none - * - * @param location - * @return - */ - public static String getResidence(final Location location) { - return isResidenceLoaded() ? residenceHook.getResidence(location) : null; - } - - /** - * Get the Residence owner at the given location or null if none - * - * @param location - * @return - */ - public static String getResidenceOwner(final Location location) { - return isResidenceLoaded() ? residenceHook.getResidenceOwner(location) : null; - } - - // ------------------------------------------------------------------------------------------------------------ - // WorldGuard - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return WorldGuard list of regions at the given location or an empty list - * - * @param loc - * @return - */ - public static List<String> getRegions(final Location loc) { - return isWorldGuardLoaded() ? worldguardHook.getRegionsAt(loc) : new ArrayList<>(); - } - - /** - * Return WorldGuard list of loaded regions or an empty list - * - * @return - */ - public static List<String> getRegions() { - return isWorldGuardLoaded() ? worldguardHook.getAllRegions() : new ArrayList<>(); - } - - /** - * Get our representation of a worldguard region by its name or null - * - * @param name - * @return - */ - public static Region getRegion(final String name) { - return isWorldGuardLoaded() ? worldguardHook.getRegion(name) : null; - } - - // ------------------------------------------------------------------------------------------------------------ - // PlotSquared - // ------------------------------------------------------------------------------------------------------------ - - /** - * Get a list of players inside a PlotSquared plot, or empty if not loaded - * - * @param players - * @return - */ - public static Collection<? extends Player> getPlotPlayers(final Player players) { - return isPlotSquaredLoaded() ? plotSquaredHook.getPlotPlayers(players) : new ArrayList<>(); - } - - // ------------------------------------------------------------------------------------------------------------ - // mcMMO - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return the active mcMMO party chat - * - * @param player - * @return - */ - public static String getActivePartyChat(final Player player) { - return isMcMMOLoaded() ? mcmmoHook.getActivePartyChat(player) : null; - } - - /** - * Return the online residents in player's party, or an empty list - * - * @param player - * @return - */ - public static List<Player> getMcMMOPartyRecipients(final Player player) { - return isMcMMOLoaded() ? mcmmoHook.getPartyRecipients(player) : new ArrayList<>(); - } - - // ------------------------------------------------------------------------------------------------------------ - // Citizens - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return true if the entity is a Citizens NPC - * - * @param entity - * @return - */ - public static boolean isNPC(final Entity entity) { - return isCitizensLoaded() ? citizensHook.isNPC(entity) : false; - } - - // ------------------------------------------------------------------------------------------------------------ - // DiscordSRV - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return all linked Discord channels. You can link those in DiscordSRV config.yml file - * - * @return the linked channels or an empty set when DiscordSRV is not loaded - */ - public static Set<String> getDiscordChannels() { - return isDiscordSRVLoaded() ? discordSRVHook.getChannels() : new HashSet<>(); - } - - /** - * Sends a message from the given sender to a certain channel on DiscordSRV - * - * @param senderName - * @param channel - * @param message - */ - /*public static void sendDiscordMessage(final String senderName, final String channel, final String message) { - if (isDiscordSRVLoaded()) - discordSRVHook.sendMessage(senderName, channel, message); - }*/ - - /** - * Sends a message from the given sender to a certain channel on Discord using DiscordSRV - * <p> - * Enhanced functionality is available if the sender is a player - * - * @param sender - * @param channel - * @param message - */ - public static void sendDiscordMessage(final CommandSender sender, final String channel, @NonNull final String message) { - if (isDiscordSRVLoaded() && !Common.stripColors(message).isEmpty()) - discordSRVHook.sendMessage(sender, channel, message); - } - - /** - * Send a message to a Discord channel if DiscordSRV is installed - * - * @param channel - * @param message - */ - public static void sendDiscordMessage(final String channel, @NonNull final String message) { - if (isDiscordSRVLoaded() && !Common.stripColors(message).isEmpty()) - discordSRVHook.sendMessage(channel, message); - } - - // ------------------------------------------------------------------------------------------------------------ - // Class helpers - // ------------------------------------------------------------------------------------------------------------ - - /** - * Represents a PlaceholderAPI placeholder replacer with the given - * variable (will be prepended with the name of your plugin, such as - * <p> - * chatcontrol_ + this variable - * <p> - * and the value that is callable so that you can return updated value each time. - */ - /*@Data - static class PAPIPlaceholder { - - private final String variable; - private final BiFunction<Player, String, String> value; - }*/ -} - -// ------------------------------------------------------------------------------------------------------------ -// -// Below are the individual classes responsible for hooking into third party plugins -// and getting data from them. Due to often changes we do not keep those documented. -// -// ------------------------------------------------------------------------------------------------------------ - -class AuthMeHook { - - boolean isLogged(final Player player) { - try { - final AuthMeApi instance = AuthMeApi.getInstance(); - - return instance.isAuthenticated(player); - } catch (final Throwable t) { - return false; - } - } -} - -class EssentialsHook { - - private final Essentials ess; - - EssentialsHook() { - ess = (Essentials) Bukkit.getPluginManager().getPlugin("Essentials"); - } - - void setGodMode(final Player player, final boolean godMode) { - final User user = getUser(player.getName()); - - if (user != null) - user.setGodModeEnabled(godMode); - } - - void setIgnore(final UUID player, final UUID toIgnore, final boolean ignore) { - try { - final com.earth2me.essentials.User user = ess.getUser(player); - final com.earth2me.essentials.User toIgnoreUser = ess.getUser(toIgnore); - - if (toIgnoreUser != null) - user.setIgnoredPlayer(toIgnoreUser, ignore); - - } catch (final Throwable t) { - } - } - - boolean isIgnoring(final UUID player, final UUID ignoringPlayer) { - try { - final com.earth2me.essentials.User user = ess.getUser(player); - final com.earth2me.essentials.User ignored = ess.getUser(ignoringPlayer); - - return user != null && ignored != null && user.isIgnoredPlayer(ignored); - - } catch (final Throwable t) { - return false; - } - } - - boolean isAfk(final String pl) { - final IUser user = getUser(pl); - - return user != null ? user.isAfk() : false; - } - - boolean isVanished(final String pl) { - final IUser user = getUser(pl); - - return user != null ? user.isVanished() : false; - } - - boolean isMuted(final String pl) { - final com.earth2me.essentials.User user = getUser(pl); - - return user != null ? user.isMuted() : false; - } - - Player getReplyTo(final String recipient) { - final User user = getUser(recipient); - - if (user == null) - return null; - - String replyPlayer = null; - - try { - replyPlayer = user.getReplyRecipient().getName(); - - } catch (final Throwable ex) { - try { - final Method getReplyTo = ReflectionUtil.getMethod(user.getClass(), "getReplyTo"); - - if (getReplyTo != null) { - final CommandSource commandSource = ReflectionUtil.invoke(getReplyTo, user); - - replyPlayer = commandSource == null ? null : commandSource.getPlayer().getName(); - } - - } catch (final Throwable t) { - replyPlayer = null; - } - } - - final Player bukkitPlayer = replyPlayer == null ? null : Bukkit.getPlayer(replyPlayer); - - if (bukkitPlayer != null && bukkitPlayer.isOnline()) - return bukkitPlayer; - - return null; - } - - String getNick(final String player) { - final User user = getUser(player); - - if (user == null) { - Common.log("&cMalfunction getting Essentials user. Have you reloaded?"); - - return player; - } - - final String essNick = Common.getOrEmpty(user.getNickname()); - - return "".equals(essNick) ? null : essNick; - } - - void setNick(final UUID uniqueId, String nick) { - final User user = getUser(uniqueId); - - if (user != null) { - final boolean isEmpty = nick == null || Common.stripColors(nick).replace(" ", "").isEmpty(); - - user.setNickname(isEmpty ? null : Common.colorize(nick)); - } - } - - String getNameFromNick(final String maybeNick) { - final UserMap users = ess.getUserMap(); - - if (users != null) - for (final UUID userId : users.getAllUniqueUsers()) { - final User user = users.getUser(userId); - - if (user != null && user.getNickname() != null && Valid.colorlessEquals(user.getNickname(), maybeNick)) - return Common.getOrDefault(user.getName(), maybeNick); - } - - return maybeNick; - } - - void setBackLocation(final String player, final Location loc) { - final User user = getUser(player); - - if (user != null) - try { - user.setLastLocation(loc); - - } catch (final Throwable t) { - } - } - - private User getUser(final String name) { - if (ess.getUserMap() == null) - return null; - - User user = null; - - try { - user = ess.getUserMap().getUser(name); - } catch (final Throwable t) { - } - - if (user == null) - try { - user = ess.getUserMap().getUserFromBukkit(name); - - } catch (final Throwable ex) { - user = ess.getUser(name); - } - return user; - } - - private User getUser(final UUID uniqueId) { - if (ess.getUserMap() == null) - return null; - - User user = null; - - try { - user = ess.getUserMap().getUser(uniqueId); - } catch (final Throwable t) { - } - - if (user == null) - try { - user = ess.getUser(uniqueId); - } catch (final Throwable ex) { - } - - return user; - } - -} - -class MultiverseHook { - - private final MultiverseCore multiVerse; - - MultiverseHook() { - multiVerse = (MultiverseCore) Bukkit.getPluginManager().getPlugin("Multiverse-Core"); - } - - String getWorldAlias(final String world) { - final MultiverseWorld mvWorld = multiVerse.getMVWorldManager().getMVWorld(world); - - if (mvWorld != null) - return mvWorld.getColoredWorldString(); - - return world; - } -} - -class TownyHook { - - Collection<? extends Player> getTownResidentsOnline(final Player pl) { - final List<Player> recipients = new ArrayList<>(); - final String playersTown = getTownName(pl); - - if (!playersTown.isEmpty()) - for (final Player online : Remain.getOnlinePlayers()) - if (playersTown.equals(getTownName(online))) - recipients.add(online); - - return recipients; - } - - Collection<? extends Player> getNationPlayersOnline(final Player pl) { - final List<Player> recipients = new ArrayList<>(); - final String playerNation = getNationName(pl); - - if (!playerNation.isEmpty()) - for (final Player online : Remain.getOnlinePlayers()) - if (playerNation.equals(getNationName(online))) - recipients.add(online); - - return recipients; - } - - Collection<? extends Player> getAllyPlayersOnline(final Player pl) { - final List<Player> recipients = new ArrayList<>(); - final Resident resident = getResident(pl); - - if (resident != null) - for (final Player online : Remain.getOnlinePlayers()) { - final Resident otherResident = getResident(online); - - if (otherResident != null && otherResident.isAlliedWith(resident)) - recipients.add(online); - } - - return recipients; - } - - String getTownName(final Player pl) { - final Town t = getTown(pl); - - return t != null ? t.getName() : ""; - } - - String getNationName(final Player pl) { - final Nation n = getNation(pl); - - return n != null ? n.getName() : ""; - } - - List<String> getTowns() { - try { - //import com.palmergames.bukkit.towny.object.TownyUniverse; - - return Common.convert(TownyUniverse.getInstance().getTowns(), Town::getName); - - } catch (final Throwable e) { - return new ArrayList<>(); - } - } - - String getTownName(final Location loc) { - final Town town = getTown(loc); - - return town != null ? town.getName() : null; - } - - private Town getTown(final Location loc) { - try { - final WorldCoord worldCoord = WorldCoord.parseWorldCoord(loc); - final TownBlock townBlock = TownyUniverse.getInstance().getTownBlock(worldCoord); - - return townBlock != null ? townBlock.getTown() : null; - - } catch (final Throwable e) { - return null; - } - } - - String getTownOwner(final Location loc) { - try { - final Town town = getTown(loc); - - return town != null ? town.getMayor().getName() : null; - - } catch (final Throwable e) { - return null; - } - } - - private Nation getNation(final Player pl) { - final Town town = getTown(pl); - - try { - return town.getNation(); - - } catch (final Throwable ex) { - return null; - } - } - - private Town getTown(final Player pl) { - final Resident res = getResident(pl); - - try { - return res.getTown(); - - } catch (final Throwable ex) { - return null; - } - } - - private Resident getResident(final Player player) { - try { - return TownyUniverse.getInstance().getResident(player.getName()); - - } catch (final Throwable e) { - return null; - } - } -} - -class ProtocolLibHook { - - private final ProtocolManager manager; - - ProtocolLibHook() { - manager = ProtocolLibrary.getProtocolManager(); - } - - final void addPacketListener(final Object listener) { - Valid.checkBoolean(listener instanceof PacketListener, "Listener must extend or implements PacketListener or PacketAdapter"); - - try { - manager.addPacketListener((PacketListener) listener); - - } catch (final Throwable t) { - Common.error(t, "Failed to register ProtocolLib packet listener! Ensure you have the latest ProtocolLib. If you reloaded, try a fresh startup (some ProtocolLib esp. for 1.8.8 fails on reload)."); - } - } - - final void removePacketListeners(final Plugin plugin) { - manager.removePacketListeners(plugin); - } - - final void sendPacket(final PacketContainer packet) { - for (final Player player : Remain.getOnlinePlayers()) - sendPacket(player, packet); - } - - final void sendPacket(final Player player, final Object packet) { - Valid.checkNotNull(player); - Valid.checkBoolean(packet instanceof PacketContainer, "Packet must be instance of PacketContainer from ProtocolLib"); - - try { - manager.sendServerPacket(player, (PacketContainer) packet); - - } catch (final InvocationTargetException e) { - Common.error(e, "Failed to send " + ((PacketContainer) packet).getType() + " packet to " + player.getName()); - } - } - - final boolean isTemporaryPlayer(Player player) { - try { - return player instanceof TemporaryPlayer; - - } catch (final NoClassDefFoundError err) { - return false; - } - } -} - -class VaultHook { - - private Chat chat; - private Economy economy; - private Permission permissions; - - VaultHook() { - setIntegration(); - } - - void setIntegration() { - final RegisteredServiceProvider<Economy> economyProvider = Bukkit.getServicesManager().getRegistration(Economy.class); - final RegisteredServiceProvider<Chat> chatProvider = Bukkit.getServicesManager().getRegistration(Chat.class); - final RegisteredServiceProvider<Permission> permProvider = Bukkit.getServicesManager().getRegistration(Permission.class); - - if (economyProvider != null) - economy = economyProvider.getProvider(); - - if (chatProvider != null) - chat = chatProvider.getProvider(); - - if (permProvider != null) - permissions = permProvider.getProvider(); - } - - boolean isChatIntegrated() { - return chat != null; - } - - boolean isEconomyIntegrated() { - return economy != null; - } - - // ------------------------------------------------------------------------------ - // Economy - // ------------------------------------------------------------------------------ - - String getCurrencyNameSG() { - return economy != null ? Common.getOrEmpty(economy.currencyNameSingular()) : "Money"; - } - - String getCurrencyNamePL() { - return economy != null ? Common.getOrEmpty(economy.currencyNamePlural()) : "Money"; - } - - double getBalance(final Player player) { - return economy != null ? economy.getBalance(player) : -1; - } - - void withdraw(final Player player, final double amount) { - if (economy != null) - economy.withdrawPlayer(player.getName(), amount); - } - - void deposit(final Player player, final double amount) { - if (economy != null) - economy.depositPlayer(player.getName(), amount); - } - - // ------------------------------------------------------------------------------ - // Permissions - // ------------------------------------------------------------------------------ - - Boolean hasPerm(@NonNull final OfflinePlayer player, final String perm) { - try { - return permissions != null ? perm != null ? permissions.playerHas((String) null, player, perm) : true : null; - - } catch (final Throwable t) { - Common.logTimed(900, - "SEVERE: Unable to ask Vault plugin if " + player.getName() + " has " + perm + " permission, returning false. " - + "This error only shows every 15 minutes. " - + "Run /vault-info and check if your permissions plugin is running correctly."); - - return false; - } - } - - Boolean hasPerm(@NonNull final String player, final String perm) { - return permissions != null ? perm != null ? permissions.has((String) null, player, perm) : true : null; - } - - Boolean hasPerm(@NonNull final String world, @NonNull final String player, final String perm) { - return permissions != null ? perm != null ? permissions.has(world, player, perm) : true : null; - } - - String getPrimaryGroup(final Player player) { - return permissions != null ? permissions.getPrimaryGroup(player) : ""; - } - - // ------------------------------------------------------------------------------ - // Prefix / Suffix - // ------------------------------------------------------------------------------ - - String getPlayerPrefix(final Player player) { - return lookupVault(player, VaultPart.PREFIX); - } - - String getPlayerSuffix(final Player player) { - return lookupVault(player, VaultPart.SUFFIX); - } - - String getPlayerGroup(final Player player) { - return lookupVault(player, VaultPart.GROUP); - } - - private String lookupVault(final Player player, final VaultPart vaultPart) { - if (chat == null) - return ""; - - final String[] groups = chat.getPlayerGroups(player); - String fallback = vaultPart == VaultPart.PREFIX ? chat.getPlayerPrefix(player) : vaultPart == VaultPart.SUFFIX ? chat.getPlayerSuffix(player) : groups != null && groups.length > 0 ? groups[0] : ""; - - if (fallback == null) - fallback = ""; - - if (vaultPart == VaultPart.PREFIX /*&& !SimplePlugin.getInstance().vaultMultiPrefix()*/ || vaultPart == VaultPart.SUFFIX /*&& !SimplePlugin.getInstance().vaultMultiSuffix()*/) - return fallback; - - final List<String> list = new ArrayList<>(); - - if (!fallback.isEmpty()) - list.add(fallback); - - if (groups != null) - for (final String group : groups) { - final String part = vaultPart == VaultPart.PREFIX ? chat.getGroupPrefix(player.getWorld(), group) : vaultPart == VaultPart.SUFFIX ? chat.getGroupSuffix(player.getWorld(), group) : group; - - if (part != null && !part.isEmpty() && !list.contains(part)) - list.add(part); - } - - return StringUtils.join(list, vaultPart == VaultPart.GROUP ? ", " : ""); - } - - enum VaultPart { - PREFIX, - SUFFIX, - GROUP, - } -} - -class PlaceholderAPIHook { - - private static volatile VariablesInjector injector; - - PlaceholderAPIHook() { - try { - injector = new VariablesInjector(); - injector.register(); - - } catch (final Throwable throwable) { - Common.error(throwable, "Failed to inject our variables into PlaceholderAPI!"); - } - } - - final void unregister() { - if (injector != null) - try { - injector.unregister(); - - } catch (final Throwable t) { - // Silence, probably plugin got removed in the meantime - } - } - - final String replacePlaceholders(final Player pl, final String msg) { - try { - return setPlaceholders(pl, msg); - - } catch (final Throwable t) { - Common.error(t, - "PlaceholderAPI failed to replace variables!", - "Player: " + pl.getName(), - "Message: " + msg, - "Error: %error"); - - return msg; - } - } - - private String setPlaceholders(final Player player, String text) { - final Map<String, PlaceholderHook> hooks = PlaceholderAPI.getPlaceholders(); - - if (hooks.isEmpty()) - return text; - - final Matcher matcher = Variables.BRACKET_PLACEHOLDER_PATTERN.matcher(text); - - while (matcher.find()) { - String format = matcher.group(1); - boolean frontSpace = false; - boolean backSpace = false; - - if (format.startsWith("+")) { - frontSpace = true; - - format = format.substring(1); - } - - if (format.endsWith("+")) { - backSpace = true; - - format = format.substring(0, format.length() - 1); - } - - final int index = format.indexOf("_"); - - if (index <= 0 || index >= format.length()) - continue; - - final String identifier = format.substring(0, index); - final String params = format.substring(index + 1); - - if (hooks.containsKey(identifier)) { - - // Wait 0.5 seconds then kill the thread to prevent server - // crashing on PlaceholderAPI variables hanging up on the main thread - final Thread currentThread = Thread.currentThread(); - final BukkitTask watchDog = Common.runLater(20, () -> { - Common.logFramed( - "IMPORTANT: PREVENTED SERVER CRASH FROM PLACEHOLDERAPI", - "Replacing a variable using PlaceholderAPI took", - "longer than our maximum limit (1 second) and", - "was forcefully interrupted to prevent your", - "server from crashing. This is not error on", - "our end, please contact the expansion author.", - "", - "Variable: " + identifier, - "Player: " + player.getName()); - - currentThread.stop(); - }); - - String value = hooks.get(identifier).onRequest(player, params); - - // Indicate we no longer have to kill the thread - watchDog.cancel(); - - if (value != null) { - value = Matcher.quoteReplacement(Common.colorize(value)); - - text = text.replaceAll(Pattern.quote(matcher.group()), value.isEmpty() ? "" : (frontSpace ? " " : "") + value + (backSpace ? " " : "")); - } - } - } - - return text; - } - - final String replaceRelationPlaceholders(final Player one, final Player two, final String message) { - try { - return setRelationalPlaceholders(one, two, message); - - } catch (final Throwable t) { - Common.error(t, - "PlaceholderAPI failed to replace relation variables!", - "Player one: " + one, - "Player two: " + two, - "Message: " + message, - "Error: %error"); - - return message; - } - } - - private String setRelationalPlaceholders(final Player one, final Player two, String text) { - final Map<String, PlaceholderHook> hooks = PlaceholderAPI.getPlaceholders(); - - if (hooks.isEmpty()) - return text; - - final Matcher matcher = Variables.BRACKET_REL_PLACEHOLDER_PATTERN.matcher(text); - - while (matcher.find()) { - final String format = matcher.group(2); - final int index = format.indexOf("_"); - - if (index <= 0 || index >= format.length()) - continue; - - final String identifier = format.substring(0, index); - final String params = format.substring(index + 1); - - if (hooks.containsKey(identifier)) { - if (!(hooks.get(identifier) instanceof Relational)) - continue; - - final Relational rel = (Relational) hooks.get(identifier); - final String value = one != null && two != null ? rel.onPlaceholderRequest(one, two, params) : ""; - - if (value != null) - text = text.replaceAll(Pattern.quote(matcher.group()), Matcher.quoteReplacement(Common.colorize(value))); - } - } - - return text; - } - - private class VariablesInjector extends PlaceholderExpansion { - - /** - * Because this is an internal class, - * you must override this method to let PlaceholderAPI know to not unregister your expansion class when - * PlaceholderAPI is reloaded - * - * @return true to persist through reloads - */ - @Override - public boolean persist() { - return true; - } - - /** - * Because this is a internal class, this check is not needed - * and we can simply return {@code true} - * - * @return Always true since it's an internal class. - */ - @Override - public boolean canRegister() { - return true; - } - - /** - * The name of the person who created this expansion should go here. - * <br>For convienience do we return the author from the plugin.yml - * - * @return The name of the author as a String. - */ - @Override - public String getAuthor() { - return SimplePlugin.getInstance().getDescription().getAuthors().toString(); - } - - /** - * The placeholder identifier should go here. - * <br>This is what tells PlaceholderAPI to call our onRequest - * method to obtain a value if a placeholder starts with our - * identifier. - * <br>This must be unique and can not contain % or _ - * - * @return The identifier in {@code %<identifier>_<value>%} as String. - */ - @Override - public String getIdentifier() { - return SimplePlugin.getNamed().toLowerCase().replace("%", "").replace(" ", "").replace("_", ""); - } - - /** - * This is the version of the expansion. - * <br>You don't have to use numbers, since it is set as a String. - * <p> - * For convenience do we return the version from the plugin.yml - * - * @return The version as a String. - */ - @Override - public String getVersion() { - return SimplePlugin.getInstance().getDescription().getVersion(); - } - - /** - * Replace Foundation variables but with our plugin name added as prefix - * - * We return null if an invalid placeholder (f.e. %ourplugin_nonexistingplaceholder%) is provided - */ - @Override - public String onRequest(OfflinePlayer offlinePlayer, @NonNull String identifier) { - final Player player = offlinePlayer != null ? offlinePlayer.getPlayer() : null; - - if (player == null || !player.isOnline()) - return null; - - final boolean frontSpace = identifier.startsWith("+"); - final boolean backSpace = identifier.endsWith("+"); - - identifier = frontSpace ? identifier.substring(1) : identifier; - identifier = backSpace ? identifier.substring(0, identifier.length() - 1) : identifier; - - final Function<CommandSender, String> variable = Variables.getVariable(identifier); - - try { - if (variable != null) { - final String value = variable.apply(player); - - if (value != null) - return value; - } - - for (final SimpleExpansion expansion : Variables.getExpansions()) { - final String value = expansion.replacePlaceholders(player, identifier); - - if (value != null) { - final boolean emptyColorless = Common.stripColors(value).isEmpty(); - - return (!value.isEmpty() && frontSpace && !emptyColorless ? " " : "") + value + (!value.isEmpty() && backSpace && !emptyColorless ? " " : ""); - } - } - - } catch (final Exception ex) { - Common.error(ex, - "Error replacing PlaceholderAPI variables", - "Identifier: " + identifier, - "Player: " + player.getName()); - } - - return null; - } - } -} - -class NickyHook { - - NickyHook() { - } - - String getNick(final Player player) { - final Constructor<?> nickConstructor = ReflectionUtil.getConstructor("io.loyloy.nicky.Nick", Player.class); - final Object nick = ReflectionUtil.instantiate(nickConstructor, player); - String nickname = ReflectionUtil.invoke("get", nick); - - if (nickname != null) { - final Method formatMethod = ReflectionUtil.getMethod(nick.getClass(), "format", String.class); - - if (formatMethod != null) - nickname = ReflectionUtil.invoke(formatMethod, nick, nickname); - } - - return nickname != null && !nickname.isEmpty() ? nickname : null; - } -} - -class MVdWPlaceholderHook { - - MVdWPlaceholderHook() { - } - - String replacePlaceholders(final Player player, final String message) { - try { - final Class<?> placeholderAPI = ReflectionUtil.lookupClass("be.maximvdw.placeholderapi.PlaceholderAPI"); - Valid.checkNotNull(placeholderAPI, "Failed to look up class be.maximvdw.placeholderapi.PlaceholderAPI"); - - final Method replacePlaceholders = ReflectionUtil.getMethod(placeholderAPI, "replacePlaceholders", OfflinePlayer.class, String.class); - Valid.checkNotNull(replacePlaceholders, "Failed to look up method PlaceholderAPI#replacePlaceholders(Player, String)"); - - final String replaced = ReflectionUtil.invoke(replacePlaceholders, null, player, message); - - return replaced == null ? "" : replaced; - - } catch (final IllegalArgumentException ex) { - if (!Common.getOrEmpty(ex.getMessage()).contains("Illegal group reference")) - ex.printStackTrace(); - - } catch (final Throwable t) { - Common.error(t, - "MvdWPlaceholders placeholders failed!", - "Player: " + player.getName(), - "Message: '" + message + "'", - "Consider writing to developer of that library", - "first as this may be a bug we cannot handle!", - "", - "Your chat message will appear without replacements."); - } - - return message; - } -} - -class LWCHook { - - String getOwner(final Block block) { - if (!LWC.ENABLED) - return null; - - final Protection protection = LWC.getInstance().findProtection(block); - - if (protection != null) { - final String uuid = protection.getOwner(); - - if (uuid != null) { - final OfflinePlayer opl = Remain.getOfflinePlayerByUUID(UUID.fromString(uuid)); - - if (opl != null) - return opl.getName(); - } - } - - return null; - } -} - -class LocketteProHook { - - boolean isOwner(final Block block, final Player player) { - final Class<?> locketteProAPI = ReflectionUtil.lookupClass("me.crafter.mc.lockettepro.LocketteProAPI"); - final Method isProtected = ReflectionUtil.getMethod(locketteProAPI, "isProtected", Block.class); - final Method isOwner = ReflectionUtil.getMethod(locketteProAPI, "isOwner", Block.class, Player.class); - - return (boolean) ReflectionUtil.invoke(isProtected, null, block) ? ReflectionUtil.invoke(isOwner, null, block, player) : false; - } -} - -class ResidenceHook { - - public Collection<String> getResidences() { - return Residence.getInstance().getResidenceManager().getResidences().keySet(); - } - - public String getResidence(final Location loc) { - final ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(loc); - - if (res != null) - return res.getName(); - - return null; - } - - public String getResidenceOwner(final Location loc) { - final ClaimedResidence res = Residence.getInstance().getResidenceManager().getByLoc(loc); - - if (res != null) - return res.getOwner(); - - return null; - } -} - -class WorldEditHook { - - public final boolean legacy; - - public WorldEditHook() { - boolean ok = false; - try { - Class.forName("com.sk89q.worldedit.world.World"); - ok = true; - } catch (final ClassNotFoundException e) { - } - - legacy = !ok; - } -} - -class WorldGuardHook { - - private final boolean legacy; - - public WorldGuardHook(final WorldEditHook we) { - final Plugin wg = Bukkit.getPluginManager().getPlugin("WorldGuard"); - - legacy = !wg.getDescription().getVersion().startsWith("7") || we != null && we.legacy; - } - - public List<String> getRegionsAt(final Location loc) { - final List<String> list = new ArrayList<>(); - - getApplicableRegions(loc).forEach(reg -> { - final String name = Common.stripColors(reg.getId()); - - if (!name.startsWith("__")) - list.add(name); - }); - - return list; - } - - public Region getRegion(final String name) { - for (final World w : Bukkit.getWorlds()) { - final Object rm = getRegionManager(w); - if (legacy) - try { - - final Map<?, ?> regionMap = (Map<?, ?>) rm.getClass().getMethod("getRegions").invoke(rm); - for (final Object regObj : regionMap.values()) { - if (regObj == null) - continue; - - if (Common.stripColors(((ProtectedRegion) regObj).getId()).equals(name)) { - - final Class<?> clazz = regObj.getClass(); - final Method getMax = clazz.getMethod("getMaximumPoint"); - final Method getMin = clazz.getMethod("getMinimumPoint"); - - final Object regMax = getMax.invoke(regObj); - final Object regMin = getMin.invoke(regObj); - - final Class<?> vectorClass = Class.forName("com.sk89q.worldedit.BlockVector"); - final Method getX = vectorClass.getMethod("getX"); - final Method getY = vectorClass.getMethod("getY"); - final Method getZ = vectorClass.getMethod("getZ"); - - final Location locMax; - final Location locMin; - locMax = new Location(w, (Double) getX.invoke(regMax), (Double) getY.invoke(regMax), (Double) getZ.invoke(regMax)); - locMin = new Location(w, (Double) getX.invoke(regMin), (Double) getY.invoke(regMin), (Double) getZ.invoke(regMin)); - - return new Region(name, locMin, locMax); - } - } - - } catch (final Throwable t) { - t.printStackTrace(); - - throw new FoException("Failed WorldEdit 6 legacy hook, see above & report"); - } - else - for (final ProtectedRegion reg : ((com.sk89q.worldguard.protection.managers.RegionManager) rm).getRegions().values()) - if (reg != null && reg.getId() != null && Common.stripColors(reg.getId()).equals(name)) { - //if(reg instanceof com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion) { - // just going to pretend that everything is a cuboid.. - final Location locMax; - final Location locMin; - final com.sk89q.worldedit.math.BlockVector3 regMax = reg.getMaximumPoint(); - final com.sk89q.worldedit.math.BlockVector3 regMin = reg.getMinimumPoint(); - - locMax = new Location(w, regMax.getX(), regMax.getY(), regMax.getZ()); - locMin = new Location(w, regMin.getX(), regMin.getY(), regMin.getZ()); - - return new Region(name, locMin, locMax); - } - } - return null; - } - - public List<String> getAllRegions() { - final List<String> list = new ArrayList<>(); - - for (final World w : Bukkit.getWorlds()) { - final Object rm = getRegionManager(w); - if (legacy) - try { - final Map<?, ?> regionMap = (Map<?, ?>) rm.getClass().getMethod("getRegions").invoke(rm); - Method getId = null; - for (final Object regObj : regionMap.values()) { - if (regObj == null) - continue; - if (getId == null) - getId = regObj.getClass().getMethod("getId"); - - final String name = Common.stripColors(getId.invoke(regObj).toString()); - - if (!name.startsWith("__")) - list.add(name); - } - } catch (final Throwable t) { - t.printStackTrace(); - - throw new FoException("Failed WorldEdit 6 legacy hook, see above & report"); - } - else - ((com.sk89q.worldguard.protection.managers.RegionManager) rm) - .getRegions().values().forEach(reg -> { - if (reg == null || reg.getId() == null) - return; - - final String name = Common.stripColors(reg.getId()); - - if (!name.startsWith("__")) - list.add(name); - }); - } - - return list; - } - - private Iterable<ProtectedRegion> getApplicableRegions(final Location loc) { - final Object rm = getRegionManager(loc.getWorld()); - - if (legacy) - try { - return (Iterable<ProtectedRegion>) rm.getClass().getMethod("getApplicableRegions", Location.class).invoke(rm, loc); - - } catch (final Throwable t) { - t.printStackTrace(); - - throw new FoException("Failed WorldEdit 6 legacy hook, see above & report"); - } - - return ((com.sk89q.worldguard.protection.managers.RegionManager) rm) - .getApplicableRegions(com.sk89q.worldedit.math.BlockVector3.at(loc.getX(), loc.getY(), loc.getZ())); - } - - private Object getRegionManager(final World w) { - if (legacy) - try { - return Class.forName("com.sk89q.worldguard.bukkit.WGBukkit").getMethod("getRegionManager", World.class).invoke(null, w); - - } catch (final Throwable t) { - t.printStackTrace(); - - throw new FoException("Failed WorldGuard 6 legacy hook, see above & report"); - } - - // causes class errors.. - //return com.sk89q.worldguard.WorldGuard.getInstance().getPlatform().getRegionContainer().get(new com.sk89q.worldedit.bukkit.BukkitWorld(w)); - // dynamically load modern WE - try { - - final Class<?> bwClass = Class.forName("com.sk89q.worldedit.bukkit.BukkitWorld"); - final Constructor<?> bwClassNew = bwClass.getConstructor(World.class); - - Object t = Class.forName("com.sk89q.worldguard.WorldGuard").getMethod("getInstance").invoke(null); - t = t.getClass().getMethod("getPlatform").invoke(t); - t = t.getClass().getMethod("getRegionContainer").invoke(t); - return t.getClass().getMethod("get", Class.forName("com.sk89q.worldedit.world.World")).invoke(t, bwClassNew.newInstance(w)); - - } catch (final Throwable t) { - t.printStackTrace(); - - throw new FoException("Failed WorldGuard hook, see above & report"); - } - } -} - -abstract class FactionsHook { - - /** - * Get all loaded factions - */ - abstract Collection<String> getFactions(); - - /** - * Get faction of the player - */ - abstract String getFaction(Player pl); - - /** - * Get faction in the location - */ - abstract String getFaction(Location loc); - - /** - * Get faction owner at the specific location - */ - abstract String getFactionOwner(Location loc); - - /** - * Get all players being in the same faction, used for party chat. - */ - final Collection<? extends Player> getSameFactionPlayers(final Player pl) { - final List<Player> recipients = new ArrayList<>(); - final String playerFaction = getFaction(pl); - - if (playerFaction != null && !playerFaction.isEmpty()) - for (final Player online : Remain.getOnlinePlayers()) { - final String onlineFaction = getFaction(online); - - if (playerFaction.equals(onlineFaction)) - recipients.add(online); - } - - return recipients; - } -} - -final class FactionsMassive extends FactionsHook { - - FactionsMassive() { - } - - @Override - public Collection<String> getFactions() { - return Common.convert(com.massivecraft.factions.entity.FactionColl.get().getAll(), object -> Common.stripColors(object.getName())); - } - - @Override - public String getFaction(final Player pl) { - try { - return MPlayer.get(pl.getUniqueId()).getFactionName(); - } catch (final Exception ex) { - return null; - } - } - - @Override - public String getFaction(final Location loc) { - final Faction f = BoardColl.get().getFactionAt(PS.valueOf(loc)); - - if (f != null) - return f.getName(); - - return null; - } - - @Override - public String getFactionOwner(final Location loc) { - final Faction f = BoardColl.get().getFactionAt(PS.valueOf(loc)); - - if (f != null) - return f.getLeader() != null ? f.getLeader().getName() : null; - - return null; - } -} - -final class FactionsUUID extends FactionsHook { - - @Override - public Collection<String> getFactions() { - try { - final Object i = instance(); - final Set<String> tags = (Set<String>) i.getClass().getMethod("getFactionTags").invoke(i); - - return tags; - } catch (final Throwable t) { - t.printStackTrace(); - - return null; - } - } - - @Override - public String getFaction(final Player pl) { - try { - final Object fplayers = fplayers(); - final Object fpl = fplayers.getClass().getMethod("getByPlayer", Player.class).invoke(fplayers, pl); - final Object f = fpl != null ? fpl.getClass().getMethod("getFaction").invoke(fpl) : null; - final Object name = f != null ? f.getClass().getMethod("getTag").invoke(f) : null; - - return name != null ? name.toString() : null; - - } catch (final ReflectiveOperationException ex) { - ex.printStackTrace(); - - return null; - } - } - - @Override - public String getFaction(final Location loc) { - final Object f = findFaction(loc); - - try { - return f != null ? f.getClass().getMethod("getTag").invoke(f).toString() : null; - } catch (final ReflectiveOperationException ex) { - ex.printStackTrace(); - - return null; - } - } - - @Override - public String getFactionOwner(final Location loc) { - final Object faction = findFaction(loc); - - try { - return faction != null ? ((com.massivecraft.factions.FPlayer) faction.getClass().getMethod("getFPlayerAdmin").invoke(faction)).getName() : null; - } catch (final ReflectiveOperationException ex) { - ex.printStackTrace(); - - return null; - } - } - - private Object findFaction(final Location loc) { - final Class<com.massivecraft.factions.Board> b = com.massivecraft.factions.Board.class; - - try { - return b.getMethod("getFactionAt", com.massivecraft.factions.FLocation.class).invoke(b.getMethod("getInstance").invoke(null), new com.massivecraft.factions.FLocation(loc)); - } catch (final ReflectiveOperationException ex) { - ex.printStackTrace(); - - return null; - } - } - - private Object instance() { - try { - return Class.forName("com.massivecraft.factions.Factions").getDeclaredMethod("getInstance").invoke(null); - } catch (final ReflectiveOperationException ex) { - ex.printStackTrace(); - - throw new FoException(ex); - } - } - - private Object fplayers() { - try { - return Class.forName("com.massivecraft.factions.FPlayers").getDeclaredMethod("getInstance").invoke(null); - } catch (final ReflectiveOperationException ex) { - ex.printStackTrace(); - - throw new FoException(ex); - } - } -} - -class McMMOHook { - - // Only display error once - private boolean errorLogged = false; - - String getActivePartyChat(final Player player) { - try { - final McMMOPlayer mcplayer = UserManager.getPlayer(player); - - if (mcplayer != null) { - final Party party = mcplayer.getParty(); - final ChatChannel channelType = mcplayer.getChatChannel(); - - return channelType == ChatChannel.PARTY || channelType == ChatChannel.PARTY_OFFICER && party != null ? party.getName() : null; - } - - } catch (final Throwable throwable) { - if (!errorLogged) { - Common.warning("Failed getting mcMMO party chat for " + player.getName() + " due to error. Returning null." - + " Ensure you have the latest mcMMO version, if so, contact plugin authors to update the integration. Error was: " + throwable); - - errorLogged = true; - } - } - - return null; - } - - List<Player> getPartyRecipients(final Player bukkitPlayer) { - try { - final McMMOPlayer mcplayer = UserManager.getPlayer(bukkitPlayer); - - if (mcplayer != null) { - final Party party = mcplayer.getParty(); - - if (party != null) - return party.getOnlineMembers(); - } - - } catch (final Throwable throwable) { - if (!errorLogged) { - Common.warning("Failed getting mcMMO party recipients for " + bukkitPlayer.getName() + " due to error. Returning null." - + " Ensure you have the latest mcMMO version, if so, contact plugin authors to update the integration. Error was: " + throwable); - - errorLogged = true; - } - } - - return new ArrayList<>(); - } -} - -class PlotSquaredHook { - - private final boolean legacy; - - /** - * - */ - PlotSquaredHook() { - final Plugin plugin = Bukkit.getPluginManager().getPlugin("PlotSquared"); - Valid.checkNotNull(plugin, "PlotSquared not hooked yet!"); - - this.legacy = plugin.getDescription().getVersion().startsWith("3"); - } - - List<Player> getPlotPlayers(final Player player) { - final List<Player> players = new ArrayList<>(); - - final Class<?> plotPlayerClass = ReflectionUtil.lookupClass((legacy ? "com.intellectualcrafters.plot.object" : "com.plotsquared.core.player") + ".PlotPlayer"); - Method wrap; - - try { - wrap = plotPlayerClass.getMethod("wrap", Player.class); - - } catch (final ReflectiveOperationException ex) { - - try { - wrap = plotPlayerClass.getMethod("wrap", Object.class); - - } catch (final ReflectiveOperationException ex2) { - - try { - wrap = plotPlayerClass.getMethod("from", Object.class); - - } catch (final ReflectiveOperationException ex3) { - throw new FoException(ex3, "PlotSquared could not convert " + player.getName() + " into PlotPlayer! Is the integration outdated?"); - } - } - } - - final Object plotPlayer = ReflectionUtil.invokeStatic(wrap, player); - Valid.checkNotNull(plotPlayer, "Failed to convert player " + player.getName() + " to PlotPlayer!"); - - final Object currentPlot = ReflectionUtil.invoke("getCurrentPlot", plotPlayer); - - if (currentPlot != null) - for (final Object playerInPlot : (Iterable<?>) ReflectionUtil.invoke("getPlayersInPlot", currentPlot)) { - final UUID id = ReflectionUtil.invoke("getUUID", playerInPlot); - final Player online = Bukkit.getPlayer(id); - - if (online != null && online.isOnline()) - players.add(online); - } - - return players; - } -} - -class CMIHook { - - boolean isVanished(final Player player) { - final CMIUser user = getUser(player); - - return user != null && user.isVanished(); - } - - boolean isAfk(final Player player) { - final CMIUser user = getUser(player); - - return user != null && user.isAfk(); - } - - boolean isMuted(final Player player) { - final CMIUser user = getUser(player); - - try { - return user != null && user.getMutedUntil() != 0 && user.getMutedUntil() != null && user.getMutedUntil() > System.currentTimeMillis(); - - } catch (final Exception ex) { - return false; - } - } - - void setGodMode(final Player player, final boolean godMode) { - final CMIUser user = getUser(player); - - user.setGod(godMode); - } - - void setLastTeleportLocation(final Player player, final Location location) { - final CMIUser user = getUser(player); - - try { - user.getClass().getMethod("setLastTeleportLocation", Location.class).invoke(user, location); - } catch (final Throwable t) { - // Silently fail - } - } - - void setIgnore(final UUID player, final UUID who, final boolean ignore) { - final CMIUser user = CMI.getInstance().getPlayerManager().getUser(player); - - if (ignore) - user.addIgnore(who, true /* save now */); - else - user.removeIgnore(who); - } - - boolean isIgnoring(final UUID player, final UUID who) { - try { - final CMIUser user = CMI.getInstance().getPlayerManager().getUser(player); - - return user.isIgnoring(who); - - } catch (final NullPointerException ex) { - return false; - } - } - - String getNick(final Player player) { - final CMIUser user = getUser(player); - final String nick = user == null ? null : user.getNickName(); - - return nick == null || "".equals(nick) ? null : nick; - } - - void setNick(final UUID uniqueId, String nick) { - final CMIUser user = getUser(uniqueId); - final TabListManager tabManager = CMI.getInstance().getTabListManager(); - - if (user != null) { - final boolean isEmpty = nick == null || Common.stripColors(nick).replace(" ", "").isEmpty(); - - user.setNickName(isEmpty ? null : Common.colorize(nick), true); - user.updateDisplayName(); - - if (tabManager.isUpdatesOnNickChange()) - tabManager.updateTabList(3); - } - } - - String getNameFromNick(String nick) { - for (final CMIUser user : CMI.getInstance().getPlayerManager().getAllUsers().values()) - if (user != null && user.getNickName() != null && Valid.colorlessEquals(user.getNickName(), nick)) - return Common.getOrDefault(user.getName(), nick); - - return nick; - } - - private CMIUser getUser(final Player player) { - return CMI.getInstance().getPlayerManager().getUser(player); - } - - private CMIUser getUser(final UUID uniqueId) { - return CMI.getInstance().getPlayerManager().getUser(uniqueId); - } -} - -class CitizensHook { - - boolean isNPC(final Entity entity) { - final NPCRegistry reg = CitizensAPI.getNPCRegistry(); - - return reg != null ? reg.isNPC(entity) : false; - } -} - -class DiscordSRVHook implements Listener { - - Set<String> getChannels() { - return DiscordSRV.getPlugin().getChannels().keySet(); - } - - /*boolean sendMessage(final String sender, final String channel, final String message) { - final DiscordSender discordSender = new DiscordSender(sender); - - return sendMessage(discordSender, channel, message); - }*/ - - boolean sendMessage(final String channel, final String message) { - return sendMessage((CommandSender) null, channel, message); - } - - boolean sendMessage(final CommandSender sender, final String channel, final String message) { - final TextChannel textChannel = DiscordSRV.getPlugin().getDestinationTextChannelForGameChannelName(channel); - - // Channel not configured in DiscordSRV config.yml, ignore - if (textChannel == null) { - Debugger.debug("discord", "[MC->Discord] Could not find Discord channel '" + channel + "'. Available: " + String.join(", ", getChannels()) + ". Not sending: " + message); - - return false; - } - - if (sender instanceof Player) { - Debugger.debug("discord", "[MC->Discord] " + sender.getName() + " send message to '" + channel + "' channel. Message: '" + message + "'"); - - final DiscordSRV instance = JavaPlugin.getPlugin(DiscordSRV.class); - - // Dirty: We have to temporarily unset value in DiscordSRV to enable the processChatMessage method to function - final File file = new File(SimplePlugin.getData().getParent(), "DiscordSRV/config.yml"); - - if (file.exists()) { - final FileConfiguration discordConfig = YamlConfiguration.loadConfiguration(file); - - if (discordConfig != null) { - final String outMessageKey = "DiscordChatChannelMinecraftToDiscord"; - final boolean outMessageOldValue = discordConfig.getBoolean(outMessageKey); - - discordConfig.set(outMessageKey, true); - - try { - instance.processChatMessage((Player) sender, message, channel, false); - - } finally { - discordConfig.set(outMessageKey, outMessageOldValue); - } - } - } - - } else { - Debugger.debug("discord", "[MC->Discord] " + (sender == null ? "No sender " : sender.getName() + " (generic)") + "sent message to '" + channel + "' channel. Message: '" + message + "'"); - - DiscordUtil.sendMessage(textChannel, message); - } - return true; - } -} - -class BanManagerHook { - - /* - * Return true if the given player is muted - */ - boolean isMuted(final Player player) { - try { - final Class<?> api = ReflectionUtil.lookupClass("me.confuser.banmanager.common.api.BmAPI"); - final Method isMuted = ReflectionUtil.getMethod(api, "isMuted", UUID.class); - - return ReflectionUtil.invoke(isMuted, null, player.getUniqueId()); - - } catch (final Throwable t) { - if (!t.toString().contains("Could not find class")) - Common.log("Unable to check if " + player.getName() + " is muted at BanManager. Is the API hook outdated? Got: " + t); - - return false; - } - } -} - -class BossHook { - - /* - * Return the Boss name if the given player is a Boss or null - */ - String getBossName(final Entity entity) { - try { - final Class<?> api = ReflectionUtil.lookupClass("org.mineacademy.boss.api.BossAPI"); - final Method getBoss = ReflectionUtil.getMethod(api, "getBoss", Entity.class); - - final Object boss = ReflectionUtil.invoke(getBoss, null, entity); - - if (boss != null) { - final Method getName = ReflectionUtil.getMethod(boss.getClass(), "getName"); - - return ReflectionUtil.invoke(getName, boss); - } - - } catch (final Throwable t) { - Common.log("Unable to check if " + entity + " is a BOSS. Is the API hook outdated? Got: " + t); - } - - return null; - } -} - -class MythicMobsHook { - - /* - * Attempt to return a MythicMob name from the given entity - * or null if the entity is not a MythicMob - */ - final String getBossName(Entity entity) { - try { - final Class<?> mythicMobs = ReflectionUtil.lookupClass("io.lumine.xikage.mythicmobs.MythicMobs"); - final Object instance = ReflectionUtil.invokeStatic(mythicMobs, "inst"); - final Object mobManager = ReflectionUtil.invoke("getMobManager", instance); - final Optional<Object> activeMob = ReflectionUtil.invoke(ReflectionUtil.getMethod(mobManager.getClass(), "getActiveMob", UUID.class), mobManager, entity.getUniqueId()); - final Object mob = activeMob != null && activeMob.isPresent() ? activeMob.get() : null; - - if (mob != null) { - final Object mythicEntity = ReflectionUtil.invoke("getEntity", mob); - - if (mythicEntity != null) - return (String) ReflectionUtil.invoke("getName", mythicEntity); - } - - } catch (final NoSuchElementException ex) { - } - - return null; - } -} - -class LandsHook { - - private final LandsIntegration lands; - - LandsHook() { - this.lands = new LandsIntegration(SimplePlugin.getInstance()); - } - - Collection<Player> getLandPlayers(Player player) { - final Land land = lands.getLand(player.getLocation()); - - if (land != null) - return land.getOnlinePlayers(); - - return new ArrayList<>(); - } -} - -class LiteBansHook { - - /* - * Return true if the given player is muted - */ - boolean isMuted(final Player player) { - return false; // Problematic, we're investigating this - /*try { - final Class<?> api = ReflectionUtil.lookupClass("litebans.api.Database"); - final Object instance = ReflectionUtil.invokeStatic(api, "get"); - - return ReflectionUtil.invoke("isPlayerMuted", instance, player.getUniqueId()); - - } catch (final Throwable t) { - if (!t.toString().contains("Could not find class")) { - Common.log("Unable to check if " + player.getName() + " is muted at LiteBans. Is the API hook outdated? See console error:"); - - t.printStackTrace(); - } - - return false; - }*/ - } -} - -class ItemsAdderHook { - - private final Class<?> itemsAdder; - private final Method replaceFontImagesMethod; - private final Method replaceFontImagesMethodNoPlayer; - - ItemsAdderHook() { - this.itemsAdder = ReflectionUtil.lookupClass("dev.lone.itemsadder.api.FontImages.FontImageWrapper"); - this.replaceFontImagesMethod = ReflectionUtil.getDeclaredMethod(itemsAdder, "replaceFontImages", Player.class, String.class); - this.replaceFontImagesMethodNoPlayer = ReflectionUtil.getDeclaredMethod(itemsAdder, "replaceFontImages", String.class); - } - - /* - * Return true if the given player is muted - */ - String replaceFontImages(@Nullable final Player player, final String message) { - if (player == null) - return ReflectionUtil.invokeStatic(replaceFontImagesMethodNoPlayer, message); - - return ReflectionUtil.invokeStatic(replaceFontImagesMethod, player, message); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/IsInList.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/IsInList.java deleted file mode 100644 index a59f04aa2841b83ab903a84e05b819e1efe3bfe3..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/IsInList.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.mineacademy.fo.model; - -import java.util.Collection; - -import org.mineacademy.fo.Common; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.collection.StrictSet; - -import lombok.Getter; - -/** - * A simple class allowing you to match if something is in that list. - * <p> - * Example: The list contains "apple", "red", "car", - * you call isInList("car") and you get true. Same for any other data type - * <p> - * If you create new IsInList("*") or with an empty list, everything will be matched - * - * @param <T> - */ -public final class IsInList<T> { - - /** - * The internal set for matching - */ - @Getter - private final StrictSet<T> list; - - /** - * Is everything matched? - */ - private final boolean matchAll; - - /** - * Create a new matching list - * - * @param list - */ - public IsInList(final StrictSet<T> list) { - this(list.getSource()); - } - - /** - * Create a new matching list - * - * @param list - */ - public IsInList(final StrictList<T> list) { - this(list.getSource()); - } - - /** - * Create a new matching list - * - * @param list - */ - public IsInList(final Collection<T> list) { - this.list = new StrictSet<>(list); - - if (list.isEmpty()) - matchAll = true; - - else if (list.iterator().next().equals("*")) - matchAll = true; - - else - matchAll = false; - } - - /** - * Return true if the given value is in this list - * - * @param toEvaluateAgainst - * @return - */ - public boolean contains(final T toEvaluateAgainst) { - return matchAll || list.contains(toEvaluateAgainst); - } - - /** - * Return true if list is equal to ["*"] - * - * @return - */ - public boolean isEntireList() { - return matchAll; - } - - /** - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "IsInList[is entire list = " + this.matchAll + ", list = " + Common.join(this.list) + "]"; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/JavaScriptExecutor.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/JavaScriptExecutor.java deleted file mode 100644 index 60568e0110e48dbc3a53fd54b6e7161a119de91a..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/JavaScriptExecutor.java +++ /dev/null @@ -1,235 +0,0 @@ -package org.mineacademy.fo.model; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; - -import javax.script.ScriptContext; -import javax.script.ScriptEngine; -import javax.script.ScriptEngineFactory; -import javax.script.ScriptEngineManager; -import javax.script.ScriptException; - -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.collection.expiringmap.ExpiringMap; -import org.mineacademy.fo.exception.EventHandledException; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.Remain; - -import lombok.NonNull; - -/** - * An engine that compiles and executes code on the fly. - * <p> - * The code is based off JavaScript with new Java methods, see: - * https://winterbe.com/posts/2014/04/05/java8-nashorn-tutorial/ - */ -public final class JavaScriptExecutor { - - /** - * The engine singleton - */ - private static final ScriptEngine engine; - - /** - * Cache scripts for 1 second per player for highest performance - * <p> - * Player -> Map of scripts and their results - */ - private static final Map<UUID, Map<String, Object>> resultCache = ExpiringMap.builder().expiration(1, TimeUnit.SECONDS).build(); - - // Load the engine - static { - Thread.currentThread().setContextClassLoader(SimplePlugin.class.getClassLoader()); - - ScriptEngineManager engineManager = new ScriptEngineManager(); - ScriptEngine scriptEngine = engineManager.getEngineByName("Nashorn"); - - // Workaround for newer Minecraft releases, still unsure what the cause is - if (scriptEngine == null) { - engineManager = new ScriptEngineManager(null); - - scriptEngine = engineManager.getEngineByName("Nashorn"); - } - - // If still fails, try to load our own library for Java 15 and up - if (scriptEngine == null) { - final String nashorn = "org.openjdk.nashorn.api.scripting.NashornScriptEngineFactory"; - - if (ReflectionUtil.isClassAvailable(nashorn)) { - final ScriptEngineFactory engineFactory = ReflectionUtil.instantiate(ReflectionUtil.lookupClass(nashorn)); - - engineManager.registerEngineName("Nashorn", engineFactory); - scriptEngine = engineManager.getEngineByName("Nashorn"); - } - } - - engine = scriptEngine; - - if (engine == null) { - final List<String> warningMessage = Common.newList( - "ERROR: JavaScript placeholders will not function!", - "", - "Your Java version/distribution lacks the", - "Nashorn library for JavaScript placeholders."); - - if (Remain.getJavaVersion() >= 15) - warningMessage.addAll(Arrays.asList( - "", - "To fix this, install the NashornPlus", - "plugin from mineacademy.org/nashorn")); - else - warningMessage.addAll(Arrays.asList( - "", - "To fix this, install Java 11 from Oracle", - "or other vendor that supports Nashorn.")); - - Common.logFramed(false, Common.toArray(warningMessage)); - } - } - - /** - * Compiles and executes the given JavaScript code - * - * @param javascript - * @return - */ - public static Object run(final String javascript) { - return run(javascript, null, null); - } - - /** - * Runs the given JavaScript code for the player, - * making the "player" variable in the code usable - * - * @param javascript - * @param sender - * @return - */ - public static Object run(final String javascript, final CommandSender sender) { - return run(javascript, sender, null); - } - - /** - * Compiles and executes the Javascript code for the player ("player" variable is put into the JS code) - * as well as the bukkit event (use "event" variable there) - * - * @param javascript - * @param sender - * @param event - * @return - */ - public static Object run(@NonNull String javascript, final CommandSender sender, final Event event) { - - // Cache for highest performance - Map<String, Object> cached = sender instanceof Player ? resultCache.get(((Player) sender).getUniqueId()) : null; - - if (cached != null) { - final Object result = cached.get(javascript); - - if (result != null) - return result; - } - - if (engine == null) { - Common.warning("Not running script" + (sender == null ? "" : " for " + sender.getName()) + " because JavaScript library is missing " - + "(install Oracle Java 8, 11 or 16 and download mineacademy.org/nashorn): " + javascript); - - return null; - } - - try { - engine.getBindings(ScriptContext.ENGINE_SCOPE).clear(); - - if (sender != null) - engine.put("player", sender); - - if (event != null) - engine.put("event", event); - - if (sender instanceof DiscordSender) { - final Matcher matcher = Variables.BRACKET_PLACEHOLDER_PATTERN.matcher(javascript); - - while (matcher.find()) { - - // We do not support variables when the message sender is Discord, - // so just replace those that were not translated earlier with false value. - javascript = javascript.replace(matcher.group(), "false"); - } - } - - final Object result = engine.eval(javascript); - - if (sender instanceof Player) { - if (cached == null) - cached = new HashMap<>(); - - cached.put(javascript, result); - resultCache.put(((Player) sender).getUniqueId(), cached); - } - - return result; - - } catch (final Throwable ex) { - final String message = ex.toString(); - String error = "Script execution failed for"; - - if (message.contains("ReferenceError:") && message.contains("is not defined")) - error = "Found invalid or unparsed variable in"; - - // Special support for throwing exceptions in the JS code so that users - // can send messages to player directly if upstream supports that - final String cause = ex.getCause().toString(); - - if (ex.getCause() != null && cause.contains("event handled")) { - final String[] errorMessageSplit = cause.contains("event handled: ") ? cause.split("event handled\\: ") : new String[0]; - - if (errorMessageSplit.length == 2) - Common.tellNoPrefix(sender, errorMessageSplit[1]); - - throw new EventHandledException(true); - } - - throw new RuntimeException(error + " '" + javascript + "'", ex); - } - } - - /** - * Executes the Javascript code with the given variables - you have to handle the error yourself - * - * @param javascript - * @param replacements - * - * @return - */ - public static Object run(final String javascript, final Map<String, Object> replacements) { - - if (engine == null) { - Common.warning("Not running script because JavaScript library is missing " - + "(install Oracle Java 8, 11 or 16 and download mineacademy.org/nashorn): " + javascript); - - return javascript; - } - - try { - engine.getBindings(ScriptContext.ENGINE_SCOPE).clear(); - - if (replacements != null) - for (final Map.Entry<String, Object> replacement : replacements.entrySet()) - engine.put(replacement.getKey(), replacement.getValue()); - - return engine.eval(javascript); - - } catch (final ScriptException ex) { - throw new RuntimeException("Script execution failed for '" + javascript + "'", ex); - } - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/LimitedQueue.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/LimitedQueue.java deleted file mode 100644 index 8d362ec2c2e2b162c0b37ef2a92199d5452db3f9..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/LimitedQueue.java +++ /dev/null @@ -1,68 +0,0 @@ -package org.mineacademy.fo.model; - -import java.util.ArrayDeque; -import java.util.Collection; -import java.util.Queue; - -import com.google.common.collect.ForwardingQueue; - -/** - * Represents a simple limited queue only storing a handful of entries in - * - * @param <E> - */ -public final class LimitedQueue<E> extends ForwardingQueue<E> { - - /** - * The delegate queue - */ - private final Queue<E> delegate; - - /** - * The maximum queue size - */ - private final int capacity; - - /** - * Create a new limited queue with the given capacity - * - * @param capacity - */ - public LimitedQueue(final int capacity) { - this.delegate = new ArrayDeque<>(capacity); - this.capacity = capacity; - } - - @Override - protected Queue<E> delegate() { - return delegate; - } - - /** - * See {@link Queue#add(Object)} however if the queue is full, we call {@link Queue#poll()} first before adding - */ - @Override - public boolean add(final E element) { - if (size() >= capacity) - delegate.poll(); - - return delegate.add(element); - } - - /** - * See {@link Queue#addAll(Collection)} - */ - @Override - public boolean addAll(final Collection<? extends E> collection) { - return standardAddAll(collection); - } - - /** - * See {@link Queue#offer(Object)} - */ - @Override - public boolean offer(final E o) { - return standardOffer(o); - } - -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/OfflineRegionScanner.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/OfflineRegionScanner.java deleted file mode 100644 index c3c20b8dc7ac65ce65fb1bc9c65345da40db91da..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/OfflineRegionScanner.java +++ /dev/null @@ -1,414 +0,0 @@ -package org.mineacademy.fo.model; - -import java.io.File; -import java.io.FilenameFilter; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.Queue; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.bukkit.Bukkit; -import org.bukkit.Chunk; -import org.bukkit.World; -import org.bukkit.scheduler.BukkitRunnable; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.ReflectionUtil.ReflectionException; -import org.mineacademy.fo.event.RegionScanCompleteEvent; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.Remain; - -import lombok.Getter; -import lombok.Setter; - -/** - * A class that has ability to scan saved regions on the disk and execute - * actions for each saved chunk. - */ -public abstract class OfflineRegionScanner { - - /** - * Folders that will be scanned - */ - private static final String[] FOLDERS = { "region", "DIM-1/region", "DIM1/region" }; - - /** - * A valid file pattern - */ - private static final Pattern FILE_PATTERN = Pattern.compile("r\\.(.+)\\.(.+)\\.mca"); - - /** - * Seconds between each file processing operation. - */ - private static int WAIT_TIME_BETWEEN_SCAN_SECONDS = 1; - - /** - * Changing flag: How many files processed out of total? - */ - private int processedFilesCount = 0; - - /** - * Changing flag: The total amount of region files to scan - */ - private int totalFilesCount = 0; - - /** - * Changing flag: The world we are scanning - */ - @Getter - private World world; - - /** - * Changing flag: The Spigot/Paper watch dog we need to temporarily suspend - */ - private Thread watchdog; - - /** - * Changing flag: Last time an operation was done successfully - */ - private long lastTick = System.currentTimeMillis(); - - /** - * In fast mode we wont load chunks only return their x-z coordinates - * - * false = we call {@link #onChunkScan(Chunk)} - * true = we call {@link #onChunkScanFast(int, int)} - */ - @Setter - private boolean fastMode = false; - - /** - * Starts the scan for the given world (warning: this operation is blocking - * and takes long time, see {@link #getEstimatedWaitTimeSec(World)}) - * - * @param world - */ - public final void scan(World world) { - final boolean hadAutoSave = world.isAutoSave(); - - try { - world.setAutoSave(false); - scan0(world); - - } finally { - world.setAutoSave(hadAutoSave); - } - } - - /* - * Invoke the main scan of all chunks within this world on the disk, both loaded and unloaded - */ - private void scan0(World world) { - - Common.log( - Common.consoleLine(), - "Scanning regions in " + world.getName(), - Common.consoleLine()); - - // Disable watch dog - disableWatchdog(); - - // Collect files - final File[] files = getRegionFiles(world); - - if (files == null || files.length == 0) { - Common.warning("Unable to locate the region files for: " + world.getName()); - - return; - } - - final Queue<File> queue = new LimitedQueue<>(files.length + 1); - queue.addAll(Arrays.asList(files)); - - this.totalFilesCount = files.length; - this.world = world; - - // Start the schedule - schedule0(queue); - } - - /* - * Disable to prevent lag warnings since we scan chunks on the main thread - */ - private void disableWatchdog() { - Thread watchdog = null; - - try { - final Field instanceField = Class.forName("org.spigotmc.WatchdogThread").getDeclaredField("instance"); - - try { - instanceField.setAccessible(true); - - watchdog = (Thread) instanceField.get(null); - watchdog.suspend(); - - this.watchdog = watchdog; - - } catch (final Throwable t) { - Common.log("ERROR: FAILED TO DISABLE WATCHDOG, ABORTING! See below and report to us. NO DATA WERE MANIPULATED."); - Common.callEvent(new RegionScanCompleteEvent(world)); - - t.printStackTrace(); - this.finishScan(); - - return; - } - - } catch (final ReflectiveOperationException err) { - // pass through, probably not using Paper - } - } - - /* - * Self-repeating cycle of loading chunks from the disk until - * we reach the end of the queue - */ - private void schedule0(Queue<File> queue) { - new BukkitRunnable() { - - @Override - public void run() { - final File file = queue.poll(); - - // Queue finished - if (file == null) { - Common.log( - Common.consoleLine(), - "Region scanner finished. World saved.", - Common.consoleLine()); - - Common.callEvent(new RegionScanCompleteEvent(world)); - - finishScan(); - cancel(); - - return; - } - - scanFile(file, queue); - } - }.runTask(SimplePlugin.getInstance()); - } - - /* - * Scans the given region file - */ - private void scanFile(File file, Queue<File> queue) { - final Matcher matcher = FILE_PATTERN.matcher(file.getName()); - - if (!matcher.matches()) - return; - - final int regionX = Integer.parseInt(matcher.group(1)); - final int regionZ = Integer.parseInt(matcher.group(2)); - - System.out.print("[" + Math.round((double) processedFilesCount++ / (double) totalFilesCount * 100) + "%] Processing " + file); - - // Calculate time, collect memory and increase pauses in between if running out of memory - if (System.currentTimeMillis() - lastTick > 4000) { - final long free = Runtime.getRuntime().freeMemory() / 1_000_000; - - if (free < 200) { - System.out.print(" [Low memory (" + free + "Mb)! Running GC and increasing delay between operations ..]"); - - WAIT_TIME_BETWEEN_SCAN_SECONDS = +2; - - System.gc(); - Common.sleep(5_000); - } else - System.out.print(" [free memory = " + free + " mb]"); - - lastTick = System.currentTimeMillis(); - } - - System.out.println(); - - // Load the file - final Object region = RegionAccessor.getRegionFile(this.world.getName(), file); - - // Load each chunk within that file - for (int x = 0; x < 32; x++) - for (int z = 0; z < 32; z++) { - final int chunkX = x + (regionX << 5); - final int chunkZ = z + (regionZ << 5); - - if (RegionAccessor.isChunkSaved(region, x, z)) { - if (this.fastMode) - this.onChunkScanFast(chunkX, chunkZ); - - else { - final Chunk chunk = world.getChunkAt(chunkX, chunkZ); - - onChunkScan(chunk); - } - } - } - - // Save - try { - RegionAccessor.save(region); - - } catch (final Throwable t) { - Common.log("Failed to save region " + file + ", operation stopped."); - Remain.sneaky(t); - } - - if (this.fastMode) - this.schedule0(queue); - - else - Common.runLater(WAIT_TIME_BETWEEN_SCAN_SECONDS, () -> schedule0(queue)); - - } - - /** - * Called when a chunk is being scanned and loaded - * ONLY CALLED WHEN FASTMODE IS NOT ENABLED (by default) - * ELSE WE CALL THE {@link #onChunkScanFast(int, int)} method you need to override - * - * @param chunk - */ - protected abstract void onChunkScan(Chunk chunk); - - /** - * Called when a chunk is being scanned and loaded - * ONLY CALLED WHEN FASTMODE IS ENABLED - * - * @param chunkX - * @param chunkZ - */ - protected void onChunkScanFast(int chunkX, int chunkZ) { - } - - /* - * Called upon this scan being completed - */ - private void finishScan() { - - if (watchdog != null) - watchdog.resume(); - - this.onScanFinished(); - } - - /** - * Called when the scan is finished, after {@link RegionScanCompleteEvent} - */ - protected void onScanFinished() { - } - - // ------------------------------------------------------------------------------------------------------------ - // Static - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return all region files stored on the disk for the given world - * - * @param world - * @return - */ - public static File[] getRegionFiles(World world) { - final File regionDir = getRegionDirectory(world); - - return regionDir == null ? null : regionDir.listFiles((FilenameFilter) (dir, name) -> name.toLowerCase().endsWith(".mca")); - } - - /** - * Return the region directory for the given world - * - * @param world - * @return - */ - private static final File getRegionDirectory(World world) { - for (final String folder : FOLDERS) { - final File file = new File(world.getWorldFolder(), folder); - - if (file.isDirectory()) - return file; - } - - return null; - } - - /** - * Get how long scanning should take for the given world - * depending on its amount of region files - * - * @param world - * @return - */ - public static int getEstimatedWaitTimeSec(World world) { - final File[] files = getRegionFiles(world); - - return (WAIT_TIME_BETWEEN_SCAN_SECONDS + 2) * files.length; - } -} - -/** - * Reflection helper class for accessing region files - */ -class RegionAccessor { - - private static Constructor<?> regionFileConstructor; - private static Method isChunkSaved; - - private static final boolean atleast1_13, atleast1_14, atleast1_15, atleast1_16; - private static final String saveMethodName; - - static { - atleast1_13 = MinecraftVersion.atLeast(V.v1_13); - atleast1_14 = MinecraftVersion.atLeast(V.v1_14); - atleast1_15 = MinecraftVersion.atLeast(V.v1_15); - atleast1_16 = MinecraftVersion.atLeast(V.v1_16); - - saveMethodName = atleast1_13 ? "close" : "c"; - - try { - final Class<?> regionFileClass = ReflectionUtil.getNMSClass("RegionFile", "net.minecraft.world.level.chunk.storage.RegionFile"); - regionFileConstructor = atleast1_16 ? regionFileClass.getConstructor(File.class, File.class, boolean.class) : atleast1_15 ? regionFileClass.getConstructor(File.class, File.class) : regionFileClass.getConstructor(File.class); - isChunkSaved = atleast1_14 ? regionFileClass.getMethod("b", ReflectionUtil.getNMSClass("ChunkCoordIntPair", "net.minecraft.world.level.ChunkCoordIntPair")) : regionFileClass.getMethod(atleast1_13 ? "b" : "c", int.class, int.class); - - } catch (final ReflectiveOperationException ex) { - Remain.sneaky(ex); - } - } - - static Object getRegionFile(String worldName, File file) { - try { - final File container = new File(Bukkit.getWorldContainer(), worldName); - - return atleast1_16 ? regionFileConstructor.newInstance(file, container, true) : atleast1_15 ? regionFileConstructor.newInstance(file, container) : regionFileConstructor.newInstance(file); - } catch (final Throwable ex) { - throw new RuntimeException("Could not create region file from " + file, ex); - } - } - - static boolean isChunkSaved(Object region, int x, int z) { - try { - if (MinecraftVersion.newerThan(V.v1_13)) { - final Object chunkCoordinates = ReflectionUtil.getNMSClass("ChunkCoordIntPair", "net.minecraft.world.level.ChunkCoordIntPair").getConstructor(int.class, int.class).newInstance(x, z); - - return (boolean) isChunkSaved.invoke(region, chunkCoordinates); - } - - return (boolean) isChunkSaved.invoke(region, x, z); - - } catch (final ReflectiveOperationException ex) { - throw new ReflectionException(ex, "Could not find if region file " + region + " has chunk at " + x + " " + z); - } - } - - static void save(Object region) { - try { - region.getClass().getDeclaredMethod(saveMethodName).invoke(region); - - } catch (final ReflectiveOperationException ex) { - throw new ReflectionException(ex, "Error saving region " + region); - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/RandomNoRepeatPicker.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/RandomNoRepeatPicker.java deleted file mode 100644 index 5bdda3455269764b916b0261ed136393236a6a83..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/RandomNoRepeatPicker.java +++ /dev/null @@ -1,143 +0,0 @@ -package org.mineacademy.fo.model; - -import java.util.ArrayList; -import java.util.List; -import java.util.function.BiFunction; - -import org.bukkit.entity.Player; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.RandomUtil; -import org.mineacademy.fo.Valid; - -/** - * A pretty specific class for picking up items for the player randomly, - * used when giving a random class to the player in arena plugins - * where each picked class is checked against players permission - * - * @param <T> - */ -public abstract class RandomNoRepeatPicker<T> { - - /** - * The list holding all items - */ - private final List<T> list = new ArrayList<>(); - - /** - * The the items we want to pick from - * - * @param list - */ - public void setItems(final Iterable<T> list) { - Valid.checkBoolean(list != null && list.iterator().hasNext(), "Cannot set items to an empty list!"); - - this.list.clear(); - this.list.addAll(Common.toList(list)); - } - - /** - * Return if there are no more items to pick from - * - * @return - */ - public boolean isEmpty() { - return list.isEmpty(); - } - - /** - * Randomly picks 1 item from the given list - * NB: This also loads up the list - * - * @param items - * @return - */ - public T pickFrom(final Iterable<T> items) { - return pickFromFor(items, null); - } - - /** - * Randomly picks 1 item for the player using {@link #canObtain(Player, Object)} method - * NB: This also loads up the list - * - * @param items - * @param player - * @return - */ - public T pickFromFor(final Iterable<T> items, final Player player) { - for (final T item : items) - list.add(item); - - return pickRandom(player); - } - - /** - * Picks and removes 1 item randomly from the list until we - * run out of items - * - * @return - */ - public T pickRandom() { - return pickRandom(null); - } - - /** - * Picks randomly 1 item and evaluates it against {@link #canObtain(Player, Object)} - * until we run out of items or find 1 that the player can acquire - * - * @param player - * @return - */ - public T pickRandom(final Player player) { - if (list.isEmpty()) - return null; - - while (!list.isEmpty()) { - final T picked = list.remove(RandomUtil.nextInt(list.size())); - - if (picked != null && canObtain(player, picked)) - return picked; - } - - return null; - } - - /** - * Should return true if the player can obtain the given item - * - * @param player - * @param picked - * @return - */ - protected abstract boolean canObtain(Player player, T picked); - - /** - * Creates a new random no repeat picker of the given class type - * All players may always obtain it - * - * @param <T> - * @param pickedType - * @return - */ - public static final <T> RandomNoRepeatPicker<T> newPicker(final Class<T> pickedType) { - return newPicker((player, type) -> true); - } - - /** - * Creates a new random no repeat picker with function - * to check if the player can obtain the class - * - * @param <T> - * @param pickedType - * @param canObtain - * @return - */ - public static final <T> RandomNoRepeatPicker<T> newPicker(final BiFunction<Player, T, Boolean> canObtain) { - return new RandomNoRepeatPicker<T>() { - - @Override - protected boolean canObtain(final Player player, final T picked) { - return canObtain.apply(player, picked); - } - }; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/RangedRandomValue.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/RangedRandomValue.java deleted file mode 100644 index f5794c51f97f48525dd4a35d0191f58d6531d103..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/RangedRandomValue.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.mineacademy.fo.model; - -import org.mineacademy.fo.RandomUtil; -import org.mineacademy.fo.Valid; - -/** - * Represents a numerical value in range. - */ -public final class RangedRandomValue extends RangedValue { - - /** - * Make a new ranged value with a fixed range - * - * @param value the fixed range - */ - public RangedRandomValue(final int value) { - this(value, value); - } - - /** - * Make a new ranged value between two numbers.- - * - * @param min the ceiling - * @param max the floor - */ - public RangedRandomValue(final int min, final int max) { - super(min, max); - - Valid.checkBoolean(min >= 0 && max >= 0, "Values may not be negative"); - Valid.checkBoolean(min <= max, "Minimum must be lower or equal maximum"); - } - - /** - * Create a {@link RangedValue} from a line - * Example: 1-10 - * 5 - 60 - * 4 - */ - public static RangedRandomValue parse(final String line) { - final RangedValue random = RangedValue.parse(line); - - return new RangedRandomValue(random.getMinInt(), random.getMaxInt()); - } - - /** - * Get a value in range between {@link #min} and {@link #max} - * - * @return a random value - */ - public int getRandom() { - return RandomUtil.nextBetween(getMinInt(), getMaxInt()); - } - - /** - * Check if a value is between {@link #min} and {@link #max} - * - * @param value the value - * @return whether or not the value is in range - */ - public boolean isInRange(final int value) { - return value >= getMinInt() && value <= getMaxInt(); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/RangedValue.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/RangedValue.java deleted file mode 100644 index abf39fc66668aac4ace75a0da9b0e910abe0262a..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/RangedValue.java +++ /dev/null @@ -1,134 +0,0 @@ -package org.mineacademy.fo.model; - -import org.apache.commons.lang.math.NumberUtils; -import org.mineacademy.fo.TimeUtil; -import org.mineacademy.fo.Valid; - -import lombok.Getter; - -/** - * A class holding a minimum and a maximum - */ -@Getter -public class RangedValue { - - /** - * The minimum - */ - private final Number min; - - /** - * The maximum - */ - private final Number max; - - /** - * Create a new static value. - * - * @param value the value - */ - public RangedValue(Number value) { - this(value, value); - } - - /** - * Create a new ranged value. - * - * @param min the minimum value - * @param max the maximum value - */ - public RangedValue(Number min, Number max) { - Valid.checkBoolean(min.longValue() >= 0 && max.longValue() >= 0, "Values may not be negative"); - Valid.checkBoolean(min.longValue() <= max.longValue(), "Minimum must be lower or equal maximum"); - - this.min = min; - this.max = max; - } - - /** - * Get the minimum as an integer - */ - public final int getMinInt() { - return min.intValue(); - } - - /** - * Get the maximum as an integer - */ - public final int getMaxInt() { - return max.intValue(); - } - - /** - * Get the minimum as an long - */ - public final long getMinLong() { - return min.longValue(); - } - - /** - * Get the maximum as an long - */ - public final long getMaxLong() { - return max.longValue(); - } - - /** - * Get if the number is within {@link #getMin()} and {@link #getMax()} - * - * @param value the number to compare - * @return if the number is within {@link #getMin()} and {@link #getMax()} - */ - public boolean isWithin(Number value) { - return value.longValue() >= min.longValue() && value.longValue() <= max.longValue(); - } - - /** - * Return whether {@link #min} equals {@link #max} - * - * @return - */ - public final boolean isStatic() { - return min == max; - } - - /** - * Return a saveable representation (assuming saving in ticks) of this value - * - * @return - */ - public final String toLine() { - return min + " - " + max; - } - - /** - * Create a {@link RangedValue} from a line - * Example: 1-10 - * 5 - 60 - * 4 - * <p> - * or - * <p> - * 10 seconds - 20 minutes (will be converted to seconds) - */ - public static RangedValue parse(String line) { - line = line.replace(" ", ""); - - final String[] parts = line.split("\\-"); - Valid.checkBoolean(parts.length == 1 || parts.length == 2, "Malformed value " + line); - - final String first = parts[0]; - final Integer min = NumberUtils.isNumber(first) ? Integer.parseInt(first) : (int) (TimeUtil.toTicks(first) / 20); - - final String second = parts.length == 2 ? parts[1] : ""; - final Integer max = parts.length == 2 ? NumberUtils.isNumber(second) ? Integer.parseInt(second) : (int) (TimeUtil.toTicks(second) / 20) : min; - Valid.checkBoolean(min != null && max != null, "Malformed value " + line); - - return new RangedValue(min, max); - } - - @Override - public final String toString() { - return isStatic() ? min + "" : min + " - " + max; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Replacer.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Replacer.java deleted file mode 100644 index 7a29720695e8421774912d1a068705e2b7e48351..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Replacer.java +++ /dev/null @@ -1,303 +0,0 @@ -package org.mineacademy.fo.model; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.regex.Matcher; - -import org.apache.commons.lang.StringUtils; -import org.bukkit.command.CommandSender; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.SerializeUtil; -import org.mineacademy.fo.SerializeUtil.SerializeFailedException; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -/** - * An elegant way to find {variables} and replace them. - * <p> - * Use {@link #find(String...)} method to find {} variables such as find("health") and then - * replace them with {@link #replace(Object...)} with the objects such as replace(20) - * <p> - * Something like {@link String#format(String, Object...)} but more useful for Minecraft - */ -@AllArgsConstructor -public final class Replacer { - - /** - * The internal deliminer used to separate variables - */ - private final static String DELIMITER = "%D3L1M1T3R%"; - - /** - * The messages we are replacing variables in - */ - private final String[] messages; - - // ------------------------------------------------------------------------------------------------------------ - // Temporary variables - // ------------------------------------------------------------------------------------------------------------ - - /** - * The variables we are looking for to replace - */ - private String[] variables; - - /** - * The finished replaced message - */ - @Getter - private String[] replacedMessage; - - /** - * Create a new instance for the given messages - * - * @param messages - */ - private Replacer(String... messages) { - this.messages = messages; - } - - /** - * Find the {} variables - * - * @param variables - * @return - * - * @deprecated use {@link Replacer#replaceArray(String, Object...)} for simplicity - */ - @Deprecated - public Replacer find(String... variables) { - this.variables = variables; - - return this; - } - - /** - * Attempts to replace key:value pairs automatically - * <p> - * See {@link SerializedMap#ofArray(Object...)} - * - * @deprecated use {@link Replacer#replaceArray(String, Object...)} for simplicity - * - * @param associativeArray - * @return - */ - @Deprecated - public String replaceAll(Object... associativeArray) { - final SerializedMap map = SerializedMap.ofArray(associativeArray); - - final List<String> find = new ArrayList<>(); - final List<Object> replaced = new ArrayList<>(); - - for (final Map.Entry<String, Object> entry : map.entrySet()) { - find.add(entry.getKey()); - replaced.add(entry.getValue()); - } - - find(find.toArray(new String[find.size()])); - replace(replaced.toArray(new Object[replaced.size()])); - - return getReplacedMessageJoined(); - } - - /** - * Replaces stored variables with their counterparts - * <p> - * Call this after {@link #find(String...)}! - * - * @deprecated use {@link Replacer#replaceArray(String, Object...)} for simplicity - * - * @param replacements - * @return - */ - @Deprecated - public Replacer replace(Object... replacements) { - Valid.checkNotNull(variables, "call find() first"); - Valid.checkBoolean(replacements.length == variables.length, "Variables " + variables.length + " != replacements " + replacements.length); - - // Join and replace as 1 message for maximum performance - String message = StringUtils.join(messages, DELIMITER); - - for (int i = 0; i < variables.length; i++) { - String find = variables[i]; - - { // Auto insert brackets - if (!find.startsWith("{")) - find = "{" + find; - - if (!find.endsWith("}")) - find = find + "}"; - } - - final Object rep = i < replacements.length ? replacements[i] : null; - - // Convert it into a human readable string - String serialized; - - try { - serialized = Objects.toString(SerializeUtil.serialize(rep)); - - } catch (final SerializeFailedException ex) { - // ignore and convert to string - serialized = rep.toString(); - } - - message = message.replace(find, rep != null ? serialized : ""); - } - - this.replacedMessage = message.split(DELIMITER); - - return this; - } - - /** - * Sends the finished message with variables replaced to the player - * - * @deprecated use {@link Replacer#replaceArray(String, Object...)} for simplicity - * - * @param recipient - */ - @Deprecated - public void tell(CommandSender recipient) { - Valid.checkNotNull(replacedMessage, "Replaced message not yet set, use find() and replace()"); - - Common.tell(recipient, replacedMessage); - } - - /** - * Return the replaced message joined with spaces - * - * @deprecated use {@link Replacer#replaceArray(String, Object...)} for simplicity - * - * @return - */ - @Deprecated - public String getReplacedMessageJoined() { - Valid.checkNotNull(replacedMessage, "Replaced message not yet set, use find() and replace()"); - - return StringUtils.join(replacedMessage, " "); - } - - // ------------------------------------------------------------------------------------------------------------ - // Static access - // ------------------------------------------------------------------------------------------------------------ - - /** - * Create a new replacer instance in which you can easily find and replace variables and send the message to player - * - * @deprecated use {@link Replacer#replaceArray(String, Object...)} for simplicity - * - * @param messages - * @return - */ - @Deprecated - public static Replacer of(String... messages) { - return new Replacer(messages); - } - - /** - * Replace all variables in the {@link SerializedMap#ofArray(Object...)} format - * adding {} to them if they do not contain it already - * - * @param list - * @param replacements - * @return - */ - public static List<String> replaceArray(List<String> list, Object... replacements) { - String joined = String.join("%FLPV%", list); - joined = replaceArray(joined, replacements); - - return java.util.Arrays.asList(joined.split("%FLPV%")); - } - - /** - * Replace all variables in the {@link SerializedMap#ofArray(Object...)} format - * adding {} to them if they do not contain it already - * - * @param message - * @param associativeArray - * @return - */ - public static String replaceArray(String message, Object... replacements) { - final SerializedMap map = SerializedMap.ofArray(replacements); - - return replaceVariables(message, map); - } - - /** - * Replace all variables in the {@link SerializedMap#ofArray(Object...)} format - * adding {} to them if they do not contain it already - * - * @param list - * @param replacements - * @return - */ - public static List<String> replaceVariables(List<String> list, SerializedMap replacements) { - String joined = String.join("%FLPV%", list); - joined = replaceVariables(joined, replacements); - - return java.util.Arrays.asList(joined.split("%FLPV%")); - } - - /** - * Replace key pairs in the message - * - * @param message - * @param variables - * @return - */ - public static String replaceVariables(String message, SerializedMap variables) { - if (message == null) - return null; - - if ("".equals(message)) - return ""; - - final Matcher matcher = Variables.BRACKET_PLACEHOLDER_PATTERN.matcher(message); - - while (matcher.find()) { - String variable = matcher.group(1); - - boolean frontSpace = false; - boolean backSpace = false; - - if (variable.startsWith("+")) { - variable = variable.substring(1); - - frontSpace = true; - } - - if (variable.endsWith("+")) { - variable = variable.substring(0, variable.length() - 1); - - backSpace = true; - } - - String value = null; - - for (final Map.Entry<String, Object> entry : variables.entrySet()) { - String variableKey = entry.getKey(); - - variableKey = variableKey.startsWith("{") ? variableKey.substring(1) : variableKey; - variableKey = variableKey.endsWith("}") ? variableKey.substring(0, variableKey.length() - 1) : variableKey; - - if (variableKey.equals(variable)) - value = entry.getValue() == null ? "null" : entry.getValue().toString(); - } - - if (value != null) { - final boolean emptyColorless = Common.stripColors(value).isEmpty(); - value = value.isEmpty() ? "" : (frontSpace && !emptyColorless ? " " : "") + Common.colorize(value) + (backSpace && !emptyColorless ? " " : ""); - - message = message.replace(matcher.group(), value); - } - } - - return message; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Rule.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Rule.java deleted file mode 100644 index db60ab624154e495d397db156832fc904261ec46..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Rule.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.mineacademy.fo.model; - -import java.io.File; - -import org.mineacademy.fo.Common; - -public interface Rule { - - /** - * Return the uniquely identifying expression that identifies this rule - * - * @return - */ - String getUid(); - - /** - * Return the file this rule residues in - * - * @return - */ - File getFile(); - - /** - * Attempts to parse the given line from {@link RuleSetReader} containing an operator such as - * "then warn Do not spam please." etc. for the given rule that is being created: - * then the args are "then" "warn" "Do" "not" "spam" "please." - * - * You can use {@link Common#joinRange(int, String[])} to join the message together. - * - * @param rule - * @param args - * - * @return true if the operator was parsed successfully - */ - boolean onOperatorParse(String[] args); -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/RuleSetReader.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/RuleSetReader.java deleted file mode 100644 index b2eb67daba25d3470674f3374f7c93056cd087b4..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/RuleSetReader.java +++ /dev/null @@ -1,214 +0,0 @@ -package org.mineacademy.fo.model; - -import java.io.File; -import java.nio.file.StandardOpenOption; -import java.util.ArrayList; -import java.util.List; - -import org.mineacademy.fo.Common; -import org.mineacademy.fo.FileUtil; -import org.mineacademy.fo.Valid; - -/** - * An engine that reads rule set from a file such as in ChatControl. - */ -public abstract class RuleSetReader<T extends Rule> { - - /** - * The matching keyword for creating new rules - * such as "match" in "match bitch" operator in ChatControl - */ - private final String newKeyword; - - /** - * Create a new rule set reader for the matching keyword - * that will dictate new rule creation - * - * @param newKeyword - */ - public RuleSetReader(String newKeyword) { - this.newKeyword = newKeyword; - } - - /** - * Load all items in this ruleset - */ - public abstract void load(); - - // ------–------–------–------–------–------–------–------–------–------–------–------– - // Classes - // ------–------–------–------–------–------–------–------–------–------–------–------– - - /** - * Toggle the given rule on/off - * - * @param rule - * @param disabled - */ - public final void toggleMessage(Rule rule, boolean disabled) { - - final File file = rule.getFile(); - Valid.checkBoolean(file.exists(), "No such file: " + file + " Rule: " + rule); - - final List<String> lines = FileUtil.readLines(file); - boolean found = false; - - for (int i = 0; i < lines.size(); i++) { - final String line = lines.get(i); - - // Found our rule - if (line.equals(this.newKeyword + " " + rule.getUid())) - found = true; - - // Found something else - else if (line.startsWith("#") || line.isEmpty() || line.startsWith("match ")) { - if (found && i > 0 && disabled) { - lines.add(i, "disabled"); - - break; - } - } - - // Found the disabled operator - else if (line.equals("disabled")) { - if (found && !disabled) { - lines.remove(i); - - break; - } - } - } - - Valid.checkBoolean(found, "Failed to disable rule " + rule); - saveAndLoad(file, lines); - } - - /** - * Save the given file with the given lines and reloads - * - * @param rule - * @param lines - */ - protected final void saveAndLoad(File file, List<String> lines) { - FileUtil.write(file, lines, StandardOpenOption.TRUNCATE_EXISTING); - - load(); - } - - /** - * Load rules from the given file path in your plugin folder - * - * @param path - * @return - */ - protected final List<T> loadFromFile(String path) { - final File file = FileUtil.extract(path); - - return loadFromFile(file); - } - - /* - * Load rules from the given file - */ - private final List<T> loadFromFile(File file) { - final List<T> rules = new ArrayList<>(); - final List<String> lines = FileUtil.readLines(file); - - // The temporary rule being created - T rule = null; - String match = null; - - for (int i = 0; i < lines.size(); i++) { - final String line = lines.get(i).trim(); - - if (!line.isEmpty() && !line.startsWith("#")) { - - // If a line starts with matcher then assume a new rule is found and start creating it. This makes a new instance of the object. - if (line.startsWith(newKeyword + " ")) { - - // Found another match, assuming previous rule is finished creating. - if (rule != null) { - //Valid.checkBoolean(!rules.contains(rule), "Duplicate rule found in: " + file + "! Duplicated rule: " + rule); - - if (canFinish(rule)) - rules.add(rule); - } - - try { - match = line.replace(newKeyword + " ", ""); - rule = createRule(file, match); - - } catch (final Throwable t) { - Common.throwError(t, - "Error creating rule from line (" + (i + 1) + "): " + line, - "File: " + file, - "Error: %error", - "Processing aborted."); - - return rules; - } - } - - // If something is being created then attempt to parse operators. - else { - if (!onNoMatchLineParse(file, line)) - Valid.checkNotNull(match, "Cannot define operator when no rule is being created! File: '" + file + "' Line (" + (i + 1) + "): '" + line + "'"); - - if (rule != null) - try { - rule.onOperatorParse(line.split(" ")); - - } catch (final Throwable t) { - Common.throwError(t, - "Error parsing rule operator from line (" + (i + 1) + "): " + line, - "File: " + file, - "Error: %error"); - } - } - } - - // Reached end of the file and a rule is still being created, finish it. - if (i + 1 == lines.size() && rule != null && canFinish(rule)) - rules.add(rule); - } - - return rules; - } - - /** - * Called if there is no match {@link #newKeyword} but something is on the line - * enabling you to inject your own custom operators and settings - * - * Return true if you processed the line, false if we should throw an error - * - * @param file the current file - * @param line - * @return - */ - protected boolean onNoMatchLineParse(File file, String line) { - return false; - } - - /** - * Return true if we can finish creating the given rule - * - * @param rule - * @return - */ - protected boolean canFinish(T rule) { - return true; - } - - /** - * Creates a new rule from the value of the {@link #newKeyword} - * where the new keyword is stripped from the value. - * - * Example: When the rule starts with "match one two", the value is only "one two" etc. - * - * @param file - * @param value - * - * @return the rule created, or null if the value is not valid - */ - protected abstract T createRule(File file, String value); -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleComponent.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleComponent.java deleted file mode 100644 index dd0f59be95d2bc5901aedf00c865353cb83b1bc3..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleComponent.java +++ /dev/null @@ -1,888 +0,0 @@ -package org.mineacademy.fo.model; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.regex.Pattern; - -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.ChatUtil; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.SerializeUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.Remain; - -import lombok.NonNull; -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.ClickEvent.Action; -import net.md_5.bungee.api.chat.HoverEvent; -import net.md_5.bungee.api.chat.TextComponent; - -/** - * A very simple way of sending interactive chat messages - */ -public final class SimpleComponent implements ConfigSerializable { - - /** - * Prevent oversized JSON from kicking players by removing interactive elements from it? - */ - public static boolean STRIP_OVERSIZED_COMPONENTS = true; - - /** - * The pattern to match URL addresses when parsing text - */ - private static final Pattern URL_PATTERN = Pattern.compile("^(?:(https?)://)?([-\\w_\\.]{2,}\\.[a-z]{2,4})(/\\S*)?$"); - - /** - * The past components - */ - private final List<Part> pastComponents = new ArrayList<>(); - - /** - * The current component being created - */ - - private Part currentComponent; - - /** - * Create a new interactive chat component - * - * @param text - */ - private SimpleComponent(String text) { - - // Inject the center element here already - if (Common.stripColors(text).startsWith("<center>")) - text = ChatUtil.center(text.replace("<center>", "").trim()); - - this.currentComponent = new Part(text); - } - - /** - * Private constructor used when deserializing - */ - private SimpleComponent() { - } - - // -------------------------------------------------------------------- - // Events - // -------------------------------------------------------------------- - - /** - * Add a show text ; event for the {@link #currentComponents} - * - * @param texts - * @return - */ - public SimpleComponent onHover(Collection<String> texts) { - return onHover(Common.toArray(texts)); - } - - /** - * Add a show text hover event for the {@link #currentComponents} - * - * @param lines - * @return - */ - public SimpleComponent onHover(String... lines) { - // I don't know why we have to wrap this inside new text component but we do this - // to properly reset bold and other decoration colors - final String joined = Common.colorize(String.join("\n", lines)); - this.currentComponent.hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_TEXT, new BaseComponent[] { new TextComponent(TextComponent.fromLegacyText(joined)) }); - - return this; - } - - /** - * Shows the item on hover if it is not air. - * <p> - * NB: Some colors from lore may get lost as a result of Minecraft/Spigot bug. - * - * @param item - * @return - */ - public SimpleComponent onHover(ItemStack item) { - if (CompMaterial.isAir(item.getType())) - return onHover("Air"); - - this.currentComponent.hoverEvent = new HoverEvent(HoverEvent.Action.SHOW_ITEM, new BaseComponent[] { new TextComponent(Remain.toJson(item)) }); - - return this; - } - - /** - * Set view permission for last component part - * - * @param viewPermission - * @return - */ - public SimpleComponent viewPermission(String viewPermission) { - this.currentComponent.viewPermission = viewPermission; - - return this; - } - - /** - * Set view permission for last component part - * - * @param viewCondition - * @return - */ - public SimpleComponent viewCondition(String viewCondition) { - this.currentComponent.viewCondition = viewCondition; - - return this; - } - - /** - * Add a run command event for the {@link #currentComponents} - * - * @param text - * @return - */ - public SimpleComponent onClickRunCmd(String text) { - return onClick(Action.RUN_COMMAND, text); - } - - /** - * Add a suggest command event for the {@link #currentComponents} - * - * @param text - * @return - */ - public SimpleComponent onClickSuggestCmd(String text) { - return onClick(Action.SUGGEST_COMMAND, text); - } - - /** - * Open the given URL for the {@link #currentComponents} - * - * @param url - * @return - */ - public SimpleComponent onClickOpenUrl(String url) { - return onClick(Action.OPEN_URL, url); - } - - /** - * Add a command event for the {@link #currentComponents} - * - * @param action - * @param text - * @return - */ - public SimpleComponent onClick(Action action, String text) { - this.currentComponent.clickEvent = new ClickEvent(action, text); - - return this; - } - - /** - * Invoke {@link TextComponent#setInsertion(String)} for {@link #currentComponents} - * - * @param insertion - * @return - */ - public SimpleComponent onClickInsert(String insertion) { - this.currentComponent.insertion = insertion; - - return this; - } - - // -------------------------------------------------------------------- - // Building - // -------------------------------------------------------------------- - - /** - * Append new component at the beginning of all components - * - * @param component - * @return - */ - public SimpleComponent appendFirst(SimpleComponent component) { - this.pastComponents.add(0, component.currentComponent); - this.pastComponents.addAll(0, component.pastComponents); - - return this; - } - - /** - * Append text to this simple component - * - * @param text - * @return - */ - public SimpleComponent append(String text) { - return this.append(text, true); - } - - /** - * Append text to this simple component - * - * @param text - * @param colorize - * @return - */ - public SimpleComponent append(String text, boolean colorize) { - return this.append(text, null, colorize); - } - - /** - * Create another component. The current is put in a list of past components - * so next time you use onClick or onHover, you will be added the event to the new one - * specified here - * - * @param text - * @param inheritFormatting - * @return - */ - public SimpleComponent append(String text, BaseComponent inheritFormatting) { - return this.append(text, inheritFormatting, true); - } - - /** - * Create another component. The current is put in a list of past components - * so next time you use onClick or onHover, you will be added the event to the new one - * specified here - * - * @param text - * @param colorize - * @return - */ - public SimpleComponent append(String text, BaseComponent inheritFormatting, boolean colorize) { - - // Get the last extra - BaseComponent inherit = inheritFormatting != null ? inheritFormatting : this.currentComponent.toTextComponent(null); - - if (inherit != null && inherit.getExtra() != null && !inherit.getExtra().isEmpty()) - inherit = inherit.getExtra().get(inherit.getExtra().size() - 1); - - // Center text for each line separatelly if replacing colors - if (colorize) { - final List<String> formatContents = Arrays.asList(text.split("\n")); - - for (int i = 0; i < formatContents.size(); i++) { - final String line = formatContents.get(i); - - if (Common.stripColors(line).startsWith("<center>")) - formatContents.set(i, ChatUtil.center(line.replace("<center>", ""))); - } - - text = String.join("\n", formatContents); - } - - this.pastComponents.add(this.currentComponent); - - this.currentComponent = new Part(colorize ? Common.colorize(text) : text); - this.currentComponent.inheritFormatting = inherit; - - return this; - } - - /** - * Append a new component on the end of this one - * - * @param component - * @return - */ - public SimpleComponent append(SimpleComponent component) { - this.pastComponents.add(this.currentComponent); - this.pastComponents.addAll(component.pastComponents); - - // Get the last extra - BaseComponent inherit = Common.getOrDefault(component.currentComponent.inheritFormatting, this.currentComponent.toTextComponent(null)); - - if (inherit != null && inherit.getExtra() != null && !inherit.getExtra().isEmpty()) - inherit = inherit.getExtra().get(inherit.getExtra().size() - 1); - - this.currentComponent = component.currentComponent; - this.currentComponent.inheritFormatting = inherit; - - return this; - } - - /** - * Return the plain colorized message combining all components into one - * without click/hover events - * - * @return - */ - public String getPlainMessage() { - return build(null).toLegacyText(); - } - - /** - * Builds the component and its past components into a {@link TextComponent} - * - * @return - */ - public TextComponent getTextComponent() { - return build(null); - } - - /** - * Builds the component and its past components into a {@link TextComponent} - * - * @param receiver - * @return - */ - public TextComponent build(CommandSender receiver) { - TextComponent preparedComponent = null; - - for (final Part part : this.pastComponents) { - final TextComponent component = part.toTextComponent(receiver); - - if (component != null) - if (preparedComponent == null) - preparedComponent = component; - else - preparedComponent.addExtra(component); - } - - final TextComponent currentComponent = this.currentComponent.toTextComponent(receiver); - - if (currentComponent != null) - if (preparedComponent == null) - preparedComponent = currentComponent; - else - preparedComponent.addExtra(currentComponent); - - return Common.getOrDefault(preparedComponent, new TextComponent("")); - } - - /** - * Quickly replaces an object in all parts of this component - * - * @param variable the factual variable - you must supply brackets - * @param value - * @return - */ - public SimpleComponent replace(String variable, Object value) { - final String serialized = SerializeUtil.serialize(value).toString(); - - for (final Part part : this.pastComponents) { - Valid.checkNotNull(part.text); - - part.text = part.text.replace(variable, serialized); - } - - Valid.checkNotNull(this.currentComponent.text); - this.currentComponent.text = this.currentComponent.text.replace(variable, serialized); - - return this; - } - - // -------------------------------------------------------------------- - // Sending - // -------------------------------------------------------------------- - - /** - * Attempts to send the complete {@link SimpleComponent} to the given - * command senders. If they are players, we send them interactive elements. - * <p> - * If they are console, they receive a plain text message. - * - * @param receiver - */ - public <T extends CommandSender> void send(T... receivers) { - this.send(Arrays.asList(receivers)); - } - - /** - * Attempts to send the complete {@link SimpleComponent} to the given - * command senders. If they are players, we send them interactive elements. - * <p> - * If they are console, they receive a plain text message. - * - * @param <T> - * @param receiver - */ - public <T extends CommandSender> void send(Iterable<T> receivers) { - this.sendAs(null, receivers); - } - - /** - * Attempts to send the complete {@link SimpleComponent} to the given - * command senders. If they are players, we send them interactive elements. - * <p> - * If they are console, they receive a plain text message. - * - * We will also replace relation placeholders if the sender is set and is player. - * - * @param <T> - * @param receiver - */ - public <T extends CommandSender> void sendAs(CommandSender sender, Iterable<T> receivers) { - for (final CommandSender receiver : receivers) { - final TextComponent component = build(receiver); - - if (receiver instanceof Player && sender instanceof Player) - setRelationPlaceholders(component, (Player) receiver, (Player) sender); - - // Prevent clients being kicked out, so we just send plain message instead - if (STRIP_OVERSIZED_COMPONENTS && Remain.toJson(component).length() + 1 >= Short.MAX_VALUE) { - final String legacy = Common.colorize(component.toLegacyText()); - - if (legacy.length() + 1 >= Short.MAX_VALUE) - Common.warning("JSON Message to " + receiver.getName() + " was too large and could not be sent: '" + legacy + "'"); - - else { - Common.warning("JSON Message to " + receiver.getName() + " was too large, removing interactive elements to avoid kick. Sending plain: '" + legacy + "'"); - - receiver.sendMessage(legacy); - } - - } else - Remain.sendComponent(receiver, component); - } - } - - /* - * Replace relationship placeholders in the full component and all of its extras - */ - private void setRelationPlaceholders(final TextComponent component, final Player receiver, final Player sender) { - - // Set the main text - component.setText(HookManager.replaceRelationPlaceholders(sender, receiver, component.getText())); - - if (component.getExtra() == null) - return; - - for (final BaseComponent extra : component.getExtra()) - if (extra instanceof TextComponent) { - - final TextComponent text = (TextComponent) extra; - final ClickEvent clickEvent = text.getClickEvent(); - final HoverEvent hoverEvent = text.getHoverEvent(); - - // Replace for the text itself - //text.setText(HookManager.replaceRelationPlaceholders(sender, receiver, text.getText())); - - // And for the click event - if (clickEvent != null) - text.setClickEvent(new ClickEvent(clickEvent.getAction(), HookManager.replaceRelationPlaceholders(sender, receiver, clickEvent.getValue()))); - - // And for the hover event - if (hoverEvent != null) - for (final BaseComponent hoverBaseComponent : hoverEvent.getValue()) - if (hoverBaseComponent instanceof TextComponent) { - final TextComponent hoverTextComponent = (TextComponent) hoverBaseComponent; - - hoverTextComponent.setText(HookManager.replaceRelationPlaceholders(sender, receiver, hoverTextComponent.getText())); - } - - // Then repeat for the extra parts in the text itself - setRelationPlaceholders(text, receiver, sender); - } - } - - /** - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return this.serialize().toStringFormatted(); - } - - // -------------------------------------------------------------------- - // Serialize - // -------------------------------------------------------------------- - - /** - * @see org.mineacademy.fo.model.ConfigSerializable#serialize() - */ - @Override - public SerializedMap serialize() { - final SerializedMap map = new SerializedMap(); - - map.putIf("Current_Component", this.currentComponent); - map.put("Past_Components", this.pastComponents); - - return map; - } - - /** - * Create a {@link SimpleComponent} from the serialized map - * - * @param map - * @return - */ - public static SimpleComponent deserialize(SerializedMap map) { - final SimpleComponent component = new SimpleComponent(); - - component.currentComponent = map.get("Current_Component", Part.class); - component.pastComponents.addAll(map.getList("Past_Components", Part.class)); - - return component; - } - - // -------------------------------------------------------------------- - // Static - // -------------------------------------------------------------------- - - /** - * Compile the message into components, creating a new {@link PermissibleComponent} - * each time the message has a new & color/formatting, preserving - * the last color - * - * @param message - * @param inheritFormatting - * @param viewPermission - * @return - */ - private static TextComponent[] toComponent(@NonNull String message, BaseComponent inheritFormatting) { - final List<TextComponent> components = new ArrayList<>(); - - // Plot the previous formatting manually before the message to retain it - if (inheritFormatting != null) { - - if (inheritFormatting.isBold()) - message = ChatColor.BOLD + message; - - if (inheritFormatting.isItalic()) - message = ChatColor.ITALIC + message; - - if (inheritFormatting.isObfuscated()) - message = ChatColor.MAGIC + message; - - if (inheritFormatting.isStrikethrough()) - message = ChatColor.STRIKETHROUGH + message; - - if (inheritFormatting.isUnderlined()) - message = ChatColor.UNDERLINE + message; - - message = inheritFormatting.getColor() + message; - } - - StringBuilder builder = new StringBuilder(); - TextComponent component = new TextComponent(); - - for (int index = 0; index < message.length(); index++) { - char letter = message.charAt(index); - - if (letter == ChatColor.COLOR_CHAR) { - if (++index >= message.length()) - break; - - letter = message.charAt(index); - - if (letter >= 'A' && letter <= 'Z') - letter += 32; - - ChatColor format; - - if (letter == 'x' && index + 12 < message.length()) { - final StringBuilder hex = new StringBuilder("#"); - - for (int j = 0; j < 6; j++) - hex.append(message.charAt(index + 2 + (j * 2))); - - try { - format = ChatColor.of(hex.toString()); - - } catch (NoSuchMethodError | IllegalArgumentException ex) { - format = null; - } - - index += 12; - - } else - format = ChatColor.getByChar(letter); - - if (format == null) - continue; - - if (builder.length() > 0) { - final TextComponent old = component; - - component = new TextComponent(old); - old.setText(builder.toString()); - - builder = new StringBuilder(); - components.add(old); - } - - if (format == ChatColor.BOLD) - component.setBold(true); - - else if (format == ChatColor.ITALIC) - component.setItalic(true); - - else if (format == ChatColor.UNDERLINE) - component.setUnderlined(true); - - else if (format == ChatColor.STRIKETHROUGH) - component.setStrikethrough(true); - - else if (format == ChatColor.MAGIC) - component.setObfuscated(true); - - else if (format == ChatColor.RESET) { - format = ChatColor.WHITE; - - component = new TextComponent(); - component.setColor(format); - - /*component.setBold(false); - component.setItalic(false); - component.setStrikethrough(false); - component.setUnderlined(false);*/ - - } else { - component = new TextComponent(); - - component.setColor(format); - } - - continue; - } - - int pos = message.indexOf(' ', index); - - if (pos == -1) - pos = message.length(); - - // Web link handling - if (URL_PATTERN.matcher(message).region(index, pos).find()) { - - if (builder.length() > 0) { - final TextComponent old = component; - component = new TextComponent(old); - - old.setText(builder.toString()); - - builder = new StringBuilder(); - components.add(old); - } - - final TextComponent old = component; - component = new TextComponent(old); - - final String urlString = message.substring(index, pos); - component.setText(urlString); - component.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, urlString.startsWith("http") ? urlString : "http://" + urlString)); - components.add(component); - - index += pos - index - 1; - component = old; - - continue; - } - - builder.append(letter); - } - - component.setText(builder.toString()); - components.add(component); - - //return components.toArray(new TextComponent[components.size()]); - return new TextComponent[] { new TextComponent(components.toArray(new TextComponent[components.size()])) }; - } - - /** - * Create a new interactive chat component - * You can then build upon your text to add interactive elements - * - * @param text - * @return - */ - public static SimpleComponent empty() { - return of(true, ""); - } - - /** - * Create a new interactive chat component - * You can then build upon your text to add interactive elements - * - * @param text - * @return - */ - public static SimpleComponent of(String text) { - return of(true, text); - } - - /** - * Create a new interactive chat component - * You can then build upon your text to add interactive elements - * - * @param colorize - * @param text - * @return - */ - public static SimpleComponent of(boolean colorize, String text) { - return new SimpleComponent(colorize ? Common.colorize(text) : text); - } - - // -------------------------------------------------------------------- - // Classes - // -------------------------------------------------------------------- - - /** - * The part that is being created - */ - static final class Part implements ConfigSerializable { - - /** - * The text - */ - private String text; - - /** - * The view permission - */ - - private String viewPermission; - - /** - * The view JS condition - */ - - private String viewCondition; - - /** - * The hover event - */ - - private HoverEvent hoverEvent; - - /** - * The click event - */ - - private ClickEvent clickEvent; - - /** - * The insertion - */ - - private String insertion; - - /** - * What component to inherit colors/decoration from? - */ - - private BaseComponent inheritFormatting; - - /* - * Create a new part - */ - private Part(String text) { - Valid.checkNotNull(text, "Part text cannot be null"); - - this.text = text; - } - - /** - * @see org.mineacademy.fo.model.ConfigSerializable#serialize() - */ - @Override - public SerializedMap serialize() { - final SerializedMap map = new SerializedMap(); - - map.put("Text", this.text); - map.putIf("View_Permission", this.viewPermission); - map.putIf("View_Condition", this.viewCondition); - map.putIf("Hover_Event", this.hoverEvent); - map.putIf("Click_Event", this.clickEvent); - map.putIf("Insertion", this.insertion); - map.putIf("Inherit_Formatting", this.inheritFormatting); - - return map; - } - - /** - * Create a Part from the given serializedMap - * - * @param map - * @return - */ - public static Part deserialize(SerializedMap map) { - final Part part = new Part(map.getString("Text")); - - part.viewPermission = map.getString("View_Permission"); - part.viewCondition = map.getString("View_Condition"); - part.hoverEvent = map.get("Hover_Event", HoverEvent.class); - part.clickEvent = map.get("Click_Event", ClickEvent.class); - part.insertion = map.getString("Insertion"); - part.inheritFormatting = map.get("Inherit_Formatting", BaseComponent.class); - - return part; - } - - /** - * Turn this part of the components into a {@link TextComponent} - * for the given receiver - * - * @param receiver - * @return - */ - - private TextComponent toTextComponent(CommandSender receiver) { - if (!canSendTo(receiver) || isEmpty()) - return null; - - final List<BaseComponent> base = toComponent(this.text, this.inheritFormatting)[0].getExtra(); - - for (final BaseComponent part : base) { - if (this.hoverEvent != null) - part.setHoverEvent(hoverEvent); - - if (this.clickEvent != null) - part.setClickEvent(clickEvent); - - if (this.insertion != null) - part.setInsertion(insertion); - } - - return new TextComponent(base.toArray(new BaseComponent[base.size()])); - } - - /* - * Return if we're dealing with an empty format - */ - private boolean isEmpty() { - return this.text.isEmpty() && this.hoverEvent == null && this.clickEvent == null && this.insertion == null; - } - - /* - * Can this component be shown to the given sender? - */ - private boolean canSendTo(CommandSender receiver) { - - if (this.viewPermission != null && !this.viewPermission.isEmpty() && (receiver == null || !PlayerUtil.hasPerm(receiver, this.viewPermission))) - return false; - - if (this.viewCondition != null && !this.viewCondition.isEmpty()) { - if (receiver == null) - return false; - - final Object result = JavaScriptExecutor.run(Variables.replace(this.viewCondition, receiver), receiver); - - if (result != null) { - Valid.checkBoolean(result instanceof Boolean, "View condition must return Boolean not " + (result == null ? "null" : result.getClass()) + " for component: " + this); - - if ((boolean) result == false) - return false; - } - } - - return true; - } - - /** - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return this.serialize().toStringFormatted(); - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleEnchant.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleEnchant.java deleted file mode 100644 index 79bd001d3784f3e8f3d588a8b78fc81bc1866f81..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleEnchant.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.mineacademy.fo.model; - -import org.bukkit.enchantments.Enchantment; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * A simple wrapper for enchants - */ -@Getter -@RequiredArgsConstructor -public final class SimpleEnchant { - - /** - * The enchantment - */ - private final Enchantment enchant; - - /** - * The level - */ - private final int level; - - /** - * Creates a new enchantment of level 1 - * - * @param enchant the enchantment - */ - public SimpleEnchant(Enchantment enchant) { - this(enchant, 1); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleEnchantment.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleEnchantment.java deleted file mode 100644 index b93128d2082135f28d8eb310d15d63f43180810a..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleEnchantment.java +++ /dev/null @@ -1,402 +0,0 @@ -package org.mineacademy.fo.model; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.regex.Pattern; - -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.NamespacedKey; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.enchantments.EnchantmentTarget; -import org.bukkit.entity.LivingEntity; -import org.bukkit.event.block.BlockBreakEvent; -import org.bukkit.event.entity.EntityDamageByEntityEvent; -import org.bukkit.event.entity.ProjectileHitEvent; -import org.bukkit.event.entity.ProjectileLaunchEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.mineacademy.fo.ChatUtil; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MathUtil; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.Remain; - -import lombok.NonNull; -import net.md_5.bungee.api.ChatColor; - -/** - * Represents a simple way of getting your own enchantments into Minecraft - * <p> - * DISCLAIMER: Minecraft is not built for your custom enchants. Removing this enchant - * from the item later will still preserve the lore saying the item has it. - * <p> - * TIP: If you want to register for custom events you just make this class implemements - * Listener and we register it automatically! However, you must make sure that the - * event actually happened when the item was used. Use {@link ItemStack#containsEnchantment(Enchantment)} - * to check - */ -public abstract class SimpleEnchantment extends Enchantment { - - /** - * Pattern for matching namespaces - */ - private static final Pattern VALID_NAMESPACE = Pattern.compile("[a-z0-9._-]+"); - - /** - * The name of this enchant - */ - private final String name; - - /** - * The maximum level of this enchant - */ - private final int maxLevel; - - /** - * Create a new enchantment with the given name - * - * @param name - */ - protected SimpleEnchantment(String name, int maxLevel) { - super(toKey(name)); - - this.name = name; - this.maxLevel = maxLevel; - - Remain.registerEnchantment(this); - } - - // Convert a name into a namespace - private static NamespacedKey toKey(@NonNull String name) { - if (!MinecraftVersion.atLeast(V.v1_13)) - throw new RuntimeException("SimpleEnchantment requires Minecraft 1.13.2 or greater. Cannot make " + name); - - name = new String(name); - name = name.toLowerCase().replace(" ", "_"); - name = ChatUtil.replaceDiacritic(name); - - Valid.checkBoolean(name != null && VALID_NAMESPACE.matcher(name).matches(), "Enchant name must only contain English alphabet names: " + name); - return new NamespacedKey(SimplePlugin.getInstance(), name); - } - - // ------------------------------------------------------------------------------------------ - // Events - // ------------------------------------------------------------------------------------------ - - /** - * Triggered automatically when the attacker has this enchantment - * - * @param level the level of this enchant - * @param damager - * @param event - */ - protected void onDamage(int level, LivingEntity damager, EntityDamageByEntityEvent event) { - } - - /** - * Triggered automatically when the player clicks block/air with the given enchant - * - * @param level - * @param event - */ - protected void onInteract(int level, PlayerInteractEvent event) { - } - - /** - * Triggered automatically when the player breaks block having hand item with this enchantment - * - * @param level - * @param event - */ - protected void onBreakBlock(int level, BlockBreakEvent event) { - } - - /** - * Triggered automatically when the projectile was shot from a living entity - * having this item at their hand - * - * @param level - * @param shooter - * @param event - */ - protected void onShoot(int level, LivingEntity shooter, ProjectileLaunchEvent event) { - } - - /** - * Triggered automatically when the projectile hits something and the shooter - * is a living entity having the hand item having this enchant - * - * @param level - * @param shooter - * @param event - */ - protected void onHit(int level, LivingEntity shooter, ProjectileHitEvent event) { - } - - // ------------------------------------------------------------------------------------------ - // Convenience methods - // ------------------------------------------------------------------------------------------ - - /** - * Gives this enchant to the given item at a certain level - * - * @param item - * @param level - * @return - */ - public ItemStack applyTo(ItemStack item, int level) { - final ItemMeta meta = item.getItemMeta(); - - meta.addEnchant(this, level, true); - item.setItemMeta(meta); - - return item; - } - - // ------------------------------------------------------------------------------------------ - // Our own methods - // ------------------------------------------------------------------------------------------ - - /** - * Return the lore shown on items having this enchant - * Return null to hide the lore - * <p> - * We have to add item lore manually since Minecraft does not really support custom - * enchantments - * - * @param level - * @return - */ - public String getLore(int level) { - return name + " " + MathUtil.toRoman(level); - } - - /** - * Improved version of EnchantmentTarget with more - * variety in the options. - * - * Select what items this enchantment may be applied to? - * Defaults to BREAKABLE (all) - * - * @return - */ - public SimpleEnchantmentTarget getCustomItemTarget() { - return SimpleEnchantmentTarget.BREAKABLE; - } - - /** - * Select what material this enchantment can be - * applied to. - * @return - */ - public Material enchantMaterial() { - return null; - } - - /** - * Select what materials this enchantment can be - * applied to. - * @return - */ - public Set<Material> enchantMaterials() { - return new HashSet<>(); - } - - // ------------------------------------------------------------------------------------------ - // Bukkit methods - // ------------------------------------------------------------------------------------------ - - /** - * What items may this be applied to? Defaults to ALL - * - * @return - */ - @Override - public EnchantmentTarget getItemTarget() { - return EnchantmentTarget.BREAKABLE; - } - - /** - * What other enchants this one conflicts with? Defaults to false for all - * - * @param - * @return - */ - @Override - public boolean conflictsWith(Enchantment other) { - return false; - } - - /** - * What items can be enchanted? Defaults to true for all - * - * @param - * @return - */ - @Override - public boolean canEnchantItem(ItemStack item) { - return true; - } - - /** - * Get the startup level, 1 by default - * - * @return - */ - @Override - public int getStartLevel() { - return 1; - } - - /** - * Get if this enchant is a treasure, default false - * - * @return - */ - @Override - public boolean isTreasure() { - return false; - } - - /** - * Get if this enchant is cursed, default false - * - * @return - */ - @Override - public boolean isCursed() { - return false; - } - - /** - * Return the max level of this enchant - * - * @return - */ - @Override - public final int getMaxLevel() { - return maxLevel; - } - - /** - * Return the name of this enchant - * - * @return - */ - @Override - public final String getName() { - return name; - } - - // ------------------------------------------------------------------------------------------ - // Static - // ------------------------------------------------------------------------------------------ - - /** - * Return a map of enchantments with their levels on the given item - * - * @param item - * @return - */ - public static Map<SimpleEnchantment, Integer> findEnchantments(ItemStack item) { - final Map<SimpleEnchantment, Integer> map = new HashMap<>(); - - if (item == null) - return map; - - final Map<Enchantment, Integer> vanilla; - - try { - vanilla = item.hasItemMeta() ? item.getItemMeta().getEnchants() : new HashMap<>(); - } catch (final NoSuchMethodError err) { - if (Remain.hasItemMeta()) - err.printStackTrace(); - - return map; - - } catch (final NullPointerException ex) { - // Caused if any associated enchant is null, probably by a third party plugin - return map; - } - - for (final Entry<Enchantment, Integer> e : vanilla.entrySet()) { - final Enchantment enchantment = e.getKey(); - final int level = e.getValue(); - - if (enchantment instanceof SimpleEnchantment) - map.put((SimpleEnchantment) enchantment, level); - } - - return map; - } - - /** - * Since Minecraft client cannot display custom enchantments we have to add lore manually. - * <p> - * This adds the fake enchant lore for the given item in case it does not exist. - * - * @param item - * @return the modified item or null if item was not edited (no enchants found) - * @deprecated internal use only - */ - @Deprecated - public static ItemStack addEnchantmentLores(ItemStack item) { - final List<String> customEnchants = new ArrayList<>(); - - // Fill in our enchants - try { - for (final Map.Entry<Enchantment, Integer> e : item.getEnchantments().entrySet()) - if (e.getKey() instanceof SimpleEnchantment) { - final String lore = ((SimpleEnchantment) e.getKey()).getLore(e.getValue()); - - if (lore != null && !lore.isEmpty()) - customEnchants.add(Common.colorize("&r&7" + lore)); - } - - } catch (final NullPointerException ex) { - // Some weird problem in third party plugin - } - - if (!customEnchants.isEmpty()) { - final ItemMeta meta = item.hasItemMeta() ? item.getItemMeta() : Bukkit.getItemFactory().getItemMeta(item.getType()); - final List<String> originalLore = meta.hasLore() ? meta.getLore() : new ArrayList<>(); - final List<String> finalLore = new ArrayList<>(); - - final List<String> colorlessOriginals = new ArrayList<>(); - - for (final String original : originalLore) - colorlessOriginals.add(ChatColor.stripColor(Common.colorize(original))); - - // Place our enchants - for (final String customEnchant : customEnchants) { - final String colorlessEnchant = ChatColor.stripColor(Common.colorize(customEnchant)); - - if (!colorlessOriginals.contains(colorlessEnchant)) - finalLore.add(customEnchant); - } - - // Place the original lore at the bottom - finalLore.addAll(originalLore); - - // Set the lore - meta.setLore(finalLore); - - // Update the item stack - item.setItemMeta(meta); - - return item; - } - - return null; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleEnchantmentTarget.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleEnchantmentTarget.java deleted file mode 100644 index 0c245806483a98caff997b3a26c3668d48cc4c08..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleEnchantmentTarget.java +++ /dev/null @@ -1,264 +0,0 @@ -package org.mineacademy.fo.model; - -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; - -public enum SimpleEnchantmentTarget { - - /** - * Allows the Enchantment to be placed on armor - */ - ARMOR { - @Override - public boolean includes(Material item) { - return ARMOR_FEET.includes(item) - || ARMOR_LEGS.includes(item) - || ARMOR_HEAD.includes(item) - || ARMOR_TORSO.includes(item); - } - }, - - /** - * Allows the Enchantment to be placed on feet slot armor - */ - ARMOR_FEET { - @Override - public boolean includes(Material item) { - return item.equals(Material.LEATHER_BOOTS) - || item.equals(Material.CHAINMAIL_BOOTS) - || item.equals(Material.IRON_BOOTS) - || item.equals(Material.DIAMOND_BOOTS) - || item.equals(Material.GOLDEN_BOOTS) - || item.equals(Material.NETHERITE_BOOTS); - } - }, - - /** - * Allows the Enchantment to be placed on leg slot armor - */ - ARMOR_LEGS { - @Override - public boolean includes(Material item) { - return item.equals(Material.LEATHER_LEGGINGS) - || item.equals(Material.CHAINMAIL_LEGGINGS) - || item.equals(Material.IRON_LEGGINGS) - || item.equals(Material.DIAMOND_LEGGINGS) - || item.equals(Material.GOLDEN_LEGGINGS) - || item.equals(Material.NETHERITE_LEGGINGS); - } - }, - - /** - * Allows the Enchantment to be placed on torso slot armor - */ - ARMOR_TORSO { - @Override - public boolean includes(Material item) { - return item.equals(Material.LEATHER_CHESTPLATE) - || item.equals(Material.CHAINMAIL_CHESTPLATE) - || item.equals(Material.IRON_CHESTPLATE) - || item.equals(Material.DIAMOND_CHESTPLATE) - || item.equals(Material.GOLDEN_CHESTPLATE) - || item.equals(Material.NETHERITE_CHESTPLATE); - } - }, - - /** - * Allows the Enchantment to be placed on head slot armor - */ - ARMOR_HEAD { - @Override - public boolean includes(Material item) { - return item.equals(Material.LEATHER_HELMET) - || item.equals(Material.CHAINMAIL_HELMET) - || item.equals(Material.DIAMOND_HELMET) - || item.equals(Material.IRON_HELMET) - || item.equals(Material.GOLDEN_HELMET) - || item.equals(Material.TURTLE_HELMET) - || item.equals(Material.NETHERITE_HELMET); - } - }, - - /** - * Allows the Enchantment to be placed on weapons (swords) - */ - WEAPON { - @Override - public boolean includes(Material item) { - return item.equals(Material.WOODEN_SWORD) - || item.equals(Material.STONE_SWORD) - || item.equals(Material.IRON_SWORD) - || item.equals(Material.DIAMOND_SWORD) - || item.equals(Material.GOLDEN_SWORD) - || item.equals(Material.NETHERITE_SWORD); - } - }, - - /** - * Allows the Enchantment to be placed on tools (spades, pickaxe, axes) - */ - TOOL { - @Override - public boolean includes(Material item) { - return SHOVEL.includes(item) - || PICKAXE.includes(item) - || AXE.includes(item) - || HOE.includes(item); - } - }, - - /** - * Allows the Enchantment to be placed on Shovel tools. - */ - SHOVEL { - @Override - public boolean includes(Material item) { - return item.equals(Material.WOODEN_SHOVEL) - || item.equals(Material.STONE_SHOVEL) - || item.equals(Material.IRON_SHOVEL) - || item.equals(Material.DIAMOND_SHOVEL) - || item.equals(Material.GOLDEN_SHOVEL) - || item.equals(Material.NETHERITE_SHOVEL); - } - }, - - /** - * Allows the Enchantment to be placed on Pickaxe tools. - */ - PICKAXE { - @Override - public boolean includes(Material item) { - return item.equals(Material.WOODEN_PICKAXE) - || item.equals(Material.STONE_PICKAXE) - || item.equals(Material.IRON_PICKAXE) - || item.equals(Material.DIAMOND_PICKAXE) - || item.equals(Material.GOLDEN_PICKAXE) - || item.equals(Material.NETHERITE_PICKAXE); - } - }, - - /** - * Allows the Enchantment to be placed on Hoe tools. - */ - AXE { - @Override - public boolean includes(Material item) { - return item.equals(Material.WOODEN_AXE) - || item.equals(Material.STONE_AXE) - || item.equals(Material.IRON_AXE) - || item.equals(Material.DIAMOND_AXE) - || item.equals(Material.GOLDEN_AXE) - || item.equals(Material.NETHERITE_AXE); - } - }, - - /** - * Allows the Enchantment to be placed on Hoe tools. - */ - HOE { - @Override - public boolean includes(Material item) { - return item.equals(Material.WOODEN_HOE) - || item.equals(Material.STONE_HOE) - || item.equals(Material.IRON_HOE) - || item.equals(Material.DIAMOND_HOE) - || item.equals(Material.GOLDEN_HOE) - || item.equals(Material.NETHERITE_HOE); - } - }, - - /** - * Allows the Enchantment to be placed on bows. - */ - BOW { - @Override - public boolean includes(Material item) { - return item.equals(Material.BOW); - } - }, - - /** - * Allows the Enchantment to be placed on fishing rods. - */ - FISHING_ROD { - @Override - public boolean includes(Material item) { - return item.equals(Material.FISHING_ROD); - } - }, - - /** - * Allows the enchantment to be placed on items with durability. - */ - BREAKABLE { - @Override - public boolean includes(Material item) { - return item.getMaxDurability() > 0 && item.getMaxStackSize() == 1; - } - }, - - /** - * Allows the enchantment to be placed on wearable items. - */ - WEARABLE { - @Override - public boolean includes(Material item) { - return ARMOR.includes(item) - || ELYTRA.includes(item) - || item.equals(Material.CARVED_PUMPKIN) - || item.equals(Material.JACK_O_LANTERN) - || item.equals(Material.SKELETON_SKULL) - || item.equals(Material.WITHER_SKELETON_SKULL) - || item.equals(Material.ZOMBIE_HEAD) - || item.equals(Material.PLAYER_HEAD) - || item.equals(Material.CREEPER_HEAD) - || item.equals(Material.DRAGON_HEAD); - } - }, - - /** - * Allows the Enchantment to be placed on Elytra's. - */ - ELYTRA { - @Override - public boolean includes(Material item) { - return item.equals(Material.ELYTRA); - } - }, - - /** - * Allow the Enchantment to be placed on tridents. - */ - TRIDENT { - @Override - public boolean includes(Material item) { - return item.equals(Material.TRIDENT); - } - }, - - /** - * Allow the Enchantment to be placed on crossbows. - */ - CROSSBOW { - @Override - public boolean includes(Material item) { - return item.equals(Material.CROSSBOW); - } - }, - - /** - * Allow the Enchantment to be placed on vanishing items. - */ - VANISHABLE { - @Override - public boolean includes(Material item) { - return BREAKABLE.includes(item) || (WEARABLE.includes(item) && !item.equals(Material.ELYTRA)) || item.equals(Material.COMPASS); - } - }; - - public abstract boolean includes(Material item); - - public boolean includes(ItemStack item) { - return includes(item.getType()); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleEquipment.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleEquipment.java deleted file mode 100644 index 7692f2106e93a9b76d4134a61db71a6249e9ccc2..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleEquipment.java +++ /dev/null @@ -1,231 +0,0 @@ -package org.mineacademy.fo.model; - -import org.bukkit.entity.LivingEntity; -import org.bukkit.inventory.EntityEquipment; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompEquipmentSlot; -import org.mineacademy.fo.remain.CompMaterial; - -import lombok.Getter; - -/** - * A more robust alternative to the {@link EntityEquipment} class found in Bukkit - * - * @deprecated subject for removal, simply use {@link LivingEntity#getEquipment()} and - * achieve the same outcome there on the Bukkit API instead - */ -@Deprecated -@Getter -public final class SimpleEquipment { - - /** - * The Bukkit equipment - */ - private final EntityEquipment equipment; - - /** - * Wrap the equipment for the given entity - * - * @param entity - */ - public SimpleEquipment(final LivingEntity entity) { - this(entity.getEquipment()); - } - - /** - * Create a new simple equipment - * - * @param equipment - */ - public SimpleEquipment(final EntityEquipment equipment) { - this.equipment = equipment; - } - - // ------------------------------------------------------------------------------------------ - // Main settings methods - // ------------------------------------------------------------------------------------------ - - /** - * Sets the given slot to the given item - * - * @param slot - * @param material - */ - public void set(final CompEquipmentSlot slot, final CompMaterial material) { - set(slot, material.toItem()); - } - - /** - * Sets the given slot to the given item - * - * @param slot - * @param builder - */ - public void set(final CompEquipmentSlot slot, final ItemCreator.ItemCreatorBuilder builder) { - set(slot, builder.build().make()); - } - - /** - * Sets the given slot to the given item - * - * @param slot - * @param item - */ - public void set(final CompEquipmentSlot slot, final ItemStack item) { - Valid.checkNotNull(item, "Equipment item cannot be null"); - - set(slot, item, null); - } - - /** - * Updates the drop chance (0.0-1.0 for the given slot) - * - * @param slot - * @param dropChance - */ - public void set(final CompEquipmentSlot slot, final float dropChance) { - set(slot, (ItemStack) null, dropChance); - } - - /** - * Sets the given slot with the given item and drop chance (0.0-1.0) - * - * @param slot - * @param material - * @param dropChance - */ - public void set(final CompEquipmentSlot slot, final CompMaterial material, final Float dropChance) { - set(slot, material.toItem(), dropChance); - } - - /** - * Sets the given slot with the given item and drop chance (0.0-1.0) - * - * @param slot - * @param builder - * @param dropChance - */ - public void set(final CompEquipmentSlot slot, final ItemCreator.ItemCreatorBuilder builder, final Float dropChance) { - set(slot, builder.build().make(), dropChance); - } - - /** - * Sets the given slot with the given item and drop chance (0.0-1.0) - * - * @param slot - * @param item - * @param dropChance - */ - public void set(CompEquipmentSlot slot, final ItemStack item, final Float dropChance) { - Valid.checkBoolean(item != null || dropChance != null, "Either item or drop chance must be given!"); - - if (slot.toString().equals("OFF_HAND") && MinecraftVersion.olderThan(V.v1_9)) - slot = CompEquipmentSlot.HAND; - - if (slot == CompEquipmentSlot.HEAD) { - if (item != null) - equipment.setHelmet(item); - if (dropChance != null) - equipment.setHelmetDropChance(dropChance); - } else if (slot == CompEquipmentSlot.CHEST) { - if (item != null) - equipment.setChestplate(item); - if (dropChance != null) - equipment.setChestplateDropChance(dropChance); - } else if (slot == CompEquipmentSlot.LEGS) { - if (item != null) - equipment.setLeggings(item); - if (dropChance != null) - equipment.setLeggingsDropChance(dropChance); - } else if (slot == CompEquipmentSlot.FEET) { - if (item != null) - equipment.setBoots(item); - if (dropChance != null) - equipment.setBootsDropChance(dropChance); - } else if (slot == CompEquipmentSlot.HAND) { - if (item != null) - equipment.setItemInHand(item); - if (dropChance != null) - equipment.setItemInHandDropChance(dropChance); - } else if (slot.toString().equals("OFF_HAND")) - try { - if (item != null) - equipment.setItemInOffHand(item); - if (dropChance != null) - equipment.setItemInOffHandDropChance(dropChance); - } catch (final Throwable t) { - } - - else - throw new FoException("Does not know how to set " + slot + " to " + item); - } - - // ------------------------------------------------------------------------------------------ - // Armor content - // ------------------------------------------------------------------------------------------ - - /** - * Return the item stack array of all content - * - * @return - */ - public ItemStack[] getArmorContents() { - return equipment.getArmorContents(); - } - - /** - * Set the armor content for this entity - * - * @param helmet - * @param chest - * @param leggings - * @param boots - */ - public void setContent(final ItemCreator.ItemCreatorBuilder helmet, final ItemCreator.ItemCreatorBuilder chest, final ItemCreator.ItemCreatorBuilder leggings, final ItemCreator.ItemCreatorBuilder boots) { - setContent(helmet.build().make(), chest.build().make(), leggings.build().make(), boots.build().make()); - } - - /** - * Set the armor content for this entity - * - * @param helmet - * @param chest - * @param leggings - * @param boots - */ - public void setContent(final CompMaterial helmet, final CompMaterial chest, final CompMaterial leggings, final CompMaterial boots) { - setContent(helmet.toItem(), chest.toItem(), leggings.toItem(), boots.toItem()); - } - - /** - * Set the armor content for this entity - * - * @param helmet - * @param chest - * @param leggings - * @param boots - */ - public void setContent(final ItemStack helmet, final ItemStack chest, final ItemStack leggings, final ItemStack boots) { - set(CompEquipmentSlot.HEAD, helmet); - set(CompEquipmentSlot.CHEST, chest); - set(CompEquipmentSlot.FEET, leggings); - set(CompEquipmentSlot.LEGS, boots); - } - - // ------------------------------------------------------------------------------------------ - // Misc - // ------------------------------------------------------------------------------------------ - - /** - * Removes entity all equipment - */ - public void clear() { - equipment.clear(); - } - -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleExpansion.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleExpansion.java deleted file mode 100644 index f0c816a91aa71290bd50a444313d80a42f2341e9..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleExpansion.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.mineacademy.fo.model; - -import org.bukkit.command.CommandSender; -import org.mineacademy.fo.Common; - -import lombok.NonNull; - -/** - * Represents a placeholder expansion used for variables that need - * dynamic on-the-fly replacements depending on the variable content. - * - * This also hooks into PlaceholderAPI as needed - */ -public abstract class SimpleExpansion { - - /** - * Indicates there is no replacement and the placeholder should be - * printed out explicitly as-is to the console/game chat. - */ - protected static final String NO_REPLACE = null; - - /** - * The current arguments changed each time the expansion is called, - * we simply split the placeholder identifier by _ after the plugin - * such as corearena_player_health will give you [player, health] - */ - protected String[] args; - - /** - * Return the value of the placeholder such as arena_name - * - * @param sender - * @param params - * - * @return the value or null if not valid - */ - public final String replacePlaceholders(CommandSender sender, String params) { - this.args = params.split("\\_"); - - return onReplace(sender, params); - } - - /** - * Return what variable we should replace for the given player and - * identifier. - * - * @param sender - * @param identifier, everything after your plugin name such as if user types {corearena_player_health}, - * we return only "player_health". You can also use {@link #args} here. - * @return - */ - protected abstract String onReplace(@NonNull CommandSender sender, String identifier); - - /** - * Automatically joins the {@link #args} from the given index - * - * @param startIndex - * @return - */ - protected final String join(int startIndex) { - return Common.joinRange(startIndex, this.args); - } - - /** - * Automatically joins the {@link #args} from and to the given index - * - * @param startIndex - * @param stopIndex - * @return - */ - protected final String join(int startIndex, int stopIndex) { - return Common.joinRange(startIndex, stopIndex, this.args); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleHologram.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleHologram.java deleted file mode 100644 index d36be7afba9e645cef029245443cde60b727388d..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleHologram.java +++ /dev/null @@ -1,315 +0,0 @@ -package org.mineacademy.fo.model; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.bukkit.Location; -import org.bukkit.entity.ArmorStand; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.CompParticle; -import org.mineacademy.fo.remain.Remain; - -import lombok.Getter; -import lombok.Setter; - -/** - * - */ -public abstract class SimpleHologram { - - /** - * The distance between each line of lore for this item - */ - @Getter - @Setter - private static double loreLineHeight = 0.26D; - - /** - * A registry of created animated items - */ - @Getter - private static Set<SimpleHologram> registeredItems = new HashSet<>(); - - /** - * The armor stand names, each line spawns another invisible stand - */ - private final List<ArmorStand> loreEntities = new ArrayList<>(); - - /** - * The spawning location - */ - private final Location lastTeleportLocation; - - /** - * The lore over the item - */ - @Getter - private final List<String> loreLines = new ArrayList<>(); - - /** - * Optional particles spawning below the hologram - */ - @Getter - private final List<Tuple<CompParticle, Object>> particles = new ArrayList<>(); - - /** - * The displayed entity - */ - @Getter - private Entity entity; - - /* - * A private flag to help with teleporting of this entity - */ - private Location pendingTeleport = null; - - /* - * Constructs a new item and registers it - */ - protected SimpleHologram(Location spawnLocation) { - this.lastTeleportLocation = spawnLocation.clone(); - - registeredItems.add(this); - } - - /** - * Spawns this hologram entity - * - * @return - */ - public SimpleHologram spawn() { - Valid.checkBoolean(!this.isSpawned(), this + " is already spawned!"); - Valid.checkNotEmpty(this.loreLines, "Call lore() first before calling spawn method for " + this); - - this.entity = this.createEntity(); - Valid.checkNotNull(this.entity, "Failed to spawn entity from " + this); - - this.drawLore(this.lastTeleportLocation); - - return this; - } - - /** - * Core implementation method to spawn your entity - * - * @return - */ - protected abstract Entity createEntity(); - - /* - * Set a lore for this armor stand - */ - private void drawLore(Location location) { - - if (this.entity instanceof ArmorStand && ((ArmorStand) this.entity).isSmall()) - location = location.add(0, -0.5, 0); - - for (final String loreLine : this.loreLines) { - final ArmorStand armorStand = (ArmorStand) location.getWorld().spawnEntity(location, EntityType.ARMOR_STAND); - - armorStand.setGravity(false); - armorStand.setVisible(false); - - Remain.setCustomName(armorStand, loreLine); - - location = location.subtract(0, loreLineHeight, 0); - - this.loreEntities.add(armorStand); - } - } - - /* - * Iterate the ticking mechanism of this entity - */ - private void tick() { - - if (this.pendingTeleport != null) { - this.entity.teleport(this.pendingTeleport); - - for (final ArmorStand loreEntity : this.loreEntities) - loreEntity.teleport(this.pendingTeleport); - - this.pendingTeleport = null; - return; - } - - this.onTick(); - - for (final Tuple<CompParticle, Object> tuple : this.particles) { - final CompParticle particle = tuple.getKey(); - final Object extra = tuple.getValue(); - - if (extra instanceof CompMaterial) - particle.spawn(this.getLocation(), (CompMaterial) extra); - - else if (extra instanceof Double) - particle.spawn(this.getLocation(), (double) extra); - } - } - - /** - * Called automatically where you can animate this armor stand - */ - protected void onTick() { - } - - /** - * Return true if this armor stand is spawned - * - * @return - */ - public final boolean isSpawned() { - return this.entity != null; - } - - /** - * Deletes all text that the armor stand has - */ - public final void removeLore() { - this.loreEntities.forEach(stand -> stand.remove()); - } - - /** - * - * @param lore - * @return - */ - public final SimpleHologram setLore(String... lore) { - this.loreLines.clear(); - this.loreLines.addAll(Arrays.asList(lore)); - - return this; - } - - /** - * Add particle effect for this hologram - * - * @param particle - */ - public final void addParticleEffect(CompParticle particle) { - this.addParticleEffect(particle, null); - } - - /** - * Add particle effect for this hologram - * - * @param particle - * @param data - */ - public final void addParticleEffect(CompParticle particle, CompMaterial data) { - this.particles.add(new Tuple<>(particle, data)); - } - - /** - * Return the current armor stand location - * - * @return - */ - public final Location getLocation() { - this.checkSpawned("getLocation"); - - return this.entity.getLocation(); - } - - /** - * Return the last known teleport location - * - * @return - */ - public final Location getLastTeleportLocation() { - return lastTeleportLocation.clone(); - } - - /** - * Teleport this hologram with its lores to the given location - * - * @param location - */ - public final void teleport(Location location) { - Valid.checkBoolean(this.pendingTeleport == null, this + " is already pending teleport to " + this.pendingTeleport); - this.checkSpawned("teleport"); - - this.lastTeleportLocation.setX(location.getY()); - this.lastTeleportLocation.setY(location.getY()); - this.lastTeleportLocation.setZ(location.getZ()); - - this.pendingTeleport = location; - } - - /** - * Deletes this armor stand - */ - public final void remove() { - this.removeLore(); - - if (this.entity != null) - this.entity.remove(); - - registeredItems.remove(this); - } - - /* - * A helper method to check if this entity is spawned - */ - private void checkSpawned(String method) { - Valid.checkBoolean(this.isSpawned(), this + " is not spawned, cannot call " + method + "!"); - } - - /** - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "ArmorStandItem{spawnLocation=" + Common.shortLocation(this.lastTeleportLocation) + ", spawned=" + this.isSpawned() + "}"; - } - - /** - * Called internally from Foundation launch ticking mechanism task - * - * @deprecated internal use only - */ - @Deprecated - public static final void init() { - - Common.runTimer(1, () -> { - - for (final Iterator<SimpleHologram> it = registeredItems.iterator(); it.hasNext();) { - final SimpleHologram model = it.next(); - - if (model.isSpawned()) { - if (!model.getEntity().isValid() || model.getEntity().isDead()) { - model.removeLore(); - model.getEntity().remove(); - - it.remove(); - } else - model.tick(); - } - } - }); - } - - /** - * Deletes all floating items on the server - */ - public static final void deleteAll() { - - for (final Iterator<SimpleHologram> it = registeredItems.iterator(); it.hasNext();) { - final SimpleHologram item = it.next(); - - if (item.isSpawned()) - item.getEntity().remove(); - - item.removeLore(); - it.remove(); - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleHologramStand.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleHologramStand.java deleted file mode 100644 index 5c196d3855d3aa7b98de06a63b8abda01e341d71..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleHologramStand.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.mineacademy.fo.model; - -import org.bukkit.Location; -import org.bukkit.entity.ArmorStand; -import org.bukkit.entity.Entity; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompMaterial; - -import lombok.Getter; - -/** - * - */ -@Getter -public class SimpleHologramStand extends SimpleHologram { - - /** - * The material this hologram will have - */ - private final CompMaterial material; - - /** - * Is this item stand small? - */ - private boolean small; - - /** - * Is this item stand glowing? - */ - private boolean glowing; - - /** - * Create a new simple hologram using armor stand showing the given material - * - * @param spawnLocation - * @param material - */ - public SimpleHologramStand(Location spawnLocation, CompMaterial material) { - super(spawnLocation); - - this.material = material; - } - - /** - * @see org.mineacademy.fo.model.SimpleHologram#createEntity() - */ - @Override - protected final Entity createEntity() { - final ArmorStand armorStand = this.getLastTeleportLocation().getWorld().spawn(this.getLastTeleportLocation(), ArmorStand.class); - - armorStand.setGravity(false); - armorStand.setHelmet(ItemCreator.of(material).glow(this.glowing).build().make()); - armorStand.setVisible(false); - armorStand.setSmall(this.small); - - return armorStand; - } - - /** - * - * @param glowing - * @return - */ - public final SimpleHologram setGlowing(boolean glowing) { - this.glowing = glowing; - - return this; - } - - /** - * @param small the small to set - */ - public final SimpleHologram setSmall(boolean small) { - this.small = small; - - return this; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleScoreboard.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleScoreboard.java deleted file mode 100644 index 7b4f2e33b58f57eea78903ae1121332505c2e4e7..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleScoreboard.java +++ /dev/null @@ -1,474 +0,0 @@ -package org.mineacademy.fo.model; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.lang.StringUtils; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; -import org.bukkit.scheduler.BukkitTask; -import org.bukkit.scoreboard.DisplaySlot; -import org.bukkit.scoreboard.Objective; -import org.bukkit.scoreboard.Scoreboard; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.RandomUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.Remain; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NonNull; -import lombok.Setter; - -public class SimpleScoreboard { - - // ------------------------------------------------------------------------------------------------------------ - // Static - // ------------------------------------------------------------------------------------------------------------ - - /** - * List of all active scoreboard (added upon creating a new instance) - */ - @Getter - private final static List<SimpleScoreboard> registeredBoards = new ArrayList<>(); - - /** - * Clears registered boards, usually called on reload - */ - public static final void clearBoards() { - registeredBoards.clear(); - } - - /** - * Removes all scoreboard for a player - * - * @param player - */ - public static final void clearBoardsFor(final Player player) { - for (final SimpleScoreboard scoreboard : registeredBoards) - if (scoreboard.isViewing(player)) - scoreboard.hide(player); - } - - // ------------------------------------------------------------------------------------------------------------ - // Public entries - // ------------------------------------------------------------------------------------------------------------ - - /** - * Stored scoreboard lines - */ - @Getter - private final List<String> rows = new ArrayList<>(); - - /** - * A list of viewed scoreboards - */ - private final StrictList<ViewedScoreboard> scoreboards = new StrictList<>(); - - /** - * The color theme for key: value pairs such as - * <p> - * Players: 12 - * Mode: playing - */ - private final String[] theme = new String[2]; - - /** - * The title of this scoreboard - */ - @Getter - private String title; - - /** - * The update tick delay - */ - @Getter - private int updateDelayTicks; - - // ------------------------------------------------------------------------------------------------------------ - // Classes - // ------------------------------------------------------------------------------------------------------------ - - /** - * Stores a viewed scoreboard per player - */ - @Getter - @Setter - @AllArgsConstructor(access = AccessLevel.PRIVATE) - private class ViewedScoreboard { - - /** - * The scoreboard - */ - private final Scoreboard scoreboard; - - /** - * The objective - */ - private Objective objective; - - /** - * The viewer - */ - private final Player viewer; - - @Override - public boolean equals(final Object obj) { - return obj instanceof ViewedScoreboard && ((ViewedScoreboard) obj).getViewer().equals(this.viewer); - } - } - - // ------------------------------------------------------------------------------------------------------------ - // Private entries - // ------------------------------------------------------------------------------------------------------------ - - /** - * The running update task - */ - private BukkitTask updateTask; - - /** - * Create a new scoreboard - */ - public SimpleScoreboard() { - registeredBoards.add(this); - } - - // ------------------------------------------------------------------------------------------------------------ - // Add new rows - // ------------------------------------------------------------------------------------------------------------ - - /** - * Add rows onto the scoreboard - * - * @param entries - */ - public final void addRows(final String... entries) { - addRows(Arrays.asList(entries)); - } - - /** - * Add rows onto the scoreboard - * - * @param entries - */ - public final void addRows(final List<String> entries) { - rows.addAll(entries); - } - - /** - * Remove all rows - */ - public final void clearRows() { - rows.clear(); - } - - /** - * Remove row at the given index - * - * @param index - */ - public final void removeRow(final int index) { - rows.remove(index); - } - - /** - * Remove row that contains the given text - * - * @param thatContains - */ - public final void removeRow(final String thatContains) { - for (final Iterator<String> it = rows.iterator(); it.hasNext();) { - final String row = it.next(); - - if (row.contains(thatContains)) - it.remove(); - } - } - - // ------------------------------------------------------------------------------------------------------------ - // Start / stop - // ------------------------------------------------------------------------------------------------------------ - - /** - * Starts visualizing this scoreboard - */ - private final void start() { - Valid.checkBoolean(updateTask == null, "Scoreboard " + this + " already running"); - - updateTask = new BukkitRunnable() { - @Override - public void run() { - - try { - update(); - - } catch (final Throwable t) { - final String lines = String.join(" ", rows); - - Common.error(t, - "Error displaying " + SimpleScoreboard.this, - "Entries: " + lines, - "%error", - "Stopping rendering for safety."); - - stop(); - } - } - }.runTaskTimer(SimplePlugin.getInstance(), 0, updateDelayTicks); - } - - /** - * Updates this scoreboard - */ - private final void update() { - onUpdate(); - - for (final ViewedScoreboard viewedScoreboard : scoreboards) { - resetObjective(viewedScoreboard); - reloadEntries(viewedScoreboard); - } - } - - /** - * Resets the objective - * - * @param viewedScoreboard - */ - private final void resetObjective(final ViewedScoreboard viewedScoreboard) { - final Scoreboard scoreboard = viewedScoreboard.getScoreboard(); - Objective objective = viewedScoreboard.getObjective(); - - if (objective != null) - objective.unregister(); - - objective = scoreboard.registerNewObjective(viewedScoreboard.getViewer().getName(), "dummy"); - - objective.setDisplayName(Common.colorize(title)); - objective.setDisplaySlot(DisplaySlot.SIDEBAR); - - viewedScoreboard.setObjective(objective); - } - - /** - * Reload entries for the given player - * - * @param viewedScoreboard - */ - private final void reloadEntries(final ViewedScoreboard viewedScoreboard) { - final Objective objective = viewedScoreboard.getObjective(); - final StrictList<String> duplicates = new StrictList<>(); - - for (int i = rows.size(); i > 0; i--) { - final String sidebarEntry = rows.get(rows.size() - i); - final String entry = replaceVariables(viewedScoreboard.getViewer(), replaceTheme(sidebarEntry)); - - String line = fixDuplicates(duplicates, entry); - - if (line.length() > 40) - line = line.substring(0, 40); - - Remain.getScore(objective, line).setScore(i); - } - } - - /** - * Adds theme colors to the row if applicable - * - * @param row - * @return - */ - private final String replaceTheme(final String row) { - if (theme != null && row.contains(":")) - if (theme.length == 1) - return theme[0] + row; - - else if (theme[0] != null) { - final String[] split = row.split("\\:"); - - if (split.length > 1) - return theme[0] + split[0] + ":" + theme[1] + split[1]; - } - - return row; - } - - /** - * Set the coloring theme for rows having : such as - * <p> - * Players: 12 - * Mode: playing - * <p> - * To use simply put color codes - * - * @param primary - * @param secondary - */ - public final void setTheme(@NonNull final ChatColor primary, final ChatColor secondary) { - if (secondary != null) { - this.theme[0] = "&" + primary.getChar(); - this.theme[1] = "&" + secondary.getChar(); - } else - this.theme[0] = "&" + primary.getChar(); - } - - /** - * Fixes color and empty lines colliding into one by adding random colors - * - * @param duplicates - * @param message - * @return - */ - private final String fixDuplicates(final StrictList<String> duplicates, String message) { - message = StringUtils.substring(message, 0, 40); - - final boolean cut = MinecraftVersion.olderThan(V.v1_8); - - if (cut && message.length() > 16) - message = message.substring(0, 16); - - if (duplicates.contains(message)) - for (int i = 0; i < duplicates.size() && message.length() < 40; i++) - message += RandomUtil.nextColorOrDecoration(); - - if (cut && message.length() > 16) - message = message.substring(0, 16); - - duplicates.add(message); - return message; - } - - /** - * Replaces variables in the message for the given player - * - * @param player - * @param message - * @return - */ - protected String replaceVariables(final Player player, final String message) { - return message; - } - - /** - * Called when this scoreboard is ticked - */ - protected void onUpdate() { - } - - /** - * Stops this scoreboard and removes it from all viewers - */ - public final void stop() { - for (final Iterator<ViewedScoreboard> iterator = scoreboards.iterator(); iterator.hasNext();) { - final ViewedScoreboard score = iterator.next(); - - score.getViewer().setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard()); - iterator.remove(); - } - - if (updateTask != null) - cancelUpdateTask(); - } - - /** - * Cancels the update task - */ - private final void cancelUpdateTask() { - Valid.checkNotNull(updateTask, "Scoreboard " + this + " not running"); - - updateTask.cancel(); - updateTask = null; - } - - /** - * Return true if the scoreboard is running and rendering? - * - * @return - */ - public final boolean isRunning() { - return updateTask != null; - } - - /** - * @param updateDelayTicks the updateDelayTicks to set - */ - public final void setUpdateDelayTicks(int updateDelayTicks) { - this.updateDelayTicks = updateDelayTicks; - } - - /** - * @param title the title to set - */ - public final void setTitle(String title) { - this.title = title; - } - - // ------------------------------------------------------------------------------------------------------------ - // Rendering - // ------------------------------------------------------------------------------------------------------------ - - /** - * Show this scoreboard to the player - * - * @param player - */ - public final void show(final Player player) { - Valid.checkBoolean(!isViewing(player), "Player " + player.getName() + " is already viewing scoreboard: " + getTitle()); - - if (updateTask == null) - start(); - - final Scoreboard scoreboard = Bukkit.getScoreboardManager().getNewScoreboard(); - - scoreboards.add(new ViewedScoreboard(scoreboard, null, player)); - player.setScoreboard(scoreboard); - } - - /** - * Hide this scoreboard from the player - * - * @param player - */ - public final void hide(final Player player) { - Valid.checkBoolean(isViewing(player), "Player " + player.getName() + " is not viewing scoreboard: " + getTitle()); - - player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard()); - - for (final ViewedScoreboard viewed : scoreboards) - if (viewed.getViewer().equals(player)) { - scoreboards.remove(viewed); - break; - } - - if (scoreboards.isEmpty()) - cancelUpdateTask(); - } - - /** - * Returns true if the given player is viewing the scoreboard - * - * @param player - * @return - */ - public final boolean isViewing(final Player player) { - for (final ViewedScoreboard viewed : scoreboards) - if (viewed.getViewer().equals(player)) - return true; - - return false; - } - - @Override - public final String toString() { - return "Scoreboard{title=" + getTitle() + "}"; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleSound.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleSound.java deleted file mode 100644 index 2997fbe3db73fd95e220ff639d988f432b8e386d..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleSound.java +++ /dev/null @@ -1,176 +0,0 @@ -package org.mineacademy.fo.model; - -import org.bukkit.Location; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.remain.CompSound; - -import lombok.AccessLevel; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NonNull; - -/** - * A class holding a sound, volume and a pitch - */ -@Getter -@AllArgsConstructor(access = AccessLevel.PRIVATE) -public final class SimpleSound { - - /** - * The Bukkit sound value - */ - @NonNull - private Sound sound; - - /** - * The volume value - */ - private float volume = 1.0F; - - /** - * The pitch value - */ - private float pitch = 1.0F; - - /** - * Is the pitch random? - */ - private boolean randomPitch = false; - - /** - * Is this sound enabled? - */ - private boolean enabled = true; - - /** - * Create a new sound - * - * @param sound - * @param volume - * @param pitch - */ - public SimpleSound(Sound sound, float volume, float pitch) { - this(sound, volume, pitch, false, true); - } - - /** - * Create a new sound with a random pitch - * - * @param sound - * @param volume - */ - public SimpleSound(Sound sound, float volume) { - this(sound, volume, 1.0F, true, true); - } - - /** - * Create a new sound from the raw line, - * we accept the plain SOUND name or the following syntax: SOUND VOLUME PITCH - * for example: ENTITY_PLAYER_HURT 1.0F 1.0F - * <p> - * Set to 'none' to disable - * - * @param line - */ - public SimpleSound(String line) { - Valid.checkNotNull(line); - - if ("none".equals(line)) { - this.sound = CompSound.CLICK.getSound(); - this.volume = 0.0F; - this.enabled = false; - - return; - } - - final String[] values = line.contains(", ") ? line.split(", ") : line.split(" "); - - try { - sound = CompSound.convert(values[0]); - - } catch (final IllegalArgumentException ex) { - Common.throwError(ex, "Sound '" + values[0] + "' does not exists (in your Minecraft version)!", - "Notice: Sound names has changed as per 1.9. See:", - "https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html"); - } - - if (values.length == 1) { - volume = 1F; - pitch = 1.5F; - return; - } - - Valid.checkBoolean(values.length == 3, "Malformed sound type, use format: 'sound' OR 'sound volume pitch'. Got: " + line); - Valid.checkNotNull(sound, "Unable to parse sound from: " + line); - - final String volumeRaw = values[1]; - final String pitchRaw = values[2]; - - volume = Float.parseFloat(volumeRaw); - - if ("random".equals(pitchRaw)) { - pitch = 1.0F; - randomPitch = true; - } - - else - pitch = Float.parseFloat(pitchRaw); - } - - /** - * Play the sound to the given player - * - * @param players - */ - public void play(Iterable<Player> players) { - if (enabled) - for (final Player player : players) - play(player); - } - - /** - * Play the sound to the given player - * - * @param player - */ - public void play(Player player) { - if (enabled) { - Valid.checkNotNull(sound); - - player.playSound(player.getLocation(), sound, volume, getPitch()); - } - } - - /** - * Play the sound at the given location - * - * @param location - */ - public void play(Location location) { - if (enabled) { - Valid.checkNotNull(sound); - - location.getWorld().playSound(location, sound, volume, getPitch()); - } - } - - /** - * Return the pitch or random if {@link #isRandomPitch()} is true - * - * @return - */ - public float getPitch() { - return randomPitch ? (float) Math.random() : pitch; - } - - /** - * Returns a serialized sound, does not support random pitch - */ - @Override - public String toString() { - return enabled ? sound + " " + volume + " " + (randomPitch ? "random" : pitch) : "none"; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleTime.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleTime.java deleted file mode 100644 index 6070f9d4093961f4f6a22287f1578fedc7e86982..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleTime.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.mineacademy.fo.model; - -import org.mineacademy.fo.TimeUtil; - -import lombok.Getter; -import lombok.NonNull; - -/** - * A simple class holding time values in human readable form such as 1 second or 5 minutes - */ -@Getter -public class SimpleTime { - - private final String raw; - private final long timeTicks; - - protected SimpleTime(@NonNull final String time) { - if ("0".equals(time) || "none".equalsIgnoreCase(time)) { - this.raw = "0"; - this.timeTicks = 0; - - } else { - this.raw = time; - this.timeTicks = TimeUtil.toTicks(time); - } - } - - /** - * Generate new time from the given seconds - * - * @param seconds - * @return - */ - public static SimpleTime fromSeconds(final int seconds) { - return from(seconds + " seconds"); - } - - /** - * Generate new time. Valid examples: 15 ticks 1 second 25 minutes 3 hours etc. - * or input "none" to create an instance with the time of 0 - * - * @param time - * @return - */ - public static SimpleTime from(final String time) { - return new SimpleTime(time); - } - - /** - * Get the time specified in seconds (ticks / 20) - * - * @return - */ - public long getTimeSeconds() { - return this.timeTicks / 20L; - } - - /** - * Get the time specified in ticks - * *WARNING* if the time ticks is over {@value Integer#MAX_VALUE} it will overflow! - * - * @return - */ - public int getTimeTicks() { - return (int) this.timeTicks; - } - - public String getRaw() { - return this.timeTicks == 0 ? "0" : this.raw; - } - - @Override - public String toString() { - return this.raw; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleTrait.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleTrait.java deleted file mode 100644 index 46c55fb3831798084b685a41ad6149147f2d65ab..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SimpleTrait.java +++ /dev/null @@ -1,185 +0,0 @@ -package org.mineacademy.fo.model; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.inventory.ClickType; -import org.mineacademy.fo.Messenger; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.exception.EventHandledException; - -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import net.citizensnpcs.api.event.NPCClickEvent; -import net.citizensnpcs.api.event.NPCLeftClickEvent; -import net.citizensnpcs.api.event.NPCRightClickEvent; -import net.citizensnpcs.api.trait.Trait; -import net.citizensnpcs.api.util.DataKey; - -/** - * This is a trait that will be applied to a NPC using the /trait killboss command. Each NPC gets its own instance of this class. - * The Trait class has a reference to the attached NPC class through the protected field 'npc' or getNPC(). - * The Trait class also implements Listener so you can add EventHandlers directly to your trait. - * - * @author https://wiki.citizensnpcs.co/API, improved by kangarko - */ -public abstract class SimpleTrait extends Trait { - - private int tickAmount = 0; - - @Getter(value = AccessLevel.PROTECTED) - @Setter(value = AccessLevel.PROTECTED) - private int tickThreshold; - - protected SimpleTrait(String traitName) { - super(traitName); - } - - /** - * @see net.citizensnpcs.api.trait.Trait#load(net.citizensnpcs.api.util.DataKey) - */ - @Override - public final void load(DataKey key) { - final SerializedMap map = SerializedMap.fromJson(key.getString("Data")); - - this.load(map); - } - - /** - * Here you should load up any values you have previously saved (optional). - * This does NOT get called when applying the trait for the first time, only loading onto an existing npc at server start. - * - * This is called BEFORE onSpawn, npc.getEntity() will return null. - * - * @param map - */ - protected abstract void load(SerializedMap map); - - /** - * @see net.citizensnpcs.api.trait.Trait#save(net.citizensnpcs.api.util.DataKey) - */ - @Override - public final void save(DataKey key) { - final SerializedMap map = new SerializedMap(); - - this.save(map); - - key.setString("Data", map.toJson()); - } - - /** - * Save settings for this NPC (optional). These values will be persisted to the Citizens saves file - * - * @param map - */ - protected abstract void save(SerializedMap map); - - /** - * Handle clicking. - * - * @param event - */ - @EventHandler - public final void onRightClick(NPCRightClickEvent event) { - this.handleClickEvent(event, ClickType.RIGHT); - } - - /** - * Handle clicking. - * - * @param event - */ - @EventHandler - public final void onLeftClick(NPCLeftClickEvent event) { - this.handleClickEvent(event, ClickType.LEFT); - } - - /* - * A helper method for click events - */ - private void handleClickEvent(NPCClickEvent event, ClickType clickType) { - - // Only apply this event for this particular NPC - if (!event.getNPC().equals(this.getNPC())) - return; - - final Player player = event.getClicker(); - - try { - this.onClick(player, clickType); - - } catch (final EventHandledException ex) { - if (ex.getMessages() != null) - Messenger.error(player, ex.getMessages()); - - if (ex.isCancelled()) - event.setCancelled(true); - } - } - - /** - * Called automatically when this NPC is clicked by the player. - * Only RIGHT or LEFT click types are supported. - * - * @param player - * @param clickType - * - * @throws EventHandledException - */ - public void onClick(Player player, ClickType clickType) throws EventHandledException { - } - - /** - * A helper method you can use in onX methods such as in the {@link #onClick(Player)} - * method to cancel the event with an optional error message for the player. - * - * @param playerMessage - */ - protected final void cancel(String... playerMessage) { - throw new EventHandledException(true, playerMessage); - } - - /** - * @see net.citizensnpcs.api.trait.Trait#run() - */ - @Override - public final void run() { - - if (this.tickAmount++ % this.tickThreshold == 0) { - this.tickAmount = 1; - - this.onTick(); - } - } - - /** - * Called every {@link #tickThreshold} - */ - protected abstract void onTick(); - - /** - * Run code when the NPC is spawned. Note that npc.getEntity() will be null until this method is called. - * This is called AFTER Load when the server is started. - * - * @see net.citizensnpcs.api.trait.Trait#onSpawn() - */ - @Override - public void onSpawn() { - } - - /** - * Run code when the NPC is despawned. This is called before the entity actually despawns so npc.getEntity() is still valid. - * - * @see net.citizensnpcs.api.trait.Trait#onDespawn() - */ - @Override - public void onDespawn() { - } - - /** - * Run code when the NPC is removed. - */ - @Override - public void onRemove() { - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SpigotUpdater.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SpigotUpdater.java deleted file mode 100644 index a37414f29921ab1c048abbeb8a1bf60d99f69e53..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/SpigotUpdater.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.mineacademy.fo.model; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; -import java.net.UnknownHostException; -import java.nio.channels.Channels; -import java.nio.channels.ReadableByteChannel; - -import org.bukkit.Bukkit; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.FileUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.settings.SimpleLocalization; - -import lombok.Getter; - -/** - * A simple class performing an update check for Spigot free and premium resources - */ -public class SpigotUpdater implements Runnable { - - /** - * The Spigot resource ID for your plugin - */ - @Getter - private final int resourceId; - - /** - * Should we automatically download newer versions to the {@link Bukkit#getUpdateFolder()}? - */ - private final boolean download; - - /** - * Did we found that a newer version is available? - */ - @Getter - private boolean newVersionAvailable = false; - - /** - * The newer version - */ - @Getter - private String newVersion = ""; - - /** - * Initializes the new instance to check but not to download updates - * - * @param resourceId the id of the plugin at Spigot's page - */ - public SpigotUpdater(final int resourceId) { - this(resourceId, false); - } - - /** - * Initializes a new instance. - * - * @param resourceId the id of the plugin at Spigot's page. - * @param download should we attempt to download new versions automatically? - * PLEASE NOTE YOU CAN ONLY DOWNLOAD FREE RESOURCES FROM SPIGOT NOT PREMIUM - */ - public SpigotUpdater(final int resourceId, final boolean download) { - this.resourceId = resourceId; - this.download = download; - } - - /** - * The main method in which the update check takes place. - */ - @Override - public void run() { - if (resourceId == -1) - return; - - final String currentVersion = SimplePlugin.getVersion(); - - if (!canUpdateFrom(currentVersion)) - return; - - try { - HttpURLConnection connection = (HttpURLConnection) new URL("https://api.spigotmc.org/legacy/update.php?resource=" + resourceId).openConnection(); - connection.setRequestMethod("GET"); - - try (final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) { - final String line = reader.readLine(); - - newVersion = line; - } - - if (newVersion.isEmpty()) - return; - - if (isNewerVersion(currentVersion, newVersion) && canUpdateTo(newVersion)) { - newVersionAvailable = true; - - if (download) { - final ReadableByteChannel channel; - - connection = (HttpURLConnection) new URL("https://api.spiget.org/v2/resources/" + resourceId + "/download").openConnection(); - connection.setRequestProperty("User-Agent", SimplePlugin.getNamed()); - Valid.checkBoolean(connection.getResponseCode() == 200, "Downloading update for " + SimplePlugin.getNamed() + " returned " + connection.getResponseCode() + ", aborting."); - - channel = Channels.newChannel(connection.getInputStream()); - - final File updateFolder = Bukkit.getUpdateFolderFile(); - FileUtil.createIfNotExists(updateFolder); - - final File destination = new File(updateFolder, SimplePlugin.getNamed() + "-" + newVersion + ".jar"); - final FileOutputStream output = new FileOutputStream(destination); - - output.getChannel().transferFrom(channel, 0, Long.MAX_VALUE); - output.flush(); - output.close(); - - Common.log(getDownloadMessage()); - } else - Common.log(getNotifyMessage()); - } - - } catch (final UnknownHostException ex) { - Common.log("Could not check for update from " + ex.getMessage() + "."); - - } catch (final IOException ex) { - if (ex.getMessage().startsWith("Server returned HTTP response code: 403")) { - // no permission - } else if (ex.getMessage().startsWith("Server returned HTTP response code:")) - Common.log("Could not check for update, SpigotMC site appears to be down (or unaccessible): " + ex.getMessage()); - else - Common.error(ex, "IOException performing update from SpigotMC.org check for " + SimplePlugin.getNamed()); - - } catch (final Exception ex) { - Common.error(ex, "Unknown error performing update from SpigotMC.org check for " + SimplePlugin.getNamed()); - } - } - - /** - * Return if the current version is suitable for upgrading from. - * <p> - * By default we do not update if it contains SNAPSHOT or DEV. - * - * @param currentVersion - * @return - */ - protected boolean canUpdateFrom(final String currentVersion) { - return !currentVersion.contains("SNAPSHOT") && !currentVersion.contains("DEV"); - } - - /** - * Return if the new version is suitable for upgrading to. - * <p> - * By default we do not update if it contains SNAPSHOT or DEV. - * - * @param newVersion - * @return - */ - protected boolean canUpdateTo(final String newVersion) { - return !newVersion.contains("SNAPSHOT") && !newVersion.contains("DEV"); - } - - /** - * Returns true if the remote version is greater than the current version - * - * @param current - * @param remote - * @return - */ - private boolean isNewerVersion(final String current, final String remote) { - if (remote.contains("-LEGACY")) - return false; - - String[] currParts = removeTagsInNumber(current).split("\\."); - String[] remoteParts = removeTagsInNumber(remote).split("\\."); - - if (currParts.length != remoteParts.length) { - final boolean olderIsLonger = currParts.length > remoteParts.length; - final String[] modifiedParts = new String[olderIsLonger ? currParts.length : remoteParts.length]; - - for (int i = 0; i < (olderIsLonger ? currParts.length : remoteParts.length); i++) - modifiedParts[i] = olderIsLonger ? remoteParts.length > i ? remoteParts[i] : "0" : currParts.length > i ? currParts[i] : "0"; - - if (olderIsLonger) - remoteParts = modifiedParts; - else - currParts = modifiedParts; - } - - for (int i = 0; i < currParts.length; i++) { - if (Integer.parseInt(currParts[i]) > Integer.parseInt(remoteParts[i])) - return false; - - if (Integer.parseInt(remoteParts[i]) > Integer.parseInt(currParts[i])) - return true; - } - - return false; - } - - /** - * Removes some tags such as -BETA in the current/new version number by splitting the version - * by "-" and then returning the first part - * - * @param raw - * @return - */ - protected String removeTagsInNumber(final String raw) { - return raw.split("\\-")[0]; - } - - /** - * Returns the update message, by default {@link SimpleLocalization.Update#AVAILABLE} - * <p> - * To change this message change your localization and refer to {@link #replaceVariables(String)} method - * - * @return - */ - public final String getNotifyMessage() { - return replaceVariables(SimpleLocalization.Update.AVAILABLE); - } - - /** - * Returns the download success message, by default {@link SimpleLocalization.Update#DOWNLOADED} - * <p> - * To change this message change your localization and refer to {@link #replaceVariables(String)} method - * - * @return - */ - public final String getDownloadMessage() { - return replaceVariables(SimpleLocalization.Update.DOWNLOADED); - } - - /** - * Used to replace variables in the update log/notify/downloaded message such - * as {new} {current} and {plugin_name} - * - * @param message - * @return - */ - protected String replaceVariables(final String message) { - return message - .replace("{resource_id}", resourceId + "") - .replace("{plugin_name}", SimplePlugin.getNamed()) - .replace("{new}", newVersion) - .replace("{current}", SimplePlugin.getVersion()) - .replace("{user_id}", "%%__USER__%%"); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Triple.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Triple.java deleted file mode 100644 index f50ad7526931749f4b45cc213ac6c8ba6f99290d..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Triple.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.mineacademy.fo.model; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * A simple placeholder for storing three values - * - * @param <A> - * @param <B> - * @param <C> - */ -@Getter -@RequiredArgsConstructor -public class Triple<A, B, C> { - - /** - * The first value we hold - */ - private final A first; - - /** - * The second value we hold - */ - private final B second; - - /** - * The third value we hold - */ - private final C third; -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Tuple.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Tuple.java deleted file mode 100644 index 69834b6b64207b371cd51d3037a94e60cd2d0be0..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Tuple.java +++ /dev/null @@ -1,105 +0,0 @@ -package org.mineacademy.fo.model; - -import org.mineacademy.fo.SerializeUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.exception.FoException; - -import lombok.Data; - -/** - * Simple tuple for key-value pairs - */ -@Data -public final class Tuple<K, V> implements ConfigSerializable { - - /** - * The key - */ - private final K key; - - /** - * The value - */ - private final V value; - - /** - * @see org.mineacademy.fo.model.ConfigSerializable#serialize() - */ - @Override - public SerializedMap serialize() { - return SerializedMap.ofArray("Key", key, "Value", value); - } - - /** - * Return this tuple in X - Y syntax - * - * @return - */ - public String toLine() { - return key + " - " + value; - } - - /** - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return this.toLine(); - } - - /** - * Transform the given config section to tuple - * - * @param <K> - * @param <V> - * @param map - * @param keyType - * @param valueType - * @return - */ - public static <K, V> Tuple<K, V> deserialize(SerializedMap map, Class<K> keyType, Class<V> valueType) { - final K key = SerializeUtil.deserialize(keyType, map.getObject("Key")); - final V value = SerializeUtil.deserialize(valueType, map.getObject("Value")); - - return new Tuple<>(key, value); - } - - /** - * Deserialize the given line (it must have the KEY - VALUE syntax) into the given tuple - * - * @param <K> - * @param <V> - * @param line - * @param keyType - * @param valueType - * @return tuple or null if line is null - */ - public static <K, V> Tuple<K, V> deserialize(String line, Class<K> keyType, Class<V> valueType) { - if (line == null) - return null; - - final String split[] = line.split(" - "); - Valid.checkBoolean(split.length == 2, "Line must have the syntax <" + keyType.getSimpleName() + "> - <" + valueType.getSimpleName() + "> but got: " + line); - - final K key = SerializeUtil.deserialize(keyType, split[0]); - final V value = SerializeUtil.deserialize(valueType, split[1]); - - return new Tuple<>(key, value); - } - - /** - * Do not use - * - * @param <K> - * @param <V> - * @param map - * - * @deprecated do not use - * @return - */ - @Deprecated - public static <K, V> Tuple<K, V> deserialize(SerializedMap map) { - throw new FoException("Tuple cannot be deserialized automatically, call Tuple#deserialize(map, keyType, valueType)"); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/UUIDToNameConverter.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/UUIDToNameConverter.java deleted file mode 100644 index 275d6d140a73f03cc55be22d176e33ea01f53771..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/UUIDToNameConverter.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.mineacademy.fo.model; - -import java.io.InputStreamReader; -import java.net.HttpURLConnection; -import java.net.URL; -import java.util.UUID; -import java.util.concurrent.Callable; - -import com.google.gson.Gson; -import com.google.gson.JsonObject; - -import lombok.RequiredArgsConstructor; - -/** - * Utility class for connecting to Mojang servers to get the players name from a - * given UUID - */ -@RequiredArgsConstructor -public class UUIDToNameConverter implements Callable<String> { - - /** - * The URL to connect to - */ - private static final String PROFILE_URL = "https://sessionserver.mojang.com/session/minecraft/profile/"; - - /** - * The JSON parser library - */ - private final Gson gson = new Gson(); - - /** - * The UUID to convert to name - */ - private final UUID uuid; - - /** - * Attempts to connect to Mojangs servers to retrieve the current player - * username from his unique id - * <p> - * Runs on the main thread - */ - @Override - public String call() throws Exception { - - final HttpURLConnection connection = (HttpURLConnection) new URL(PROFILE_URL + uuid.toString().replace("-", "")).openConnection(); - final JsonObject response = gson.fromJson(new InputStreamReader(connection.getInputStream()), JsonObject.class); - final String name = response.get("name").getAsString(); - - if (name == null) - return ""; - - final String cause = response.get("cause").getAsString(); - final String errorMessage = response.get("errorMessage").getAsString(); - - if (cause != null && cause.length() > 0) - throw new IllegalStateException(errorMessage); - - return name; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Variable.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Variable.java deleted file mode 100644 index b42bcd4ae205edeb7e0ea2c7bf1b1531a26e56b7..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Variable.java +++ /dev/null @@ -1,435 +0,0 @@ -package org.mineacademy.fo.model; - -import java.util.List; -import java.util.Map; -import java.util.function.Function; - -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.settings.YamlConfig; - -import lombok.Getter; -import lombok.NonNull; -import lombok.RequiredArgsConstructor; - -public final class Variable extends YamlConfig { - - /** - * Return the prototype file path for the given variable field name - */ - public static Function<String, String> PROTOTYPE_PATH = t -> NO_DEFAULT; - - /** - * A list of all loaded variables - */ - private static final ConfigItems<Variable> loadedVariables = ConfigItems.fromFolder("variable", "variables", Variable.class); - - /** - * The kind of this variable - */ - @Getter - private Type type; - - /** - * The variable key what we should find - */ - @Getter - private String key; - - /** - * The variable value what we should replace the key with - * JavaScript engine - */ - private String value; - - /** - * The JavaScript condition that must return TRUE for this variable to be shown - */ - - @Getter - private String senderCondition; - - /** - * The JavaScript condition that must return TRUE for this variable to be shown to a receiver - */ - - @Getter - private String receiverCondition; - - /** - * The permission the sender must have to show the part - */ - - @Getter - private String senderPermission; - - /** - * The permission receiver must have to see the part - */ - - @Getter - private String receiverPermission; - - /** - * The hover text or null if not set - */ - @Getter - - private List<String> hoverText; - - /** - * The JavaScript pointing to a particular {@link ItemStack} - */ - @Getter - - private String hoverItem; - - /** - * What URL should be opened on click? Null if none - */ - @Getter - - private String openUrl; - - /** - * What command should be suggested on click? Null if none - */ - @Getter - - private String suggestCommand; - - /** - * What command should be run on click? Null if none - */ - @Getter - - private String runCommand; - - /* - * Shall we save comments for this file? - */ - private final boolean saveComments; - - /* - * Create and load a new variable (automatically called) - */ - private Variable(String file) { - final String prototypePath = PROTOTYPE_PATH.apply(file); - - this.saveComments = prototypePath != null; - this.loadConfiguration(prototypePath, "variables/" + file + ".yml"); - } - - /** - * @see org.mineacademy.fo.settings.YamlConfig#saveComments() - */ - @Override - protected boolean saveComments() { - return saveComments; - } - - // ---------------------------------------------------------------------------------- - // Loading - // ---------------------------------------------------------------------------------- - - /** - * @see org.mineacademy.fo.settings.YamlConfig#onLoadFinish() - */ - @Override - protected void onLoadFinish() { - - this.type = get("Type", Type.class); - this.key = getString("Key"); - this.value = getString("Value"); - this.senderCondition = getString("Sender_Condition"); - this.receiverCondition = getString("Receiver_Condition"); - this.senderPermission = getString("Sender_Permission"); - this.receiverPermission = getString("Receiver_Permission"); - - // Correct common mistakes - if (this.type == null) { - this.type = Type.FORMAT; - - save(); - } - - if (this.key.startsWith("{") || this.key.startsWith("[")) { - this.key = this.key.substring(1); - - save(); - } - - if (this.key.endsWith("}") || this.key.endsWith("]")) { - this.key = this.key.substring(0, this.key.length() - 1); - - save(); - } - - if (this.type == Type.MESSAGE) { - this.hoverText = getStringList("Hover"); - this.hoverItem = getString("Hover_Item"); - this.openUrl = getString("Open_Url"); - this.suggestCommand = getString("Suggest_Command"); - this.runCommand = getString("Run_Command"); - } - - // Check for known mistakes - if (this.key == null || this.key.isEmpty()) - throw new NullPointerException("(DO NOT REPORT, PLEASE FIX YOURSELF) Please set 'Key' as variable name in " + getFile()); - - if (this.value == null || this.value.isEmpty()) - throw new NullPointerException("(DO NOT REPORT, PLEASE FIX YOURSELF) Please set 'Value' key as what the variable shows in " + getFile() + " (this can be a JavaScript code)"); - - // Test for key validity - if (!Common.regExMatch("^\\w+$", this.key)) - throw new IllegalArgumentException("(DO NOT REPORT, PLEASE FIX YOURSELF) The 'Key' variable in " + getFile() + " must only contains letters, numbers or underscores. Do not write [] or {} there!"); - } - - /** - * Return this class as a map - * - * @return - */ - @Override - public SerializedMap serialize() { - final SerializedMap map = new SerializedMap(); - - map.putIf("Type", this.type); - map.putIf("Key", this.key); - map.putIf("Sender_Condition", this.senderCondition); - map.putIf("Receiver_Condition", this.receiverCondition); - map.putIf("Hover", this.hoverText); - map.putIf("Hover_Item", this.hoverItem); - map.putIf("Open_Url", this.openUrl); - map.putIf("Suggest_Command", this.suggestCommand); - map.putIf("Run_Command", this.runCommand); - map.putIf("Sender_Permission", this.senderPermission); - map.putIf("Receiver_Permission", this.receiverPermission); - - return map; - } - - // ---------------------------------------------------------------------------------- - // Getters - // ---------------------------------------------------------------------------------- - - /** - * Runs the script for the given player and the replacements, - * returns the output - * - * @param sender - * @param replacements - * @return - */ - public String getValue(CommandSender sender, Map<String, Object> replacements) { - Variables.REPLACE_JAVASCRIPT = false; - - try { - // Replace variables in script - final String script = Variables.replace(this.value, sender, replacements); - final String result = String.valueOf(JavaScriptExecutor.run(script, sender)); - - return result; - - } catch (final RuntimeException ex) { - - // Assume console or Discord lack proper methods to call - if (sender instanceof Player) - throw ex; - - return ""; - - } finally { - Variables.REPLACE_JAVASCRIPT = true; - } - } - - /** - * Create the variable and append it to the existing component as if the player initiated it - * - * @param sender - * @param existingComponent - * @return - */ - public SimpleComponent build(CommandSender sender, SimpleComponent existingComponent, Map<String, Object> replacements) { - - if (this.senderPermission != null && !this.senderPermission.isEmpty() && !PlayerUtil.hasPerm(sender, this.senderPermission)) - return SimpleComponent.of(""); - - if (this.senderCondition != null && !this.senderCondition.isEmpty()) { - final Object result = JavaScriptExecutor.run(this.senderCondition, sender); - - if (result != null) { - Valid.checkBoolean(result instanceof Boolean, "Variable '" + getName() + "' option Condition must return boolean not " + (result == null ? "null" : result.getClass())); - - if ((boolean) result == false) - return SimpleComponent.of(""); - } - } - - final String value = this.getValue(sender, replacements); - - if (value == null || value.isEmpty() || "null".equals(value)) - return SimpleComponent.of(""); - - final SimpleComponent component = existingComponent - .append(Variables.replace(value, sender, replacements)) - .viewPermission(this.receiverPermission) - .viewCondition(this.receiverCondition); - - if (!Valid.isNullOrEmpty(this.hoverText)) - component.onHover(Variables.replace(this.hoverText, sender, replacements)); - - if (this.hoverItem != null && !this.hoverItem.isEmpty()) { - final Object result = JavaScriptExecutor.run(Variables.replace(this.hoverItem, sender, replacements), sender); - Valid.checkBoolean(result instanceof ItemStack, "Variable '" + getName() + "' option Hover_Item must return ItemStack not " + result.getClass()); - - component.onHover((ItemStack) result); - } - - if (this.openUrl != null && !this.openUrl.isEmpty()) - component.onClickOpenUrl(Variables.replace(this.openUrl, sender, replacements)); - - if (this.suggestCommand != null && !this.suggestCommand.isEmpty()) - component.onClickSuggestCmd(Variables.replace(this.suggestCommand, sender, replacements)); - - if (this.runCommand != null && !this.runCommand.isEmpty()) - component.onClickRunCmd(Variables.replace(this.runCommand, sender, replacements)); - - return component; - } - - /** - * @see org.mineacademy.fo.settings.YamlConfig#toString() - */ - @Override - public String toString() { - return serialize().toStringFormatted(); - } - - // ------–------–------–------–------–------–------–------–------–------–------–------– - // Static - // ------–------–------–------–------–------–------–------–------–------–------–------– - - /** - * Creates a new variable and loads - * - * @param name - */ - public static void createVariable(String name) { - loadedVariables.loadOrCreateItem(name); - } - - /** - * Load all variables from variables/ folder - */ - public static void loadVariables() { - loadedVariables.loadItems(); - } - - /** - * Remove the given variable in case it exists - * - * @param variable - */ - public static void removeVariable(final Variable variable) { - loadedVariables.removeItem(variable); - } - - /** - * Return true if the given variable by key is loaded - * - * @param name - * @return - */ - public static boolean isVariableLoaded(final String name) { - return loadedVariables.isItemLoaded(name); - } - - /** - * Return a variable, or null if not loaded - * - * @param name - * @return - */ - public static Variable findVariable(@NonNull final String name) { - for (final Variable item : getVariables()) - if (item.getKey().equalsIgnoreCase(name)) - return item; - - return null; - } - - /** - * Return a list of all variables - * - * @return - */ - public static List<Variable> getVariables() { - return loadedVariables.getItems(); - } - - /** - * Return a list of all variable names - * - * @return - */ - public static List<String> getVariableNames() { - return loadedVariables.getItemNames(); - } - - // ------–------–------–------–------–------–------–------–------–------–------–------– - // Classes - // ------–------–------–------–------–------–------–------–------–------–------–------– - - /** - * Represents a variable type - */ - @RequiredArgsConstructor - public enum Type { - - /** - * This variable is used in chat format and "server to player" messages - * Cannot be used by players. Example: [{channel}] {player}: {message} - */ - FORMAT("format"), - - /** - * This variable can be used by players in chat such as "I have an [item]" - */ - MESSAGE("message"),; - - /** - * The saveable non-obfuscated key - */ - @Getter - private final String key; - - /** - * Attempt to load the type from the given config key - * - * @param key - * @return - */ - public static Type fromKey(String key) { - for (final Type mode : values()) - if (mode.key.equalsIgnoreCase(key)) - return mode; - - throw new IllegalArgumentException("No such item type: " + key + ". Available: " + Common.join(values())); - } - - /** - * Returns {@link #getKey()} - */ - @Override - public String toString() { - return this.key; - } - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Variables.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Variables.java deleted file mode 100644 index 504fcf4dc477bf0f26bf09a72e67e129813f629f..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Variables.java +++ /dev/null @@ -1,512 +0,0 @@ -package org.mineacademy.fo.model; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import java.util.function.Function; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; -import org.bukkit.command.ConsoleCommandSender; -import org.bukkit.entity.Player; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.GeoAPI; -import org.mineacademy.fo.GeoAPI.GeoResponse; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.TimeUtil; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.collection.expiringmap.ExpiringMap; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.fo.settings.SimpleSettings; - -/** - * A simple engine that replaces variables in a message. - */ -public final class Variables { - - /** - * The pattern to find singular [syntax_name] variables - */ - public static final Pattern MESSAGE_PLACEHOLDER_PATTERN = Pattern.compile("[\\[]([^\\[\\]]+)[\\]]"); - - /** - * The pattern to find simple {} placeholders - */ - public static final Pattern BRACKET_PLACEHOLDER_PATTERN = Pattern.compile("[({|%)]([^{}]+)[(}|%)]"); - - /** - * The patter to find simple {} placeholders starting with {rel_ (used for PlaceholderAPI) - */ - public static final Pattern BRACKET_REL_PLACEHOLDER_PATTERN = Pattern.compile("[({|%)](rel_)([^}]+)[(}|%)]"); - - /** - * Player - [Original Message - Translated Message] - */ - private static final Map<String, Map<String, String>> cache = ExpiringMap.builder().expiration(500, TimeUnit.MILLISECONDS).build(); - - /** - * Should we replace javascript placeholders from variables/ folder automatically? - * Used internally to prevent race condition - */ - static boolean REPLACE_JAVASCRIPT = true; - - // ------------------------------------------------------------------------------------------------------------ - // Custom variables - // ------------------------------------------------------------------------------------------------------------ - - /** - * Variables added to Foundation by you or other plugins - * - * You take in a command sender (may/may not be a player) and output a replaced string. - * The variable name (the key) is automatically surrounded by {} brackets - */ - private static final StrictMap<String, Function<CommandSender, String>> customVariables = new StrictMap<>(); - - /** - * Variables added to Foundation by you or other plugins - * - * This is used to dynamically replace the variable based on its content, like - * PlaceholderAPI. - * - * We also hook into PlaceholderAPI, however, you'll have to use your plugin's prefix before - * all variables when called from there. - */ - private static final StrictList<SimpleExpansion> customExpansions = new StrictList<>(); - - /** - * Return the variable for the given key that is a function of replacing - * itself for the player. Returns null if no such variable by key is present. - * - * @return - */ - - public static Function<CommandSender, String> getVariable(String key) { - return customVariables.get(key); - } - - /** - * Register a new variable. The variable will be found inside {} block so if you give the variable - * name player_health it will be {player_health}. The function takes in a command sender (can be player) - * and outputs the variable value. - * <p> - * Please keep in mind we replace your variables AFTER PlaceholderAPI and Javascript variables - * - * @param variable - * @param replacer - */ - public static void addVariable(String variable, Function<CommandSender, String> replacer) { - customVariables.override(variable, replacer); - } - - /** - * Removes an existing variable, only put the name here without brackets, e.g. player_name not {player_name} - * This fails when the variables does not exist - * - * @param variable - */ - public static void removeVariable(String variable) { - customVariables.remove(variable); - } - - /** - * Checks if the given variable exist. Warning: only put the name here without brackets, - * e.g. player_name not {player_name} - * - * @param variable - * @return - */ - public static boolean hasVariable(String variable) { - return customVariables.contains(variable); - } - - /** - * Return an immutable list of all currently loaded expansions - * - * @return - */ - public static List<SimpleExpansion> getExpansions() { - return Collections.unmodifiableList(customExpansions.getSource()); - } - - /** - * Registers a new expansion if it was not already registered - * - * @param expansion - */ - public static void addExpansion(SimpleExpansion expansion) { - customExpansions.addIfNotExist(expansion); - } - - /** - * Unregisters an expansion if it was registered already - * - * @param expansion - */ - public static void removeExpansion(SimpleExpansion expansion) { - customExpansions.remove(expansion); - } - - /** - * Return true if the expansion has already been registered - * - * @param expansion - * @return - */ - public static boolean hasExpansion(SimpleExpansion expansion) { - return customExpansions.contains(expansion); - } - - // ------------------------------------------------------------------------------------------------------------ - // Replacing - // ------------------------------------------------------------------------------------------------------------ - - /** - * @deprecated, use {@link #replace(String, CommandSender)} as it will work the same - */ - @Deprecated - public static String replace(boolean replaceCustom, String message, CommandSender sender) { - return replace(message, sender); - } - - /** - * Replaces variables in the messages using the message sender as an object to replace - * player-related placeholders. - * - * We also support PlaceholderAPI and MvdvPlaceholderAPI (only if sender is a Player). - * - * @param messages - * @param sender - * @return - */ - public static List<String> replace(Iterable<String> messages, CommandSender sender, Map<String, Object> replacements) { - - // Trick: Join the lines to only parse variables at once -- performance++ -- then split again - final String deliminer = "%FLVJ%"; - - return Arrays.asList(replace(String.join(deliminer, messages), sender, replacements).split(deliminer)); - } - - /** - * Replaces variables in the message using the message sender as an object to replace - * player-related placeholders. - * - * We also support PlaceholderAPI and MvdvPlaceholderAPI (only if sender is a Player). - * - * @param message - * @param sender - * @return - */ - public static String replace(String message, CommandSender sender) { - return replace(message, sender, null); - } - - /** - * Replaces variables in the message using the message sender as an object to replace - * player-related placeholders. - * - * We also support PlaceholderAPI and MvdvPlaceholderAPI (only if sender is a Player). - * - * @param message - * @param sender - * @return - */ - public static String replace(String message, CommandSender sender, Map<String, Object> replacements) { - return replace(message, sender, replacements, true); - } - - /** - * Replaces variables in the message using the message sender as an object to replace - * player-related placeholders. - * - * We also support PlaceholderAPI and MvdvPlaceholderAPI (only if sender is a Player). - * - * @param message - * @param sender - * @param colorize - * @return - */ - public static String replace(String message, CommandSender sender, Map<String, Object> replacements, boolean colorize) { - if (message == null || message.isEmpty()) - return ""; - - final String original = message; - final boolean senderIsPlayer = sender instanceof Player; - - // Replace custom variables first - if (replacements != null && !replacements.isEmpty()) - message = Replacer.replaceArray(message, replacements); - - if (senderIsPlayer) { - - // Already cached ? Return. - final Map<String, String> cached = cache.get(sender.getName()); - final String cachedVar = cached != null ? cached.get(message) : null; - - if (cachedVar != null) - return cachedVar; - } - - // Custom placeholders - if (REPLACE_JAVASCRIPT) { - REPLACE_JAVASCRIPT = false; - - try { - message = replaceJavascriptVariables0(message, sender, replacements); - - } finally { - REPLACE_JAVASCRIPT = true; - } - } - - if (senderIsPlayer) { - - // PlaceholderAPI and MvdvPlaceholderAPI - message = HookManager.replacePlaceholders((Player) sender, message); - } - - // Default - message = replaceHardVariables0(sender, message); - - // Support the & color system - if (!message.startsWith("[JSON]")) - message = Common.colorize(message); - - if (senderIsPlayer) { - final Map<String, String> map = cache.get(sender.getName()); - - if (map != null) - map.put(original, message); - else - cache.put(sender.getName(), Common.newHashMap(original, message)); - } - - return message; - } - - /* - * Replaces JavaScript variables in the message - */ - private static String replaceJavascriptVariables0(String message, CommandSender sender, Map<String, Object> replacements) { - - final Matcher matcher = BRACKET_PLACEHOLDER_PATTERN.matcher(message); - - while (matcher.find()) { - final String variableKey = matcher.group(); - - // Find the variable key without [] - final Variable variable = Variable.findVariable(variableKey.substring(1, variableKey.length() - 1)); - - if (variable != null && variable.getType() == Variable.Type.FORMAT) { - final SimpleComponent component = variable.build(sender, SimpleComponent.empty(), replacements); - - // We do not support interact chat elements in format variables, - // so we just flatten the variable. Use formatting or chat variables instead. - String plain = component.getPlainMessage(); - - // And we remove the white prefix that is by default added in every component - if (plain.startsWith(ChatColor.COLOR_CHAR + "f" + ChatColor.COLOR_CHAR + "f")) - plain = plain.substring(4); - - message = message.replace(variableKey, plain); - } - } - - return message; - } - - /* - * Replaces our hardcoded variables in the message, using a cache for better performance - */ - private static String replaceHardVariables0(CommandSender sender, String message) { - final Matcher matcher = Variables.BRACKET_PLACEHOLDER_PATTERN.matcher(message); - final Player player = sender instanceof Player ? (Player) sender : null; - - while (matcher.find()) { - String variable = matcher.group(1); - boolean frontSpace = false; - boolean backSpace = false; - - if (variable.startsWith("+")) { - variable = variable.substring(1); - - frontSpace = true; - } - - if (variable.endsWith("+")) { - variable = variable.substring(0, variable.length() - 1); - - backSpace = true; - } - - String value = lookupVariable0(player, sender, variable); - - if (value != null) { - final boolean emptyColorless = Common.stripColors(value).isEmpty(); - value = value.isEmpty() ? "" : (frontSpace && !emptyColorless ? " " : "") + Common.colorize(value) + (backSpace && !emptyColorless ? " " : ""); - - message = message.replace(matcher.group(), value); - } - } - - return message; - } - - /* - * Replaces the given variable with a few hardcoded within the plugin, see below - */ - private static String lookupVariable0(Player player, CommandSender console, String variable) { - GeoResponse geoResponse = null; - - if (player != null && Arrays.asList("country_code", "country_name", "region_name", "isp").contains(variable)) - geoResponse = GeoAPI.getCountry(player.getAddress()); - - if (console != null) { - - // Replace custom expansions - for (final SimpleExpansion expansion : customExpansions) { - final String value = expansion.replacePlaceholders(console, variable); - - if (value != null) - return value; - } - - // Replace custom variables - final Function<CommandSender, String> customReplacer = customVariables.get(variable); - - if (customReplacer != null) - return customReplacer.apply(console); - } - - switch (variable) { - case "server_name": - return Remain.getServerName(); - case "nms_version": - return MinecraftVersion.getServerVersion(); - case "timestamp": - return SimpleSettings.TIMESTAMP_FORMAT.format(System.currentTimeMillis()); - case "timestamp_short": - return TimeUtil.getFormattedDateShort(); - case "chat_line": - return Common.chatLine(); - case "chat_line_smooth": - return Common.chatLineSmooth(); - case "town": - return player == null ? "" : HookManager.getTownName(player); - case "nation": - return player == null ? "" : HookManager.getNation(player); - case "faction": - return player == null ? "" : HookManager.getFaction(player); - - case "world": - return player == null ? "" : HookManager.getWorldAlias(player.getWorld()); - case "health": - return player == null ? "" : formatHealth0(player) + ChatColor.RESET; - case "location": - return player == null ? "" : Common.shortLocation(player.getLocation()); - case "x": - return player == null ? "" : String.valueOf(player.getLocation().getBlockX()); - case "y": - return player == null ? "" : String.valueOf(player.getLocation().getBlockY()); - case "z": - return player == null ? "" : String.valueOf(player.getLocation().getBlockZ()); - - case "player": - case "player_name": - return player == null ? Common.resolveSenderName(console) : player.getName(); - case "tab_name": - return player == null ? Common.resolveSenderName(console) : player.getPlayerListName(); - case "display_name": - return player == null ? Common.resolveSenderName(console) : player.getDisplayName(); - case "player_nick": - case "nick": - return player == null ? Common.resolveSenderName(console) : HookManager.getNickColored(player); - - case "player_prefix": - case "pl_prefix": - return player == null ? "" : HookManager.getPlayerPrefix(player); - case "player_suffix": - case "pl_suffix": - return player == null ? "" : HookManager.getPlayerSuffix(player); - case "player_group": - case "pl_group": - return player == null ? "" : HookManager.getPlayerPermissionGroup(player); - case "player_primary_group": - case "pl_primary_group": - return player == null ? "" : HookManager.getPlayerPrimaryGroup(player); - case "ip_address": - case "pl_address": - return player == null ? "" : formatIp0(player); - - case "player_vanished": - return player == null ? "false" : String.valueOf(PlayerUtil.isVanished(player)); - - case "country_code": - return player == null ? "" : geoResponse.getCountryCode(); - case "country_name": - return player == null ? "" : geoResponse.getCountryName(); - case "region_name": - return player == null ? "" : geoResponse.getRegionName(); - case "isp": - return player == null ? "" : geoResponse.getIsp(); - - case "label": - return SimplePlugin.getInstance().getMainCommand() != null ? SimplePlugin.getInstance().getMainCommand().getLabel() : "noMainCommandLabel"; - case "sender_is_player": - return player != null ? "true" : "false"; - case "sender_is_discord": - return console instanceof DiscordSender ? "true" : "false"; - case "sender_is_console": - return console instanceof ConsoleCommandSender ? "true" : "false"; - - case "plugin_prefix": - return SimpleSettings.PLUGIN_PREFIX; - case "info_prefix": - case "prefix_info": - return org.mineacademy.fo.Messenger.getInfoPrefix(); - case "success_prefix": - case "prefix_success": - return org.mineacademy.fo.Messenger.getSuccessPrefix(); - case "warn_prefix": - case "prefix_warn": - return org.mineacademy.fo.Messenger.getWarnPrefix(); - case "error_prefix": - case "prefix_error": - return org.mineacademy.fo.Messenger.getErrorPrefix(); - case "question_prefix": - case "prefix_question": - return org.mineacademy.fo.Messenger.getQuestionPrefix(); - case "announce_prefix": - case "prefix_announce": - return org.mineacademy.fo.Messenger.getAnnouncePrefix(); - } - - return null; - } - - /* - * Formats the {health} variable - */ - private static String formatHealth0(Player player) { - final int hp = Remain.getHealth(player); - - return (hp > 10 ? ChatColor.DARK_GREEN : hp > 5 ? ChatColor.GOLD : ChatColor.RED) + "" + hp; - } - - /* - * Formats the IP address variable for the player - */ - private static String formatIp0(Player player) { - try { - return player.getAddress().toString().split("\\:")[0]; - } catch (final Throwable t) { - return player.getAddress() != null ? player.getAddress().toString() : ""; - } - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Whiteblacklist.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Whiteblacklist.java deleted file mode 100644 index 9dd37f1b2f0a609259b3db944d6636b14d318b23..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/model/Whiteblacklist.java +++ /dev/null @@ -1,143 +0,0 @@ -package org.mineacademy.fo.model; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.mineacademy.fo.Valid; - -import lombok.Getter; -import lombok.NonNull; - -/** - * Represents a simple way of checking for whitelist or blacklist according - * to the list, see {@link #Whiteblacklist(List)} - */ -@Getter -public final class Whiteblacklist { - - /** - * The list of items - */ - private final Set<String> items; - - /** - * Used for matching items against an item - * - * true = except - * false = only - */ - private final boolean whitelist; - - /** - * Special flag if the list is set to ["*"], that will always return true for - * everything - */ - private final boolean entireList; - - /** - * Create a new white black list from the given list - * - * If the first line equals to '@blacklist', matching will be - * blacklisting (only rules), otherwise this will be a whitelist (except rules) - */ - public Whiteblacklist(@NonNull List<String> items) { - if (!items.isEmpty()) { - final String firstLine = items.get(0); - - // Identify if the first line contains our flags - this.entireList = firstLine.equals("*"); - this.whitelist = !firstLine.equals("@blacklist") && !entireList; - - final List<String> newItems = new ArrayList<>(items); - - // If yes, remove it from the list - if (this.entireList || firstLine.equals("@blacklist")) - newItems.remove(0); - - this.items = new HashSet<>(this.whitelist ? items : newItems); - } - - else { - this.items = new HashSet<>(); - this.whitelist = true; - this.entireList = false; - } - } - - /** - * Return true if {@link Valid#isInList(String, Iterable)} returns true - * inverting it according to the {@link #isWhitelist()} flag - * - * @param item - * @return - */ - public boolean isInList(String item) { - if (entireList) - return true; - - final boolean match = Valid.isInList(item, this.items); - - return whitelist ? match : !match; - } - - /** - * Return true if {@link Valid#isInListRegex(String, Iterable)} returns true - * inverting it according to the {@link #isWhitelist()} flag - * - * @param item - * @return - */ - public boolean isInListRegex(String item) { - if (entireList) - return true; - - final boolean match = Valid.isInListRegex(item, this.items); - - return whitelist ? match : !match; - } - - /** - * Return true if {@link Valid#isInListContains(String, Iterable)} returns true - * inverting it according to the {@link #isWhitelist()} flag - * - * @param item - * @return - * - * @deprecated can lead to unwanted matches such as when /time is in list, /t will also get caught - */ - @Deprecated - public boolean isInListContains(String item) { - if (entireList) - return true; - - final boolean match = Valid.isInListContains(item, this.items); - - return whitelist ? match : !match; - } - - /** - * Return true if {@link Valid#isInListStartsWith(String, Iterable)} returns true - * inverting it according to the {@link #isWhitelist()} flag - * - * @param item - * @return - */ - public boolean isInListStartsWith(String item) { - if (entireList) - return true; - - final boolean match = Valid.isInListStartsWith(item, this.items); - - return whitelist ? match : !match; - } - - /** - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "{" + (entireList ? "entire list" : whitelist ? "whitelist" : "blacklist") + " " + this.items + "}"; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/plugin/FoundationFilter.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/plugin/FoundationFilter.java deleted file mode 100644 index 6cca57881aad9792b624c92355e53d1b17d1a5a3..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/plugin/FoundationFilter.java +++ /dev/null @@ -1,275 +0,0 @@ -package org.mineacademy.fo.plugin; - -import java.io.PrintStream; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.LogRecord; - -import org.apache.logging.log4j.Level; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Marker; -import org.apache.logging.log4j.core.LogEvent; -import org.apache.logging.log4j.core.Logger; -import org.apache.logging.log4j.message.Message; -import org.bukkit.Bukkit; -import org.bukkit.plugin.Plugin; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.settings.SimpleSettings; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.Setter; - -/** - * Represents the console filtering module - */ -final class FoundationFilter { - - /** - * The messages we should filter, plugin authors can customize this in {@link SimplePlugin} - */ - @Setter(value = AccessLevel.PACKAGE) - private static List<String> MESSAGES_TO_FILTER = new ArrayList<>(); - - /** - * Start filtering the console - */ - public static void inject() { - - // Set filter for System out - System.setOut(new FilterSystem()); - - // Set filter for Bukkit - final FilterLegacy filter = new FilterLegacy(); - - for (final Plugin plugin : Bukkit.getPluginManager().getPlugins()) - plugin.getLogger().setFilter(filter); - - Bukkit.getLogger().setFilter(filter); - - // Set Log4j filter - try { - FilterLog4j.inject(); - - } catch (final Throwable t) { - // Ignore for legacy MC - } - } - - /* - * Return true if the message is filtered - */ - static boolean isFiltered(String message) { - if (message == null || message.isEmpty()) - return false; - - // Replace & color codes only if server is available - if (Bukkit.getServer() != null) - message = Common.stripColors(message); - - // Filter a warning since we've already patched this with NashornPlus extension - if (message.equals("Warning: Nashorn engine is planned to be removed from a future JDK release")) - return true; - - // One less spammy message for server owners - if (message.endsWith("which is not a depend, softdepend or loadbefore of this plugin.")) - return true; - - message = message.toLowerCase(); - - // Only filter this after plugin has been fully enabled - if (!SimpleSettings.MAIN_COMMAND_ALIASES.isEmpty()) { - - // Filter inbuilt Foundation or ChatControl commands - if (message.contains("issued server command: /" + SimpleSettings.MAIN_COMMAND_ALIASES.get(0) + " internal") || message.contains("issued server command: /#flp")) - return true; - - // Filter user-defined commands - if (SimplePlugin.hasInstance()) - for (String filter : SimplePlugin.getInstance().getConsoleFilter()) { - filter = filter.toLowerCase(); - - if (message.startsWith(filter) || message.contains(filter)) - return true; - } - } - - return false; - } -} - -/** - * The old Bukkit filter - */ -class FilterLegacy implements java.util.logging.Filter { - - @Override - public boolean isLoggable(LogRecord record) { - final String message = record.getMessage(); - - return !FoundationFilter.isFiltered(message); - } -} - -/** - * The System out filter - */ -class FilterSystem extends PrintStream { - - FilterSystem() { - super(System.out); - } - - @Override - public void println(Object x) { - if (x != null && !FoundationFilter.isFiltered(x.toString())) - super.println(x); - } - - @Override - public void println(String x) { - if (x != null && !FoundationFilter.isFiltered(x)) - super.println(x); - } -} - -/** - * The new Log4j filter - */ -@NoArgsConstructor(access = AccessLevel.PACKAGE) -class FilterLog4j implements org.apache.logging.log4j.core.Filter { - - /* - * Starts logging for this filter - */ - static void inject() { - try { - ((Logger) LogManager.getRootLogger()).addFilter(new FilterLog4j()); - - } catch (final Throwable ex) { - // Unsupported - } - } - - @Override - public Result filter(LogEvent record) { - return checkMessage(record.getMessage().getFormattedMessage()); - } - - @Override - public Result filter(Logger arg0, Level arg1, Marker arg2, String message, Object... arg4) { - return checkMessage(message); - } - - @Override - public Result filter(Logger arg0, Level arg1, Marker arg2, Object message, Throwable arg4) { - return checkMessage(message.toString()); - } - - @Override - public Result filter(Logger arg0, Level arg1, Marker arg2, Message message, Throwable arg4) { - return checkMessage(message.getFormattedMessage()); - } - - /* - * Return if the message should be filtered - */ - private final Result checkMessage(String message) { - return FoundationFilter.isFiltered(message) ? Result.DENY : Result.NEUTRAL; - } - - /* ------------------------------------------------------------ */ - /* Implementation required methods */ - /* ------------------------------------------------------------ */ - - @Override - public Result getOnMatch() { - return Result.NEUTRAL; - } - - @Override - public Result getOnMismatch() { - return Result.NEUTRAL; - } - - @Override - public State getState() { - try { - return State.STARTED; - } catch (final Throwable t) { - return null; - } - } - - @Override - public void initialize() { - } - - @Override - public boolean isStarted() { - return true; - } - - @Override - public boolean isStopped() { - return false; - } - - @Override - public void start() { - } - - @Override - public void stop() { - } - - @Override - public Result filter(Logger arg0, Level arg1, Marker arg2, String arg3, Object arg4) { - return null; - } - - @Override - public Result filter(Logger arg0, Level arg1, Marker arg2, String arg3, Object arg4, Object arg5) { - return null; - } - - @Override - public Result filter(Logger arg0, Level arg1, Marker arg2, String arg3, Object arg4, Object arg5, Object arg6) { - return null; - } - - @Override - public Result filter(Logger arg0, Level arg1, Marker arg2, String arg3, Object arg4, Object arg5, Object arg6, Object arg7) { - return null; - } - - @Override - public Result filter(Logger arg0, Level arg1, Marker arg2, String arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8) { - return null; - } - - @Override - public Result filter(Logger arg0, Level arg1, Marker arg2, String arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9) { - return null; - } - - @Override - public Result filter(Logger arg0, Level arg1, Marker arg2, String arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10) { - return null; - } - - @Override - public Result filter(Logger arg0, Level arg1, Marker arg2, String arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10, Object arg11) { - return null; - } - - @Override - public Result filter(Logger arg0, Level arg1, Marker arg2, String arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10, Object arg11, Object arg12) { - return null; - } - - @Override - public Result filter(Logger arg0, Level arg1, Marker arg2, String arg3, Object arg4, Object arg5, Object arg6, Object arg7, Object arg8, Object arg9, Object arg10, Object arg11, Object arg12, Object arg13) { - return null; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/plugin/FoundationListener.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/plugin/FoundationListener.java deleted file mode 100644 index 6617aea5b4444a738b6e67bcb44714aad1de23ef..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/plugin/FoundationListener.java +++ /dev/null @@ -1,173 +0,0 @@ -package org.mineacademy.fo.plugin; - -import java.util.List; -import java.util.Map; - -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.server.ServiceRegisterEvent; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MathUtil; -import org.mineacademy.fo.Messenger; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.constants.FoPermissions; -import org.mineacademy.fo.model.ChatPaginator; -import org.mineacademy.fo.model.HookManager; -import org.mineacademy.fo.model.SimpleComponent; -import org.mineacademy.fo.model.SimpleScoreboard; -import org.mineacademy.fo.model.SpigotUpdater; -import org.mineacademy.fo.settings.SimpleLocalization; - -/** - * Listens for some events we handle for you automatically - */ -final class FoundationListener implements Listener { - - @EventHandler(priority = EventPriority.LOW) - public void onJoin(PlayerJoinEvent event) { - final SpigotUpdater check = SimplePlugin.getInstance().getUpdateCheck(); - - if (check != null && check.isNewVersionAvailable() && PlayerUtil.hasPerm(event.getPlayer(), FoPermissions.NOTIFY_UPDATE)) - Common.tellLater(4 * 20, event.getPlayer(), check.getNotifyMessage()); - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void onQuit(PlayerQuitEvent event) { - SimpleScoreboard.clearBoardsFor(event.getPlayer()); - } - - @EventHandler(priority = EventPriority.HIGHEST) - public void onServiceRegister(ServiceRegisterEvent event) { - HookManager.updateVaultIntegration(); - } - - /** - * Handler for {@link ChatPaginator} - * - * @param event - */ - @EventHandler(priority = EventPriority.LOWEST) - public void onCommand(PlayerCommandPreprocessEvent event) { - - final Player player = event.getPlayer(); - final String message = event.getMessage(); - final String[] args = message.split(" "); - - if (!message.startsWith("/#flp")) - return; - - if (args.length != 2) { - Common.tell(player, SimpleLocalization.Pages.NO_PAGE_NUMBER); - - event.setCancelled(true); - return; - } - - final String nbtPageTag = ChatPaginator.getPageNbtTag(); - - if (!player.hasMetadata(nbtPageTag)) { - event.setCancelled(true); - - return; - } - - // Prevent shading issue with multiple plugins having Foundation shaded - if (player.hasMetadata("FoPages") && !player.getMetadata("FoPages").get(0).asString().equals(SimplePlugin.getNamed())) - return; - - final String numberRaw = args[1]; - int page = -1; - - try { - page = Integer.parseInt(numberRaw) - 1; - - } catch (final NumberFormatException ex) { - Common.tell(player, SimpleLocalization.Pages.INVALID_PAGE.replace("{input}", numberRaw)); - - event.setCancelled(true); - return; - } - - final ChatPaginator chatPages = (ChatPaginator) player.getMetadata(nbtPageTag).get(0).value(); - final Map<Integer, List<SimpleComponent>> pages = chatPages.getPages(); - - // Remove empty lines - pages.entrySet().removeIf(entry -> entry.getValue().isEmpty()); - - if (!pages.containsKey(page)) { - final String playerMessage = SimpleLocalization.Pages.NO_PAGE; - - if (Messenger.ENABLED) - Messenger.error(player, playerMessage); - else - Common.tell(player, playerMessage); - - event.setCancelled(true); - return; - } - - { // Send the message body - for (final SimpleComponent component : chatPages.getHeader()) - component.send(player); - - final List<SimpleComponent> messagesOnPage = pages.get(page); - int count = 1; - - for (final SimpleComponent comp : messagesOnPage) - comp.replace("{count}", page + count++).send(player); - - int whiteLines = chatPages.getLinesPerPage(); - - if (whiteLines == 15 && pages.size() == 1) { - if (messagesOnPage.size() < 17) - whiteLines = 7; - else - whiteLines += 2; - } - - for (int i = messagesOnPage.size(); i < whiteLines; i++) - SimpleComponent.of("&r").send(player); - - for (final SimpleComponent component : chatPages.getFooter()) - component.send(player); - } - - // Fill in the pagination line - if (MinecraftVersion.atLeast(V.v1_7) && pages.size() > 1) { - Common.tellNoPrefix(player, " "); - - final int pagesDigits = (int) (Math.log10(pages.size()) + 1); - final int multiply = 23 - (int) MathUtil.ceiling(pagesDigits); - - final SimpleComponent pagination = SimpleComponent.of(chatPages.getThemeColor() + "&m" + Common.duplicate("-", multiply) + "&r"); - - if (page == 0) - pagination.append(" &7« "); - else - pagination.append(" &6« ").onHover(SimpleLocalization.Pages.GO_TO_PAGE.replace("{page}", String.valueOf(page))).onClickRunCmd("/#flp " + page); - - pagination.append("&f" + (page + 1)).onHover(SimpleLocalization.Pages.GO_TO_FIRST_PAGE).onClickRunCmd("/#flp 1"); - pagination.append("/"); - pagination.append(pages.size() + "").onHover(SimpleLocalization.Pages.TOOLTIP); - - if (page + 1 >= pages.size()) - pagination.append(" &7» "); - else - pagination.append(" &6» ").onHover(SimpleLocalization.Pages.GO_TO_PAGE.replace("{page}", String.valueOf(page + 2))).onClickRunCmd("/#flp " + (page + 2)); - - pagination.append(chatPages.getThemeColor() + "&m" + Common.duplicate("-", multiply)); - - pagination.send(player); - } - - // Prevent "Unknown command message" - event.setCancelled(true); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/plugin/FoundationPacketListener.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/plugin/FoundationPacketListener.java deleted file mode 100644 index fe52b7ac06a52eca7c3073d49bae2a4acf9d5d8d..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/plugin/FoundationPacketListener.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.mineacademy.fo.plugin; - -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.PacketUtil; -import org.mineacademy.fo.model.HookManager; -import org.mineacademy.fo.model.SimpleEnchantment; -import org.mineacademy.fo.remain.CompMaterial; - -import com.comphenix.protocol.PacketType; -import com.comphenix.protocol.reflect.StructureModifier; - -/** - * Listens to and intercepts packets using Foundation inbuilt features - */ -final class FoundationPacketListener { - - /** - * Registers our packet listener for some of the more advanced features of Foundation - */ - static void addNativeListener() { - if (HookManager.isProtocolLibLoaded()) - - // Auto placement of our lore when items are custom enchanted - PacketUtil.addSendingListener(PacketType.Play.Server.SET_SLOT, event -> { - final StructureModifier<ItemStack> itemModifier = event.getPacket().getItemModifier(); - ItemStack item = itemModifier.read(0); - - if (item != null && !CompMaterial.isAir(item.getType())) { - item = SimpleEnchantment.addEnchantmentLores(item); - - // Write the item - if (item != null) - itemModifier.write(0, item); - } - }); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/plugin/Reloadables.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/plugin/Reloadables.java deleted file mode 100644 index 272c2dac15028bad867f41fe9f7d3b99aa443493..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/plugin/Reloadables.java +++ /dev/null @@ -1,103 +0,0 @@ -package org.mineacademy.fo.plugin; - -import java.util.List; - -import org.bukkit.event.Event; -import org.bukkit.event.HandlerList; -import org.bukkit.event.Listener; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.command.SimpleCommandGroup; -import org.mineacademy.fo.event.SimpleListener; - -/** - * A simple way of registering events and other things that - * are cancelled automatically when the plugin is reloaded. - */ -final class Reloadables { - - /** - * A list of currently enabled event listeners - */ - private final StrictList<Listener> listeners = new StrictList<>(); - - /** - * A list of registered command groups - */ - private final StrictList<SimpleCommandGroup> commandGroups = new StrictList<>(); - - // ------------------------------------------------------------------------------------------- - // Main - // ------------------------------------------------------------------------------------------- - - /** - * Remove all listeners and cancel all running tasks - */ - void reload() { - for (final Listener listener : listeners) - HandlerList.unregisterAll(listener); - - listeners.clear(); - - for (final SimpleCommandGroup commandGroup : commandGroups) - commandGroup.unregister(); - - commandGroups.clear(); - } - - // ------------------------------------------------------------------------------------------- - // Events / Listeners - // ------------------------------------------------------------------------------------------- - - /** - * Register events to Bukkit - * - * @param listener - */ - void registerEvents(Listener listener) { - Common.registerEvents(listener); - - listeners.add(listener); - } - - /** - * Register events to Bukkit using our listener - * - * @param <T> - * @param listener - */ - <T extends Event> void registerEvents(SimpleListener<T> listener) { - listener.register(); - - listeners.add(listener); - } - - // ------------------------------------------------------------------------------------------- - // Command groups - // ------------------------------------------------------------------------------------------- - - /** - * Register the given command group - * - * @param label - * @param aliases - * @param group - */ - void registerCommands(final String label, final List<String> aliases, final SimpleCommandGroup group) { - group.register(label, aliases); - - commandGroups.add(group); - } - - /** - * Register the given command group - * - * @param labelAndAliases - * @param group - */ - void registerCommands(final StrictList<String> labelAndAliases, final SimpleCommandGroup group) { - group.register(labelAndAliases); - - commandGroups.add(group); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/plugin/SimplePlugin.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/plugin/SimplePlugin.java deleted file mode 100644 index 918e67f0329770ba55fb4895d553ebb437d600dd..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/plugin/SimplePlugin.java +++ /dev/null @@ -1,1331 +0,0 @@ -/** - * (c) 2013 - 2019 - All rights reserved. - * <p> - * Do not share, copy, reproduce or sell any part of this library - * unless you have written permission from MineAcademy.org. - * All infringements will be prosecuted. - * <p> - * If you are the personal owner of the MineAcademy.org End User License - * then you may use it for your own use in plugins but not for any other purpose. - */ -package org.mineacademy.fo.plugin; - -import java.io.File; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.PluginCommand; -import org.bukkit.configuration.InvalidConfigurationException; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.Listener; -import org.bukkit.plugin.java.JavaPlugin; -import org.bukkit.plugin.messaging.Messenger; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.bungee.SimpleBungee; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.command.SimpleCommand; -import org.mineacademy.fo.command.SimpleCommandGroup; -import org.mineacademy.fo.command.SimpleSubCommand; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.event.SimpleListener; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.menu.Menu; -import org.mineacademy.fo.menu.MenuListener; -import org.mineacademy.fo.menu.tool.Rocket; -import org.mineacademy.fo.menu.tool.Tool; -import org.mineacademy.fo.menu.tool.ToolsListener; -import org.mineacademy.fo.metrics.Metrics; -import org.mineacademy.fo.model.DiscordListener; -import org.mineacademy.fo.model.EnchantmentListener; -import org.mineacademy.fo.model.FolderWatcher; -import org.mineacademy.fo.model.HookManager; -import org.mineacademy.fo.model.JavaScriptExecutor; -import org.mineacademy.fo.model.SimpleEnchantment; -import org.mineacademy.fo.model.SimpleHologram; -import org.mineacademy.fo.model.SimpleScoreboard; -import org.mineacademy.fo.model.SpigotUpdater; -import org.mineacademy.fo.remain.CompMetadata; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.fo.settings.Lang; -import org.mineacademy.fo.settings.SimpleLocalization; -import org.mineacademy.fo.settings.SimpleSettings; -import org.mineacademy.fo.settings.YamlConfig; -import org.mineacademy.fo.settings.YamlStaticConfig; -import org.mineacademy.fo.visual.BlockVisualizer; - -import lombok.Getter; -import lombok.NonNull; - -/** - * Represents a basic Java plugin using enhanced library functionality - */ -public abstract class SimplePlugin extends JavaPlugin implements Listener { - - // ---------------------------------------------------------------------------------------- - // Static - // ---------------------------------------------------------------------------------------- - - /** - * The instance of this plugin - */ - private static volatile SimplePlugin instance; - - /** - * Shortcut for getDescription().getVersion() - * - * @return plugin's version - */ - @Getter - private static String version; - - /** - * Shortcut for getName() - * - * @return plugin's name - */ - @Getter - private static String named; - - /** - * Shortcut for getFile() - * - * @return plugin's jar file - */ - @Getter - private static File source; - - /** - * Shortcut for getDataFolder() - * - * @return plugins' data folder in plugins/ - */ - @Getter - private static File data; - - /** - * An internal flag to indicate that the plugin is being reloaded. - */ - @Getter - private static volatile boolean reloading = false; - - /** - * Returns the instance of {@link SimplePlugin}. - * <p> - * It is recommended to override this in your own {@link SimplePlugin} - * implementation so you will get the instance of that, directly. - * - * @return this instance - */ - public static SimplePlugin getInstance() { - if (instance == null) { - try { - instance = JavaPlugin.getPlugin(SimplePlugin.class); - - } catch (final IllegalStateException ex) { - if (Bukkit.getPluginManager().getPlugin("PlugMan") != null) - Bukkit.getLogger().severe("Failed to get instance of the plugin, if you reloaded using PlugMan you need to do a clean restart instead."); - - throw ex; - } - - Objects.requireNonNull(instance, "Cannot get a new instance! Have you reloaded?"); - } - - return instance; - } - - /** - * Get if the instance that is used across the library has been set. Normally it - * is always set, except for testing. - * - * @return if the instance has been set. - */ - public static final boolean hasInstance() { - return instance != null; - } - - // ---------------------------------------------------------------------------------------- - // Instance specific - // ---------------------------------------------------------------------------------------- - - /** - * Is this plugin enabled? Checked for after {@link #onPluginPreStart()} - */ - protected boolean isEnabled = true; - - /** - * For your convenience, event listeners and timed tasks may be set here to stop/unregister - * them automatically on reload - */ - private final Reloadables reloadables = new Reloadables(); - - /** - * An internal flag to indicate whether we are calling the {@link #onReloadablesStart()} - * block. We register things using {@link #reloadables} during this block - */ - private boolean startingReloadables = false; - - // ---------------------------------------------------------------------------------------- - // Main methods - // ---------------------------------------------------------------------------------------- - - static { - - // Add console filters early - no reload support - FoundationFilter.inject(); - } - - @Override - public final void onLoad() { - - // Set the instance - try { - getInstance(); - - } catch (final Throwable ex) { - if (MinecraftVersion.olderThan(V.v1_7)) - instance = this; // Workaround - else - throw ex; - } - - // Cache results for best performance - version = instance.getDescription().getVersion(); - named = instance.getName(); - source = instance.getFile(); - data = instance.getDataFolder(); - - // Call parent - onPluginLoad(); - } - - @Override - public final void onEnable() { - - // Solve reloading issues with PlugMan - for (final StackTraceElement element : new Throwable().getStackTrace()) { - if (element.toString().contains("com.rylinaux.plugman.util.PluginUtil.load")) { - Common.warning("Detected PlugMan reload, which is poorly designed. " - + "It causes Bukkit not able to get our plugin from a static initializer." - + " It may or may not run. Use our own reload command or do a clean restart!"); - - break; - } - } - - // Check if Foundation is correctly moved - checkShading(); - - if (!isEnabled) - return; - - // Before all, check if necessary libraries and the minimum required MC version - if (!checkLibraries0() || !checkServerVersions0()) { - isEnabled = false; - setEnabled(false); - - return; - } - - // Load debug mode early - Debugger.detectDebugMode(); - - // Disable logging prefix if logo is set - if (getStartupLogo() != null) - Common.ADD_LOG_PREFIX = false; - - // Print startup logo early before onPluginPreStart - if (getStartupLogo() != null) { - final boolean hadLogPrefix = Common.ADD_LOG_PREFIX; - - Common.ADD_LOG_PREFIX = false; - Common.log(getStartupLogo()); - Common.ADD_LOG_PREFIX = hadLogPrefix; - } - - // Inject server-name to newer MC versions that lack it - Remain.injectServerName(); - - // Load our dependency system - try { - HookManager.loadDependencies(); - - } catch (final Throwable throwable) { - Common.throwError(throwable, "Error while loading " + getName() + " dependencies!"); - } - - // -------------------------------------------- - // Call the main pre start method - // -------------------------------------------- - onPluginPreStart(); - // -------------------------------------------- - - // Return if plugin pre start indicated a fatal problem - if (!isEnabled || !isEnabled()) - return; - - try { - - // Load our main static settings classes - YamlStaticConfig.load(getSettings()); - - if (!isEnabled || !isEnabled()) - return; - - // Register classes - checkSingletons(); - - if (!isEnabled || !isEnabled()) - return; - - // Load legacy permanent metadata store - CompMetadata.MetadataFile.getInstance(); - - SimpleHologram.init(); - - // Register main command if it is set - if (getMainCommand() != null) { - Valid.checkBoolean(!SimpleSettings.MAIN_COMMAND_ALIASES.isEmpty(), "Please make a settings class extending SimpleSettings and specify Command_Aliases in your settings file."); - - reloadables.registerCommands(SimpleSettings.MAIN_COMMAND_ALIASES, getMainCommand()); - } - - // -------------------------------------------- - // Call the main start method - // -------------------------------------------- - if (!isEnabled || !isEnabled()) - return; - - // Hide plugin name before console messages - final boolean hadLogPrefix = Common.ADD_LOG_PREFIX; - Common.ADD_LOG_PREFIX = false; - - startingReloadables = true; - onReloadablesStart(); - startingReloadables = false; - - onPluginStart(); - // -------------------------------------------- - - // Return if plugin start indicated a fatal problem - if (!isEnabled || !isEnabled()) - return; - - // Register BungeeCord when used - if (getBungeeCord() != null) - registerBungeeCord(getBungeeCord()); - - // Start update check - if (getUpdateCheck() != null) - getUpdateCheck().run(); - - // Register our listeners - registerEvents(this); // For convenience - registerEvents(new MenuListener()); - registerEvents(new FoundationListener()); - registerEvents(new EnchantmentListener()); - - if (areToolsEnabled()) - registerEvents(new ToolsListener()); - - // Register our packet listener - FoundationPacketListener.addNativeListener(); - - // Register DiscordSRV listener - if (HookManager.isDiscordSRVLoaded()) { - final DiscordListener.DiscordListenerImpl discord = DiscordListener.DiscordListenerImpl.getInstance(); - - discord.resubscribe(); - discord.registerHook(); - - reloadables.registerEvents(DiscordListener.DiscordListenerImpl.getInstance()); - } - - // Prepare Nashorn engine - JavaScriptExecutor.run(""); - - // Finish off by starting metrics (currently bStats) - final int pluginId = getMetricsPluginId(); - - if (pluginId != -1) - new Metrics(this, pluginId); - - // Set the logging and tell prefix - Common.setTellPrefix(SimpleSettings.PLUGIN_PREFIX); - - // Finally, place plugin name before console messages after plugin has (re)loaded - Common.runLater(() -> Common.ADD_LOG_PREFIX = hadLogPrefix); - - } catch (final Throwable t) { - displayError0(t); - } - } - - /** - * Register a simple bungee class as a custom bungeecord listener, - * for sample implementation you can see the SimpleBungee field at: - * https://github.com/kangarko/PluginTemplate/blob/main/src/main/java/org/mineacademy/template/PluginTemplate.java - * - * DO NOT use this if you only have that one field there with a getter, we already register it automatically, - * this method is intended to be used if you have multiple fields there and want to register multiple channels. - * Then you just call this method and parse the field into it from your onReloadablesStart method. - */ - protected final void registerBungeeCord(@NonNull SimpleBungee bungee) { - final Messenger messenger = getServer().getMessenger(); - - messenger.registerIncomingPluginChannel(this, bungee.getChannel(), bungee.getListener()); - messenger.registerOutgoingPluginChannel(this, bungee.getChannel()); - - reloadables.registerEvents(bungee.getListener()); - Debugger.debug("bungee", "Registered BungeeCord listener on channel " + bungee.getChannel()); - } - - /** - * Scans your plugin and if your {@link Tool} or {@link SimpleEnchantment} class implements {@link Listener} - * and has "instance" method to be a singleton, your events are registered there automatically - * <p> - * If not, we only call the instance constructor in case there is any underlying registration going on - */ - private static void checkSingletons() { - - try (final JarFile file = new JarFile(SimplePlugin.getSource())) { - for (final Enumeration<JarEntry> entry = file.entries(); entry.hasMoreElements();) { - final JarEntry jar = entry.nextElement(); - final String name = jar.getName().replace("/", "."); - - try { - - if (name.endsWith(".class")) { - final String className = name.substring(0, name.length() - 6); - Class<?> clazz = null; - - try { - clazz = SimplePlugin.class.getClassLoader().loadClass(className); - } catch (final NoClassDefFoundError | ClassNotFoundException | IncompatibleClassChangeError error) { - continue; - } - - final boolean isTool = Tool.class.isAssignableFrom(clazz) && !Tool.class.equals(clazz) && !Rocket.class.equals(clazz); - final boolean isEnchant = SimpleEnchantment.class.isAssignableFrom(clazz) && !SimpleEnchantment.class.equals(clazz); - - if (isTool || isEnchant) { - - if (isEnchant && MinecraftVersion.olderThan(V.v1_13)) { - Bukkit.getLogger().warning("**** WARNING ****"); - Bukkit.getLogger().warning("SimpleEnchantment requires Minecraft 1.13.2 or greater. The following class will not be registered: " + clazz.getName()); - - continue; - } - - try { - Field instanceField = null; - - for (final Field field : clazz.getDeclaredFields()) - if ((Tool.class.isAssignableFrom(field.getType()) || Enchantment.class.isAssignableFrom(field.getType())) - && Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers())) - instanceField = field; - - if (SimpleEnchantment.class.isAssignableFrom(clazz)) - Valid.checkNotNull(instanceField, "Your enchant class " + clazz.getSimpleName() + " must be a singleton and have static 'instance' field and private constructors!"); - - if (instanceField != null) { - instanceField.setAccessible(true); - - final Object instance = instanceField.get(null); - - // Enforce private constructors - for (final Constructor<?> con : instance.getClass().getDeclaredConstructors()) - Valid.checkBoolean(Modifier.isPrivate(con.getModifiers()), "Constructor " + con + " not private! Did you put '@NoArgsConstructor(access = AccessLevel.PRIVATE)' in your tools class?"); - - // Finally register events - if (instance instanceof Listener) - Common.registerEvents((Listener) instance); - } - - } catch (final NoClassDefFoundError | NoSuchFieldError ex) { - Bukkit.getLogger().warning("Failed to auto register " + (isTool ? "tool" : "enchant") + " class " + clazz + " due to it requesting missing fields/classes: " + ex.getMessage()); - - // Ignore if no field is present - - } catch (final Throwable t) { - final String error = Common.getOrEmpty(t.getMessage()); - - if (t instanceof NoClassDefFoundError && error.contains("org/bukkit/entity")) { - Bukkit.getLogger().warning("**** WARNING ****"); - - if (error.contains("DragonFireball")) - Bukkit.getLogger().warning("Your Minecraft version does not have DragonFireball class, we suggest replacing it with a Fireball instead in: " + clazz); - else - Bukkit.getLogger().warning("Your Minecraft version does not have " + error + " class you call in: " + clazz); - } else - Common.error(t, "Failed to register events in " + clazz.getSimpleName() + " class " + clazz); - } - } - } - - } catch (final Throwable t) { - if (t instanceof VerifyError) // Exception in other class we loaded - continue; - - Common.error(t, "Failed to scan class '" + name + "' using Foundation!"); - } - } - } catch (final Throwable t) { - Common.error(t, "Failed to scan classes using Foundation!"); - } - } - - /** - * A dirty way of checking if Foundation has been shaded correctly - */ - private final void checkShading() { - try { - throw new ShadingException(); - } catch (final Throwable t) { - } - } - - /** - * The exception enabling us to check if for some reason {@link SimplePlugin}'s instance - * does not match this class' instance, which is most likely caused by wrong repackaging - * or no repackaging at all (two plugins using Foundation must both have different packages - * for their own Foundation version). - * <p> - * Or, this is caused by a PlugMan, and we have no mercy for that. - */ - private final class ShadingException extends Throwable { - private static final long serialVersionUID = 1L; - - public ShadingException() { - if (!SimplePlugin.getNamed().equals(getDescription().getName())) { - Bukkit.getLogger().severe(Common.consoleLine()); - Bukkit.getLogger().severe("We have a class path problem in the Foundation library"); - Bukkit.getLogger().severe("preventing " + getDescription().getName() + " from loading correctly!"); - Bukkit.getLogger().severe(""); - Bukkit.getLogger().severe("This is likely caused by two plugins having the"); - Bukkit.getLogger().severe("same Foundation library paths - make sure you"); - Bukkit.getLogger().severe("relocale the package! If you are testing using"); - Bukkit.getLogger().severe("Ant, only test one plugin at the time."); - Bukkit.getLogger().severe(""); - Bukkit.getLogger().severe("Possible cause: " + SimplePlugin.getNamed()); - Bukkit.getLogger().severe("Foundation package: " + SimplePlugin.class.getPackage().getName()); - Bukkit.getLogger().severe(Common.consoleLine()); - - isEnabled = false; - } - } - } - - /** - * Check if both md5 chat and gson libraries are present, - * or suggest an additional plugin to fix their lack - * - * @return - */ - private final boolean checkLibraries0() { - boolean md_5 = false; - boolean gson = false; - - try { - Class.forName("net.md_5.bungee.api.chat.BaseComponent"); - md_5 = true; - } catch (final ClassNotFoundException ex) { - } - - try { - Class.forName("com.google.gson.JsonSyntaxException"); - gson = true; - - } catch (final ClassNotFoundException ex) { - } - - if (!md_5 || !gson) { - Bukkit.getLogger().severe(Common.consoleLine()); - Bukkit.getLogger().severe("Your Minecraft version (" + MinecraftVersion.getCurrent() + ")"); - Bukkit.getLogger().severe("lacks libraries " + getName() + " needs:"); - Bukkit.getLogger().severe("JSON Chat (by md_5) found: " + md_5); - Bukkit.getLogger().severe("Gson (by Google) found: " + gson); - Bukkit.getLogger().severe(" "); - Bukkit.getLogger().severe("To fix that, please install BungeeChatAPI:"); - Bukkit.getLogger().severe("https://mineacademy.org/plugins/#misc"); - Bukkit.getLogger().severe(Common.consoleLine()); - } - - return true; - } - - /** - * Check if the minimum required MC version is installed - * - * @return - */ - private final boolean checkServerVersions0() { - - // Call the static block to test compatibility early - if (!MinecraftVersion.getCurrent().isTested()) - Common.logFramed( - "*** WARNING ***", - "Your Minecraft version " + MinecraftVersion.getCurrent() + " has not yet", - "been officialy tested with the Foundation,", - "the library that " + SimplePlugin.getNamed() + " plugin uses.", - "", - "Loading the plugin at your own risk...", - Common.consoleLine()); - - // Check min version - final V minimumVersion = getMinimumVersion(); - - if (minimumVersion != null && MinecraftVersion.olderThan(minimumVersion)) { - Common.logFramed(false, - getName() + " requires Minecraft " + minimumVersion + " or newer to run.", - "Please upgrade your server."); - - return false; - } - - // Check max version - final V maximumVersion = getMaximumVersion(); - - if (maximumVersion != null && MinecraftVersion.newerThan(maximumVersion)) { - Common.logFramed(false, - getName() + " requires Minecraft " + maximumVersion + " or older to run.", - "Please downgrade your server or", - "wait for the new version."); - - return false; - } - - return true; - } - - /** - * Handles various startup problems - * - * @param throwable - */ - protected final void displayError0(Throwable throwable) { - Debugger.printStackTrace(throwable); - - Common.log( - "&4 ___ _ ", - "&4 / _ \\ ___ _ __ ___| |", - "&4 | | | |/ _ \\| '_ \\/ __| |", - "&4 | |_| | (_) | |_) \\__ \\_|", - "&4 \\___/ \\___/| .__/|___(_)", - "&4 |_| ", - "&4!-----------------------------------------------------!", - " &cError loading " + getDescription().getName() + " v" + getDescription().getVersion() + ", plugin is disabled!", - " &cRunning on " + getServer().getBukkitVersion() + " (" + MinecraftVersion.getServerVersion() + ") & Java " + System.getProperty("java.version"), - "&4!-----------------------------------------------------!"); - - if (throwable instanceof InvalidConfigurationException) { - Common.log(" &cSeems like your config is not a valid YAML."); - Common.log(" &cUse online services like"); - Common.log(" &chttp://yaml-online-parser.appspot.com/"); - Common.log(" &cto check for syntax errors!"); - - } else if (throwable instanceof UnsupportedOperationException || throwable.getCause() != null && throwable.getCause() instanceof UnsupportedOperationException) - if (getServer().getBukkitVersion().startsWith("1.2.5")) - Common.log(" &cSorry but Minecraft 1.2.5 is no longer supported!"); - else { - Common.log(" &cUnable to setup reflection!"); - Common.log(" &cYour server is either too old or"); - Common.log(" &cthe plugin broke on the new version :("); - } - - { - while (throwable.getCause() != null) - throwable = throwable.getCause(); - - String error = "Unable to get the error message, search above."; - if (throwable.getMessage() != null && !throwable.getMessage().isEmpty() && !throwable.getMessage().equals("null")) - error = throwable.getMessage(); - - Common.log(" &cError: " + error); - } - Common.log("&4!-----------------------------------------------------!"); - - getPluginLoader().disablePlugin(this); - } - - // ---------------------------------------------------------------------------------------- - // Shutdown - // ---------------------------------------------------------------------------------------- - - @Override - public final void onDisable() { - - // If the early startup was interrupted, do not call shutdown methods - if (!isEnabled) - return; - - try { - onPluginStop(); - } catch (final Throwable t) { - Common.log("&cPlugin might not shut down property. Got " + t.getClass().getSimpleName() + ": " + t.getMessage()); - } - - unregisterReloadables(); - - try { - for (final Player online : Remain.getOnlinePlayers()) - SimpleScoreboard.clearBoardsFor(online); - - } catch (final Throwable t) { - Common.log("Error clearing scoreboards for players.."); - - t.printStackTrace(); - } - - try { - for (final Player online : Remain.getOnlinePlayers()) { - final Menu menu = Menu.getMenu(online); - - if (menu != null) - online.closeInventory(); - } - } catch (final Throwable t) { - Common.log("Error closing menu inventories for players.."); - - t.printStackTrace(); - } - - Objects.requireNonNull(instance, "Instance of " + getName() + " already nulled!"); - instance = null; - } - - // ---------------------------------------------------------------------------------------- - // Delegate methods - // ---------------------------------------------------------------------------------------- - - /** - * Called before the plugin is started, see {@link JavaPlugin#onLoad()} - */ - protected void onPluginLoad() { - } - - /** - * Called before we start loading the plugin, but after {@link #onPluginLoad()} - */ - protected void onPluginPreStart() { - } - - /** - * The main loading method, called when we are ready to load - */ - protected abstract void onPluginStart(); - - /** - * The main method called when we are about to shut down - */ - protected void onPluginStop() { - } - - /** - * Invoked before settings were reloaded. - */ - protected void onPluginPreReload() { - } - - /** - * Invoked after settings were reloaded. - */ - protected void onPluginReload() { - } - - /** - * Register your commands, events, tasks and files here. - * <p> - * This is invoked when you start the plugin, call /reload, or the {@link #reload()} - * method. - */ - protected void onReloadablesStart() { - } - - // ---------------------------------------------------------------------------------------- - // Reload - // ---------------------------------------------------------------------------------------- - - /** - * Attempts to reload the plugin - */ - public final void reload() { - final boolean hadLogPrefix = Common.ADD_LOG_PREFIX; - Common.ADD_LOG_PREFIX = false; - - Common.log(Common.consoleLineSmooth()); - Common.log(" "); - Common.log("Reloading plugin " + this.getName() + " v" + getVersion()); - Common.log(" "); - - reloading = true; - - try { - Debugger.detectDebugMode(); - - unregisterReloadables(); - - // Load our dependency system - try { - HookManager.loadDependencies(); - - } catch (final Throwable throwable) { - Common.throwError(throwable, "Error while loading " + getName() + " dependencies!"); - } - - onPluginPreReload(); - reloadables.reload(); - - YamlConfig.clearLoadedFiles(); - YamlStaticConfig.load(getSettings()); - - CompMetadata.MetadataFile.onReload(); - - FoundationPacketListener.addNativeListener(); - - SimpleHologram.init(); - - Lang.reloadFile(); - - Common.setTellPrefix(SimpleSettings.PLUGIN_PREFIX); - onPluginReload(); - - // Something went wrong in the reload pipeline - if (!isEnabled || !isEnabled()) - return; - - if (getMainCommand() != null) - reloadables.registerCommands(SimpleSettings.MAIN_COMMAND_ALIASES, getMainCommand()); - - startingReloadables = true; - onReloadablesStart(); - startingReloadables = false; - - if (HookManager.isDiscordSRVLoaded()) { - DiscordListener.DiscordListenerImpl.getInstance().resubscribe(); - - reloadables.registerEvents(DiscordListener.DiscordListenerImpl.getInstance()); - } - - if (getBungeeCord() != null) - registerBungeeCord(getBungeeCord()); - - Common.log(Common.consoleLineSmooth()); - - } catch (final Throwable t) { - Common.throwError(t, "Error reloading " + getName() + " " + getVersion()); - - } finally { - Common.ADD_LOG_PREFIX = hadLogPrefix; - - reloading = false; - } - } - - private final void unregisterReloadables() { - SimpleSettings.resetSettingsCall(); - SimpleLocalization.resetLocalizationCall(); - - BlockVisualizer.stopAll(); - FolderWatcher.stopThreads(); - - if (HookManager.isDiscordSRVLoaded()) - DiscordListener.clearRegisteredListeners(); - - try { - HookManager.unloadDependencies(this); - } catch (final NoClassDefFoundError ex) { - } - - getServer().getMessenger().unregisterIncomingPluginChannel(this); - getServer().getMessenger().unregisterOutgoingPluginChannel(this); - - getServer().getScheduler().cancelTasks(this); - } - - // ---------------------------------------------------------------------------------------- - // Methods - // ---------------------------------------------------------------------------------------- - - /** - * Convenience method for quickly registering events in all classes in your plugin that - * extend the given class. - * - * NB: You must have a no arguments constructor otherwise it will not be registered - * - * TIP: Set your Debug key in your settings.yml to ["auto-register"] to see what is registered. - * - * @param extendingClass - */ - protected final <T extends Listener> void registerAllEvents(final Class<T> extendingClass) { - - Valid.checkBoolean(!extendingClass.equals(Listener.class), "registerAllEvents does not support Listener.class due to conflicts, create your own middle class instead"); - Valid.checkBoolean(!extendingClass.equals(SimpleListener.class), "registerAllEvents does not support SimpleListener.class due to conflicts, create your own middle class instead"); - - classLookup: - for (final Class<? extends T> pluginClass : ReflectionUtil.getClasses(instance, extendingClass)) { - for (final Constructor<?> con : pluginClass.getConstructors()) { - if (con.getParameterCount() == 0) { - final T instance = (T) ReflectionUtil.instantiate(con); - - Debugger.debug("auto-register", "Auto-registering events in " + pluginClass); - registerEvents(instance); - - continue classLookup; - } - } - - Debugger.debug("auto-register", "Skipping auto-registering events in " + pluginClass + " because it lacks at least one no arguments constructor"); - } - } - - /** - * Convenience method for quickly registering events if the condition is met - * - * @param listener - * @param condition - */ - protected final void registerEventsIf(final Listener listener, final boolean condition) { - if (condition) - if (startingReloadables) - reloadables.registerEvents(listener); - else - registerEvents(listener); - } - - /** - * Convenience method for quickly registering events for this plugin - * - * @param listener - */ - protected final void registerEvents(final Listener listener) { - if (startingReloadables) - reloadables.registerEvents(listener); - else - getServer().getPluginManager().registerEvents(listener, this); - - if (listener instanceof DiscordListener) - ((DiscordListener) listener).register(); - } - - /** - * Convenience method for quickly registering an event if the condition is met - * - * @param listener - * @param condition - */ - protected final void registerEventsIf(final SimpleListener<? extends Event> listener, final boolean condition) { - if (condition) - if (startingReloadables) - reloadables.registerEvents(listener); - else - registerEvents(listener); - } - - /** - * Convenience method for quickly registering a single event - * - * @param listener - */ - protected final void registerEvents(final SimpleListener<? extends Event> listener) { - if (startingReloadables) - reloadables.registerEvents(listener); - - else - listener.register(); - } - - /** - * Convenience method for quickly registering all command classes in your plugin that - * extend the given class. - * - * NB: You must have a no arguments constructor otherwise it will not be registered - * - * TIP: Set your Debug key in your settings.yml to ["auto-register"] to see what is registered. - * - * @param extendingClass - */ - protected final <T extends Command> void registerAllCommands(final Class<T> extendingClass) { - Valid.checkBoolean(!extendingClass.equals(Command.class), "registerAllCommands does not support Command.class due to conflicts, create your own middle class instead"); - Valid.checkBoolean(!extendingClass.equals(SimpleCommand.class), "registerAllCommands does not support SimpleCommand.class due to conflicts, create your own middle class instead"); - Valid.checkBoolean(!extendingClass.equals(SimpleSubCommand.class), "registerAllCommands does not support SubCommand.class"); - - classLookup: - for (final Class<? extends T> pluginClass : ReflectionUtil.getClasses(instance, extendingClass)) { - - if (SimpleSubCommand.class.isAssignableFrom(pluginClass)) { - Debugger.debug("auto-register", "Skipping auto-registering command " + pluginClass + " because sub-commands cannot be registered"); - - continue; - } - - try { - for (final Constructor<?> con : pluginClass.getConstructors()) { - if (con.getParameterCount() == 0) { - final T instance = (T) ReflectionUtil.instantiate(con); - - Debugger.debug("auto-register", "Auto-registering command " + pluginClass); - - if (instance instanceof SimpleCommand) - registerCommand((SimpleCommand) instance); - - else - registerCommand(instance); - - continue classLookup; - } - } - - } catch (final LinkageError ex) { - Common.log("Unable to register commands in '" + pluginClass.getSimpleName() + "' due to error: " + ex); - } - - Debugger.debug("auto-register", "Skipping auto-registering command " + pluginClass + " because it lacks at least one no arguments constructor"); - } - } - - /** - * Convenience method for registering a bukkit command - * - * @param command - */ - protected final void registerCommand(final Command command) { - Remain.registerCommand(command); - } - - /** - * Convenience shortcut for calling the register method in {@link SimpleCommand} - * - * @param command - */ - protected final void registerCommand(final SimpleCommand command) { - command.register(); - } - - /** - * Shortcut for calling {@link SimpleCommandGroup#register(String, List))} - * - * @param labelAndAliases - * @param group - */ - protected final void registerCommands(final String labelAndAliases, final SimpleCommandGroup group) { - this.registerCommands(new StrictList<>(labelAndAliases.split("\\|")), group); - } - - /** - * Shortcut for calling {@link SimpleCommandGroup#register(StrictList)} - * - * @param labelAndAliases - * @param group - */ - protected final void registerCommands(final StrictList<String> labelAndAliases, final SimpleCommandGroup group) { - Valid.checkBoolean(!labelAndAliases.isEmpty(), "Must specify at least label for command group: " + group); - - if (getMainCommand() != null && getMainCommand().getLabel().equals(labelAndAliases.get(0))) - throw new FoException("Your main command group is registered automatically!"); - - reloadables.registerCommands(labelAndAliases, group); - } - - // ---------------------------------------------------------------------------------------- - // Additional features - // ---------------------------------------------------------------------------------------- - - /** - * The start-up fancy logo - * - * @return null by default - */ - protected String[] getStartupLogo() { - return null; - } - - /** - * The the minimum MC version to run - * <p> - * We will prevent loading it automatically if the server's version is - * below the given one - * - * @return - */ - public MinecraftVersion.V getMinimumVersion() { - return null; - } - - /** - * The maximum MC version for this plugin to load - * <p> - * We will prevent loading it automatically if the server's version is - * above the given one - * - * @return - */ - public MinecraftVersion.V getMaximumVersion() { - return null; - } - - /** - * Return your main setting classes extending {@link YamlStaticConfig}. - * <p> - * TIP: Extend {@link SimpleSettings} and {@link SimpleLocalization} - * - * @return - */ - public List<Class<? extends YamlStaticConfig>> getSettings() { - return null; - } - - /** - * Get your main command group, e.g. for ChatControl it's /chatcontrol - * - * @return - */ - public SimpleCommandGroup getMainCommand() { - return null; - } - - /** - * Get the year of foundation displayed in {@link #getMainCommand()} - * - * @return -1 by default, or the founded year - */ - public int getFoundedYear() { - return -1; - } - - /** - * Get your automatic update check - * - * @return - */ - public SpigotUpdater getUpdateCheck() { - return null; - } - - /** - * If you want to use bStats.org metrics system, - * simply return the plugin ID (https://bstats.org/what-is-my-plugin-id) - * here and we will automatically start tracking it. - * <p> - * Defaults to -1 which means disabled - * - * @return - */ - public int getMetricsPluginId() { - return -1; - } - - /** - * Foundation automatically can filter console commands for you, including - * messages from other plugins or the server itself, preventing unnecessary console spam. - * - * You can return a list of messages that will be matched using "startsWith OR contains" method - * and will be filtered. - * - * @return - */ - public Set<String> getConsoleFilter() { - return new HashSet<>(); - } - - /** - * When processing regular expressions, limit executing to the specified time. - * This prevents server freeze/crash on malformed regex (loops). - * - * @return time limit in milliseconds for processing regular expression - */ - public int getRegexTimeout() { - throw new FoException("Must override getRegexTimeout()"); - } - - /** - * Strip colors from checked message while checking it against a regex? - * - * @return - */ - public boolean regexStripColors() { - return true; - } - - /** - * Should Pattern.CASE_INSENSITIVE be applied when compiling regular expressions in {@link Common#compilePattern(String)}? - * <p> - * May impose a slight performance penalty but increases catches. - * - * @return - */ - public boolean regexCaseInsensitive() { - return true; - } - - /** - * Should Pattern.UNICODE_CASE be applied when compiling regular expressions in {@link Common#compilePattern(String)}? - * <p> - * May impose a slight performance penalty but useful for non-English servers. - * - * @return - */ - public boolean regexUnicode() { - return true; - } - - /** - * Should we remove diacritical marks before matching regex? - * Defaults to true - * - * @return - */ - public boolean regexStripAccents() { - return true; - } - - /** - * Should we replace accents with their non accented friends when - * checking two strings for similarity in ChatUtil? - * - * @return defaults to true - */ - public boolean similarityStripAccents() { - return true; - } - - /** - * Return the BungeeCord suite if you want this plugin - * to send and receive messages from BungeeCord - * - * @return - */ - public SimpleBungee getBungeeCord() { - return null; - } - - /** - * Should every message be divided by \n by an own method (tends to work more - * then split("\n")) - * - * @return - */ - public boolean enforeNewLine() { - return false; - } - - /** - * Should we listen for {@link Tool} in this plugin and - * handle clicking events automatically? Disable to increase performance - * if you do not want to use our tool system. Enabled by default. - * - * @return - */ - public boolean areToolsEnabled() { - return true; - } - - /** - * Use JavaScript variables/javascript.txt file - * - * @return - * @deprecated this feature has been removed - */ - @Deprecated - public boolean areScriptVariablesEnabled() { - return false; - } - - // ---------------------------------------------------------------------------------------- - // Prevention - // ---------------------------------------------------------------------------------------- - - /** - * Get the plugins jar file - */ - @Override - protected final File getFile() { - return super.getFile(); - } - - /** - * @deprecated DO NOT USE - * Use {@link SimpleCommand#register()} instead for your commands - */ - @Deprecated - @Override - public final PluginCommand getCommand(final String name) { - return super.getCommand(name); - } - - /** - * @deprecated do not use - */ - @Deprecated - @Override - public final boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { - throw unsupported("onCommand"); - } - - /** - * @deprecated do not use - */ - @Deprecated - @Override - public final List<String> onTabComplete(final CommandSender sender, final Command command, final String alias, final String[] args) { - throw unsupported("onTabComplete"); - } - - /** - * @deprecated do not use - */ - @Deprecated - @Override - public final FileConfiguration getConfig() { - throw unsupported("getConfig"); - } - - /** - * @deprecated do not use - */ - @Deprecated - @Override - public final void saveConfig() { - throw unsupported("saveConfig"); - } - - /** - * @deprecated do not use - */ - @Deprecated - @Override - public final void saveDefaultConfig() { - throw unsupported("saveDefaultConfig"); - } - - /** - * @deprecated do not use - */ - @Deprecated - @Override - public final void reloadConfig() { - throw new FoException("Cannot call reloadConfig in " + getName() + ", use reload()!"); - } - - private final FoException unsupported(final String method) { - return new FoException("Cannot call " + method + " in " + getName() + ", use YamlConfig or SimpleCommand classes in Foundation for that!"); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/region/Region.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/region/Region.java deleted file mode 100644 index 771174c7db9c920fae3cf09b6e31af0542501f83..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/region/Region.java +++ /dev/null @@ -1,300 +0,0 @@ -package org.mineacademy.fo.region; - -import java.util.LinkedList; -import java.util.List; -import java.util.Set; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.entity.Entity; -import org.mineacademy.fo.BlockUtil; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.model.ConfigSerializable; -import org.mineacademy.fo.visual.VisualizedRegion; - -import lombok.Getter; -import lombok.NonNull; -import lombok.Setter; - -/** - * Represents a cuboid region - */ -@Getter -public class Region implements ConfigSerializable { - - /** - * Represents an empty region - */ - public static final VisualizedRegion EMPTY = new VisualizedRegion(null, null); - - /** - * The name of the region, or null if not given - */ - @Setter - private String name; - - /** - * The primary region position - */ - private Location primary; - - /** - * The secondary region position - */ - private Location secondary; - - /** - * Create a new region - * - * @param primary - * @param secondary - */ - public Region(final Location primary, final Location secondary) { - this(null, primary, secondary); - } - - /** - * Create a new named region - * - * @param name - * @param primary - * @param secondary - */ - public Region(final String name, final Location primary, final Location secondary) { - this.name = name; - - if (primary != null) { - Valid.checkNotNull(primary.getWorld(), "Primary location lacks a world!"); - - this.primary = primary; - } - - if (secondary != null) { - Valid.checkNotNull(secondary.getWorld(), "Primary location lacks a world!"); - - this.secondary = secondary; - } - } - - /* - * Change primary/secondary around to make secondary always the lowest point - */ - private Location[] getCorrectedPoints() { - if (primary == null || secondary == null) - return null; - - Valid.checkBoolean(primary.getWorld().getName().equals(secondary.getWorld().getName()), "Points must be in one world! Primary: " + primary + " != secondary: " + secondary); - - final int x1 = primary.getBlockX(), x2 = secondary.getBlockX(), - y1 = primary.getBlockY(), y2 = secondary.getBlockY(), - z1 = primary.getBlockZ(), z2 = secondary.getBlockZ(); - - final Location primary = this.primary.clone(); - final Location secondary = this.secondary.clone(); - - primary.setX(Math.min(x1, x2)); - primary.setY(Math.min(y1, y2)); - primary.setZ(Math.min(z1, z2)); - - secondary.setX(Math.max(x1, x2)); - secondary.setY(Math.max(y1, y2)); - secondary.setZ(Math.max(z1, z2)); - - return new Location[] { primary, secondary }; - } - - /** - * Calculate a rough location of the center of this region - * - * @return - */ - public final Location getCenter() { - Valid.checkBoolean(isWhole(), "Cannot perform getCenter on a non-complete region: " + toString()); - - final Location[] centered = getCorrectedPoints(); - final Location primary = centered[0]; - final Location secondary = centered[1]; - - return new Location(primary.getWorld(), - (primary.getX() + secondary.getX()) / 2, - (primary.getY() + secondary.getY()) / 2, - (primary.getZ() + secondary.getZ()) / 2); - } - - /** - * Count all blocks within this region - * - * @return - */ - public final List<Block> getBlocks() { - Valid.checkBoolean(isWhole(), "Cannot perform getBlocks on a non-complete region: " + toString()); - final Location[] centered = getCorrectedPoints(); - - return BlockUtil.getBlocks(centered[0], centered[1]); - } - - /** - * Return locations representing the bounding box of a cuboid region, - * used when rendering particle effects - * - * @return - */ - public final Set<Location> getBoundingBox() { - Valid.checkBoolean(isWhole(), "Cannot perform getBoundingBox on a non-complete region: " + toString()); - - return BlockUtil.getBoundingBox(primary, secondary); - } - - /** - * Count all entities within this region - * - * @return - */ - public final List<Entity> getEntities() { - Valid.checkBoolean(isWhole(), "Cannot perform getEntities on a non-complete region: " + toString()); - - final List<Entity> found = new LinkedList<>(); - - final Location[] centered = getCorrectedPoints(); - final Location primary = centered[0]; - final Location secondary = centered[1]; - - final int xMin = (int) primary.getX() >> 4; - final int xMax = (int) secondary.getX() >> 4; - final int zMin = (int) primary.getZ() >> 4; - final int zMax = (int) secondary.getZ() >> 4; - - for (int cx = xMin; cx <= xMax; ++cx) - for (int cz = zMin; cz <= zMax; ++cz) - for (final Entity entity : getWorld().getChunkAt(cx, cz).getEntities()) - if (entity.isValid() && entity.getLocation() != null && isWithin(entity.getLocation())) - found.add(entity); - - return found; - } - - /** - * Get world for this region - * - * @return - */ - public final World getWorld() { - if (!isWhole()) - return null; - - if (primary != null && secondary == null) - return Bukkit.getWorld(primary.getWorld().getName()); - - if (secondary != null && primary == null) - return Bukkit.getWorld(secondary.getWorld().getName()); - - Valid.checkBoolean(primary.getWorld().getName().equals(secondary.getWorld().getName()), "Worlds of this region not the same: " + primary.getWorld() + " != " + secondary.getWorld()); - return Bukkit.getWorld(primary.getWorld().getName()); - } - - /** - * Return true if the given point is within this region - * - * @param location - * @return - */ - public final boolean isWithin(@NonNull final Location location) { - Valid.checkBoolean(isWhole(), "Cannot perform isWithin on a non-complete region: " + toString()); - - if (!location.getWorld().getName().equals(primary.getWorld().getName())) - return false; - - final Location[] centered = getCorrectedPoints(); - final Location primary = centered[0]; - final Location secondary = centered[1]; - - final int x = (int) location.getX(); - final int y = (int) location.getY(); - final int z = (int) location.getZ(); - - return x >= primary.getX() && x <= secondary.getX() - && y >= primary.getY() && y <= secondary.getY() - && z >= primary.getZ() && z <= secondary.getZ(); - } - - /** - * Return true if both region points are set - * - * @return - */ - public final boolean isWhole() { - return primary != null && secondary != null; - } - - /** - * Set the primary region point - * - * @param primary - */ - public final void setPrimary(final Location primary) { - this.primary = primary; - } - - /** - * Set the secondary region point - * - * @param primary - */ - public final void setSecondary(final Location secondary) { - this.secondary = secondary; - } - - /** - * Sets a new primary and secondary locations, - * preserving old keys if the new are not given - * - * @param primary - * @param secondary - */ - public final void updateLocationsWeak(final Location primary, final Location secondary) { - if (primary != null) - this.primary = primary; - - if (secondary != null) - this.secondary = secondary; - } - - @Override - public final String toString() { - return getClass().getSimpleName() + "{name=" + name + ",location=" + Common.shortLocation(primary) + " - " + Common.shortLocation(secondary) + "}"; - } - - /** - * Saves the region data into a map you can save in your yaml or json file - */ - @Override - public final SerializedMap serialize() { - final SerializedMap map = new SerializedMap(); - - map.putIfExist("Name", name); - map.putIfExist("Primary", primary); - map.putIfExist("Secondary", secondary); - - return map; - } - - /** - * Converts a saved map from your yaml/json file into a region if it contains Primary and Secondary keys - * - * @param map - * @return - */ - public static Region deserialize(final SerializedMap map) { - Valid.checkBoolean(map.containsKey("Primary") && map.containsKey("Secondary"), "The region must have Primary and a Secondary location"); - - final String name = map.getString("Name"); - final Location prim = map.getLocation("Primary"); - final Location sec = map.getLocation("Secondary"); - - return new Region(name, prim, sec); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompAttribute.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompAttribute.java deleted file mode 100644 index d6765f147deef9efdd3428af01500603883d883c..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompAttribute.java +++ /dev/null @@ -1,211 +0,0 @@ -package org.mineacademy.fo.remain; - -import java.lang.reflect.Method; - -import org.bukkit.attribute.Attribute; -import org.bukkit.attribute.AttributeInstance; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.exception.FoException; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * Wrapper for {@link Attribute} - * <p> - * See https://minecraft.gamepedia.com/Attribute for more information - */ -@RequiredArgsConstructor -public enum CompAttribute { - - /** - * Maximum health of an Entity. - */ - GENERIC_MAX_HEALTH("generic.maxHealth", "maxHealth"), - - /** - * Range at which an Entity will follow others. - */ - GENERIC_FOLLOW_RANGE("generic.followRange", "FOLLOW_RANGE"), - - /** - * Resistance of an Entity to knockback. - */ - GENERIC_KNOCKBACK_RESISTANCE("generic.knockbackResistance", "c"), - - /** - * Movement speed of an Entity. - * <p> - * For default values see https://minecraft.gamepedia.com/Attribute - */ - GENERIC_MOVEMENT_SPEED("generic.movementSpeed", "MOVEMENT_SPEED"), - - /** - * Flying speed of an Entity. - */ - GENERIC_FLYING_SPEED("generic.flyingSpeed"), - - /** - * Attack damage of an Entity. - * <p> - * This attribute is not found on passive mobs and golems. - */ - GENERIC_ATTACK_DAMAGE("generic.attackDamage", "ATTACK_DAMAGE"), - - /** - * Attack speed of an Entity. - */ - GENERIC_ATTACK_SPEED("generic.attackSpeed"), - - /** - * Armor bonus of an Entity. - */ - GENERIC_ARMOR("generic.armor"), - - /** - * Armor durability bonus of an Entity. - */ - GENERIC_ARMOR_TOUGHNESS("generic.armorToughness"), - - /** - * Luck bonus of an Entity. - */ - GENERIC_LUCK("generic.luck"), - - /** - * Strength with which a horse will jump. - */ - HORSE_JUMP_STRENGTH("horse.jumpStrength"), - - /** - * Chance of a Zombie to spawn reinforcements. - */ - ZOMBIE_SPAWN_REINFORCEMENTS("zombie.spawnReinforcements"); - - /** - * The internal name - */ - @Getter - private final String minecraftName; - - /** - * Used for MC 1.8.9 compatibility. Returns the field name in GenericAttributes - * class for that MC version, or null if not existing. - */ - private String genericFieldName; - - /** - * Construct a new Attribute. - * - * @param name the generic name - * @param genericFieldName, see {@link #genericFieldName} - */ - private CompAttribute(final String name, final String genericFieldName) { - this.minecraftName = name; - this.genericFieldName = genericFieldName; - } - - /** - * Get if this attribute existed in MC 1.8.9 - * - * @return true if this attribute existed in MC 1.8.9 - */ - public final boolean hasLegacy() { - return genericFieldName != null; - } - - /** - * Finds the attribute of an entity - * - * @param entity - * @return the attribute, or null if not supported by the server - */ - public final Double get(final LivingEntity entity) { - try { - final AttributeInstance instance = entity.getAttribute(Attribute.valueOf(toString())); - - return instance != null ? instance.getBaseValue() : null; - - } catch (IllegalArgumentException | NoSuchMethodError | NoClassDefFoundError ex) { - try { - return hasLegacy() ? getLegacy(entity) : null; - - } catch (final NullPointerException exx) { - return null; - - } catch (final Throwable t) { - if (MinecraftVersion.equals(V.v1_8)) - t.printStackTrace(); - - return null; - } - } - } - - /** - * If supported by the server, sets a new attribute to the entity - * - * @param entity - * @param value - */ - public final void set(final LivingEntity entity, final double value) { - Valid.checkNotNull(entity, "Entity cannot be null"); - Valid.checkNotNull(entity, "Attribute cannot be null"); - - try { - final AttributeInstance instance = entity.getAttribute(Attribute.valueOf(toString())); - - instance.setBaseValue(value); - } catch (NullPointerException | NoSuchMethodError | NoClassDefFoundError ex) { - try { - if (hasLegacy()) - setLegacy(entity, value); - - } catch (final Throwable t) { - if (MinecraftVersion.equals(V.v1_8)) - t.printStackTrace(); - - if (t instanceof NullPointerException) - throw new FoException("Attribute " + this + " cannot be set for " + entity); - } - } - } - - // MC 1.8.9 - private double getLegacy(final Entity entity) { - return (double) ReflectionUtil.invoke("getValue", getLegacyAttributeInstance(entity)); - } - - // MC 1.8.9 - private void setLegacy(final Entity entity, final double value) { - final Object instance = getLegacyAttributeInstance(entity); - - ReflectionUtil.invoke(ReflectionUtil.getMethod(instance.getClass(), "setValue", double.class), instance, value); - } - - // MC 1.8.9 - private Object getLegacyAttributeInstance(final Entity entity) { - final Object nmsEntity = ReflectionUtil.invoke("getHandle", entity); - - final Class<?> genericAttribute = ReflectionUtil.getNMSClass("GenericAttributes", "net.minecraft.world.entity.ai.attributes.GenericAttributes"); - Object iAttribute; - - try { - iAttribute = ReflectionUtil.getStaticFieldContent(genericAttribute, this.genericFieldName); - } catch (final Throwable t) { - iAttribute = ReflectionUtil.getStaticFieldContent(genericAttribute, this.minecraftName); - } - - final Class<?> nmsLiving = ReflectionUtil.getNMSClass("EntityLiving", "N/A"); - final Method method = ReflectionUtil.getMethod(nmsLiving, "getAttributeInstance", ReflectionUtil.getNMSClass("IAttribute", "N/A")); - - final Object ret = ReflectionUtil.invoke(method, nmsEntity, iAttribute); - - return ret; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompBarColor.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompBarColor.java deleted file mode 100644 index 40637186894ee8be44b7160f46dafb01df327b5a..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompBarColor.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.mineacademy.fo.remain; - -import org.mineacademy.fo.Common; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * A wrapper for BarColor from bukkit - */ -@RequiredArgsConstructor -public enum CompBarColor { - - PINK("PINK"), - BLUE("BLUE"), - RED("RED"), - GREEN("GREEN"), - YELLOW("YELLOW"), - PURPLE("PURPLE"), - WHITE("WHITE"); - - @Getter - private final String key; - - /** - * Attempt to load CompBarColor from the given key - * - * @param key - * @return - */ - public static CompBarColor fromKey(String key) { - for (final CompBarColor mode : values()) - if (mode.key.equalsIgnoreCase(key)) - return mode; - - throw new IllegalArgumentException("No such CompBarColor: " + key + ". Available: " + Common.join(values())); - } - - @Override - public String toString() { - return this.key; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompBarStyle.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompBarStyle.java deleted file mode 100644 index def6feef1bf53ccec59567669ecf96ba5e9f0fdd..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompBarStyle.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.mineacademy.fo.remain; - -import org.mineacademy.fo.Common; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * A wrapper for BarStyle from bukkit - */ -@RequiredArgsConstructor -public enum CompBarStyle { - - /** - * Makes the boss bar solid (no segments) - */ - SOLID("SOLID", "SOLID"), - - /** - * Splits the boss bar into 6 segments - */ - SEGMENTED_6("SEGMENTED_6", "SEG6"), - - /** - * Splits the boss bar into 10 segments - */ - SEGMENTED_10("SEGMENTED_10", "SEG10"), - - /** - * Splits the boss bar into 12 segments - */ - SEGMENTED_12("SEGMENTED_12", "SEG12"), - - /** - * Splits the boss bar into 20 segments - */ - SEGMENTED_20("SEGMENTED_20", "SEG20"); - - @Getter - private final String key; - - @Getter - private final String shortKey; - - /** - * Attempt to load CompBarStyle from the given key - * - * @param key - * @return - */ - public static CompBarStyle fromKey(String key) { - for (final CompBarStyle mode : values()) - if (mode.key.equalsIgnoreCase(key) || mode.shortKey.equalsIgnoreCase(key)) - return mode; - - throw new IllegalArgumentException("No such CompBarStyle: " + key + ". Available: " + Common.join(values())); - } - - @Override - public String toString() { - return this.key; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompBiome.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompBiome.java deleted file mode 100644 index fd7ce81a997d7032d5217ffed001d2a029528e80..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompBiome.java +++ /dev/null @@ -1,132 +0,0 @@ -package org.mineacademy.fo.remain; - -import java.util.Map.Entry; - -import org.bukkit.block.Biome; -import org.mineacademy.fo.collection.StrictMap; - -/** - * A simple class for getting biome ID for legacy biomes. - * - * @deprecated We stopped storing new biomes since 1.13 due to major changes and less usage cases. - */ -@Deprecated -public final class CompBiome { - - /** - * Biome enumeration with its biome ID data - */ - private final static StrictMap<Biome, Integer> map = new StrictMap<>(); - - private CompBiome() { - } - - /** - * Get the biome by its id, or null if the id is invalid or we don't - * have the biome stored. - * <p> - * We stopped storing new biomes since 1.13 due to major changes and less usage cases. - * - * @param id - * @return - */ - public static Biome getBiomeByID(final int id) { - for (final Entry<Biome, Integer> e : map.entrySet()) - if (e.getValue() == id) - return e.getKey(); - - return null; - } - - /** - * Get the biome ID or 0 if not stored - * <p> - * We stopped storing new biomes since 1.13 due to major changes and less usage cases. - * - * @param biome - * @return - */ - public static byte getBiomeID(final Biome biome) { - return map.contains(biome) ? map.get(biome).byteValue() : 0; - } - - static { - add("PLAINS", 1); - add("FOREST_HILLS", 18); - add("TAIGA", 5); - add("BEACHES", 16); - add("SAVANNA_ROCK", 36); - add("REDWOOD_TAIGA_HILLS", 33); - add("MUTATED_TAIGA_COLD", -98); - add("OCEAN", 0); - add("COLD_BEACH", 26); - add("ICE_FLATS", 12); - add("MUTATED_SAVANNA", -93); - add("DEEP_OCEAN", 24); - add("MUTATED_SAVANNA_ROCK", -92); - add("MUTATED_ICE_FLATS", -116); - add("MUTATED_JUNGLE", -107); - add("HELL", 8); - add("MUTATED_FOREST", -124); - add("MESA_CLEAR_ROCK", 39); - add("MUTATED_SWAMPLAND", -122); - add("TAIGA_HILLS", 19); - add("SWAMPLAND", 6); - add("BIRCH_FOREST_HILLS", 28); - add("MUTATED_REDWOOD_TAIGA_HILLS", -95); - add("RIVER", 7); - add("SNOWY_TAIGA", 10); - add("FROZEN_OCEAN", 10); - add("MUTATED_PLAINS", -127); - add("TAIGA_COLD", 30); - add("MESA_ROCK", 38); - add("JUNGLE_HILLS", 22); - add("MUTATED_TAIGA", -123); - add("FROZEN_RIVER", 11); - add("STONE_BEACH", 25); - add("MUTATED_BIRCH_FOREST_HILLS", -100); - add("MUTATED_REDWOOD_TAIGA", -96); - add("MUTATED_MESA_ROCK", -90); - add("MUTATED_MESA_CLEAR_ROCK", -89); - add("JUNGLE_EDGE", 23); - add("MUTATED_EXTREME_HILLS_WITH_TREES", -94); - add("EXTREME_HILLS_WITH_TREES", 34); - add("DESERT_HILLS", 17); - add("REDWOOD_TAIGA", 32); - add("BIRCH_FOREST", 27); - add("VOID", 127); - add("MUTATED_JUNGLE_EDGE", -105); - add("JUNGLE", 21); - add("MUTATED_ROOFED_FOREST", -99); - add("ROOFED_FOREST", 29); - add("MUSHROOM_ISLAND", 14); - add("EXTREME_HILLS", 3); - add("MESA", 37); - add("MUTATED_BIRCH_FOREST", -101); - add("SMALLER_EXTREME_HILLS", 20); - add("MUSHROOM_ISLAND_SHORE", 15); - add("MUTATED_MESA", -91); - add("SKY", 9); - add("FOREST", 4); - add("DESERT", 2); - add("SAVANNA", 35); - add("MUTATED_EXTREME_HILLS", -125); - add("ICE_MOUNTAINS", 13); - add("MUTATED_DESERT", -126); - add("TAIGA_COLD_HILLS", 31); - } - - /** - * Register new biome into the map - * - * @param biome - * @param id - */ - private static void add(String biome, int id) { - try { - map.put(Biome.valueOf(biome), id); - } catch (final Throwable t) { - // ignore if is not present in the current MC version - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompChatColor.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompChatColor.java deleted file mode 100644 index 249cdaa7c8fe19863e4f1133d77dcfcfcbc5b772..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompChatColor.java +++ /dev/null @@ -1,354 +0,0 @@ -package org.mineacademy.fo.remain; - -import java.awt.Color; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Objects; - -import org.mineacademy.fo.ItemUtil; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.Valid; - -import lombok.Getter; -import lombok.NonNull; - -/** - * Simplistic enumeration of all supported color values for chat. - * - * @author md_5, backported for comp. reasons by kangarko - */ -public final class CompChatColor { - - /** - * The special character which prefixes all chat colour codes. Use this if - * you need to dynamically convert colour codes from your custom format. - */ - public static final char COLOR_CHAR = '\u00A7'; - public static final String ALL_CODES = "0123456789AaBbCcDdEeFfKkLlMmNnOoRrXx"; - - /** - * Colour instances keyed by their active character. - */ - private static final Map<Character, CompChatColor> BY_CHAR = new HashMap<>(); - - /** - * Colour instances keyed by their name. - */ - private static final Map<String, CompChatColor> BY_NAME = new HashMap<>(); - - /** - * Represents black. - */ - public static final CompChatColor BLACK = new CompChatColor('0', "black", new Color(0x000000)); - - /** - * Represents dark blue. - */ - public static final CompChatColor DARK_BLUE = new CompChatColor('1', "dark_blue", new Color(0x0000AA)); - - /** - * Represents dark green. - */ - public static final CompChatColor DARK_GREEN = new CompChatColor('2', "dark_green", new Color(0x00AA00)); - - /** - * Represents dark blue (aqua). - */ - public static final CompChatColor DARK_AQUA = new CompChatColor('3', "dark_aqua", new Color(0x00AAAA)); - - /** - * Represents dark red. - */ - public static final CompChatColor DARK_RED = new CompChatColor('4', "dark_red", new Color(0xAA0000)); - - /** - * Represents dark purple. - */ - public static final CompChatColor DARK_PURPLE = new CompChatColor('5', "dark_purple", new Color(0xAA00AA)); - - /** - * Represents gold. - */ - public static final CompChatColor GOLD = new CompChatColor('6', "gold", new Color(0xFFAA00)); - - /** - * Represents gray. - */ - public static final CompChatColor GRAY = new CompChatColor('7', "gray", new Color(0xAAAAAA)); - - /** - * Represents dark gray. - */ - public static final CompChatColor DARK_GRAY = new CompChatColor('8', "dark_gray", new Color(0x555555)); - - /** - * Represents blue. - */ - public static final CompChatColor BLUE = new CompChatColor('9', "blue", new Color(0x05555FF)); - - /** - * Represents green. - */ - public static final CompChatColor GREEN = new CompChatColor('a', "green", new Color(0x55FF55)); - - /** - * Represents aqua. - */ - public static final CompChatColor AQUA = new CompChatColor('b', "aqua", new Color(0x55FFFF)); - - /** - * Represents red. - */ - public static final CompChatColor RED = new CompChatColor('c', "red", new Color(0xFF5555)); - - /** - * Represents light purple. - */ - public static final CompChatColor LIGHT_PURPLE = new CompChatColor('d', "light_purple", new Color(0xFF55FF)); - - /** - * Represents yellow. - */ - public static final CompChatColor YELLOW = new CompChatColor('e', "yellow", new Color(0xFFFF55)); - - /** - * Represents white. - */ - public static final CompChatColor WHITE = new CompChatColor('f', "white", new Color(0xFFFFFF)); - - /** - * Represents magical characters that change around randomly. - */ - public static final CompChatColor MAGIC = new CompChatColor('k', "obfuscated"); - - /** - * Makes the text bold. - */ - public static final CompChatColor BOLD = new CompChatColor('l', "bold"); - - /** - * Makes a line appear through the text. - */ - public static final CompChatColor STRIKETHROUGH = new CompChatColor('m', "strikethrough"); - - /** - * Makes the text appear underlined. - */ - public static final CompChatColor UNDERLINE = new CompChatColor('n', "underline"); - - /** - * Makes the text italic. - */ - public static final CompChatColor ITALIC = new CompChatColor('o', "italic"); - - /** - * Resets all previous chat colors or formats. - */ - public static final CompChatColor RESET = new CompChatColor('r', "reset"); - - /** - * The code representing this color such as a, r, etc. - */ - private final char code; - - /** - * The name of this color - */ - @Getter - private final String name; - - /** - * The RGB color of the ChatColor. null for non-colors (formatting) - */ - @Getter - private final Color color; - - /** - * This colour's colour char prefixed by the {@link #COLOR_CHAR}. - */ - private final String toString; - - private CompChatColor(char code, String name) { - this(code, name, null); - } - - private CompChatColor(char code, String name, Color color) { - this.code = code; - this.name = name; - this.color = color; - this.toString = new String(new char[] { COLOR_CHAR, code }); - - BY_CHAR.put(code, this); - BY_NAME.put(name.toUpperCase(Locale.ROOT), this); - } - - private CompChatColor(String name, String toString, int rgb) { - this.code = '#'; - this.name = name; - this.color = new Color(rgb); - this.toString = toString; - } - - @Override - public int hashCode() { - int hash = 7; - hash = 53 * hash + Objects.hashCode(this.toString); - return hash; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - - if (obj == null || getClass() != obj.getClass()) - return false; - - return Objects.equals(this.toString, ((CompChatColor) obj).toString); - } - - /** - * Get the color code - * - * @return the code - */ - public char getCode() { - Valid.checkBoolean(code != '#', "Cannot retrieve color code for HEX colors"); - - return code; - } - - /** - * Return true if the color is HEX? - * - * @return - */ - public boolean isHex() { - return code == '#'; - } - - /** - * Return the color's name such as red, or in case of hex color return - * the code, colorized - * @return - */ - public String toReadableString() { - return isHex() ? toString + "\\" + getName() : ItemUtil.bountify(getName()); - } - - /** - * Return a string that can be used in saving yml files - * - * @return - */ - public String toSaveableString() { - return isHex() ? getName() : getName(); - } - - @Override - public String toString() { - return toString; - } - - /** - * Get the color represented by the specified code. - * - * @param code the code to search for - * @return the mapped colour, or null if non exists - */ - public static CompChatColor getByChar(char code) { - return BY_CHAR.get(code); - } - - /** - * Parse the given color to chat color - * - * @param color - * @return - */ - public static CompChatColor of(Color color) { - return of("#" + Integer.toHexString(color.getRGB()).substring(2)); - } - - /** - * Get a color from #123456 HEX code, & color code or name - * - * @param string - * @return - */ - public static CompChatColor of(@NonNull String string) { - - if (string.startsWith("#") && string.length() == 7) { - if (!MinecraftVersion.atLeast(V.v1_16)) - throw new IllegalArgumentException("Only Minecraft 1.16+ supports # HEX color codes!"); - - int rgb; - - try { - rgb = Integer.parseInt(string.substring(1), 16); - - } catch (final NumberFormatException ex) { - throw new IllegalArgumentException("Illegal hex string " + string); - } - - final StringBuilder magic = new StringBuilder(COLOR_CHAR + "x"); - - for (final char c : string.substring(1).toCharArray()) - magic.append(COLOR_CHAR).append(c); - - return new CompChatColor(string, magic.toString(), rgb); - } - - if (string.length() == 2) { - if (string.charAt(0) != '&') - throw new IllegalArgumentException("Invalid syntax, please use & + color code. Got: " + string); - - final CompChatColor byChar = BY_CHAR.get(string.charAt(1)); - - if (byChar != null) - return byChar; - - } else { - final CompChatColor byName = BY_NAME.get(string.toUpperCase(Locale.ROOT)); - - if (byName != null) - return byName; - - if (string.equalsIgnoreCase("magic")) - return MAGIC; - } - - throw new IllegalArgumentException("Could not parse CompChatColor " + string); - } - - /** - * Get an array of all defined colors and formats. - * - * @return copied array of all colors and formats - */ - public static CompChatColor[] values() { - return BY_CHAR.values().toArray(new CompChatColor[BY_CHAR.values().size()]); - } - - /** - * Return a list of all colors - * - * @return - */ - public static List<CompChatColor> getColors() { - return Arrays.asList(BLACK, DARK_BLUE, DARK_GREEN, DARK_AQUA, DARK_RED, DARK_PURPLE, GOLD, GRAY, DARK_GRAY, BLUE, GREEN, AQUA, RED, LIGHT_PURPLE, YELLOW, WHITE); - } - - /** - * Return a list of all decorations - * - * @return - */ - public static List<CompChatColor> getDecorations() { - return Arrays.asList(MAGIC, BOLD, STRIKETHROUGH, UNDERLINE, ITALIC); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompColor.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompColor.java deleted file mode 100644 index c078c77ea2d5dd6063ee606845610e27d8a294d6..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompColor.java +++ /dev/null @@ -1,447 +0,0 @@ -package org.mineacademy.fo.remain; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.ChatColor; -import org.bukkit.Color; -import org.bukkit.DyeColor; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.exception.FoException; - -import lombok.Getter; - -/** - * A utility class enabling you to convert between {@link DyeColor} and {@link ChatColor} with ease - */ -public final class CompColor { - - /** - * The list of all native values - */ - private static final List<CompColor> values = new ArrayList<>(); - - /** - * The blue color - */ - public static final CompColor BLUE = new CompColor("BLUE", DyeColor.BLUE); - - /** - * The black color - */ - public static final CompColor BLACK = new CompColor("BLACK", DyeColor.BLACK); - - /** - * The dark aqua (cyan) color - */ - public static final CompColor DARK_AQUA = new CompColor("DARK_AQUA", DyeColor.CYAN); - - /** - * The dark blue color, called BLUE for dyecolor - */ - public static final CompColor DARK_BLUE = new CompColor("DARK_BLUE", DyeColor.BLUE); - - /** - * The aqua color (called light blue for dyecolor) - */ - public static final CompColor AQUA = new CompColor("AQUA", DyeColor.LIGHT_BLUE); - - /** - * The light gray color, previously silver (compatible for all MC versions) - */ - public static final CompColor GRAY = new CompColor("GRAY", getEnum("LIGHT_GRAY", "SILVER", DyeColor.class), null, "SILVER"); - - /** - * The dark gray color, called gray for dyecolor - */ - public static final CompColor DARK_GRAY = new CompColor("DARK_GRAY", DyeColor.GRAY); - - /** - * The dark green color, called green for dyecolor - */ - public static final CompColor DARK_GREEN = new CompColor("DARK_GREEN", DyeColor.GREEN); - - /** - * The green color, called lime for dyecolor - */ - public static final CompColor GREEN = new CompColor("GREEN", DyeColor.LIME); - - /** - * The gold color, called orange for dyecolor - */ - public static final CompColor GOLD = new CompColor("GOLD", DyeColor.ORANGE); - - /** - * The brown color - * <p> - * NB: This color does not have a {@link ChatColor} alternative, - * so we give you GOLD chat color instead - */ - public static final CompColor BROWN = new CompColor("BROWN", DyeColor.BROWN, ChatColor.GOLD); - - /** - * The dark red color, called red for dyecolor - */ - public static final CompColor DARK_RED = new CompColor("DARK_RED", DyeColor.RED); - - /** - * The red color - */ - public static final CompColor RED = new CompColor("RED", DyeColor.RED); - - /** - * The white - */ - public static final CompColor WHITE = new CompColor("WHITE", DyeColor.WHITE); - - /** - * The yellow color - */ - public static final CompColor YELLOW = new CompColor("YELLOW", DyeColor.YELLOW); - - /** - * The dark purple color, called purple for dyecolor - */ - public static final CompColor DARK_PURPLE = new CompColor("DARK_PURPLE", DyeColor.PURPLE); - - /** - * The light purple color, called magenta for dyecolor - */ - public static final CompColor LIGHT_PURPLE = new CompColor("LIGHT_PURPLE", DyeColor.MAGENTA); - - /** - * The pink color - * <p> - * NB: This color does not have a {@link ChatColor} alternative, - * so we give you LIGHT_PURPLE chat color instead - */ - public static final CompColor PINK = new CompColor("PINK", DyeColor.PINK, ChatColor.LIGHT_PURPLE); - - /** - * The toString representation - */ - @Getter - private final String name; - - /** - * The {@link DyeColor} representation - */ - @Getter - private final DyeColor dye; - - /** - * The {@link ChatColor} representation - */ - @Getter - private final ChatColor chatColor; - - /** - * The legacy dye/chat color name, or null if none - */ - private final String legacyName; - - /** - * The associated HEX color or null if not set - */ - private Color color; - - private CompColor(final Color color) { - this(null, null, null); - - this.color = color; - } - - private CompColor(final String name, final DyeColor dye) { - this(name, dye, null); - } - - private CompColor(final String name, final DyeColor dye, final ChatColor chatColor) { - this(name, dye, chatColor, null); - } - - private CompColor(final String name, final DyeColor dye, final ChatColor chatColor, final String legacyName) { - this.name = name; - this.dye = dye; - this.chatColor = chatColor == null ? name != null ? ChatColor.valueOf(name) : ChatColor.WHITE : chatColor; - this.legacyName = Common.getOrEmpty(legacyName); - - values.add(this); - } - - /** - * Get the bukkit color - * - * @return - */ - public Color getColor() { - return color != null ? color : dye.getColor(); - } - - // ---------------------------------------------------------------------------------------------------- - // Static access - // ---------------------------------------------------------------------------------------------------- - - /** - * Attempts to lookup an enum by its primary name, if fails then by secondary - * name, if fails than returns null - * - * @param newName - * @param oldName - * @param clazz - * @return - */ - private static <T extends Enum<T>> T getEnum(final String newName, final String oldName, final Class<T> clazz) { - T en = ReflectionUtil.lookupEnumSilent(clazz, newName); - - if (en == null) - en = ReflectionUtil.lookupEnumSilent(clazz, oldName); - - return en; - } - - /** - * Make new compatible dye from wool data - * - * @param data - * @return - */ - public static CompColor fromWoolData(final byte data) { - return fromDye(DyeColor.getByWoolData(data)); - } - - /** - * Make new compatible dye from name - * - * @param color - * @return - */ - public static CompColor fromColor(Color color) { - return fromName("#" + Integer.toHexString(color.asRGB()).substring(2)); - } - - /** - * Make new compatible dye from name. Name can also be a valid - * RGB: #123456 - * - * @param name - * @return - */ - public static CompColor fromName(String name) { - - // Support HEX colors - if (name.startsWith("#") && name.length() == 7) - return new CompColor(Color.fromRGB( - Integer.valueOf(name.substring(1, 3), 16), - Integer.valueOf(name.substring(3, 5), 16), - Integer.valueOf(name.substring(5, 7), 16))); - - name = name.toUpperCase(); - - for (final CompColor comp : values()) - if (comp.chatColor.toString().equals(name) || comp.dye.toString().equals(name) || comp.legacyName.equals(name)) - return comp; - - throw new IllegalArgumentException("Could not get CompColor from name: " + name); - } - - /** - * Make new compatible dye from bukkit dye - * - * @param dye - * @return - */ - public static CompColor fromDye(final DyeColor dye) { - for (final CompColor comp : values()) - if (comp.dye == dye || comp.legacyName.equals(dye.toString())) - return comp; - - throw new IllegalArgumentException("Could not get CompColor from DyeColor." + dye.toString()); - } - - /** - * Returns a {@link CompDye} from the given chat color - * - * @param color - * @return - */ - public static CompColor fromChatColor(final ChatColor color) { - for (final CompColor comp : values()) - if (comp.chatColor == color || comp.legacyName.equals(color.toString())) - return comp; - - throw new IllegalArgumentException("Could not get CompColor from ChatColor." + color.name()); - } - - /** - * Returns a {@link CompDye} from the given chat color - * - * @param color - * @return - */ - public static CompColor fromChatColor(final CompChatColor color) { - for (final CompColor comp : values()) - if (comp.chatColor.name().equalsIgnoreCase(color.getName()) || comp.legacyName.equalsIgnoreCase(color.toString())) - return comp; - - throw new FoException("Could not get CompColor from ChatColor." + color.getName()); - } - - // ---------------------------------------------------------------------------------------------------- - // Converters - // ---------------------------------------------------------------------------------------------------- - - /** - * Convert a chat color into dye color - * - * @param color - * @return - */ - public static DyeColor toDye(final ChatColor color) { - final CompColor c = fromName(color.name()); - - return c != null ? c.getDye() : DyeColor.WHITE; - } - - /** - * Convert a dye color into chat color - * - * @param dye - * @return - */ - public static ChatColor toColor(final DyeColor dye) { - for (final CompColor c : CompColor.values()) - if (c.getDye() == dye) - return c.getChatColor(); - - return ChatColor.WHITE; - } - - /** - * Return a colored concrete (or wool if the current MC does not support it - * - * @param color - * @return - */ - public static CompMaterial toConcrete(final ChatColor color) { - final CompMaterial wool = toWool(color); - - return CompMaterial.fromString(wool.toString().replace("_WOOL", MinecraftVersion.olderThan(V.v1_12) ? "_STAINED_GLASS" : "_CONCRETE")); - } - - /** - * Create colored wool from the given chat color - * - * @param color - * @return - */ - public static CompMaterial toWool(final ChatColor color) { - final CompColor comp = fromChatColor(color); - - if (comp == AQUA) - return CompMaterial.LIGHT_BLUE_WOOL; - - if (comp == BLACK) - return CompMaterial.BLACK_WOOL; - - if (comp == BLUE) - return CompMaterial.BLUE_WOOL; - - if (comp == BROWN) - return CompMaterial.BROWN_WOOL; - - if (comp == DARK_AQUA) - return CompMaterial.CYAN_WOOL; - - if (comp == DARK_BLUE) - return CompMaterial.BLUE_WOOL; - - if (comp == DARK_GRAY) - return CompMaterial.GRAY_WOOL; - - if (comp == DARK_GREEN) - return CompMaterial.GREEN_WOOL; - - if (comp == DARK_PURPLE) - return CompMaterial.PURPLE_WOOL; - - if (comp == DARK_RED) - return CompMaterial.RED_WOOL; - - if (comp == GOLD) - return CompMaterial.ORANGE_WOOL; - - if (comp == GRAY) - return CompMaterial.LIGHT_GRAY_WOOL; - - if (comp == GREEN) - return CompMaterial.LIME_WOOL; - - if (comp == LIGHT_PURPLE) - return CompMaterial.MAGENTA_WOOL; - - if (comp == PINK) - return CompMaterial.PINK_WOOL; - - if (comp == RED) - return CompMaterial.RED_WOOL; - - if (comp == WHITE) - return CompMaterial.WHITE_WOOL; - - if (comp == YELLOW) - return CompMaterial.YELLOW_WOOL; - - return CompMaterial.WHITE_WOOL; - - } - - // ---------------------------------------------------------------------------------------------------- - // Utils - // ---------------------------------------------------------------------------------------------------- - - /** - * Get a list of all chat colors (only colors, NO formats like bold, reset etc.) - * - * @return - */ - public static List<ChatColor> getChatColors() { - final List<ChatColor> list = new ArrayList<>(); - - for (final ChatColor color : ChatColor.values()) - if (color.isColor() && !color.isFormat()) - list.add(color); - - return list; - } - - // ---------------------------------------------------------------------------------------------------- - // Leftovers from when this class was an enum - // ---------------------------------------------------------------------------------------------------- - - /** - * Return all predefined colors - * - * @return - */ - public static CompColor[] values() { - return values.toArray(new CompColor[values.size()]); - } - - /** - * See {@link #fromName(String)} - * - * @param name - * @return - */ - public static CompColor valueOf(String name) { - return fromName(name); - } - - @Override - public String toString() { - return this.name; - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompDye.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompDye.java deleted file mode 100644 index 9d5ac00d486e2c9438e2b6636097b98d120ebe4c..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompDye.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.mineacademy.fo.remain; - -import org.bukkit.ChatColor; -import org.bukkit.DyeColor; - -/** - * A utility class enabling you to convert between {@link DyeColor} and {@link ChatColor} with ease - * - * @deprecated this has been merged into {@link CompColor}, use that instead - */ -public enum CompDye { -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompEquipmentSlot.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompEquipmentSlot.java deleted file mode 100644 index 64fa726f79307dc378d3440e34ae6955e21e9526..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompEquipmentSlot.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.mineacademy.fo.remain; - -import org.bukkit.inventory.EquipmentSlot; - -/** - * A wrapper for EquiptmentSlot for legacy bukkit - * - * @deprecated subject for removal, simply use {@link EquipmentSlot} - * from the official API - */ -public enum CompEquipmentSlot { - - HAND, - OFF_HAND, - FEET, - LEGS, - CHEST, - HEAD -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompItemFlag.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompItemFlag.java deleted file mode 100644 index 02b166b3cfc12a03245cc51557bf74032c555ac1..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompItemFlag.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.mineacademy.fo.remain; - -import org.bukkit.inventory.ItemFlag; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; - -/** - * A compatibility wrapper for {@link ItemFlag} - */ -public enum CompItemFlag { - - /** - * Setting to show/hide enchants - */ - HIDE_ENCHANTS, - - /** - * Setting to show/hide Attributes like Damage - */ - HIDE_ATTRIBUTES, - - /** - * Setting to show/hide the unbreakable State - */ - HIDE_UNBREAKABLE, - - /** - * Setting to show/hide what the ItemStack can break/destroy - */ - HIDE_DESTROYS, - - /** - * Setting to show/hide where this ItemStack can be build/placed on - */ - HIDE_PLACED_ON, - - /** - * Setting to show/hide potion effects on this ItemStack - */ - HIDE_POTION_EFFECTS; - - /** - * Tries to apply this item flag to the given item, fails silently - * - * @param item - */ - public final void applyTo(ItemStack item) { - try { - final ItemMeta meta = item.getItemMeta(); - final ItemFlag bukkitFlag = ItemFlag.valueOf(toString()); - - meta.addItemFlags(bukkitFlag); - - item.setItemMeta(meta); - - } catch (final Throwable t) { - // Unsupported MC version - } - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompMaterial.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompMaterial.java deleted file mode 100644 index 26f50a8a61916ccfd468ff1ba263dbcdf77ae99e..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompMaterial.java +++ /dev/null @@ -1,2692 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2018 Hex_27 - * Copyright (c) 2021 Crypto Morin - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR - * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE - * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -package org.mineacademy.fo.remain; - -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Locale; -import java.util.Map; -import java.util.Objects; -import java.util.Set; - -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.ItemUtil; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictSet; -import org.mineacademy.fo.debug.Debugger; - -import lombok.Getter; -import lombok.NonNull; - -/** - * <b>CompMaterial</b> - Data Values/Pre-flattening<br> - * 1.13 and above as priority. - * <p> - * This class is mainly designed to support {@link ItemStack}. If you want to use it on blocks, you'll have to use - * <a href="https://github.com/CryptoMorin/XSeries/blob/master/src/main/java/com/cryptomorin/xseries/XBlock.java">XBlock</a> - * <p> - * Pre-flattening: https://minecraft.gamepedia.com/Java_Edition_data_values/Pre-flattening - * Materials: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html - * Materials (1.12): https://helpch.at/docs/1.12.2/index.html?org/bukkit/Material.html - * Material IDs: https://minecraft-ids.grahamedgecombe.com/ - * Material Source Code: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/Material.java - * XMaterial v1: https://www.spigotmc.org/threads/329630/ - * <p> - * This class will throw a "unsupported material" error if someone tries to use an item with an invalid data value which can only happen in 1.12 servers and below or when the - * utility is missing a new material in that specific version. - * To get an invalid item, (aka <a href="https://minecraft.fandom.com/wiki/Missing_Texture_Block">Missing Texture Block</a>) you can use the command - * <b>/give @p minecraft:dirt 1 10</b> where 1 is the item amount, and 10 is the data value. The material {@link #DIRT} with a data value of {@code 10} doesn't exist. - * - * @author Crypto Morin, forked by kangarko from MineAcademy.org - */ -public enum CompMaterial { - ACACIA_BOAT("BOAT_ACACIA"), - ACACIA_BUTTON("WOOD_BUTTON"), - ACACIA_DOOR("ACACIA_DOOR", "ACACIA_DOOR_ITEM"), - ACACIA_FENCE, - ACACIA_FENCE_GATE, - ACACIA_LEAVES("LEAVES_2"), - ACACIA_LOG("LOG_2"), - ACACIA_PLANKS(4, "WOOD"), - ACACIA_PRESSURE_PLATE("WOOD_PLATE"), - ACACIA_SAPLING(4, "SAPLING"), - ACACIA_SIGN("SIGN_POST", "SIGN"), - ACACIA_SLAB(4, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), - ACACIA_STAIRS, - ACACIA_TRAPDOOR("TRAP_DOOR"), - ACACIA_WALL_SIGN("WALL_SIGN"), - ACACIA_WOOD("LOG_2"), - ACTIVATOR_RAIL, - /** - * https://minecraft.gamepedia.com/Air - * {@link Material#isAir()} - * - * @see #VOID_AIR - * @see #CAVE_AIR - */ - AIR, - ALLIUM(2, "RED_ROSE"), - AMETHYST_BLOCK, - AMETHYST_CLUSTER, - AMETHYST_SHARD, - ANCIENT_DEBRIS(16), - ANDESITE(5, "STONE"), - ANDESITE_SLAB, - ANDESITE_STAIRS, - ANDESITE_WALL, - ANVIL, - APPLE, - ARMOR_STAND, - ARROW, - ATTACHED_MELON_STEM(7, "MELON_STEM"), - ATTACHED_PUMPKIN_STEM(7, "PUMPKIN_STEM"), - AXOLOTL_BUCKET, - AXOLOTL_SPAWN_EGG, - AZALEA, - AZALEA_LEAVES, - AZURE_BLUET(3, "RED_ROSE"), - BAKED_POTATO, - BAMBOO(0, 14), - BAMBOO_SAPLING(14), - BARREL(0, 14), - BARRIER, - BASALT(16), - BAT_SPAWN_EGG(65, "MONSTER_EGG"), - BEACON, - BEDROCK, - BEEF("RAW_BEEF"), - BEEHIVE(15), - /** - * Beetroot is a known material in pre-1.13 - */ - BEETROOT("BEETROOT_BLOCK"), - BEETROOTS("BEETROOT"), - BEETROOT_SEEDS, - BEETROOT_SOUP, - BEE_NEST(15), - BEE_SPAWN_EGG(15), - BELL(14), - BIG_DRIPLEAF, - BIG_DRIPLEAF_STEM, - BIRCH_BOAT("BOAT_BIRCH"), - BIRCH_BUTTON("WOOD_BUTTON"), - BIRCH_DOOR("BIRCH_DOOR", "BIRCH_DOOR_ITEM"), - BIRCH_FENCE, - BIRCH_FENCE_GATE, - BIRCH_LEAVES(2, "LEAVES"), - BIRCH_LOG(2, "LOG"), - BIRCH_PLANKS(2, "WOOD"), - BIRCH_PRESSURE_PLATE("WOOD_PLATE"), - BIRCH_SAPLING(2, "SAPLING"), - BIRCH_SIGN("SIGN_POST", "SIGN"), - BIRCH_SLAB(2, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), - BIRCH_STAIRS("BIRCH_WOOD_STAIRS"), - BIRCH_TRAPDOOR("TRAP_DOOR"), - BIRCH_WALL_SIGN("WALL_SIGN"), - BIRCH_WOOD(2, "LOG"), - BLACKSTONE(16), - BLACKSTONE_SLAB(16), - BLACKSTONE_STAIRS(16), - BLACKSTONE_WALL(16), - BLACK_BANNER("STANDING_BANNER", "BANNER"), - BLACK_BED(15, "BED_BLOCK", "BED"), - BLACK_CANDLE, - BLACK_CANDLE_CAKE, - BLACK_CARPET(15, "CARPET"), - BLACK_CONCRETE(15, "CONCRETE"), - BLACK_CONCRETE_POWDER(15, "CONCRETE_POWDER"), - BLACK_DYE(0, 14, "INK_SACK", "INK_SAC"), - BLACK_GLAZED_TERRACOTTA(15, 12), - BLACK_SHULKER_BOX, - BLACK_STAINED_GLASS(15, "STAINED_GLASS"), - BLACK_STAINED_GLASS_PANE(15, "STAINED_GLASS_PANE"), - BLACK_TERRACOTTA(15, "STAINED_CLAY"), - BLACK_WALL_BANNER("WALL_BANNER"), - BLACK_WOOL(15, "WOOL"), - BLAST_FURNACE(0, 14), - BLAZE_POWDER, - BLAZE_ROD, - BLAZE_SPAWN_EGG(61, "MONSTER_EGG"), - BLUE_BANNER(4, "STANDING_BANNER", "BANNER"), - BLUE_BED(11, "BED_BLOCK", "BED"), - BLUE_CANDLE, - BLUE_CANDLE_CAKE, - BLUE_CARPET(11, "CARPET"), - BLUE_CONCRETE(11, "CONCRETE"), - BLUE_CONCRETE_POWDER(11, "CONCRETE_POWDER"), - BLUE_DYE(4, "INK_SACK", "LAPIS_LAZULI"), - BLUE_GLAZED_TERRACOTTA(11, 12), - BLUE_ICE(0, 13), - BLUE_ORCHID(1, "RED_ROSE"), - BLUE_SHULKER_BOX, - BLUE_STAINED_GLASS(11, "STAINED_GLASS"), - BLUE_STAINED_GLASS_PANE(11, "THIN_GLASS", "STAINED_GLASS_PANE"), - BLUE_TERRACOTTA(11, "STAINED_CLAY"), - BLUE_WALL_BANNER(4, "WALL_BANNER"), - BLUE_WOOL(11, "WOOL"), - BONE, - BONE_BLOCK, - BONE_MEAL(15, "INK_SACK"), - BOOK, - BOOKSHELF, - BOW, - BOWL, - BRAIN_CORAL(13), - BRAIN_CORAL_BLOCK(13), - BRAIN_CORAL_FAN(13), - BRAIN_CORAL_WALL_FAN, - BREAD, - BREWING_STAND("BREWING_STAND", "BREWING_STAND_ITEM"), - BRICK("CLAY_BRICK"), - BRICKS("BRICKS", "BRICK"), - BRICK_SLAB(4, "STEP"), - BRICK_STAIRS, - BRICK_WALL, - BROWN_BANNER(3, "STANDING_BANNER", "BANNER"), - BROWN_BED(12, "BED_BLOCK", "BED"), - BROWN_CANDLE, - BROWN_CANDLE_CAKE, - BROWN_CARPET(12, "CARPET"), - BROWN_CONCRETE(12, "CONCRETE"), - BROWN_CONCRETE_POWDER(12, "CONCRETE_POWDER"), - BROWN_DYE(3, "INK_SACK", "DYE", "COCOA_BEANS"), - BROWN_GLAZED_TERRACOTTA(12, 12), - BROWN_MUSHROOM, - BROWN_MUSHROOM_BLOCK("BROWN_MUSHROOM", "HUGE_MUSHROOM_1"), - BROWN_SHULKER_BOX, - BROWN_STAINED_GLASS(12, "STAINED_GLASS"), - BROWN_STAINED_GLASS_PANE(12, "THIN_GLASS", "STAINED_GLASS_PANE"), - BROWN_TERRACOTTA(12, "STAINED_CLAY"), - BROWN_WALL_BANNER(3, "WALL_BANNER"), - BROWN_WOOL(12, "WOOL"), - BUBBLE_COLUMN(13), - BUBBLE_CORAL(13), - BUBBLE_CORAL_BLOCK(13), - BUBBLE_CORAL_FAN(13), - BUBBLE_CORAL_WALL_FAN, - BUCKET, - BUDDING_AMETHYST, - BUNDLE, - CACTUS, - CAKE("CAKE_BLOCK"), - CALCITE, - CAMPFIRE(14), - CANDLE, - CANDLE_CAKE, - CARROT("CARROT_ITEM"), - CARROTS("CARROT"), - CARROT_ON_A_STICK("CARROT_STICK"), - CARTOGRAPHY_TABLE(0, 14), - CARVED_PUMPKIN(1, 13), - CAT_SPAWN_EGG, - CAULDRON("CAULDRON", "CAULDRON_ITEM"), - /** - * 1.13 tag is not added because it's the same thing as {@link #AIR} - * - * @see #VOID_AIR - */ - CAVE_AIR("AIR"), - CAVE_SPIDER_SPAWN_EGG(59, "MONSTER_EGG"), - CAVE_VINES, - CAVE_VINES_PLANT, - CHAIN(16), - CHAINMAIL_BOOTS, - CHAINMAIL_CHESTPLATE, - CHAINMAIL_HELMET, - CHAINMAIL_LEGGINGS, - CHAIN_COMMAND_BLOCK("COMMAND", "COMMAND_CHAIN"), - CHARCOAL(1, "COAL"), - CHEST("LOCKED_CHEST"), - CHEST_MINECART("STORAGE_MINECART"), - CHICKEN("RAW_CHICKEN"), - CHICKEN_SPAWN_EGG(93, "MONSTER_EGG"), - CHIPPED_ANVIL(1, "ANVIL"), - CHISELED_DEEPSLATE, - CHISELED_NETHER_BRICKS(1, "NETHER_BRICKS"), - CHISELED_POLISHED_BLACKSTONE(0, 16, "POLISHED_BLACKSTONE"), - CHISELED_QUARTZ_BLOCK(1, "QUARTZ_BLOCK"), - CHISELED_RED_SANDSTONE(1, "RED_SANDSTONE"), - CHISELED_SANDSTONE(1, "SANDSTONE"), - CHISELED_STONE_BRICKS(3, "SMOOTH_BRICK"), - CHORUS_FLOWER(0, 9), - CHORUS_FRUIT(0, 9), - CHORUS_PLANT(0, 9), - CLAY("HARD_CLAY"), - CLAY_BALL, - CLOCK("WATCH"), - COAL, - COAL_BLOCK, - COAL_ORE, - COARSE_DIRT(1, "DIRT"), - COBBLED_DEEPSLATE, - COBBLED_DEEPSLATE_SLAB, - COBBLED_DEEPSLATE_STAIRS, - COBBLED_DEEPSLATE_WALL, - COBBLESTONE, - COBBLESTONE_SLAB(3, "STEP"), - COBBLESTONE_STAIRS, - COBBLESTONE_WALL("COBBLE_WALL"), - COBWEB("WEB"), - COCOA(15), - COCOA_BEANS(3, "INK_SACK"), - COD("RAW_FISH"), - COD_BUCKET(0, 13), - COD_SPAWN_EGG(0, 13), - COMMAND_BLOCK("COMMAND"), - COMMAND_BLOCK_MINECART("COMMAND_MINECART"), - /** - * Unlike redstone torch and redstone lamp... neither REDTONE_COMPARATOR_OFF nor REDSTONE_COMPARATOR_ON - * are items. REDSTONE_COMPARATOR is. - * - * @see #REDSTONE_TORCH - * @see #REDSTONE_LAMP - */ - COMPARATOR("REDSTONE_COMPARATOR_OFF", "REDSTONE_COMPARATOR_ON", "REDSTONE_COMPARATOR"), - COMPASS, - COMPOSTER(0, 14), - CONDUIT(0, 13, "BEACON"), - COOKED_BEEF, - COOKED_CHICKEN, - COOKED_COD("COOKED_FISH"), - COOKED_MUTTON, - COOKED_PORKCHOP("PORK", "GRILLED_PORK"), - COOKED_RABBIT, - COOKED_SALMON(1, "COOKED_FISH"), - COOKIE, - COPPER_BLOCK, - COPPER_INGOT, - COPPER_ORE, - CORNFLOWER(4, 14), - COW_SPAWN_EGG(92, "MONSTER_EGG"), - CRACKED_DEEPSLATE_BRICKS, - CRACKED_DEEPSLATE_TILES, - CRACKED_NETHER_BRICKS(2, "NETHER_BRICKS"), - CRACKED_POLISHED_BLACKSTONE_BRICKS(0, 16, "POLISHED_BLACKSTONE_BRICKS"), - CRACKED_STONE_BRICKS(2, "SMOOTH_BRICK"), - CRAFTING_TABLE("WORKBENCH"), - CREEPER_BANNER_PATTERN, - CREEPER_HEAD(4, "SKULL", "SKULL_ITEM"), - CREEPER_SPAWN_EGG(50, "MONSTER_EGG"), - CREEPER_WALL_HEAD(4, "SKULL", "SKULL_ITEM"), - CRIMSON_BUTTON(16), - CRIMSON_DOOR(16), - CRIMSON_FENCE(16), - CRIMSON_FENCE_GATE(16), - CRIMSON_FUNGUS(16), - CRIMSON_HYPHAE(16), - CRIMSON_NYLIUM(16), - CRIMSON_PLANKS(16), - CRIMSON_PRESSURE_PLATE(16), - CRIMSON_ROOTS(16), - CRIMSON_SIGN(0, 16, "SIGN_POST"), - CRIMSON_SLAB(16), - CRIMSON_STAIRS(16), - CRIMSON_STEM(16), - CRIMSON_TRAPDOOR(16), - CRIMSON_WALL_SIGN(0, 16, "WALL_SIGN"), - CROSSBOW, - CRYING_OBSIDIAN(16), - CUT_COPPER, - CUT_COPPER_SLAB, - CUT_COPPER_STAIRS, - CUT_RED_SANDSTONE(13), - CUT_RED_SANDSTONE_SLAB("STONE_SLAB2"), - CUT_SANDSTONE(13), - CUT_SANDSTONE_SLAB("STEP"), - CYAN_BANNER(6, "STANDING_BANNER", "BANNER"), - CYAN_BED(9, "BED_BLOCK", "BED"), - CYAN_CANDLE, - CYAN_CANDLE_CAKE, - CYAN_CARPET(9, "CARPET"), - CYAN_CONCRETE(9, "CONCRETE"), - CYAN_CONCRETE_POWDER(9, "CONCRETE_POWDER"), - CYAN_DYE(6, "INK_SACK"), - CYAN_GLAZED_TERRACOTTA(9, 12), - CYAN_SHULKER_BOX, - CYAN_STAINED_GLASS(9, "STAINED_GLASS"), - CYAN_STAINED_GLASS_PANE(9, "STAINED_GLASS_PANE"), - CYAN_TERRACOTTA(9, "STAINED_CLAY"), - CYAN_WALL_BANNER(6, "WALL_BANNER"), - CYAN_WOOL(9, "WOOL"), - DAMAGED_ANVIL(2, "ANVIL"), - DANDELION("YELLOW_FLOWER"), - DARK_OAK_BOAT("BOAT_DARK_OAK"), - DARK_OAK_BUTTON("WOOD_BUTTON"), - DARK_OAK_DOOR("DARK_OAK_DOOR", "DARK_OAK_DOOR_ITEM"), - DARK_OAK_FENCE, - DARK_OAK_FENCE_GATE, - DARK_OAK_LEAVES(4, "LEAVES", "LEAVES_2"), - DARK_OAK_LOG(1, "LOG_2"), - DARK_OAK_PLANKS(5, "WOOD"), - DARK_OAK_PRESSURE_PLATE("WOOD_PLATE"), - DARK_OAK_SAPLING(5, "SAPLING"), - DARK_OAK_SIGN("SIGN_POST", "SIGN"), - DARK_OAK_SLAB(5, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), - DARK_OAK_STAIRS, - DARK_OAK_TRAPDOOR("TRAP_DOOR"), - DARK_OAK_WALL_SIGN("WALL_SIGN"), - DARK_OAK_WOOD(1, "LOG_2"), - DARK_PRISMARINE(1, "PRISMARINE"), - DARK_PRISMARINE_SLAB(13), - DARK_PRISMARINE_STAIRS(13), - DAYLIGHT_DETECTOR("DAYLIGHT_DETECTOR_INVERTED"), - DEAD_BRAIN_CORAL(13), - DEAD_BRAIN_CORAL_BLOCK(13), - DEAD_BRAIN_CORAL_FAN(13), - DEAD_BRAIN_CORAL_WALL_FAN(13), - DEAD_BUBBLE_CORAL(13), - DEAD_BUBBLE_CORAL_BLOCK(13), - DEAD_BUBBLE_CORAL_FAN(13), - DEAD_BUBBLE_CORAL_WALL_FAN(13), - DEAD_BUSH, - DEAD_FIRE_CORAL(13), - DEAD_FIRE_CORAL_BLOCK(13), - DEAD_FIRE_CORAL_FAN(13), - DEAD_FIRE_CORAL_WALL_FAN(13), - DEAD_HORN_CORAL(13), - DEAD_HORN_CORAL_BLOCK(13), - DEAD_HORN_CORAL_FAN(13), - DEAD_HORN_CORAL_WALL_FAN(13), - DEAD_TUBE_CORAL(13), - DEAD_TUBE_CORAL_BLOCK(13), - DEAD_TUBE_CORAL_FAN(13), - DEAD_TUBE_CORAL_WALL_FAN(13), - DEBUG_STICK(0, 13), - DEEPSLATE, - DEEPSLATE_BRICKS, - DEEPSLATE_BRICK_SLAB, - DEEPSLATE_BRICK_STAIRS, - DEEPSLATE_BRICK_WALL, - DEEPSLATE_COAL_ORE, - DEEPSLATE_COPPER_ORE, - DEEPSLATE_DIAMOND_ORE, - DEEPSLATE_EMERALD_ORE, - DEEPSLATE_GOLD_ORE, - DEEPSLATE_IRON_ORE, - DEEPSLATE_LAPIS_ORE, - DEEPSLATE_REDSTONE_ORE, - DEEPSLATE_TILES, - DEEPSLATE_TILE_SLAB, - DEEPSLATE_TILE_STAIRS, - DEEPSLATE_TILE_WALL, - DETECTOR_RAIL, - DIAMOND, - DIAMOND_AXE, - DIAMOND_BLOCK, - DIAMOND_BOOTS, - DIAMOND_CHESTPLATE, - DIAMOND_HELMET, - DIAMOND_HOE, - DIAMOND_HORSE_ARMOR("DIAMOND_BARDING"), - DIAMOND_LEGGINGS, - DIAMOND_ORE, - DIAMOND_PICKAXE, - DIAMOND_SHOVEL("DIAMOND_SPADE"), - DIAMOND_SWORD, - DIORITE(3, "STONE"), - DIORITE_SLAB, - DIORITE_STAIRS, - DIORITE_WALL, - DIRT, - /** - * Changed in 1.17 - */ - DIRT_PATH("GRASS_PATH"), - DISPENSER, - DOLPHIN_SPAWN_EGG(0, 13), - DONKEY_SPAWN_EGG(32, "MONSTER_EGG"), - DRAGON_BREATH("DRAGONS_BREATH"), - DRAGON_EGG, - DRAGON_HEAD(5, 9, "SKULL", "SKULL_ITEM"), - DRAGON_WALL_HEAD(5, "SKULL", "SKULL_ITEM"), - DRIED_KELP(13), - DRIED_KELP_BLOCK(13), - DRIPSTONE_BLOCK, - DROPPER, - DROWNED_SPAWN_EGG(0, 13), - EGG, - ELDER_GUARDIAN_SPAWN_EGG(4, "MONSTER_EGG"), - ELYTRA, - EMERALD, - EMERALD_BLOCK, - EMERALD_ORE, - ENCHANTED_BOOK, - ENCHANTED_GOLDEN_APPLE(1, "GOLDEN_APPLE"), - ENCHANTING_TABLE("ENCHANTMENT_TABLE"), - ENDERMAN_SPAWN_EGG(58, "MONSTER_EGG"), - ENDERMITE_SPAWN_EGG(67, "MONSTER_EGG"), - ENDER_CHEST, - ENDER_EYE("EYE_OF_ENDER"), - ENDER_PEARL, - END_CRYSTAL, - END_GATEWAY(0, 9), - END_PORTAL("ENDER_PORTAL"), - END_PORTAL_FRAME("ENDER_PORTAL_FRAME"), - END_ROD(0, 9), - END_STONE("ENDER_STONE"), - END_STONE_BRICKS("END_BRICKS"), - END_STONE_BRICK_SLAB(6, "STEP"), - END_STONE_BRICK_STAIRS("SMOOTH_STAIRS"), - END_STONE_BRICK_WALL, - EVOKER_SPAWN_EGG(34, "MONSTER_EGG"), - EXPERIENCE_BOTTLE("EXP_BOTTLE"), - EXPOSED_COPPER, - EXPOSED_CUT_COPPER, - EXPOSED_CUT_COPPER_SLAB, - EXPOSED_CUT_COPPER_STAIRS, - FARMLAND("SOIL"), - FEATHER, - FERMENTED_SPIDER_EYE, - FERN(2, "LONG_GRASS"), - /** - * For some reasons filled map items are really special. - * Their data value starts from 0 and every time a player - * creates a new map that maps data value increases. - * https://github.com/CryptoMorin/XSeries/issues/91 - */ - FILLED_MAP("MAP"), - FIRE, - FIREWORK_ROCKET("FIREWORK"), - FIREWORK_STAR("FIREWORK_CHARGE"), - FIRE_CHARGE("FIREBALL"), - FIRE_CORAL(13), - FIRE_CORAL_BLOCK(13), - FIRE_CORAL_FAN(13), - FIRE_CORAL_WALL_FAN, - FISHING_ROD, - FLETCHING_TABLE(0, 14), - FLINT, - FLINT_AND_STEEL, - FLOWERING_AZALEA, - FLOWERING_AZALEA_LEAVES, - FLOWER_BANNER_PATTERN, - FLOWER_POT("FLOWER_POT", "FLOWER_POT_ITEM"), - FOX_SPAWN_EGG(14), - /** - * This special material cannot be obtained as an item. - */ - FROSTED_ICE(0, 9), - FURNACE("BURNING_FURNACE"), - FURNACE_MINECART("POWERED_MINECART"), - GHAST_SPAWN_EGG(56, "MONSTER_EGG"), - GHAST_TEAR, - GILDED_BLACKSTONE(16), - GLASS, - GLASS_BOTTLE, - GLASS_PANE("THIN_GLASS"), - GLISTERING_MELON_SLICE("SPECKLED_MELON"), - GLOBE_BANNER_PATTERN, - GLOWSTONE, - GLOWSTONE_DUST, - GLOW_BERRIES, - GLOW_INK_SAC, - GLOW_ITEM_FRAME, - GLOW_LICHEN, - GLOW_SQUID_SPAWN_EGG, - GOAT_SPAWN_EGG, - GOLDEN_APPLE, - GOLDEN_AXE("GOLD_AXE"), - GOLDEN_BOOTS("GOLD_BOOTS"), - GOLDEN_CARROT, - GOLDEN_CHESTPLATE("GOLD_CHESTPLATE"), - GOLDEN_HELMET("GOLD_HELMET"), - GOLDEN_HOE("GOLD_HOE"), - GOLDEN_HORSE_ARMOR("GOLD_BARDING"), - GOLDEN_LEGGINGS("GOLD_LEGGINGS"), - GOLDEN_PICKAXE("GOLD_PICKAXE"), - GOLDEN_SHOVEL("GOLD_SPADE"), - GOLDEN_SWORD("GOLD_SWORD"), - GOLD_BLOCK, - GOLD_INGOT, - GOLD_NUGGET, - GOLD_ORE, - GRANITE(1, "STONE"), - GRANITE_SLAB, - GRANITE_STAIRS, - GRANITE_WALL, - GRASS(1, "LONG_GRASS"), - GRASS_BLOCK("GRASS"), - GRAVEL, - GRAY_BANNER(8, "STANDING_BANNER", "BANNER"), - GRAY_BED(7, "BED_BLOCK", "BED"), - GRAY_CANDLE, - GRAY_CANDLE_CAKE, - GRAY_CARPET(7, "CARPET"), - GRAY_CONCRETE(7, "CONCRETE"), - GRAY_CONCRETE_POWDER(7, "CONCRETE_POWDER"), - GRAY_DYE(8, "INK_SACK"), - GRAY_GLAZED_TERRACOTTA(7, 12), - GRAY_SHULKER_BOX, - GRAY_STAINED_GLASS(7, "STAINED_GLASS"), - GRAY_STAINED_GLASS_PANE(7, "THIN_GLASS", "STAINED_GLASS_PANE"), - GRAY_TERRACOTTA(7, "STAINED_CLAY"), - GRAY_WALL_BANNER(8, "WALL_BANNER"), - GRAY_WOOL(7, "WOOL"), - GREEN_BANNER(2, "STANDING_BANNER", "BANNER"), - GREEN_BED(13, "BED_BLOCK", "BED"), - GREEN_CANDLE, - GREEN_CANDLE_CAKE, - GREEN_CARPET(13, "CARPET"), - GREEN_CONCRETE(13, "CONCRETE"), - GREEN_CONCRETE_POWDER(13, "CONCRETE_POWDER"), - GREEN_DYE(2, "INK_SACK", "CACTUS_GREEN"), - GREEN_GLAZED_TERRACOTTA(13, 12), - GREEN_SHULKER_BOX, - GREEN_STAINED_GLASS(13, "STAINED_GLASS"), - GREEN_STAINED_GLASS_PANE(13, "THIN_GLASS", "STAINED_GLASS_PANE"), - GREEN_TERRACOTTA(13, "STAINED_CLAY"), - GREEN_WALL_BANNER(2, "WALL_BANNER"), - GREEN_WOOL(13, "WOOL"), - GRINDSTONE(0, 14), - GUARDIAN_SPAWN_EGG(68, "MONSTER_EGG"), - GUNPOWDER("SULPHUR"), - HANGING_ROOTS, - HAY_BLOCK, - HEART_OF_THE_SEA(13), - HEAVY_WEIGHTED_PRESSURE_PLATE("IRON_PLATE"), - HOGLIN_SPAWN_EGG(0, 16, "MONSTER_EGG"), - HONEYCOMB(15), - HONEYCOMB_BLOCK(15), - HONEY_BLOCK(0, 15), - HONEY_BOTTLE(0, 15), - HOPPER, - HOPPER_MINECART, - HORN_CORAL(13), - HORN_CORAL_BLOCK(13), - HORN_CORAL_FAN(13), - HORN_CORAL_WALL_FAN, - HORSE_SPAWN_EGG(100, "MONSTER_EGG"), - HUSK_SPAWN_EGG(23, "MONSTER_EGG"), - ICE, - INFESTED_CHISELED_STONE_BRICKS(5, "MONSTER_EGGS"), - INFESTED_COBBLESTONE(1, "MONSTER_EGGS"), - INFESTED_CRACKED_STONE_BRICKS(4, "MONSTER_EGGS"), - INFESTED_DEEPSLATE, - INFESTED_MOSSY_STONE_BRICKS(3, "MONSTER_EGGS"), - INFESTED_STONE("MONSTER_EGGS"), - INFESTED_STONE_BRICKS(2, "MONSTER_EGGS"), - /** - * We will only add "INK_SAC" for {@link #BLACK_DYE} since it's - * the only material (linked with this material) that is added - * after 1.13, which means it can use both INK_SACK and INK_SAC. - */ - INK_SAC("INK_SACK"), - IRON_AXE, - IRON_BARS("IRON_FENCE"), - IRON_BLOCK, - IRON_BOOTS, - IRON_CHESTPLATE, - IRON_DOOR("IRON_DOOR_BLOCK"), - IRON_HELMET, - IRON_HOE, - IRON_HORSE_ARMOR("IRON_BARDING"), - IRON_INGOT, - IRON_LEGGINGS, - IRON_NUGGET, - IRON_ORE, - IRON_PICKAXE, - IRON_SHOVEL("IRON_SPADE"), - IRON_SWORD, - IRON_TRAPDOOR, - ITEM_FRAME, - JACK_O_LANTERN, - JIGSAW(0, 14), - JUKEBOX, - JUNGLE_BOAT("BOAT_JUNGLE"), - JUNGLE_BUTTON("WOOD_BUTTON"), - JUNGLE_DOOR("JUNGLE_DOOR", "JUNGLE_DOOR_ITEM"), - JUNGLE_FENCE, - JUNGLE_FENCE_GATE, - JUNGLE_LEAVES(3, "LEAVES"), - JUNGLE_LOG(3, "LOG"), - JUNGLE_PLANKS(3, "WOOD"), - JUNGLE_PRESSURE_PLATE("WOOD_PLATE"), - JUNGLE_SAPLING(3, "SAPLING"), - JUNGLE_SIGN("SIGN_POST", "SIGN"), - JUNGLE_SLAB(3, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), - JUNGLE_STAIRS("JUNGLE_WOOD_STAIRS"), - JUNGLE_TRAPDOOR("TRAP_DOOR"), - JUNGLE_WALL_SIGN("WALL_SIGN"), - JUNGLE_WOOD(3, "LOG"), - KELP(13), - KELP_PLANT(13), - KNOWLEDGE_BOOK(0, 12, "BOOK"), - LADDER, - LANTERN(0, 14), - LAPIS_BLOCK, - LAPIS_LAZULI(4, "INK_SACK"), - LAPIS_ORE, - LARGE_AMETHYST_BUD, - LARGE_FERN(3, "DOUBLE_PLANT"), - LAVA("STATIONARY_LAVA"), - LAVA_BUCKET, - LAVA_CAULDRON, - LEAD("LEASH"), - LEATHER, - LEATHER_BOOTS, - LEATHER_CHESTPLATE, - LEATHER_HELMET, - LEATHER_HORSE_ARMOR(0, 14, "IRON_HORSE_ARMOR"), - LEATHER_LEGGINGS, - LECTERN(0, 14), - LEVER, - LIGHT, - LIGHTNING_ROD, - LIGHT_BLUE_BANNER(12, "STANDING_BANNER", "BANNER"), - LIGHT_BLUE_BED(3, "BED_BLOCK", "BED"), - LIGHT_BLUE_CANDLE, - LIGHT_BLUE_CANDLE_CAKE, - LIGHT_BLUE_CARPET(3, "CARPET"), - LIGHT_BLUE_CONCRETE(3, "CONCRETE"), - LIGHT_BLUE_CONCRETE_POWDER(3, "CONCRETE_POWDER"), - LIGHT_BLUE_DYE(12, "INK_SACK"), - LIGHT_BLUE_GLAZED_TERRACOTTA(3, 12), - LIGHT_BLUE_SHULKER_BOX, - LIGHT_BLUE_STAINED_GLASS(3, "STAINED_GLASS"), - LIGHT_BLUE_STAINED_GLASS_PANE(3, "THIN_GLASS", "STAINED_GLASS_PANE"), - LIGHT_BLUE_TERRACOTTA(3, "STAINED_CLAY"), - LIGHT_BLUE_WALL_BANNER(12, "WALL_BANNER", "STANDING_BANNER", "BANNER"), - LIGHT_BLUE_WOOL(3, "WOOL"), - LIGHT_GRAY_BANNER(7, "STANDING_BANNER", "BANNER"), - LIGHT_GRAY_BED(8, "BED_BLOCK", "BED"), - LIGHT_GRAY_CANDLE, - LIGHT_GRAY_CANDLE_CAKE, - LIGHT_GRAY_CARPET(8, "CARPET"), - LIGHT_GRAY_CONCRETE(8, "CONCRETE"), - LIGHT_GRAY_CONCRETE_POWDER(8, "CONCRETE_POWDER"), - LIGHT_GRAY_DYE(7, "INK_SACK"), - /** - * Renamed to SILVER_GLAZED_TERRACOTTA in 1.12 - * Renamed to LIGHT_GRAY_GLAZED_TERRACOTTA in 1.14 - */ - LIGHT_GRAY_GLAZED_TERRACOTTA(0, 12, "STAINED_CLAY", "LIGHT_GRAY_TERRACOTTA", "SILVER_GLAZED_TERRACOTTA"), - LIGHT_GRAY_SHULKER_BOX("SILVER_SHULKER_BOX"), - LIGHT_GRAY_STAINED_GLASS(8, "STAINED_GLASS"), - LIGHT_GRAY_STAINED_GLASS_PANE(8, "THIN_GLASS", "STAINED_GLASS_PANE"), - LIGHT_GRAY_TERRACOTTA(8, "STAINED_CLAY"), - LIGHT_GRAY_WALL_BANNER(7, "WALL_BANNER"), - LIGHT_GRAY_WOOL(8, "WOOL"), - LIGHT_WEIGHTED_PRESSURE_PLATE("GOLD_PLATE"), - LILAC(1, "DOUBLE_PLANT"), - LILY_OF_THE_VALLEY(15, 14), - LILY_PAD("WATER_LILY"), - LIME_BANNER(10, "STANDING_BANNER", "BANNER"), - LIME_BED(5, "BED_BLOCK", "BED"), - LIME_CANDLE, - LIME_CANDLE_CAKE, - LIME_CARPET(5, "CARPET"), - LIME_CONCRETE(5, "CONCRETE"), - LIME_CONCRETE_POWDER(5, "CONCRETE_POWDER"), - LIME_DYE(10, "INK_SACK"), - LIME_GLAZED_TERRACOTTA(5, 12), - LIME_SHULKER_BOX, - LIME_STAINED_GLASS(5, "STAINED_GLASS"), - LIME_STAINED_GLASS_PANE(5, "STAINED_GLASS_PANE"), - LIME_TERRACOTTA(5, "STAINED_CLAY"), - LIME_WALL_BANNER(10, "WALL_BANNER"), - LIME_WOOL(5, "WOOL"), - LINGERING_POTION, - LLAMA_SPAWN_EGG(103, "MONSTER_EGG"), - LODESTONE(16), - LOOM(14), - MAGENTA_BANNER(13, "STANDING_BANNER", "BANNER"), - MAGENTA_BED(2, "BED_BLOCK", "BED"), - MAGENTA_CANDLE, - MAGENTA_CANDLE_CAKE, - MAGENTA_CARPET(2, "CARPET"), - MAGENTA_CONCRETE(2, "CONCRETE"), - MAGENTA_CONCRETE_POWDER(2, "CONCRETE_POWDER"), - MAGENTA_DYE(13, "INK_SACK"), - MAGENTA_GLAZED_TERRACOTTA(2, 12), - MAGENTA_SHULKER_BOX, - MAGENTA_STAINED_GLASS(2, "STAINED_GLASS"), - MAGENTA_STAINED_GLASS_PANE(2, "THIN_GLASS", "STAINED_GLASS_PANE"), - MAGENTA_TERRACOTTA(2, "STAINED_CLAY"), - MAGENTA_WALL_BANNER(13, "WALL_BANNER"), - MAGENTA_WOOL(2, "WOOL"), - MAGMA_BLOCK(0, 10, "MAGMA"), - MAGMA_CREAM, - MAGMA_CUBE_SPAWN_EGG(62, "MONSTER_EGG"), - /** - * Adding this to the duplicated list will give you a filled map - * for 1.13+ versions and removing it from duplicated list will - * still give you a filled map in -1.12 versions. - * Since higher versions are our priority I'll keep 1.13+ support - * until I can come up with something to fix it. - */ - MAP("EMPTY_MAP"), - MEDIUM_AMETHYST_BUD, - MELON("MELON_BLOCK"), - MELON_SEEDS, - MELON_SLICE("MELON"), - MELON_STEM, - MILK_BUCKET, - MINECART, - MOJANG_BANNER_PATTERN, - MOOSHROOM_SPAWN_EGG(96, "MONSTER_EGG"), - MOSSY_COBBLESTONE, - MOSSY_COBBLESTONE_SLAB(3, "STEP"), - MOSSY_COBBLESTONE_STAIRS, - MOSSY_COBBLESTONE_WALL(1, "COBBLE_WALL", "COBBLESTONE_WALL"), - MOSSY_STONE_BRICKS(1, "SMOOTH_BRICK"), - MOSSY_STONE_BRICK_SLAB(5, "STEP"), - MOSSY_STONE_BRICK_STAIRS("SMOOTH_STAIRS"), - MOSSY_STONE_BRICK_WALL, - MOSS_BLOCK, - MOSS_CARPET, - MOVING_PISTON("PISTON_MOVING_PIECE"), - MULE_SPAWN_EGG(32, "MONSTER_EGG"), - MUSHROOM_STEM("BROWN_MUSHROOM"), - MUSHROOM_STEW("MUSHROOM_SOUP"), - MUSIC_DISC_11("GOLD_RECORD"), - MUSIC_DISC_13("GREEN_RECORD"), - MUSIC_DISC_BLOCKS("RECORD_3"), - MUSIC_DISC_CAT("RECORD_4"), - MUSIC_DISC_CHIRP("RECORD_5"), - MUSIC_DISC_FAR("RECORD_6"), - MUSIC_DISC_MALL("RECORD_7"), - MUSIC_DISC_MELLOHI("RECORD_8"), - MUSIC_DISC_PIGSTEP(16), - MUSIC_DISC_STAL("RECORD_9"), - MUSIC_DISC_STRAD("RECORD_10"), - MUSIC_DISC_WAIT("RECORD_11"), - MUSIC_DISC_WARD("RECORD_12"), - MUTTON, - MYCELIUM("MYCEL"), - NAME_TAG, - NAUTILUS_SHELL(13), - NETHERITE_AXE(16, "GOLDEN_AXE", "GOLD_AXE"), - NETHERITE_BLOCK(16), - NETHERITE_BOOTS(16), - NETHERITE_CHESTPLATE(16), - NETHERITE_HELMET(16), - NETHERITE_HOE(16), - NETHERITE_INGOT(16), - NETHERITE_LEGGINGS(16), - NETHERITE_PICKAXE(16), - NETHERITE_SCRAP(16), - NETHERITE_SHOVEL(16), - NETHERITE_SWORD(16), - NETHERRACK, - NETHER_BRICK("NETHER_BRICK_ITEM"), - NETHER_BRICKS("NETHER_BRICK"), - NETHER_BRICK_FENCE("NETHER_FENCE"), - NETHER_BRICK_SLAB(6, "STEP"), - NETHER_BRICK_STAIRS, - NETHER_BRICK_WALL, - NETHER_GOLD_ORE(16), - NETHER_PORTAL("PORTAL"), - NETHER_QUARTZ_ORE("QUARTZ_ORE"), - NETHER_SPROUTS(16), - NETHER_STAR, - /** - * Just like mentioned in https://minecraft.gamepedia.com/Nether_Wart - * Nether wart is also known as nether stalk in the code. - * NETHER_STALK is the planted state of nether warts. - */ - NETHER_WART("NETHER_WARTS", "NETHER_STALK"), - NETHER_WART_BLOCK, - NOTE_BLOCK, - OAK_BOAT("BOAT"), - OAK_BUTTON("WOOD_BUTTON"), - OAK_DOOR("WOODEN_DOOR", "WOOD_DOOR"), - OAK_FENCE("FENCE"), - OAK_FENCE_GATE("FENCE_GATE"), - OAK_LEAVES("LEAVES"), - OAK_LOG("LOG"), - OAK_PLANKS("WOOD"), - OAK_PRESSURE_PLATE("WOOD_PLATE"), - OAK_SAPLING("SAPLING"), - OAK_SIGN("SIGN_POST", "SIGN"), - OAK_SLAB("WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), - OAK_STAIRS("WOOD_STAIRS"), - OAK_TRAPDOOR("TRAP_DOOR"), - OAK_WALL_SIGN("WALL_SIGN"), - OAK_WOOD("LOG"), - OBSERVER, - OBSIDIAN, - OCELOT_SPAWN_EGG(98, "MONSTER_EGG"), - ORANGE_BANNER(14, "STANDING_BANNER", "BANNER"), - ORANGE_BED(1, "BED_BLOCK", "BED"), - ORANGE_CANDLE, - ORANGE_CANDLE_CAKE, - ORANGE_CARPET(1, "CARPET"), - ORANGE_CONCRETE(1, "CONCRETE"), - ORANGE_CONCRETE_POWDER(1, "CONCRETE_POWDER"), - ORANGE_DYE(14, "INK_SACK"), - ORANGE_GLAZED_TERRACOTTA(1, 12), - ORANGE_SHULKER_BOX, - ORANGE_STAINED_GLASS(1, "STAINED_GLASS"), - ORANGE_STAINED_GLASS_PANE(1, "STAINED_GLASS_PANE"), - ORANGE_TERRACOTTA(1, "STAINED_CLAY"), - ORANGE_TULIP(5, "RED_ROSE"), - ORANGE_WALL_BANNER(14, "WALL_BANNER"), - ORANGE_WOOL(1, "WOOL"), - OXEYE_DAISY(8, "RED_ROSE"), - OXIDIZED_COPPER, - OXIDIZED_CUT_COPPER, - OXIDIZED_CUT_COPPER_SLAB, - OXIDIZED_CUT_COPPER_STAIRS, - PACKED_ICE, - PAINTING, - PANDA_SPAWN_EGG(14), - PAPER, - PARROT_SPAWN_EGG(105, "MONSTER_EGG"), - PEONY(5, "DOUBLE_PLANT"), - PETRIFIED_OAK_SLAB("WOOD_STEP"), - PHANTOM_MEMBRANE(13), - PHANTOM_SPAWN_EGG(0, 13), - PIGLIN_BANNER_PATTERN(16), - PIGLIN_BRUTE_SPAWN_EGG(16), - PIGLIN_SPAWN_EGG(57, "MONSTER_EGG"), - PIG_SPAWN_EGG(90, "MONSTER_EGG"), - PILLAGER_SPAWN_EGG(14), - PINK_BANNER(9, "STANDING_BANNER", "BANNER"), - PINK_BED(6, "BED_BLOCK", "BED"), - PINK_CANDLE, - PINK_CANDLE_CAKE, - PINK_CARPET(6, "CARPET"), - PINK_CONCRETE(6, "CONCRETE"), - PINK_CONCRETE_POWDER(6, "CONCRETE_POWDER"), - PINK_DYE(9, "INK_SACK"), - PINK_GLAZED_TERRACOTTA(6, 12), - PINK_SHULKER_BOX, - PINK_STAINED_GLASS(6, "STAINED_GLASS"), - PINK_STAINED_GLASS_PANE(6, "THIN_GLASS", "STAINED_GLASS_PANE"), - PINK_TERRACOTTA(6, "STAINED_CLAY"), - PINK_TULIP(7, "RED_ROSE"), - PINK_WALL_BANNER(9, "WALL_BANNER"), - PINK_WOOL(6, "WOOL"), - PISTON("PISTON_BASE"), - PISTON_HEAD("PISTON_EXTENSION"), - PLAYER_HEAD(3, "SKULL", "SKULL_ITEM"), - PLAYER_WALL_HEAD(3, "SKULL", "SKULL_ITEM"), - PODZOL(2, "DIRT"), - POINTED_DRIPSTONE, - POISONOUS_POTATO, - POLAR_BEAR_SPAWN_EGG(102, "MONSTER_EGG"), - POLISHED_ANDESITE(6, "STONE"), - POLISHED_ANDESITE_SLAB, - POLISHED_ANDESITE_STAIRS, - POLISHED_BASALT(16), - POLISHED_BLACKSTONE(16), - POLISHED_BLACKSTONE_BRICKS(16), - POLISHED_BLACKSTONE_BRICK_SLAB(16), - POLISHED_BLACKSTONE_BRICK_STAIRS(16), - POLISHED_BLACKSTONE_BRICK_WALL(16), - POLISHED_BLACKSTONE_BUTTON(16), - POLISHED_BLACKSTONE_PRESSURE_PLATE(16), - POLISHED_BLACKSTONE_SLAB(16), - POLISHED_BLACKSTONE_STAIRS(16), - POLISHED_BLACKSTONE_WALL(16), - POLISHED_DEEPSLATE, - POLISHED_DEEPSLATE_SLAB, - POLISHED_DEEPSLATE_STAIRS, - POLISHED_DEEPSLATE_WALL, - POLISHED_DIORITE(4, "STONE"), - POLISHED_DIORITE_SLAB, - POLISHED_DIORITE_STAIRS, - POLISHED_GRANITE(2, "STONE"), - POLISHED_GRANITE_SLAB, - POLISHED_GRANITE_STAIRS, - POPPED_CHORUS_FRUIT("CHORUS_FRUIT_POPPED"), - POPPY("RED_ROSE"), - PORKCHOP("PORK"), - POTATO("POTATO_ITEM"), - POTATOES("POTATO"), - POTION, - POTTED_ACACIA_SAPLING(4, "SAPLING", "FLOWER_POT"), - POTTED_ALLIUM(2, "RED_ROSE", "FLOWER_POT"), - POTTED_AZALEA_BUSH, - POTTED_AZURE_BLUET(3, "RED_ROSE", "FLOWER_POT"), - POTTED_BAMBOO, - POTTED_BIRCH_SAPLING(2, "SAPLING", "FLOWER_POT"), - POTTED_BLUE_ORCHID(1, "RED_ROSE", "FLOWER_POT"), - POTTED_BROWN_MUSHROOM("FLOWER_POT"), - POTTED_CACTUS("FLOWER_POT"), - POTTED_CORNFLOWER, - POTTED_CRIMSON_FUNGUS(16), - POTTED_CRIMSON_ROOTS(16), - POTTED_DANDELION("YELLOW_FLOWER", "FLOWER_POT"), - POTTED_DARK_OAK_SAPLING(5, "SAPLING", "FLOWER_POT"), - POTTED_DEAD_BUSH("FLOWER_POT"), - POTTED_FERN(2, "LONG_GRASS", "FLOWER_POT"), - POTTED_FLOWERING_AZALEA_BUSH, - POTTED_JUNGLE_SAPLING(3, "SAPLING", "FLOWER_POT"), - POTTED_LILY_OF_THE_VALLEY, - POTTED_OAK_SAPLING("SAPLING", "FLOWER_POT"), - POTTED_ORANGE_TULIP(5, "RED_ROSE", "FLOWER_POT"), - POTTED_OXEYE_DAISY(8, "RED_ROSE", "FLOWER_POT"), - POTTED_PINK_TULIP(7, "RED_ROSE", "FLOWER_POT"), - POTTED_POPPY("RED_ROSE", "FLOWER_POT"), - POTTED_RED_MUSHROOM("FLOWER_POT"), - POTTED_RED_TULIP(4, "RED_ROSE", "FLOWER_POT"), - POTTED_SPRUCE_SAPLING(1, "SAPLING", "FLOWER_POT"), - POTTED_WARPED_FUNGUS(16), - POTTED_WARPED_ROOTS(16), - POTTED_WHITE_TULIP(6, "RED_ROSE", "FLOWER_POT"), - POTTED_WITHER_ROSE, - POWDER_SNOW, - POWDER_SNOW_BUCKET, - POWDER_SNOW_CAULDRON, - POWERED_RAIL, - PRISMARINE, - PRISMARINE_BRICKS(2, "PRISMARINE"), - PRISMARINE_BRICK_SLAB(4, "STEP"), - PRISMARINE_BRICK_STAIRS(13), - PRISMARINE_CRYSTALS, - PRISMARINE_SHARD, - PRISMARINE_SLAB(13), - PRISMARINE_STAIRS(13), - PRISMARINE_WALL, - PUFFERFISH(3, "RAW_FISH"), - PUFFERFISH_BUCKET(0, 13), - PUFFERFISH_SPAWN_EGG(0, 13), - PUMPKIN, - PUMPKIN_PIE, - PUMPKIN_SEEDS, - PUMPKIN_STEM, - PURPLE_BANNER(5, "STANDING_BANNER", "BANNER"), - PURPLE_BED(10, "BED_BLOCK", "BED"), - PURPLE_CANDLE, - PURPLE_CANDLE_CAKE, - PURPLE_CARPET(10, "CARPET"), - PURPLE_CONCRETE(10, "CONCRETE"), - PURPLE_CONCRETE_POWDER(10, "CONCRETE_POWDER"), - PURPLE_DYE(5, "INK_SACK"), - PURPLE_GLAZED_TERRACOTTA(10, 12), - PURPLE_SHULKER_BOX, - PURPLE_STAINED_GLASS(10, "STAINED_GLASS"), - PURPLE_STAINED_GLASS_PANE(10, "THIN_GLASS", "STAINED_GLASS_PANE"), - PURPLE_TERRACOTTA(10, "STAINED_CLAY"), - PURPLE_WALL_BANNER(5, "WALL_BANNER"), - PURPLE_WOOL(10, "WOOL"), - PURPUR_BLOCK, - PURPUR_PILLAR, - PURPUR_SLAB("PURPUR_DOUBLE_SLAB"), - PURPUR_STAIRS, - QUARTZ, - QUARTZ_BLOCK, - QUARTZ_BRICKS(16), - QUARTZ_PILLAR(2, "QUARTZ_BLOCK"), - QUARTZ_SLAB(7, "STEP"), - QUARTZ_STAIRS, - RABBIT, - RABBIT_FOOT, - RABBIT_HIDE, - RABBIT_SPAWN_EGG(101, "MONSTER_EGG"), - RABBIT_STEW, - RAIL("RAILS"), - RAVAGER_SPAWN_EGG(14), - RAW_COPPER, - RAW_COPPER_BLOCK, - RAW_GOLD, - RAW_GOLD_BLOCK, - RAW_IRON, - RAW_IRON_BLOCK, - REDSTONE, - REDSTONE_BLOCK, - /** - * Unlike redstone torch, REDSTONE_LAMP_ON isn't an item. - * The name is just here on the list for matching. - * - * @see #REDSTONE_TORCH - */ - REDSTONE_LAMP("REDSTONE_LAMP_ON", "REDSTONE_LAMP_OFF"), - REDSTONE_ORE("GLOWING_REDSTONE_ORE"), - /** - * REDSTONE_TORCH_OFF isn't an item, but a block. - * But REDSTONE_TORCH_ON is the item. - * The name is just here on the list for matching. - */ - REDSTONE_TORCH("REDSTONE_TORCH_OFF", "REDSTONE_TORCH_ON"), - REDSTONE_WALL_TORCH, - REDSTONE_WIRE, - RED_BANNER(1, "STANDING_BANNER", "BANNER"), - /** - * Data value 14 or 0 - */ - RED_BED(14, "BED_BLOCK", "BED"), - RED_CANDLE, - RED_CANDLE_CAKE, - RED_CARPET(14, "CARPET"), - RED_CONCRETE(14, "CONCRETE"), - RED_CONCRETE_POWDER(14, "CONCRETE_POWDER"), - RED_DYE(1, "INK_SACK", "ROSE_RED"), - RED_GLAZED_TERRACOTTA(14, 12), - RED_MUSHROOM, - RED_MUSHROOM_BLOCK("RED_MUSHROOM", "HUGE_MUSHROOM_2"), - RED_NETHER_BRICKS("RED_NETHER_BRICK"), - RED_NETHER_BRICK_SLAB(4, "STEP"), - RED_NETHER_BRICK_STAIRS, - RED_NETHER_BRICK_WALL, - RED_SAND(1, "SAND"), - RED_SANDSTONE, - RED_SANDSTONE_SLAB("DOUBLE_STONE_SLAB2", "STONE_SLAB2"), - RED_SANDSTONE_STAIRS, - RED_SANDSTONE_WALL, - RED_SHULKER_BOX, - RED_STAINED_GLASS(14, "STAINED_GLASS"), - RED_STAINED_GLASS_PANE(14, "THIN_GLASS", "STAINED_GLASS_PANE"), - RED_TERRACOTTA(14, "STAINED_CLAY"), - RED_TULIP(4, "RED_ROSE"), - RED_WALL_BANNER(1, "WALL_BANNER"), - RED_WOOL(14, "WOOL"), - REPEATER("DIODE_BLOCK_ON", "DIODE_BLOCK_OFF", "DIODE"), - REPEATING_COMMAND_BLOCK("COMMAND", "COMMAND_REPEATING"), - RESPAWN_ANCHOR(16), - ROOTED_DIRT, - ROSE_BUSH(4, "DOUBLE_PLANT"), - ROTTEN_FLESH, - SADDLE, - SALMON(1, "RAW_FISH"), - SALMON_BUCKET(0, 13), - SALMON_SPAWN_EGG(0, 13), - SAND, - SANDSTONE, - SANDSTONE_SLAB(1, "DOUBLE_STEP", "STEP", "STONE_SLAB"), - SANDSTONE_STAIRS, - SANDSTONE_WALL, - SCAFFOLDING(0, 14), - SCULK_SENSOR, - SCUTE(13), - SEAGRASS(0, 13), - SEA_LANTERN, - SEA_PICKLE(13), - SHEARS, - SHEEP_SPAWN_EGG(91, "MONSTER_EGG"), - SHIELD, - SHROOMLIGHT(16), - SHULKER_BOX("PURPLE_SHULKER_BOX"), - SHULKER_SHELL, - SHULKER_SPAWN_EGG(69, "MONSTER_EGG"), - SILVERFISH_SPAWN_EGG(60, "MONSTER_EGG"), - SKELETON_HORSE_SPAWN_EGG(28, "MONSTER_EGG"), - SKELETON_SKULL("SKULL", "SKULL_ITEM"), - SKELETON_SPAWN_EGG(51, "MONSTER_EGG"), - SKELETON_WALL_SKULL("SKULL", "SKULL_ITEM"), - SKULL_BANNER_PATTERN, - SLIME_BALL, - SLIME_BLOCK, - SLIME_SPAWN_EGG(55, "MONSTER_EGG"), - SMALL_AMETHYST_BUD, - SMALL_DRIPLEAF, - SMITHING_TABLE, - SMOKER(0, 14), - SMOOTH_BASALT, - SMOOTH_QUARTZ(0, 13), - SMOOTH_QUARTZ_SLAB(7, "STEP"), - SMOOTH_QUARTZ_STAIRS, - SMOOTH_RED_SANDSTONE(2, "RED_SANDSTONE"), - SMOOTH_RED_SANDSTONE_SLAB("STONE_SLAB2"), - SMOOTH_RED_SANDSTONE_STAIRS, - SMOOTH_SANDSTONE(2, "SANDSTONE"), - SMOOTH_SANDSTONE_SLAB("STEP"), - SMOOTH_SANDSTONE_STAIRS, - SMOOTH_STONE("STEP"), - SMOOTH_STONE_SLAB("STEP"), - SNOW, - SNOWBALL("SNOW_BALL"), - SNOW_BLOCK, - SOUL_CAMPFIRE(16), - SOUL_FIRE(16), - SOUL_LANTERN(16), - SOUL_SAND, - SOUL_SOIL(16), - SOUL_TORCH(16), - SOUL_WALL_TORCH(16), - SPAWNER("MOB_SPAWNER"), - SPECTRAL_ARROW(0, 9), - SPIDER_EYE, - SPIDER_SPAWN_EGG(52, "MONSTER_EGG"), - SPLASH_POTION, - SPONGE, - SPORE_BLOSSOM, - SPRUCE_BOAT("BOAT_SPRUCE"), - SPRUCE_BUTTON("WOOD_BUTTON"), - SPRUCE_DOOR("SPRUCE_DOOR", "SPRUCE_DOOR_ITEM"), - SPRUCE_FENCE, - SPRUCE_FENCE_GATE, - SPRUCE_LEAVES(1, "LEAVES", "LEAVES_2"), - SPRUCE_LOG(1, "LOG"), - SPRUCE_PLANKS(1, "WOOD"), - SPRUCE_PRESSURE_PLATE("WOOD_PLATE"), - SPRUCE_SAPLING(1, "SAPLING"), - SPRUCE_SIGN("SIGN_POST", "SIGN"), - SPRUCE_SLAB(1, "WOOD_DOUBLE_STEP", "WOOD_STEP", "WOODEN_SLAB"), - SPRUCE_STAIRS("SPRUCE_WOOD_STAIRS"), - SPRUCE_TRAPDOOR("TRAP_DOOR"), - SPRUCE_WALL_SIGN("WALL_SIGN"), - SPRUCE_WOOD(1, "LOG"), - SPYGLASS, - SQUID_SPAWN_EGG(94, "MONSTER_EGG"), - STICK, - STICKY_PISTON("PISTON_BASE", "PISTON_STICKY_BASE"), - STONE, - STONECUTTER(14), - STONE_AXE, - STONE_BRICKS("SMOOTH_BRICK"), - STONE_BRICK_SLAB(4, "DOUBLE_STEP", "STEP", "STONE_SLAB"), - STONE_BRICK_STAIRS("SMOOTH_STAIRS"), - STONE_BRICK_WALL, - STONE_BUTTON, - STONE_HOE, - STONE_PICKAXE, - STONE_PRESSURE_PLATE("STONE_PLATE"), - STONE_SHOVEL("STONE_SPADE"), - STONE_SLAB("DOUBLE_STEP", "STEP"), - STONE_STAIRS, - STONE_SWORD, - STRAY_SPAWN_EGG(6, "MONSTER_EGG"), - STRIDER_SPAWN_EGG(16), - STRING, - STRIPPED_ACACIA_LOG("LOG_2"), - STRIPPED_ACACIA_WOOD("LOG_2"), - STRIPPED_BIRCH_LOG(2, "LOG"), - STRIPPED_BIRCH_WOOD(2, "LOG"), - STRIPPED_CRIMSON_HYPHAE(16), - STRIPPED_CRIMSON_STEM(16), - STRIPPED_DARK_OAK_LOG("LOG"), - STRIPPED_DARK_OAK_WOOD("LOG"), - STRIPPED_JUNGLE_LOG(3, "LOG"), - STRIPPED_JUNGLE_WOOD(3, "LOG"), - STRIPPED_OAK_LOG("LOG"), - STRIPPED_OAK_WOOD("LOG"), - STRIPPED_SPRUCE_LOG(1, "LOG"), - STRIPPED_SPRUCE_WOOD(1, "LOG"), - STRIPPED_WARPED_HYPHAE(16), - STRIPPED_WARPED_STEM(16), - STRUCTURE_BLOCK, - /** - * Originally developers used barrier blocks for its purpose. - * So technically this isn't really considered as a suggested material. - */ - STRUCTURE_VOID(10, "BARRIER"), - SUGAR, - /** - * Sugar Cane is a known material in pre-1.13 - */ - SUGAR_CANE("SUGAR_CANE_BLOCK"), - SUNFLOWER("DOUBLE_PLANT"), - SUSPICIOUS_STEW(0, 14), - SWEET_BERRIES(14), - SWEET_BERRY_BUSH(0, 14), - TALL_GRASS(2, "DOUBLE_PLANT"), - TALL_SEAGRASS(2, 13), - TARGET(16), - TERRACOTTA("STAINED_CLAY"), - TINTED_GLASS, - TIPPED_ARROW(0, 9), - TNT, - TNT_MINECART("EXPLOSIVE_MINECART"), - TORCH, - TOTEM_OF_UNDYING("TOTEM"), - TRADER_LLAMA_SPAWN_EGG(103, 14), - TRAPPED_CHEST, - TRIDENT(13), - TRIPWIRE, - TRIPWIRE_HOOK, - TROPICAL_FISH(2, "RAW_FISH"), - TROPICAL_FISH_BUCKET(0, 13, "BUCKET", "WATER_BUCKET"), - TROPICAL_FISH_SPAWN_EGG(0, 13, "MONSTER_EGG"), - TUBE_CORAL(13), - TUBE_CORAL_BLOCK(13), - TUBE_CORAL_FAN(13), - TUBE_CORAL_WALL_FAN, - TUFF, - TURTLE_EGG(0, 13), - TURTLE_HELMET(0, 13), - TURTLE_SPAWN_EGG(0, 13), - TWISTING_VINES(16), - TWISTING_VINES_PLANT(16), - VEX_SPAWN_EGG(35, "MONSTER_EGG"), - VILLAGER_SPAWN_EGG(120, "MONSTER_EGG"), - VINDICATOR_SPAWN_EGG(36, "MONSTER_EGG"), - VINE, - /** - * 1.13 tag is not added because it's the same thing as {@link #AIR} - * - * @see #CAVE_AIR - */ - VOID_AIR("AIR"), - WALL_TORCH("TORCH"), - WANDERING_TRADER_SPAWN_EGG(0, 14), - WARPED_BUTTON(16), - WARPED_DOOR(16), - WARPED_FENCE(16), - WARPED_FENCE_GATE(16), - WARPED_FUNGUS(16), - WARPED_FUNGUS_ON_A_STICK(16), - WARPED_HYPHAE(16), - WARPED_NYLIUM(16), - WARPED_PLANKS(16), - WARPED_PRESSURE_PLATE(16), - WARPED_ROOTS(16), - WARPED_SIGN(0, 16, "SIGN_POST"), - WARPED_SLAB(16), - WARPED_STAIRS(16), - WARPED_STEM(16), - WARPED_TRAPDOOR(16), - WARPED_WALL_SIGN(0, 16, "WALL_SIGN"), - WARPED_WART_BLOCK(16), - /** - * This is used for blocks only. - * In 1.13- WATER will turn into STATIONARY_WATER after it finished spreading. - * After 1.13+ this uses - * https://hub.spigotmc.org/javadocs/spigot/org/bukkit/block/data/Levelled.html water flowing system. - */ - WATER("STATIONARY_WATER"), - WATER_BUCKET, - WATER_CAULDRON, - WAXED_COPPER_BLOCK, - WAXED_CUT_COPPER, - WAXED_CUT_COPPER_SLAB, - WAXED_CUT_COPPER_STAIRS, - WAXED_EXPOSED_COPPER, - WAXED_EXPOSED_CUT_COPPER, - WAXED_EXPOSED_CUT_COPPER_SLAB, - WAXED_EXPOSED_CUT_COPPER_STAIRS, - WAXED_OXIDIZED_COPPER, - WAXED_OXIDIZED_CUT_COPPER, - WAXED_OXIDIZED_CUT_COPPER_SLAB, - WAXED_OXIDIZED_CUT_COPPER_STAIRS, - WAXED_WEATHERED_COPPER, - WAXED_WEATHERED_CUT_COPPER, - WAXED_WEATHERED_CUT_COPPER_SLAB, - WAXED_WEATHERED_CUT_COPPER_STAIRS, - WEATHERED_COPPER, - WEATHERED_CUT_COPPER, - WEATHERED_CUT_COPPER_SLAB, - WEATHERED_CUT_COPPER_STAIRS, - WEEPING_VINES(16), - WEEPING_VINES_PLANT(16), - WET_SPONGE(1, "SPONGE"), - /** - * Wheat is a known material in pre-1.13 - */ - WHEAT("CROPS"), - WHEAT_SEEDS("SEEDS"), - WHITE_BANNER(15, "STANDING_BANNER", "BANNER"), - WHITE_BED("BED_BLOCK", "BED"), - WHITE_CANDLE, - WHITE_CANDLE_CAKE, - WHITE_CARPET("CARPET"), - WHITE_CONCRETE("CONCRETE"), - WHITE_CONCRETE_POWDER("CONCRETE_POWDER"), - WHITE_DYE(15, 14, "INK_SACK", "BONE_MEAL"), - WHITE_GLAZED_TERRACOTTA(0, 12, "STAINED_CLAY"), - WHITE_SHULKER_BOX, - WHITE_STAINED_GLASS("STAINED_GLASS"), - WHITE_STAINED_GLASS_PANE("THIN_GLASS", "STAINED_GLASS_PANE"), - WHITE_TERRACOTTA("STAINED_CLAY", "TERRACOTTA"), - WHITE_TULIP(6, "RED_ROSE"), - WHITE_WALL_BANNER(15, "WALL_BANNER"), - WHITE_WOOL("WOOL"), - WITCH_SPAWN_EGG(66, "MONSTER_EGG"), - WITHER_ROSE(0, 14), - WITHER_SKELETON_SKULL(1, "SKULL", "SKULL_ITEM"), - WITHER_SKELETON_SPAWN_EGG(5, "MONSTER_EGG"), - WITHER_SKELETON_WALL_SKULL(1, "SKULL", "SKULL_ITEM"), - WOLF_SPAWN_EGG(95, "MONSTER_EGG"), - WOODEN_AXE("WOOD_AXE"), - WOODEN_HOE("WOOD_HOE"), - WOODEN_PICKAXE("WOOD_PICKAXE"), - WOODEN_SHOVEL("WOOD_SPADE"), - WOODEN_SWORD("WOOD_SWORD"), - WRITABLE_BOOK("BOOK_AND_QUILL"), - WRITTEN_BOOK, - YELLOW_BANNER(11, "STANDING_BANNER", "BANNER"), - YELLOW_BED(4, "BED_BLOCK", "BED"), - YELLOW_CANDLE, - YELLOW_CANDLE_CAKE, - YELLOW_CARPET(4, "CARPET"), - YELLOW_CONCRETE(4, "CONCRETE"), - YELLOW_CONCRETE_POWDER(4, "CONCRETE_POWDER"), - YELLOW_DYE(11, "INK_SACK", "DANDELION_YELLOW"), - YELLOW_GLAZED_TERRACOTTA(4, 12, "STAINED_CLAY", "YELLOW_TERRACOTTA"), - YELLOW_SHULKER_BOX, - YELLOW_STAINED_GLASS(4, "STAINED_GLASS"), - YELLOW_STAINED_GLASS_PANE(4, "THIN_GLASS", "STAINED_GLASS_PANE"), - YELLOW_TERRACOTTA(4, "STAINED_CLAY"), - YELLOW_WALL_BANNER(11, "WALL_BANNER"), - YELLOW_WOOL(4, "WOOL"), - ZOGLIN_SPAWN_EGG(16), - ZOMBIE_HEAD(2, "SKULL", "SKULL_ITEM"), - ZOMBIE_HORSE_SPAWN_EGG(29, "MONSTER_EGG"), - ZOMBIE_SPAWN_EGG(54, "MONSTER_EGG"), - ZOMBIE_VILLAGER_SPAWN_EGG(27, "MONSTER_EGG"), - ZOMBIE_WALL_HEAD(2, "SKULL", "SKULL_ITEM"), - ZOMBIFIED_PIGLIN_SPAWN_EGG(57, "MONSTER_EGG", "ZOMBIE_PIGMAN_SPAWN_EGG"); - - /** - * Cached array of {@link CompMaterial#values()} to avoid allocating memory for - * calling the method every time. - * - * @since 2.0.0 - */ - private static final CompMaterial[] VALUES = values(); - - /** - * We don't want to use Enums#getIfPresent(Class, String) to avoid a few checks. - * - * @since 5.1.0 - */ - private static final Map<String, CompMaterial> NAMES = new HashMap<>(); - - /** - * The maximum data value in the pre-flattening update which belongs to {@link #VILLAGER_SPAWN_EGG}<br> - * https://minecraftitemids.com/types/spawn-egg - * - * @see #matchWithData(String) - * @since 8.0.0 - */ - private static final byte MAX_DATA_VALUE = 120; - - /** - * Used to tell the system that the passed object's (name or material) data value - * is not provided or is invalid. - * - * @since 8.0.0 - */ - private static final byte UNKNOWN_DATA_VALUE = -1; - - /** - * The maximum material ID before the pre-flattening update which belongs to {@link #MUSIC_DISC_WAIT} - * - * @since 8.1.0 - */ - private static final short MAX_ID = 2267; - - /** - * <b>CompMaterial Paradox (Duplication Check)</b> - * <p> - * A set of duplicated material names in 1.13 and 1.12 that will conflict with the legacy names. - * Values are the new material names. This map also contains illegal elements. Check the static initializer for more info. - * <p> - * Duplications are not useful at all in versions above the flattening update {@link Data#ISFLAT} - * This set is only used for matching materials, for parsing refer to {@link #isDuplicated()} - * - * @since 3.0.0 - */ - private static final Set<String> DUPLICATED; - - static { - for (final CompMaterial material : VALUES) - NAMES.put(material.name(), material); - } - - static { - if (Data.ISFLAT) { - // It's not needed at all if it's the newer version. We can save some memory. - DUPLICATED = null; - } else { - // MELON_SLICE, CARROTS, POTATOES, BEETROOTS, GRASS_BLOCK, BRICKS, NETHER_BRICKS, BROWN_MUSHROOM - // Using the constructor to add elements will decide to allocate more size which we don't need. - DUPLICATED = new HashSet<>(4); - DUPLICATED.add(GRASS.name()); - DUPLICATED.add(MELON.name()); - DUPLICATED.add(BRICK.name()); - DUPLICATED.add(NETHER_BRICK.name()); - } - } - - /** - * The data value of this material <a href="https://minecraft.gamepedia.com/Java_Edition_data_values/Pre-flattening">pre-flattening</a>. - * - * Can be accessed with {@link ItemStack#getData()} then {@code MaterialData#getData()} - * or {@link ItemStack#getDurability()} if not damageable. - */ - @Getter - private final byte data; - - /** - * The version that this material was added in, otherwise 0 if the version is not recorded. - * - * @see #getMaterialVersion() - * @since 7.0.0 - */ - private final byte version; - - /** - * A list of material names that was being used for older verions. - * - * @see #getLegacy() - */ - private final String[] legacy; - - /** - * The cached Bukkit parsed material. - * - * @see #toMaterial() - * @since 9.0.0 - */ - @Getter - private final Material material; - - CompMaterial(int data, int version, String... legacy) { - this.data = (byte) data; - this.version = (byte) version; - this.legacy = legacy; - - Material mat = null; - - if ((!Data.ISFLAT && this.isDuplicated()) || (mat = Material.getMaterial(this.name())) == null) - for (int i = legacy.length - 1; i >= 0; i--) { - mat = Material.getMaterial(legacy[i]); - - if (mat != null) - break; - } - - this.material = Common.getOrDefault(mat, Material.STONE); - } - - CompMaterial(int data, String... legacy) { - this(data, 0, legacy); - } - - CompMaterial(int version) { - this(0, version); - } - - CompMaterial() { - this(0, 0); - } - - CompMaterial(String... legacy) { - this(0, 0, legacy); - } - - /** - * Convenience method for giving 1 piece of this material into a players inventory - * - * @param player - */ - public final void give(final Player player) { - give(player, 1); - } - - /** - * Convenience method for giving this material into a players inventory - * - * @param player - * @param amount - */ - public final void give(final Player player, final int amount) { - player.getInventory().addItem(this.toItem(amount)); - } - - /** - * Parses an item from this CompMaterial. - * Uses data values on older versions. - * - * @return an ItemStack with the same material (and data value if in older versions.) - * @see #setType(ItemStack) - */ - - public ItemStack toItem() { - return this.toItem(1); - } - - /** - * Parses an item from this CompMaterial. - * Uses data values on older versions. - * - * @return an ItemStack with the same material (and data value if in older versions.) - * @see #setType(ItemStack) - * - * @param amount - */ - - public ItemStack toItem(int amount) { - final Material material = this.toMaterial(); - - if (material == null) - return null; - - return Data.ISFLAT ? new ItemStack(material, amount) : new ItemStack(material, amount, this.data); - } - - /** - * Parses the material of this CompMaterial. - * - * @return the material related to this CompMaterial based on the server version. - * @since 1.0.0 - */ - - public Material toMaterial() { - return this.material; - } - - /** - * Return true if the {@link #getMaterial()} and the given Material matches. - * <p> - * NOT cross-version compatible. For this, use {@link #is(ItemStack)} - * - * @param mat - * @return - */ - public final boolean is(final Material mat) { - return this.material == mat; - } - - /** - * Evaluates whether a given {@link ItemStack} is equal material-wise. Takes - * data value in account if we are on Minecraft 1.13+ or older. - * - * @param comp the itemstack - * @return -see above- - */ - public final boolean is(final ItemStack comp) { - if (MinecraftVersion.atLeast(V.v1_13)) - return comp.getType() == material; - - return is(comp.getType(), comp.getData().getData()); - } - - /** - * Evaluates whether the given block equals this material - * - * @param block - * @return - */ - public final boolean is(final Block block) { - if (MinecraftVersion.atLeast(V.v1_13)) - return block.getType() == material; - - return block != null && is(block.getType(), block.getData()); - } - - /** - * Evaluates whether the given type/data equals this material - * - * @param type - * @param data - * @return - */ - public final boolean is(final Material type, final int data) { - if (MinecraftVersion.atLeast(V.v1_13)) - return type == this.material; - - if (type == toMaterial() && data == this.data) - return true; - - final CompMaterial compMat = fromMaterial(type); - - return isDamageable(compMat) && this.toMaterial() == type; - } - - /** - * Returns true for damageable materials. - * - * @return - */ - public final boolean isDamageable() { - return isDamageable(this); - } - - /** - * Return true if this class equals the given block, comparing data and {@link Material} type - * - * @param block - * @return - */ - public final boolean equals(Block block) { - return block.getData() == this.getData() && block.getType() == this.material; - } - - /** - * Returns true if the given material is damageable. - * - * @param type - * @return - */ - public static boolean isDamageable(final CompMaterial type) { - Valid.checkNotNull(type); - - try { - if (MinecraftVersion.atLeast(V.v1_13)) - return type.toItem().getItemMeta() instanceof org.bukkit.inventory.meta.Damageable; - } catch (final Throwable t) { - // MC unsupported - } - - switch (type.toString()) { - case "HELMET": - case "CHESTPLATE": - case "LEGGINGS": - case "BOOTS": - case "SWORD": - case "AXE": - case "PICKAXE": - case "SHOVEL": - case "HOE": - case "ELYTRA": - case "TURTLE_HELMET": - case "TRIDENT": - case "HORSE_ARMOR": - case "SHEARS": - return true; - default: - return false; - } - } - - /** - * Return true if the given block is air - * - * @param block - * @return - */ - public static boolean isAir(final Block block) { - return block == null || isAir(block.getType()); - } - - /** - * Returns if the given material is air - * - * @param material - * @return - */ - public static boolean isAir(final Material material) { - return nameEquals(material, "AIR", "CAVE_AIR", "VOID_AIR", "LEGACY_AIR"); - } - - /** - * Returns true if the given material is a horse armor (prev. named barding). - * - * @param mat - * @return - */ - public static boolean isHorseArmor(final Material mat) { - return nameEquals(mat, "BARDING", "HORSE_ARMOR"); - } - - /** - * Returns true if the given material is a carpet (any variation). - * - * @param mat - * @return - */ - public static boolean isCarpet(final Material mat) { - return nameContains(mat, "CARPET"); - } - - /** - * Return true if the given material is leaves (any variation) - * - * @param mat - * @return - */ - public static boolean isLeaves(final Material mat) { - return mat.toString().endsWith("_LEAVES") || nameEquals(mat, "LEAVES", "LEAVES_2"); - } - - /** - * Returns true if the given material is a hard clay (any variations), later - * named terracotta. - * - * @param mat - * @return - */ - public static boolean isHardClay(final Material mat) { - return nameContains(mat, "STAINED_CLAY", "HARD_CLAY", "TERRACOTTA"); - } - - /** - * Returns true if the given material is a leash for horses. - * - * @param mat - * @return - */ - public static boolean isLeash(final Material mat) { - return nameEquals(mat, "LEASH", "LEAD"); - } - - /** - * Returns true if the given material is either gold or iron pressure plate. - * - * @param mat - * @return - */ - public static boolean isHeavyPressurePlate(final Material mat) { - return nameContains(mat, "IRON_PLATE", "GOLD_PLATE", "WEIGHTED_PRESSURE_PLATE"); - } - - /** - * Return true for all kinds of wood pressure plates - * - * @param mat - * @return - */ - public static boolean isWoodPressurePlate(final Material mat) { - return nameEquals(mat, "WOOD_PLATE", "ACACIA_PRESSURE_PLATE", "BIRCH_PRESSURE_PLATE", "DARK_OAK_PRESSURE_PLATE", - "JUNGLE_PRESSURE_PLATE", "OAK_PRESSURE_PLATE", "SPRUCE_PRESSURE_PLATE"); - } - - /** - * Returns true if the given material is a firework. - * - * @param mat - * @return - */ - public static boolean isFirework(final Material mat) { - return nameContains(mat, "FIREWORK"); - } - - /** - * Returns true if the given material is log (any variation). - * - * @param mat - * @return - */ - public static boolean isLog(final Material mat) { - return nameEquals(mat, "LOG", "LOG_2") || mat.toString().endsWith("_LOG"); - } - - /** - * Returns true if the given material is a bloat (that's right) (any variation). - * - * @param mat - * @return - */ - public static boolean isBoat(final Material mat) { - return nameContains(mat, "BOAT"); - } - - /** - * Returns true if the given material is a wood button (any variation). - * - * @param mat - * @return - */ - public static boolean isWoodButton(final Material mat) { - final String n = mat.toString(); - - return n.endsWith("_BUTTON") && !n.equals("STONE_BUTTON"); - } - - /** - * Returns true if the given material is a redstone lamp (any state). - * - * @param mat - * @return - */ - public static boolean isRedstoneLamp(final Material mat) { - return nameContains(mat, "REDSTONE_LAMP"); - } - - /** - * Returns true if the given material is a monster egg. - * - * @param mat - * @return - */ - public static boolean isMonsterEgg(final Material mat) { - return nameContains(mat, "MONSTER_EGG", "_SPAWN_EGG"); - } - - /** - * Returns true if the given material is a tree sapling (not potted). - * - * @param mat - * @return - */ - public static boolean isSapling(final Material mat) { - return nameContains(mat, "SAPLING") && !mat.toString().startsWith("POTTED"); - } - - /** - * Returns true if the given material is a wall sign (any variation). - * - * @param mat the material - * @return - */ - public static boolean isWallSign(final Material mat) { - return nameContains(mat, "WALL_SIGN"); - } - - /** - * Returns true if the given material is a dead shrub or a grass. - * - * @param mat - * @return - */ - public static boolean isLongGrass(final Material mat) { - return nameEquals(mat, "LONG_GRASS", "TALL_GRASS", "FERN", "DEAD_BUSH") && !mat.toString().startsWith("POTTED"); - } - - /** - * Returns true if the given material is normally 2 blocks tall when placed. - * - * @param mat - * @return - */ - public static boolean isDoublePlant(final Material mat) { - return nameEquals(mat, "DOUBLE_PLANT", "SUNFLOWER", "LILAC", "TALL_GRASS", "LARGE_FERN", "ROSE_BUSH", "PEONY", "TALL_SEAGRASS"); - } - - /** - * Returns true if the given material is a skull. - * - * @param mat - * @return - */ - public static boolean isSkull(final CompMaterial mat) { - return isSkull(mat.getMaterial()); - } - - /** - * Returns true if the given material is a skull. - * - * @param mat - * @return - */ - public static boolean isSkull(final Material mat) { - final String name = mat.toString(); - - return (name.endsWith("_HEAD") || name.endsWith("_SKULL")) && !name.contains("WALL"); - } - - /** - * Returns true if the given material is a trap door (any variation). - * - * @param mat - * @return - */ - public static boolean isTrapDoor(final Material mat) { - final String name = mat.toString(); - - return name.contains("TRAP_DOOR") || name.contains("TRAPDOOR"); - } - - // Utility method for evaluating matches. - private static boolean nameContains(final Material mat, final String... names) { - final String matName = mat.toString(); - - for (final String name : names) - if (matName.contains(name)) - return true; - - return false; - } - - // Utility method for evaluating matches. - private static boolean nameEquals(final Material mat, final String... names) { - final String matName = mat.toString(); - - for (final String name : names) - if (matName.equals(name)) - return true; - - return false; - } - - /** - * Create a wool from the given data type and amount. - * - * @param color - * @param amount - * @return - */ - public static ItemStack makeWool(final byte color, final int amount) { - return makeWool(CompColor.fromWoolData(color), amount); - } - - /** - * Create a wool from dye of certain amount. - * - * @param color - * @param amount - * @return - */ - public static ItemStack makeWool(final CompColor color, final int amount) { - if (MinecraftVersion.atLeast(V.v1_13)) - return new ItemStack(Material.valueOf(color.getDye() + "_WOOL"), amount); - - else - return new ItemStack(Material.valueOf("WOOL"), amount, color.getDye().getWoolData()); - } - - /** - * Attempts to convert an {@link EntityType} into a valid {@link CompMaterial} - * representing a spawnable Monster Egg. - * <p> - * In case the entity given is not a valid entity or does not have an egg, we - * return Sheep Monster Egg instead. - * - * @param type - * @return the corresponding egg, or Sheep Monster Egg if does not exist - */ - public static CompMaterial makeMonsterEgg(final EntityType type) { - try { - String name = type.toString() + "_SPAWN_EGG"; - - // Special cases - if (type.name().equals("ZOMBIFIED_PIGLIN")) - if (MinecraftVersion.newerThan(V.v1_15)) - name = "ZOMBIFIED_PIGLIN_SPAWN_EGG"; - else - name = "ZOMBIE_PIGMAN_SPAWN_EGG"; - - else if (type == EntityType.MUSHROOM_COW) - name = "MOOSHROOM_SPAWN_EGG"; - - // Parse normally, backwards compatible - final CompMaterial mat = fromString(name); - - if (mat == CompMaterial.STONE) - return CompMaterial.SHEEP_SPAWN_EGG; - - // Return the egg or sheep egg if does not exist - return Common.getOrDefault(mat, CompMaterial.SHEEP_SPAWN_EGG); - - } catch (final Throwable throwable) { - Debugger.saveError(throwable, "Something went wrong while creating spawn egg!", "Type: " + type); - } - return CompMaterial.SHEEP_SPAWN_EGG; - } - - /** - * Reverts back the 1.13+ spawn egg material to {@link EntityType} - * - * @param monsterEgg the monster egg - * @return the egg, or null if does not exist in the current MC version - */ - public static EntityType makeEntityType(final CompMaterial monsterEgg) { - Valid.checkBoolean(monsterEgg.toString().endsWith("_SPAWN_EGG"), "Material " + monsterEgg + " is not a valid monster egg! (Must end with _SPAWN_EGG)"); - - final String name = monsterEgg.toString().replace("_SPAWN_EGG", ""); - - // Special cases - if (name.equals("ZOMBIE_PIGMAN_SPAWN_EGG")) - try { - return EntityType.ZOMBIFIED_PIGLIN; // PIGMAN - - } catch (final Throwable t) { - // MC compatible - return EntityType.valueOf("PIG_ZOMBIE"); - } - - else if (name.equals("MOOSHROOM_SPAWN_EGG")) - return EntityType.MUSHROOM_COW; - - else - // Parse normally, backwards compatible - try { - return EntityType.valueOf(name); - } catch (final IllegalArgumentException ex) { - // Does not exist for the current MC version - } - - return null; - } - - /* - * Gets the CompMaterial with this name similar to {@link #valueOf(String)} - * without throwing an exception. - * - * @param name the name of the material. - * - * @return an optional that can be empty. - * @since 5.1.0 - */ - - private static CompMaterial getIfPresent(String name) { - return NAMES.get(name); - } - - /* - * When using 1.13+, this helps to find the old material name - * with its data value using a cached search for optimization. - * - * @see #matchDefinedCompMaterial(String, byte) - * @since 1.0.0 - */ - - private static CompMaterial requestOldMaterial(String name, int data) { - - for (final CompMaterial material : VALUES) - // Not using material.name().equals(name) check is intended. - if ((data == UNKNOWN_DATA_VALUE || data == material.data) && material.anyMatchLegacy(name)) - return material; - - return null; - } - - /** - * Parses the given material name as an CompMaterial with a given data - * value in the string if attached. Check {@link #matchWithData(String)} for more info. - * - * @see #matchWithData(String) - * @see #fromLegacy(String, byte) - * @since 2.0.0 - */ - public static CompMaterial fromString(String key) { - - // try to resolve common pitfalls and emulate the material enum writing style - key = key.replace(" ", "_").toUpperCase(); - - // Translate generic monster egg to sheep instead of the white unattributed egg on MC 1.13+ - if (MinecraftVersion.atLeast(V.v1_13) && key.equals("MONSTER_EGG")) - key = "SHEEP_SPAWN_EGG"; - - final CompMaterial oldMatch = matchWithData(key); - - return oldMatch != null ? oldMatch : fromLegacy(format(key), UNKNOWN_DATA_VALUE); - } - - /* - * Parses material name and data value from the specified string. - * The separator for the material name and its data value is {@code :} - * Spaces are allowed. Mostly used when getting materials from config for old school minecrafters. - * <p> - * <b>Examples</b> - * <p><pre> - * {@code INK_SACK:1 -> RED_DYE} - * {@code WOOL: 14 -> RED_WOOL} - * </pre> - * - * @param name the material string that consists of the material name, data and separator character. - * - * @return the parsed CompMaterial. - * @see #matchCompMaterial(String) - * @since 3.0.0 - */ - private static CompMaterial matchWithData(String name) { - final int index = name.indexOf(':'); - - if (index != -1) { - final String mat = format(name.substring(0, index)); - - try { - // We don't use Byte.parseByte because we have our own range check. - final byte data = (byte) Integer.parseInt(name.substring(index + 1).replace(" ", "")); - return data >= 0 && data < MAX_DATA_VALUE ? fromLegacy(mat, data) : fromLegacy(mat, UNKNOWN_DATA_VALUE); - - } catch (final NumberFormatException ignored) { - return fromLegacy(mat, UNKNOWN_DATA_VALUE); - } - } - - return null; - } - - /** - * Return a {@link CompMaterial} from the given block, also comparing the data value - * - * @param block - * @return - */ - public static CompMaterial fromBlock(final Block block) { - return MinecraftVersion.atLeast(V.v1_13) ? fromMaterial(block.getType()) : fromLegacy(block.getType().toString(), block.getData()); - } - - /** - * Parses the given item as an CompMaterial using its material and data value (durability) - * if not a damageable item {@link ItemStack#getDurability()}. - * - * @param item the ItemStack to match. - * - * @return an CompMaterial if matched any. - * @throws IllegalArgumentException may be thrown as an unexpected exception. - * @see #fromMaterial(Material) - * @since 2.0.0 - */ - public static CompMaterial fromItem(@NonNull ItemStack item) { - Objects.requireNonNull(item, "Cannot match null ItemStack"); - - final String material = item.getType().name(); - final byte data = (byte) (Data.ISFLAT || item.getType().getMaxDurability() > 0 ? 0 : item.getDurability()); - - final CompMaterial compmaterial = fromLegacy(material, data); - Valid.checkNotNull("Unsupported material from item: " + material + " (" + data + ')'); - - return compmaterial; - } - - /** - * Parses the given material as an CompMaterial. - * - * @throws IllegalArgumentException may be thrown as an unexpected exception. - * @see #fromLegacy(String, byte) - * @see #fromItem(ItemStack) - * @since 2.0.0 - */ - public static CompMaterial fromMaterial(@NonNull Material material) { - final CompMaterial compmaterial = fromLegacy(material.name(), UNKNOWN_DATA_VALUE); - Valid.checkNotNull(compmaterial, "Unsupported material with no data value: " + material.name()); - - return compmaterial; - } - - /** - * See {@link #fromString(String)}, with the addition that - * this method throws an error if the string could not be parsed - * - * @param key - * @return - */ - public static CompMaterial fromStringStrict(final String key) { - final CompMaterial material = fromString(key); - - Valid.checkNotNull(material, "Invalid material '" + key + "'! For valid names, see: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html (Note that names change across MC versions!)"); - return material; - } - - /** - * A special method for some of our plugins that by default include - * materials in their config files that do not exist in older MC versions. - * <p> - * For these materials, we simply return null and do not add them to settings - * instead of throwing an error. - * - * @param name - * @return - * @deprecated special usage only - */ - @Deprecated - public static CompMaterial fromStringCompat(final String name) { - final CompMaterial lookup = fromString(name); - - if (lookup == null && SoftMaterials.MATERIALS.contains(name)) - return null; - - return fromStringStrict(name); - } - - /** - * The main method that parses the given material name and data value as an CompMaterial. - * All the values passed to this method will not be null or empty and are formatted correctly. - * - * @param name the formatted name of the material. - * @param data the data value of the material. Is always 0 or {@link #UNKNOWN_DATA_VALUE} when {@link Data#ISFLAT} - * - * @return an CompMaterial (with the same data value if specified) - * @see #fromMaterial(Material) - * @see #matchCompMaterial(int, byte) - * @see #fromItem(ItemStack) - * @since 3.0.0 - */ - public static CompMaterial fromLegacy(String name, int data) { - - // try to resolve common pitfalls and emulate the material enum writing style - name = name.replace(" ", "_").toUpperCase(); - - // CompMaterial does not support legacy names - name = name.replace("LEGACY_", ""); - - Boolean duplicated = null; - final boolean isAMap = name.equalsIgnoreCase("MAP"); - - // Do basic number and boolean checks before accessing more complex enum stuff. - if (Data.ISFLAT || (!isAMap && data <= 0 && !(duplicated = isDuplicated(name)))) { - final CompMaterial compmaterial = getIfPresent(name); - - if (compmaterial != null) - return compmaterial; - } - // Usually flat versions wouldn't pass this point, but some special materials do. - - final CompMaterial oldCompmaterial = requestOldMaterial(name, data); - - if (oldCompmaterial == null) { - // Special case. Refer to FILLED_MAP for more info. - return (data >= 0 && isAMap) ? FILLED_MAP : null; - } - - if (!Data.ISFLAT && oldCompmaterial.isPlural() && (duplicated == null ? isDuplicated(name) : duplicated)) - return getIfPresent(name); - - return oldCompmaterial; - } - - /* - * <b>CompMaterial Paradox (Duplication Check)</b> - * Checks if the material has any duplicates. - * <p> - * <b>Example:</b> - * <p>{@code MELON, CARROT, POTATO, BEETROOT -> true} - * - * @param name the name of the material to check. - * - * @return true if there's a duplicated material for this material, otherwise false. - * @since 2.0.0 - */ - private static boolean isDuplicated(String name) { - // Don't use matchCompMaterial() since this method is being called from matchCompMaterial() itself and will cause a StackOverflowError. - return DUPLICATED.contains(name); - } - - /** - * Gets the CompMaterial based on the material's ID (Magic Value) and data value.<br> - * You should avoid using this for performance issues. - * - * @param id the ID (Magic value) of the material. - * @param data the data value of the material. - * - * @return a parsed CompMaterial with the same ID and data value. - * @see #fromItem(ItemStack) - * @since 2.0.0 - */ - public static CompMaterial fromId(int id, byte data) { - if (id < 0 || id > MAX_ID || data < 0) - return null; - - for (final CompMaterial materials : VALUES) - if (materials.data == data && materials.getId() == id) - return materials; - - return null; - } - - /** - * Attempts to build the string like an enum name. - * Removes all the spaces, and extra non-English characters. Also removes some config/in-game based strings. - * While this method is hard to maintain, it's extremely efficient. It's approximately more than x5 times faster than - * the normal RegEx + String Methods approach for both formatted and unformatted material names. - * - * @param name the material name to modify. - * - * @return an enum name. - * @since 2.0.0 - */ - protected static String format(String name) { - final int len = name.length(); - final char[] chs = new char[len]; - int count = 0; - boolean appendUnderline = false; - - for (int i = 0; i < len; i++) { - final char ch = name.charAt(i); - - if (!appendUnderline && count != 0 && (ch == '-' || ch == ' ' || ch == '_') && chs[count] != '_') - appendUnderline = true; - else { - boolean number = false; - // Old materials have numbers in them. - if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (number = (ch >= '0' && ch <= '9'))) { - if (appendUnderline) { - chs[count++] = '_'; - appendUnderline = false; - } - - if (number) - chs[count++] = ch; - else - chs[count++] = (char) (ch & 0x5f); - } - } - } - - return new String(chs, 0, count); - } - - /* - * Checks if the specified version is the same version or higher than the current server version. - * - * @param version the major version to be checked. "1." is ignored. E.g. 1.12 = 12 | 1.9 = 9 - * - * @return true of the version is equal or higher than the current version. - * @since 2.0.0 - */ - private static boolean supports(int version) { - return Data.VERSION >= version; - } - - /* - * Gets the exact major version (..., 1.9, 1.10, ..., 1.14) - * In most cases, you shouldn't be using this method. - * - * @param version Supports {@link Bukkit#getVersion()}, {@link Bukkit#getBukkitVersion()} and normal formats such as "1.14" - * - * @return the exact major version. - * @see #supports(int) - * @see #getVersion() - * @see #getMaterialVersion() - * @since 2.0.0 - */ - - private static String getMajorVersion(@NonNull String version) { - - // getVersion() - int index = version.lastIndexOf("MC:"); - if (index != -1) { - version = version.substring(index + 4, version.length() - 1); - } else if (version.endsWith("SNAPSHOT")) { - // getBukkitVersion() - index = version.indexOf('-'); - version = version.substring(0, index); - } - - // 1.13.2, 1.14.4, etc... - final int lastDot = version.lastIndexOf('.'); - if (version.indexOf('.') != lastDot) - version = version.substring(0, lastDot); - - return version; - } - - /* - * CompMaterial Paradox (Duplication Check) - * I've concluded that this is just an infinite loop that keeps - * going around the Singular Form and the Plural Form materials. A waste of brain cells and a waste of time. - * This solution works just fine anyway. - * <p> - * A solution for CompMaterial Paradox. - * Manually parses the duplicated materials to find the exact material based on the server version. - * If the name ends with "S" -> Plural Form Material. - * Plural methods are only plural if they're also {@link #DUPLICATED} - * <p> - * The only special exceptions are {@link #BRICKS} and {@link #NETHER_BRICKS} - * - * @return true if this material is a plural form material, otherwise false. - * @since 8.0.0 - */ - private boolean isPlural() { - // this.name().charAt(this.name().length() - 1) == 'S' - return this == CARROTS || this == POTATOES; - } - - /** - * Checks if the list of given material names matches the given base material. - * Mostly used for configs. - * <p> - * Supports {@link String#contains} {@code CONTAINS:NAME} formats. - * <p> - * <b>Example:</b> - * <blockquote><pre> - * CompMaterial material = {@link #fromItem(ItemStack)}; - * if (material.isOneOf(plugin.getConfig().getStringList("disabled-items")) return; - * </pre></blockquote> - * <br> - * <b>{@code CONTAINS} Examples:</b> - * <pre> - * {@code "CONTAINS:CHEST" -> CHEST, ENDERCHEST, TRAPPED_CHEST -> true} - * {@code "cOnTaINS:dYe" -> GREEN_DYE, YELLOW_DYE, BLUE_DYE, INK_SACK -> true} - * </pre> - * <p> - * The reason that there are tags for {@code CONTAINS} is for the performance. - * - * <p> - * - * @param materials the material names to check base material on. - * - * @return true if one of the given material names is similar to the base material. - * @since 3.1.1 - */ - public boolean isOneOf(Collection<String> materials) { - if (materials == null || materials.isEmpty()) - return false; - final String name = this.name(); - - for (String comp : materials) { - final String checker = comp.toUpperCase(Locale.ENGLISH); - if (checker.startsWith("CONTAINS:")) { - comp = format(checker.substring(9)); - - if (name.contains(comp)) - return true; - - continue; - } - - // Direct Object Equals - final CompMaterial xMat = fromString(comp); - - if (xMat != null && xMat == this) - return true; - } - return false; - } - - /** - * Sets the {@link Material} (and data value on older versions) of an item. - * Damageable materials will not have their durability changed. - * <p> - * Use {@link #toItem()} instead when creating new ItemStacks. - * - * @param item the item to change its type. - * - * @see #toItem() - * @since 3.0.0 - */ - - public ItemStack setType(ItemStack item) { - Objects.requireNonNull(item, "Cannot set material for null ItemStack"); - final Material material = this.toMaterial(); - Objects.requireNonNull(material, () -> "Unsupported material: " + this.name()); - - item.setType(material); - if (!Data.ISFLAT && material.getMaxDurability() <= 0) - item.setDurability(this.data); - - return item; - } - - /* - * Checks if the given material name matches any of this CompMaterial's legacy material names. - * All the values passed to this method will not be null or empty and are formatted correctly. - * - * @param name the material name to check. - * - * @return true if it's one of the legacy names, otherwise false. - * @since 2.0.0 - */ - private boolean anyMatchLegacy(String name) { - for (int i = this.legacy.length - 1; i >= 0; i--) { - if (name.equals(this.legacy[i])) - return true; - } - return false; - } - - /** - * Gets the ID (Magic value) of the material. - * https://www.minecraftinfo.com/idlist.htm - * - * @return the ID of the material or <b>-1</b> if it's not a legacy material or the server doesn't support the material. - * @see #fromId(int, byte) - * @since 2.2.0 - */ - public int getId() { - if (this.data != 0 || this.version >= 13) - return -1; - - final Material material = this.toMaterial(); - - if (material == null) - return -1; - - if (Data.ISFLAT && !material.isLegacy()) - return -1; - - return material.getId(); - } - - /** - * @see ItemUtil#isSimilar(ItemStack, ItemStack) - */ - public boolean isSimilar(ItemStack item) { - return ItemUtil.isSimilar(this.toItem(), item); - } - - /* - * This method is needed due to Java enum initialization limitations. - * It's really inefficient yes, but it's only used for initialization. - * <p> - * Yes there are many other ways like comparing the hardcoded ordinal or using a boolean in the enum constructor, - * but it's not really a big deal. - * <p> - * This method should not be called if the version is after the flattening update {@link Data#ISFLAT} - * and is only used for parsing materials, not matching, for matching check {@link #DUPLICATED} - */ - private boolean isDuplicated() { - switch (this.name()) { - case "MELON": - case "CARROT": - case "POTATO": - case "GRASS": - case "BRICK": - case "NETHER_BRICK": - - // Illegal Elements - // Since both 1.12 and 1.13 have <type>_DOOR CompMaterial will use it - // for 1.12 to parse the material, but it needs <type>_DOOR_ITEM. - // We'll trick CompMaterial into thinking this needs to be parsed - // using the old methods. - // Some of these materials have their enum name added to the legacy list as well. - case "DARK_OAK_DOOR": - case "ACACIA_DOOR": - case "BIRCH_DOOR": - case "JUNGLE_DOOR": - case "SPRUCE_DOOR": - case "MAP": - case "CAULDRON": - case "BREWING_STAND": - case "FLOWER_POT": - return true; - default: - return false; - } - } - - /** - * Used for datas that need to be accessed during enum initilization. - * - * @since 9.0.0 - */ - private static final class Data { - /** - * The current version of the server in the a form of a major version. - * If the static initialization for this fails, you know something's wrong with the server software. - * - * @since 1.0.0 - */ - private static final int VERSION = Integer.parseInt(getMajorVersion(Bukkit.getVersion()).substring(2)); - /** - * Cached result if the server version is after the v1.13 flattening update. - * - * @since 3.0.0 - */ - private static final boolean ISFLAT = supports(13); - } -} - -/** - * A special class for some of our plugins that by default include - * materials in their config files that do not exist in older MC versions. - * <p> - * For these materials, we simply return null and do not add them to settings - * instead of throwing an error. - * - * @deprecated special usage only, limited - */ -@Deprecated -class SoftMaterials { - - final static StrictSet<String> MATERIALS = new StrictSet<>(Common.newSet( - "SKULL", - "ANVIL", - "TRAPPED_CHEST", - "GOLD_PLATE", - "IRON_PLATE", - "REDSTONE_COMPARATOR_OFF", - "REDSTONE_COMPARATOR_ON", - "DAYLIGHT_DETECTOR", - "REDSTONE_BLOCK", - "QUARTZ_ORE", - "HOPPER", - "QUARTZ_BLOCK", - "QUARTZ_STAIRS", - "ACTIVATOR_RAIL", - "DROPPER", - "STAINED_CLAY", - "STAINED_GLASS_PANE", - "LEAVES_2", - "LOG_2", - "ACACIA_STAIRS", - "DARK_OAK_STAIRS", - "SLIME_BLOCK", - "BARRIER", - "IRON_TRAPDOOR", - "PRISMARINE", - "SEA_LANTERN", - "HAY_BLOCK", - "CARPET", - "HARD_CLAY", - "COAL_BLOCK", - "PACKED_ICE", - "DOUBLE_PLANT", - "STANDING_BANNER", - "WALL_BANNER", - "DAYLIGHT_DETECTOR_INVERTED", - "RED_SANDSTONE", - "RED_SANDSTONE_STAIRS", - "DOUBLE_STONE_SLAB2", - "STONE_SLAB2", - "SPRUCE_FENCE_GATE", - "BIRCH_FENCE_GATE", - "JUNGLE_FENCE_GATE", - "DARK_OAK_FENCE_GATE", - "ACACIA_FENCE_GATE", - "SPRUCE_FENCE", - "BIRCH_FENCE", - "JUNGLE_FENCE", - "DARK_OAK_FENCE", - "ACACIA_FENCE", - "SPRUCE_DOOR", - "BIRCH_DOOR", - "JUNGLE_DOOR", - "ACACIA_DOOR", - "DARK_OAK_DOOR", - "END_ROD", - "CHORUS_PLANT", - "CHORUS_FLOWER", - "PURPUR_BLOCK", - "PURPUR_PILLAR", - "PURPUR_STAIRS", - "PURPUR_DOUBLE_SLAB", - "PURPUR_SLAB", - "END_BRICKS", - "GRASS_PATH", - "END_GATEWAY", - "FROSTED_ICE", - "MAGMA", - "NETHER_WART_BLOCK", - "RED_NETHER_BRICK", - "BONE_BLOCK", - "OBSERVER", - "PURPLE_SHULKER_BOX" - - )); -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompMetadata.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompMetadata.java deleted file mode 100644 index 5afc57cae79e75a7da382f38ee9357da55218bae..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompMetadata.java +++ /dev/null @@ -1,551 +0,0 @@ -package org.mineacademy.fo.remain; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.bukkit.Location; -import org.bukkit.NamespacedKey; -import org.bukkit.block.Block; -import org.bukkit.block.BlockState; -import org.bukkit.block.CreatureSpawner; -import org.bukkit.block.TileState; -import org.bukkit.entity.Entity; -import org.bukkit.inventory.ItemStack; -import org.bukkit.metadata.FixedMetadataValue; -import org.bukkit.metadata.MetadataValue; -import org.bukkit.metadata.Metadatable; -import org.bukkit.persistence.PersistentDataType; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.SerializeUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.constants.FoConstants; -import org.mineacademy.fo.model.ConfigSerializable; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.nbt.NBTCompound; -import org.mineacademy.fo.remain.nbt.NBTItem; -import org.mineacademy.fo.settings.YamlSectionConfig; - -import lombok.Getter; -import lombok.NonNull; -import lombok.RequiredArgsConstructor; - -/** - * Utility class for persistent metadata manipulation - * <p> - * We apply scoreboard tags to ensure permanent metadata storage - * if supported, otherwise it is lost on reload - */ -public final class CompMetadata { - - /** - * The tag delimiter - */ - private final static String DELIMITER = "%-%"; - - // Static access - private CompMetadata() { - } - - // ---------------------------------------------------------------------------------------- - // Setting metadata - // ---------------------------------------------------------------------------------------- - - /** - * A shortcut for setting a tag with key-value pair on an item - * - * @param item - * @param compoundTag - * @param key - * @param value - * @return - */ - public static ItemStack setMetadata(final ItemStack item, final String key, final String value) { - Valid.checkNotNull(item, "Setting NBT tag got null item"); - - final NBTItem nbt = new NBTItem(item); - final NBTCompound tag = nbt.addCompound(FoConstants.NBT.TAG); - - tag.setString(key, value); - return nbt.getItem(); - } - - /** - * Attempts to set a persistent metadata for entity - * - * @param entity - * @param tag - */ - public static void setMetadata(final Entity entity, final String tag) { - setMetadata(entity, tag, tag); - } - - /** - * Attempts to set a persistent metadata tag with value for entity - * - * @param entity - * @param key - * @param value - */ - public static void setMetadata(final Entity entity, final String key, final String value) { - Valid.checkNotNull(entity); - - final String tag = format(key, value); - - if (Remain.hasScoreboardTags()) { - if (!entity.getScoreboardTags().contains(tag)) - entity.addScoreboardTag(tag); - - } else { - entity.setMetadata(key, new FixedMetadataValue(SimplePlugin.getInstance(), value)); - - MetadataFile.getInstance().addMetadata(entity, key, value); - } - } - - // Format the syntax of stored tags - private static String format(final String key, final String value) { - return SimplePlugin.getNamed() + DELIMITER + key + DELIMITER + value; - } - - /** - * Sets persistent tile entity metadata - * - * @param tileEntity - * @param key - * @param value - */ - public static void setMetadata(final BlockState tileEntity, final String key, final String value) { - Valid.checkNotNull(tileEntity); - Valid.checkNotNull(key); - Valid.checkNotNull(value); - - if (MinecraftVersion.atLeast(V.v1_14)) { - Valid.checkBoolean(tileEntity instanceof TileState, "BlockState must be instance of a TileState not " + tileEntity); - - setNamedspaced((TileState) tileEntity, key, value); - tileEntity.update(); - - } else { - tileEntity.setMetadata(key, new FixedMetadataValue(SimplePlugin.getInstance(), value)); - tileEntity.update(); - - MetadataFile.getInstance().addMetadata(tileEntity, key, value); - } - } - - private static void setNamedspaced(final TileState tile, final String key, final String value) { - tile.getPersistentDataContainer().set(new NamespacedKey(SimplePlugin.getInstance(), key), PersistentDataType.STRING, value); - } - - // ---------------------------------------------------------------------------------------- - // Getting metadata - // ---------------------------------------------------------------------------------------- - - /** - * A shortcut from reading a certain key from an item's given compound tag - * - * @param item - * @param compoundTag - * @param key - * @return - */ - public static String getMetadata(final ItemStack item, final String key) { - Valid.checkNotNull(item, "Reading NBT tag got null item"); - - if (item == null || CompMaterial.isAir(item.getType())) - return null; - - final String compoundTag = FoConstants.NBT.TAG; - final NBTItem nbt = new NBTItem(item); - - final String value = nbt.hasKey(compoundTag) ? nbt.getCompound(compoundTag).getString(key) : null; - - return Common.getOrNull(value); - } - - /** - * Attempts to get the entity's metadata, first from scoreboard tag, - * second from Bukkit metadata - * - * @param entity - * @param key - * @return the tag, or null - */ - public static String getMetadata(final Entity entity, final String key) { - Valid.checkNotNull(entity); - - if (Remain.hasScoreboardTags()) - for (final String line : entity.getScoreboardTags()) { - final String tag = getTag(line, key); - - if (tag != null && !tag.isEmpty()) - return tag; - } - - final String value = entity.hasMetadata(key) ? entity.getMetadata(key).get(0).asString() : null; - - return Common.getOrNull(value); - } - - // Parses the tag and gets its value - private static String getTag(final String raw, final String key) { - final String[] parts = raw.split(DELIMITER); - - return parts.length == 3 && parts[0].equals(SimplePlugin.getNamed()) && parts[1].equals(key) ? parts[2] : null; - } - - /** - * Return saved tile entity metadata, or null if none - * - * @param tileEntity - * @param key, or null if none - * @return - */ - public static String getMetadata(final BlockState tileEntity, final String key) { - Valid.checkNotNull(tileEntity); - Valid.checkNotNull(key); - - if (MinecraftVersion.atLeast(V.v1_14)) { - Valid.checkBoolean(tileEntity instanceof TileState, "BlockState must be instance of a TileState not " + tileEntity); - - return getNamedspaced((TileState) tileEntity, key); - } - - final String value = tileEntity.hasMetadata(key) ? tileEntity.getMetadata(key).get(0).asString() : null; - - return Common.getOrNull(value); - } - - private static String getNamedspaced(final TileState tile, final String key) { - final String value = tile.getPersistentDataContainer().get(new NamespacedKey(SimplePlugin.getInstance(), key), PersistentDataType.STRING); - - return Common.getOrNull(value); - } - - // ---------------------------------------------------------------------------------------- - // Checking for metadata - // ---------------------------------------------------------------------------------------- - - /** - * Return true if the given itemstack has the given key stored at its compound - * tag {@link FoConstants.NBT#TAG} - * - * @param item - * @param key - * @return - */ - public static boolean hasMetadata(final ItemStack item, final String key) { - Valid.checkBoolean(MinecraftVersion.atLeast(V.v1_7), "NBT ItemStack tags only support MC 1.7.10+"); - Valid.checkNotNull(item); - - if (CompMaterial.isAir(item.getType())) - return false; - - final NBTItem nbt = new NBTItem(item); - final NBTCompound tag = nbt.getCompound(FoConstants.NBT.TAG); - - return tag != null && tag.hasKey(key); - } - - /** - * Returns if the entity has the given tag by key, first checks scoreboard tags, - * and then bukkit metadata - * - * @param entity - * @param key - * @return - */ - public static boolean hasMetadata(final Entity entity, final String key) { - Valid.checkNotNull(entity); - - if (Remain.hasScoreboardTags()) - for (final String line : entity.getScoreboardTags()) - if (hasTag(line, key)) - return true; - - return entity.hasMetadata(key); - } - - /** - * Return true if the given tile entity block such as {@link CreatureSpawner} has - * the given key - * - * @param tileEntity - * @param key - * @return - */ - public static boolean hasMetadata(final BlockState tileEntity, final String key) { - Valid.checkNotNull(tileEntity); - Valid.checkNotNull(key); - - if (MinecraftVersion.atLeast(V.v1_14)) { - Valid.checkBoolean(tileEntity instanceof TileState, "BlockState must be instance of a TileState not " + tileEntity); - - return hasNamedspaced((TileState) tileEntity, key); - } - - return tileEntity.hasMetadata(key); - } - - private static boolean hasNamedspaced(final TileState tile, final String key) { - return tile.getPersistentDataContainer().has(new NamespacedKey(SimplePlugin.getInstance(), key), PersistentDataType.STRING); - } - - // Parses the tag and gets its value - private static boolean hasTag(final String raw, final String tag) { - final String[] parts = raw.split(DELIMITER); - - return parts.length == 3 && parts[0].equals(SimplePlugin.getNamed()) && parts[1].equals(tag); - } - - /** - * Sets a temporary metadata to entity. This metadata is NOT persistent - * and is removed on server stop, restart or reload. - * <p> - * Use {@link #setMetadata(Entity, String)} to set persistent custom tags for entities. - * - * @param entity - * @param tag - */ - public static void setTempMetadata(final Entity entity, final String tag) { - entity.setMetadata(createTempMetadataKey(tag), new FixedMetadataValue(SimplePlugin.getInstance(), tag)); - } - - /** - * Sets a temporary metadata to entity. This metadata is NOT persistent - * and is removed on server stop, restart or reload. - * <p> - * Use {@link #setMetadata(Entity, String)} to set persistent custom tags for entities. - * - * @param entity - * @param tag - * @param key - */ - public static void setTempMetadata(final Entity entity, final String tag, final Object key) { - entity.setMetadata(createTempMetadataKey(tag), new FixedMetadataValue(SimplePlugin.getInstance(), key)); - } - - /** - * Return entity metadata value or null if has none - * <p> - * Only usable if you set it using the {@link #setTempMetadata(Entity, String, Object)} with the key parameter - * because otherwise the tag is the same as the value we return - * - * @param entity - * @param tag - * @return - */ - public static MetadataValue getTempMetadata(final Entity entity, final String tag) { - final String key = createTempMetadataKey(tag); - - return entity.hasMetadata(key) ? entity.getMetadata(key).get(0) : null; - } - - public static boolean hasTempMetadata(final Entity player, final String tag) { - return player.hasMetadata(createTempMetadataKey(tag)); - } - - /** - * Remove temporary metadata from the entity - * - * @param player - * @param tag - */ - public static void removeTempMetadata(final Entity player, final String tag) { - final String key = createTempMetadataKey(tag); - - if (player.hasMetadata(key)) - player.removeMetadata(key, SimplePlugin.getInstance()); - } - - /* - * Create a new temporary metadata key - */ - private static String createTempMetadataKey(final String tag) { - return SimplePlugin.getNamed() + "_" + tag; - } - - /** - * Due to lack of persistent metadata implementation until Minecraft 1.14.x, - * we simply store them in a file during server restart and then apply - * as a temporary metadata for the Bukkit entities. - * <p> - * internal use only - */ - public static final class MetadataFile extends YamlSectionConfig { - - private static volatile Object LOCK = new Object(); - - @Getter - private static volatile MetadataFile instance = new MetadataFile(); - - private final StrictMap<UUID, List<String>> entityMetadataMap = new StrictMap<>(); - private final StrictMap<Location, BlockCache> blockMetadataMap = new StrictMap<>(); - - private MetadataFile() { - super("Metadata"); - - loadConfiguration(NO_DEFAULT, FoConstants.File.DATA); - } - - @Override - protected void onLoadFinish() { - synchronized (LOCK) { - loadEntities(); - loadBlockStates(); - - save(); - } - } - - private void loadEntities() { - synchronized (LOCK) { - entityMetadataMap.clear(); - - for (final String uuidName : getMap("Entity").keySet()) { - final UUID uuid = UUID.fromString(uuidName); - - // Remove broken key - if (!(getObject("Entity." + uuidName) instanceof List)) { - setNoSave("Entity." + uuidName, null); - - continue; - } - - final List<String> metadata = getStringList("Entity." + uuidName); - final Entity entity = Remain.getEntity(uuid); - - // Check if the entity is still real - if (!metadata.isEmpty() && entity != null && entity.isValid() && !entity.isDead()) { - entityMetadataMap.put(uuid, metadata); - - applySavedMetadata(metadata, entity); - } - } - - save("Entity", this.entityMetadataMap); - } - } - - private void loadBlockStates() { - synchronized (LOCK) { - blockMetadataMap.clear(); - - for (final String locationRaw : getMap("Block").keySet()) { - final Location location = SerializeUtil.deserializeLocation(locationRaw); - final BlockCache blockCache = get("Block." + locationRaw, BlockCache.class); - - final Block block = location.getBlock(); - - // Check if the block remained the same - if (!CompMaterial.isAir(block) && CompMaterial.fromBlock(block) == blockCache.getType()) { - blockMetadataMap.put(location, blockCache); - - applySavedMetadata(blockCache.getMetadata(), block); - } - } - - save("Block", this.blockMetadataMap); - } - } - - private void applySavedMetadata(final List<String> metadata, final Metadatable entity) { - synchronized (LOCK) { - for (final String metadataLine : metadata) { - if (metadataLine.isEmpty()) - continue; - - final String[] lines = metadataLine.split(DELIMITER); - Valid.checkBoolean(lines.length == 3, "Malformed metadata line for " + entity + ". Length 3 != " + lines.length + ". Data: " + metadataLine); - - final String key = lines[1]; - final String value = lines[2]; - - entity.setMetadata(key, new FixedMetadataValue(SimplePlugin.getInstance(), value)); - } - } - } - - protected void addMetadata(final Entity entity, @NonNull final String key, final String value) { - synchronized (LOCK) { - final List<String> metadata = entityMetadataMap.getOrPut(entity.getUniqueId(), new ArrayList<>()); - - for (final Iterator<String> i = metadata.iterator(); i.hasNext();) { - final String meta = i.next(); - - if (getTag(meta, key) != null) - i.remove(); - } - - if (value != null && !value.isEmpty()) { - final String formatted = format(key, value); - - metadata.add(formatted); - } - - save("Entity", entityMetadataMap); - } - } - - protected void addMetadata(final BlockState blockState, final String key, final String value) { - synchronized (LOCK) { - final BlockCache blockCache = blockMetadataMap.getOrPut(blockState.getLocation(), new BlockCache(CompMaterial.fromBlock(blockState.getBlock()), new ArrayList<>())); - - for (final Iterator<String> i = blockCache.getMetadata().iterator(); i.hasNext();) { - final String meta = i.next(); - - if (getTag(meta, key) != null) - i.remove(); - } - - if (value != null && !value.isEmpty()) { - final String formatted = format(key, value); - - blockCache.getMetadata().add(formatted); - } - - { // Save - for (final Map.Entry<Location, BlockCache> entry : blockMetadataMap.entrySet()) - setNoSave("Block." + SerializeUtil.serializeLoc(entry.getKey()), entry.getValue().serialize()); - - save(); - } - } - } - - @Getter - @RequiredArgsConstructor - public static final class BlockCache implements ConfigSerializable { - private final CompMaterial type; - private final List<String> metadata; - - public static BlockCache deserialize(final SerializedMap map) { - final CompMaterial type = map.getMaterial("Type"); - final List<String> metadata = map.getStringList("Metadata"); - - return new BlockCache(type, metadata); - } - - @Override - public SerializedMap serialize() { - final SerializedMap map = new SerializedMap(); - - map.put("Type", type.toString()); - map.put("Metadata", metadata); - - return map; - } - } - - public static void onReload() { - instance = new MetadataFile(); - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompMonsterEgg.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompMonsterEgg.java deleted file mode 100644 index 315dcea024ad43df205f35dfb0b95e8a46427761..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompMonsterEgg.java +++ /dev/null @@ -1,369 +0,0 @@ -package org.mineacademy.fo.remain; - -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import org.bukkit.entity.EntityType; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SpawnEggMeta; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.nbt.NBTCompound; -import org.mineacademy.fo.remain.nbt.NBTItem; - -import lombok.NonNull; - -/** - * Utility class for manipulating Monster Eggs - */ -public final class CompMonsterEgg { - - /** - * Our universal tag we use to mark our eggs - */ - private static final String TAG = SimplePlugin.getNamed() + "_NbtTag"; - - /** - * Suppress errors when entity type cannot be detected from an item stack and - * return unknown entity or otherwise. - */ - public static boolean acceptUnsafeEggs = false; - - // Prevent new instance, always call static methods - private CompMonsterEgg() { - } - - /** - * Makes a monster egg of the specified type. - * - * @param type - * @return the finished monster egg - */ - public static ItemStack makeEgg(final EntityType type) { - return makeEgg(type, 1); - } - - /** - * Makes a monster egg of a certain count. - * - * @param type - * @param count - * @return the finished egg - */ - public static ItemStack makeEgg(final EntityType type, final int count) { - Valid.checkNotNull(type, "Entity type cannot be null!"); - ItemStack itemStack = new ItemStack(CompMaterial.makeMonsterEgg(type).getMaterial(), count); - - // For older MC - if (itemStack.getType().toString().equals("MONSTER_EGG")) - itemStack = setEntity(itemStack, type); - - return itemStack; - } - - /** - * Detect an {@link EntityType} from an {@link ItemStack} - * - * @param item - * @return the entity type, or unknown or error if not found, see - * {@link #acceptUnsafeEggs} - */ - public static EntityType getEntity(final ItemStack item) { - Valid.checkBoolean(CompMaterial.isMonsterEgg(item.getType()), "Item must be a monster egg not " + item); - EntityType type = null; - - if (MinecraftVersion.atLeast(V.v1_13)) - type = getTypeFromMaterial(item); - - else if (Remain.hasSpawnEggMeta()) - type = getTypeByMeta(item); - - else - type = getTypeByData(item); - - if (type == null) - type = getTypeByNbt(item); - - if (type == null && acceptUnsafeEggs) - type = EntityType.UNKNOWN; - - Valid.checkNotNull(type, "Could not detect monster type from " + item + " (data = " + item.getData() + ", dura = " + item.getDurability() + ")"); - return type; - } - - private static EntityType getTypeFromMaterial(final ItemStack item) { - final String name = item.getType().toString().replace("_SPAWN_EGG", ""); - EntityType type = null; - - try { - - // Try to translate directly - type = EntityType.valueOf(name); - - } catch (final IllegalArgumentException ex) { - - // Special cases e.g. zombie_pigman is pig_zombie - for (final EntityType all : EntityType.values()) - if (all.getName() != null && all.getName().equalsIgnoreCase(name)) - type = all; - } - - Valid.checkNotNull(type, "Unable to find EntityType from Material." + item.getType()); - return type; - } - - private static EntityType getTypeByMeta(final ItemStack item) { - final ItemMeta m = item.getItemMeta(); - - return item.hasItemMeta() && m instanceof SpawnEggMeta ? ((SpawnEggMeta) m).getSpawnedType() : null; - } - - private static EntityType getTypeByData(final ItemStack item) { - EntityType type = readEntity0(item); - - if (type == null) { - if (item.getDurability() != 0) - type = DataMap.getEntity(item.getDurability()); - - if (type == null && item.getData().getData() != 0) - type = DataMap.getEntity(item.getData().getData()); - } - - return type; - } - - private static EntityType readEntity0(final ItemStack item) { - Valid.checkNotNull(item, "Reading entity got null item"); - - final NBTItem nbt = new NBTItem(item); - final String type = nbt.hasKey(TAG) ? nbt.getCompound(TAG).getString("entity") : null; - - return type != null && !type.isEmpty() ? EntityType.valueOf(type) : null; - } - - private static EntityType getTypeByNbt(@NonNull final ItemStack item) { - try { - final Class<?> NMSItemStackClass = ReflectionUtil.getNMSClass("ItemStack", "net.minecraft.world.item.ItemStack"); - final Class<?> craftItemStackClass = ReflectionUtil.getOBCClass("inventory.CraftItemStack"); - final Method asNMSCopyMethod = craftItemStackClass.getMethod("asNMSCopy", ItemStack.class); - final Object stack = asNMSCopyMethod.invoke(null, item); - final Object tagCompound = NMSItemStackClass.getMethod("getTag").invoke(stack); - - if (tagCompound == null && acceptUnsafeEggs) - return null; - - Valid.checkNotNull(tagCompound, "Spawn egg lacks tag compound: " + item); - - final Method tagGetCompound = tagCompound.getClass().getMethod("getCompound", String.class); - final Object entityTag = tagGetCompound.invoke(tagCompound, "EntityTag"); - - final Method tagGetString = entityTag.getClass().getMethod("getString", String.class); - String idString = (String) tagGetString.invoke(entityTag, "id"); - - if (MinecraftVersion.atLeast(V.v1_11) && idString.startsWith("minecraft:")) - idString = idString.split("minecraft:")[1]; - - final EntityType type = EntityType.fromName(idString); - //Valid.requireNonNull(type, "Unable to parse mob egg from string: " + idString); - - return type; - } catch (final ReflectiveOperationException ex) { - ex.printStackTrace(); - - return null; - } - } - - /** - * Insert metadata to an existing monster itemstack. - * - * @param item - * @param type - * @return the itemstack - */ - public static ItemStack setEntity(ItemStack item, final EntityType type) { - Valid.checkNotNull(item, "Item == null"); - Valid.checkBoolean(type.isSpawnable(), type + " cannot be spawned and thus set into a monster egg!"); - - if (MinecraftVersion.atLeast(V.v1_13)) { - item.setType(CompMaterial.makeMonsterEgg(type).getMaterial()); - - return item; - } - - Valid.checkBoolean(CompMaterial.isMonsterEgg(item.getType()), "Item must be a monster egg not " + item); - - if (Remain.hasSpawnEggMeta()) - item = setTypeByMeta(item, type); - - else - item = setTypeByData(item, type); - - return item; - } - - private static ItemStack setTypeByMeta(final ItemStack item, final EntityType type) { - final SpawnEggMeta m = (SpawnEggMeta) item.getItemMeta(); - - m.setSpawnedType(type); - item.setItemMeta(m); - - return item; - } - - private static ItemStack setTypeByData(final ItemStack item, final EntityType type) { - final Number data = DataMap.getData(type); - - if (data.intValue() != -1) { - - item.setDurability(data.shortValue()); - item.getData().setData(data.byteValue()); - - return writeEntity0(item, type); - - } else if (!acceptUnsafeEggs) - throw new FoException("Could not set monster egg to " + type); - - return item; - } - - private static ItemStack writeEntity0(final ItemStack item, final EntityType type) { - Valid.checkNotNull(item, "setting nbt got null item"); - Valid.checkNotNull(type, "setting nbt got null entity"); - - final NBTItem nbt = new NBTItem(item); - final NBTCompound tag = nbt.addCompound(TAG); - - tag.setString("entity", type.toString()); - return nbt.getItem(); - } -} - -/** - * Wrapper for mapping entity ID to its respective type - */ -final class DataMap { - - private static final Map<Integer, String> map = new HashMap<>(); - - static EntityType getEntity(final int data) { - final String name = map.get(data); - - return name != null ? ReflectionUtil.lookupEnumSilent(EntityType.class, name.toUpperCase()) : null; - } - - static int getData(final EntityType type) { - final Integer data = getKeyFromValue(type.toString()); - - return data != null ? data : -1; - } - - private static Integer getKeyFromValue(final String value) { - for (final Entry<Integer, String> e : map.entrySet()) - if (e.getValue().equals(value)) - return e.getKey(); - - return null; - } - - static { - map.put(1, "DROPPED_ITEM"); - map.put(2, "EXPERIENCE_ORB"); - map.put(3, "AREA_EFFECT_CLOUD"); - map.put(4, "ELDER_GUARDIAN"); - map.put(5, "WITHER_SKELETON"); - map.put(6, "STRAY"); - map.put(7, "EGG"); - map.put(8, "LEASH_HITCH"); - map.put(9, "PAINTING"); - map.put(10, "ARROW"); - map.put(11, "SNOWBALL"); - map.put(12, "FIREBALL"); - map.put(13, "SMALL_FIREBALL"); - map.put(14, "ENDER_PEARL"); - map.put(15, "ENDER_SIGNAL"); - map.put(16, "SPLASH_POTION"); - map.put(17, "THROWN_EXP_BOTTLE"); - map.put(18, "ITEM_FRAME"); - map.put(19, "WITHER_SKULL"); - map.put(20, "PRIMED_TNT"); - map.put(21, "FALLING_BLOCK"); - map.put(22, "FIREWORK"); - map.put(23, "HUSK"); - map.put(24, "SPECTRAL_ARROW"); - map.put(25, "SHULKER_BULLET"); - map.put(26, "DRAGON_FIREBALL"); - map.put(27, "ZOMBIE_VILLAGER"); - map.put(28, "SKELETON_HORSE"); - map.put(29, "ZOMBIE_HORSE"); - map.put(30, "ARMOR_STAND"); - map.put(31, "DONKEY"); - map.put(32, "MULE"); - map.put(33, "EVOKER_FANGS"); - map.put(34, "EVOKER"); - map.put(35, "VEX"); - map.put(36, "VINDICATOR"); - map.put(37, "ILLUSIONER"); - map.put(40, "MINECART_COMMAND"); - map.put(41, "BOAT"); - map.put(42, "MINECART"); - map.put(43, "MINECART_CHEST"); - map.put(44, "MINECART_FURNACE"); - map.put(45, "MINECART_TNT"); - map.put(46, "MINECART_HOPPER"); - map.put(47, "MINECART_MOB_SPAWNER"); - map.put(50, "CREEPER"); - map.put(51, "SKELETON"); - map.put(52, "SPIDER"); - map.put(53, "GIANT"); - map.put(54, "ZOMBIE"); - map.put(55, "SLIME"); - map.put(56, "GHAST"); - map.put(57, "PIG_ZOMBIE"); - map.put(58, "ENDERMAN"); - map.put(59, "CAVE_SPIDER"); - map.put(60, "SILVERFISH"); - map.put(61, "BLAZE"); - map.put(62, "MAGMA_CUBE"); - map.put(63, "ENDER_DRAGON"); - map.put(64, "WITHER"); - map.put(65, "BAT"); - map.put(66, "WITCH"); - map.put(67, "ENDERMITE"); - map.put(68, "GUARDIAN"); - map.put(69, "SHULKER"); - map.put(90, "PIG"); - map.put(91, "SHEEP"); - map.put(92, "COW"); - map.put(93, "CHICKEN"); - map.put(94, "SQUID"); - map.put(95, "WOLF"); - map.put(96, "MUSHROOM_COW"); - map.put(97, "SNOWMAN"); - map.put(98, "OCELOT"); - map.put(99, "IRON_GOLEM"); - map.put(100, "HORSE"); - map.put(101, "RABBIT"); - map.put(102, "POLAR_BEAR"); - map.put(103, "LLAMA"); - map.put(104, "LLAMA_SPIT"); - map.put(105, "PARROT"); - map.put(120, "VILLAGER"); - //map.put(200, "ENDER_CRYSTAL"); - //map.put(-1, "LINGERING_POTION"); - //map.put(-1, "FISHING_HOOK"); - //map.put(-1, "LIGHTNING"); - //map.put(-1, "WEATHER"); - //map.put(-1, "PLAYER"); - //map.put(-1, "COMPLEX_PART"); - //map.put(-1, "TIPPED_ARROW"); - //map.put(-1, "UNKNOWN"); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompParticle.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompParticle.java deleted file mode 100644 index ba983baa831d1f1d41f08fa6b708095b3321644e..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompParticle.java +++ /dev/null @@ -1,418 +0,0 @@ -package org.mineacademy.fo.remain; - -import java.lang.reflect.Constructor; - -import javax.annotation.Nullable; - -import org.bukkit.Color; -import org.bukkit.Location; -import org.bukkit.Particle; -import org.bukkit.Particle.DustOptions; -import org.bukkit.entity.Player; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.Valid; - -import lombok.SneakyThrows; - -/** - * Wrapper for {@link Particle} - */ -public enum CompParticle { - - EXPLOSION_NORMAL("explode"), - EXPLOSION_LARGE("largeexplode"), - EXPLOSION_HUGE("hugeexplosion"), - FIREWORKS_SPARK("fireworksSpark"), - WATER_BUBBLE("bubble"), - WATER_SPLASH("splash"), - WATER_WAKE("wake"), - SUSPENDED("suspend"), - SUSPENDED_DEPTH("depthsuspend"), - CRIT("crit"), - CRIT_MAGIC("magicCrit"), - SMOKE_NORMAL("smoke"), - SMOKE_LARGE("largesmoke"), - SPELL("spell"), - SPELL_INSTANT("instantSpell"), - SPELL_MOB("mobSpell"), - SPELL_MOB_AMBIENT("mobSpellAmbient"), - SPELL_WITCH("witchMagic"), - DRIP_WATER("dripWater"), - DRIP_LAVA("dripLava"), - VILLAGER_ANGRY("angryVillager"), - VILLAGER_HAPPY("happyVillager"), - TOWN_AURA("townaura"), - NOTE("note"), - PORTAL("portal"), - ENCHANTMENT_TABLE("enchantmenttable"), - FLAME("flame"), - LAVA("lava"), - FOOTSTEP("footstep"), - CLOUD("cloud"), - REDSTONE("reddust"), - SNOWBALL("snowballpoof"), - SNOW_SHOVEL("snowshovel"), - SLIME("slime"), - HEART("heart"), - BARRIER("barrier"), - ITEM_CRACK("iconcrack_"), - BLOCK_CRACK("blockcrack_"), - BLOCK_DUST("blockdust_"), - WATER_DROP("droplet"), - ITEM_TAKE("take"), - MOB_APPEARANCE("mobappearance"), - - // MC 1.8.8+ - DRAGON_BREATH, - END_ROD, - DAMAGE_INDICATOR, - SWEEP_ATTACK, - FALLING_DUST, - TOTEM, - SPIT, - SQUID_INK, - BUBBLE_POP, - CURRENT_DOWN, - BUBBLE_COLUMN_UP, - NAUTILUS, - DOLPHIN, - SNEEZE, - CAMPFIRE_COSY_SMOKE, - CAMPFIRE_SIGNAL_SMOKE, - COMPOSTER, - FLASH, - FALLING_LAVA, - LANDING_LAVA, - FALLING_WATER, - DRIPPING_HONEY, - FALLING_HONEY, - LANDING_HONEY, - FALLING_NECTAR, - SOUL_FIRE_FLAME, - ASH, - CRIMSON_SPORE, - WARPED_SPORE, - SOUL, - DRIPPING_OBSIDIAN_TEAR, - FALLING_OBSIDIAN_TEAR, - LANDING_OBSIDIAN_TEAR, - REVERSE_PORTAL, - WHITE_ASH, - LIGHT, - DUST_COLOR_TRANSITION, - VIBRATION, - FALLING_SPORE_BLOSSOM, - SPORE_BLOSSOM_AIR, - SMALL_FLAME, - SNOWFLAKE, - DRIPPING_DRIPSTONE_LAVA, - FALLING_DRIPSTONE_LAVA, - DRIPPING_DRIPSTONE_WATER, - FALLING_DRIPSTONE_WATER, - GLOW_SQUID_INK, - GLOW, - WAX_ON, - WAX_OFF, - ELECTRIC_SPARK, - SCRAPE; - - /** - * Hardcoded values for best performance - */ - private static final boolean atLeast1_13 = MinecraftVersion.atLeast(V.v1_13); - private static final boolean atLeast1_12 = MinecraftVersion.atLeast(V.v1_12); - private static final boolean atLeast1_8 = MinecraftVersion.atLeast(V.v1_8); - - /** - * The name for Minecraft 1.7.10 - */ - private final String name1_7; - - /** - * The NMS EnumParticle class cache here for top performance - */ - @Nullable - private final Object nmsEnumParticle; - - /** - * The bukkit particle object, if this is running on a new MC version, cached for top performance - */ - @Nullable - private final Object bukkitEnumParticle; - - /** - * The NMS packet class constructor cached here for top performance - */ - private final Constructor<?> packetConstructor; - - /* - * Construct a new compatible particle class - */ - private CompParticle() { - this(null); - } - - /* - * Construct a new compatible particle class - */ - @SuppressWarnings("rawtypes") - private CompParticle(String name1_7) { - this.name1_7 = name1_7; - - try { - - // Minecraft <1.7 lacks that class, Minecraft >1.13 already has native API - if (MinecraftVersion.atLeast(V.v1_7) && MinecraftVersion.olderThan(V.v1_13)) { - - final Class<?> packetClass = ReflectionUtil.getNMSClass("PacketPlayOutWorldParticles", "net.minecraft.network.protocol.game.PacketPlayOutWorldParticles"); - - if (MinecraftVersion.equals(V.v1_7)) { - this.nmsEnumParticle = null; - this.packetConstructor = ReflectionUtil.getConstructor(packetClass, String.class, Float.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Integer.TYPE); - } - - else { - final Class<? extends Enum> particleClass = (Class<? extends Enum>) ReflectionUtil.getNMSClass("EnumParticle"); - - this.nmsEnumParticle = ReflectionUtil.lookupEnumSilent(particleClass, this.name()); - - // MC 1.8.8 or newer but lacks this given particle type - if (this.nmsEnumParticle == null) - this.packetConstructor = null; - else - this.packetConstructor = ReflectionUtil.getConstructor(packetClass, particleClass, Boolean.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Float.TYPE, Integer.TYPE, int[].class); - } - - } else { - this.nmsEnumParticle = null; - this.packetConstructor = null; - } - - if (MinecraftVersion.atLeast(V.v1_12)) { - final Class<Enum> particleClass = ReflectionUtil.lookupClass("org.bukkit.Particle"); - - this.bukkitEnumParticle = ReflectionUtil.lookupEnumSilent(particleClass, this.name()); - - } else - this.bukkitEnumParticle = null; - - } catch (final Throwable t) { - t.printStackTrace(); - - throw new RuntimeException("Fatal error setting up CompParticle, see above"); - } - } - - /** - * Spawns this particle with the given color, only works for {@link #REDSTONE} - * The particle size requires MC 1.13+ - * - * @param location - * @param color - * @param particleSize - */ - public void spawn(Location location, Color color, float particleSize) { - Valid.checkBoolean(this == REDSTONE, "Can only send colors for REDSTONE particle, not: " + this); - - if (atLeast1_13) - location.getWorld().spawnParticle((Particle) this.bukkitEnumParticle, location, 1, 0, 0, 0, 0, new DustOptions(color, particleSize)); - - else { - final float red = color.getRed() == 0 ? Float.MIN_VALUE : color.getRed() / 255F; - final float green = color.getGreen() / 255F; - final float blue = color.getBlue() / 255F; - - this.spawn(location, red, green, blue, 1, 0, 1, null); - } - } - - /** - * Spawns a particle at the given location - * - * @param location - */ - public void spawn(Location location) { - this.spawn(location, 0, 0, 0, 0, 0, 0, null); - } - - /** - * Spawns the particle at the given location with extra material data - * - * @param location - * @param data - */ - public final void spawn(Location location, CompMaterial data) { - Valid.checkBoolean(this == ITEM_CRACK || this == BLOCK_CRACK || this == BLOCK_DUST || this == FALLING_DUST, "Can only call particle spawn with data on crack or dust particles, not: " + this); - - if (atLeast1_12) { - if (atLeast1_13) - location.getWorld().spawnParticle((Particle) this.bukkitEnumParticle, location, 1, data.getMaterial().createBlockData()); - - else - location.getWorld().spawnParticle((Particle) this.bukkitEnumParticle, location, 1, data.getMaterial().getNewData(data.getData())); - - } else - this.spawn(location, 0, 0, 0, 0, 1, 0, (int) data.getData()); - } - - /** - * Spawns a particle at the given location with given data - * - * @param location - * @param extra - */ - public final void spawn(Location location, double extra) { - this.spawn(location, 0, extra); - } - - /** - * Spawns a particle at the given location with given data - * - * @param location - * @param speed - * @param extra - */ - public final void spawn(Location location, double speed, double extra) { - this.spawn(location, 0d, 0d, 0d, speed, 0, extra, null); - } - - /** - * Spawns a particle at the given location with the given params, see Bukkit API for documentation - * - * @param location - * @param offsetX - * @param offsetY - * @param offsetZ - * @param speed - * @param count - * @param extra - * @param data - */ - public void spawn(Location location, double offsetX, double offsetY, double offsetZ, double speed, int count, double extra, int... data) { - - // Minecraft 1.12 and up - if (this.bukkitEnumParticle != null) { - if (MinecraftVersion.atLeast(V.v1_13) && this == REDSTONE) - location.getWorld().spawnParticle((Particle) this.bukkitEnumParticle, location, count, offsetX, offsetY, offsetZ, extra, new DustOptions(Color.RED, 1F)); - else - location.getWorld().spawnParticle((Particle) this.bukkitEnumParticle, location, count, offsetX, offsetY, offsetZ, extra, data); - } - - else if (this.packetConstructor != null) { - final Object packet = this.preparePacket(location.getX(), location.getY(), location.getZ(), offsetX, offsetY, offsetZ, speed, count, extra, data); - - for (final Player player : Remain.getOnlinePlayers()) - Remain.sendPacket(player, packet); - } - } - - /** - * Spawns a particle only shown to the given player at the given location - * - * @param player - * @param location - */ - public void spawn(Player player, Location location) { - this.spawn(player, location, 0d, 0d, 0d, 0d, 0, 0d, null); - } - - /** - * Spawns a particle only shown to the given player at the given location - * - * @param player - * @param location - * @param extra - */ - public void spawn(Player player, Location location, double extra) { - this.spawn(player, location, 0d, 0d, 0d, 0d, 0, extra, null); - } - - /** - * Spawns the particle only shown to the given player at the given location with extra material data - * - * @param location - * @param data - */ - public final void spawn(Player player, Location location, CompMaterial data) { - Valid.checkBoolean(this == ITEM_CRACK || this == BLOCK_CRACK || this == BLOCK_DUST || this == FALLING_DUST, "Can only call particle spawn with data on crack or dust particles, not: " + this); - - if (atLeast1_12) { - if (atLeast1_13) - player.spawnParticle((Particle) this.bukkitEnumParticle, location, 1, data.getMaterial().createBlockData()); - - else - player.spawnParticle((Particle) this.bukkitEnumParticle, location, 1, data.getMaterial().getNewData(data.getData())); - - } else - this.spawn(player, location, 0, 0, 0, 0, 1, 0, (int) data.getData()); - } - - /** - * Spawns a particle only shown to the given player at the given location with the given params, see Bukkit API for documentation - * - * @param player - * @param location - * @param offsetX - * @param offsetY - * @param offsetZ - * @param speed - * @param count - * @param extra - * @param data - */ - public void spawn(Player player, Location location, double offsetX, double offsetY, double offsetZ, double speed, int count, double extra, int... data) { - - // Minecraft 1.12 and up - if (this.bukkitEnumParticle != null && this != REDSTONE) - player.spawnParticle((Particle) this.bukkitEnumParticle, location, count, offsetX, offsetY, offsetZ, extra, data); - - else if (this.packetConstructor != null) - Remain.sendPacket(player, this.preparePacket(location.getX(), location.getY(), location.getZ(), offsetX, offsetY, offsetZ, speed, count, extra, data)); - } - - /* - * Resolves a compatible particle packet using Foundation fast cached reflection methods - */ - @SneakyThrows - private Object preparePacket(double posX, double posY, double posZ, double offsetX, double offsetY, double offsetZ, double speed, int count, double extra, int... data) { - - if (atLeast1_8) { - - if (this == BLOCK_CRACK) { - int materialId = 0; - int materialData = 0; - - if (data.length > 0) - materialId = data[0]; - - if (data.length > 1) - materialData = data[1]; - - data = new int[] { materialId, materialId | materialData << 12 }; - } - - return ReflectionUtil.instantiate(this.packetConstructor, this.nmsEnumParticle, true, (float) posX, (float) posY, (float) posZ, (float) offsetX, (float) offsetY, (float) offsetZ, (float) speed, count, data); - } - - else { - String correctedName = this.name1_7; - - if (this == BLOCK_CRACK || this == ITEM_CRACK || this == BLOCK_DUST) { - int materialId = 0; - int materialData = 0; - - if (data.length > 0) - materialId = data[0]; - - if (data.length > 1) - materialData = data[1]; - - correctedName = correctedName + materialId + "_" + materialData; - } - - return ReflectionUtil.instantiate(this.packetConstructor, correctedName, (float) posX, (float) posY, (float) posZ, (float) offsetX, (float) offsetY, (float) offsetZ, (float) speed, count); - } - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompProperty.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompProperty.java deleted file mode 100644 index 0849244d65e938431a7128dbaa3531a77bfaf83a..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompProperty.java +++ /dev/null @@ -1,156 +0,0 @@ -package org.mineacademy.fo.remain; - -import java.lang.reflect.Method; - -import org.apache.commons.lang.WordUtils; -import org.bukkit.entity.Entity; -import org.bukkit.inventory.meta.ItemMeta; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.remain.nbt.NBTEntity; - -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -/** - * A convenience class for applying "properies" to certain Bukkit classes - * such as items or entities - * <p> - * This basically calls methods that are not available in all MC versions - * and prevents errors in your plugin. - * <p> - * If they are not available, nothing is applied. - */ -@RequiredArgsConstructor -public enum CompProperty { - - // ItemMeta - /** - * The unbreakable property of ItemMeta - */ - UNBREAKABLE(ItemMeta.class, boolean.class), - - // Entity - /** - * The glowing entity property, currently only support white color - */ - GLOWING(Entity.class, boolean.class), - - /** - * The AI navigator entity property - */ - AI(Entity.class, boolean.class), - - /** - * The gravity entity property - */ - GRAVITY(Entity.class, boolean.class), - - /** - * Silent entity property that controls if the entity emits sounds - */ - SILENT(Entity.class, boolean.class), - - /** - * The god mode entity property - */ - INVULNERABLE(Entity.class, boolean.class); - - /** - * The class that this enum applies for, for example {@link Entity} - */ - @Getter - private final Class<?> requiredClass; - - /** - * The "setter" field type, for example setSilent method accepts boolean - */ - private final Class<?> setterMethodType; - - /** - * Apply the property to the entity. Class must be compatible with {@link #requiredClass} - * <p> - * Example: SILENT.apply(myZombieEntity, true) - * - * @param instance - * @param key - */ - public final void apply(Object instance, Object key) { - Valid.checkNotNull(instance, "instance is null!"); - Valid.checkBoolean(requiredClass.isAssignableFrom(instance.getClass()), this + " accepts " + requiredClass.getSimpleName() + ", not " + instance.getClass().getSimpleName()); - - try { - final Method m = getMethod(instance.getClass()); - m.setAccessible(true); - - m.invoke(instance, key); - - } catch (final ReflectiveOperationException e) { - if (e instanceof NoSuchMethodException && MinecraftVersion.olderThan(V.values()[0])) { - // Pass through - - if (instance instanceof Entity) { - final NBTEntity nbtEntity = new NBTEntity((Entity) instance); - final boolean has = Boolean.parseBoolean(key.toString()); - - if (this == INVULNERABLE) - nbtEntity.setInteger("Invulnerable", has ? 1 : 0); - - else if (this == AI) - nbtEntity.setInteger("NoAI", has ? 0 : 1); - - else if (this == CompProperty.GRAVITY) - nbtEntity.setInteger("NoGravity", has ? 0 : 1); - } - - if (Remain.hasItemMeta() && instance instanceof ItemMeta) { - if (this == UNBREAKABLE) - try { - final boolean has = Boolean.parseBoolean(key.toString()); - - final Method spigotMethod = instance.getClass().getMethod("spigot"); - spigotMethod.setAccessible(true); - - final Object spigot = spigotMethod.invoke(instance); - - final Method setUnbreakable = spigot.getClass().getMethod("setUnbreakable", boolean.class); - setUnbreakable.setAccessible(true); - - setUnbreakable.invoke(spigot, has); - - } catch (final Throwable t) { - if (MinecraftVersion.atLeast(V.v1_8)) - t.printStackTrace(); - } - } - - } else - e.printStackTrace(); - } - } - - /** - * Can this property be used on this server for the given class? Class must be compatible with {@link #requiredClass} - * <p> - * Class is for example {@link Entity} - * - * @param clazz - * @return - */ - public final boolean isAvailable(Class<?> clazz) { - try { - getMethod(clazz); - } catch (final ReflectiveOperationException e) { - if (e instanceof NoSuchMethodException && MinecraftVersion.olderThan(V.values()[0])) - return false; - } - - return true; - } - - // Automatically returns the correct getter or setter method for class - private final Method getMethod(Class<?> clazz) throws ReflectiveOperationException { - return clazz.getMethod("set" + (toString().equals("AI") ? "AI" : WordUtils.capitalize(toString().toLowerCase())), setterMethodType); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompSound.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompSound.java deleted file mode 100644 index e22f03fd5195f1cf4eb77c6f70bac36a90186450..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/CompSound.java +++ /dev/null @@ -1,334 +0,0 @@ -package org.mineacademy.fo.remain; - -import org.apache.commons.lang.ArrayUtils; -import org.bukkit.Location; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; - -/** - * Version independent Spigot sounds. - * <p> - * Enum mapping to sound names for different - * minecraft versions. - * <p> - * Source: https://gist.github.com/NiklasEi/7bd0ffd136f8459df0940e4501d47a8a - * - * @author NiklasEi - */ -public enum CompSound { - AMBIENCE_CAVE("AMBIENCE_CAVE", "AMBIENT_CAVE"), - AMBIENCE_RAIN("AMBIENCE_RAIN", "WEATHER_RAIN"), - AMBIENCE_THUNDER("AMBIENCE_THUNDER", "ENTITY_LIGHTNING_THUNDER", "ENTITY_LIGHTNING_BOLT_THUNDER"), - ANVIL_BREAK("ANVIL_BREAK", "BLOCK_ANVIL_BREAK"), - ANVIL_LAND("ANVIL_LAND", "BLOCK_ANVIL_LAND"), - ANVIL_USE("ANVIL_USE", "BLOCK_ANVIL_USE"), - ARROW_HIT("ARROW_HIT", "ENTITY_ARROW_HIT"), - BURP("BURP", "ENTITY_PLAYER_BURP"), - CHEST_CLOSE("CHEST_CLOSE", "ENTITY_CHEST_CLOSE", "BLOCK_CHEST_CLOSE"), - CHEST_OPEN("CHEST_OPEN", "ENTITY_CHEST_OPEN", "BLOCK_CHEST_OPEN"), - CLICK("CLICK", "UI_BUTTON_CLICK"), - DOOR_CLOSE("DOOR_CLOSE", "BLOCK_WOODEN_DOOR_CLOSE"), - DOOR_OPEN("DOOR_OPEN", "BLOCK_WOODEN_DOOR_OPEN"), - DRINK("DRINK", "ENTITY_GENERIC_DRINK"), - EAT("EAT", "ENTITY_GENERIC_EAT"), - EXPLODE("EXPLODE", "ENTITY_GENERIC_EXPLODE"), - FALL_BIG("FALL_BIG", "ENTITY_GENERIC_BIG_FALL"), - FALL_SMALL("FALL_SMALL", "ENTITY_GENERIC_SMALL_FALL"), - FIRE("FIRE", "BLOCK_FIRE_AMBIENT"), - FIRE_IGNITE("FIRE_IGNITE", "ITEM_FLINTANDSTEEL_USE"), - FIZZ("FIZZ", "BLOCK_FIRE_EXTINGUISH"), - FUSE("FUSE", "ENTITY_TNT_PRIMED"), - GLASS("GLASS", "BLOCK_GLASS_BREAK"), - HURT_FLESH("HURT_FLESH", "ENTITY_PLAYER_HURT"), - ITEM_BREAK("ITEM_BREAK", "ENTITY_ITEM_BREAK"), - ITEM_PICKUP("ITEM_PICKUP", "ENTITY_ITEM_PICKUP"), - LAVA("LAVA", "BLOCK_LAVA_AMBIENT"), - LAVA_POP("LAVA_POP", "BLOCK_LAVA_POP"), - LEVEL_UP("LEVEL_UP", "ENTITY_PLAYER_LEVELUP"), - MINECART_BASE("MINECART_BASE", "ENTITY_MINECART_RIDING"), - MINECART_INSIDE("MINECART_INSIDE", "ENTITY_MINECART_RIDING"), - NOTE_BASS("NOTE_BASS", "BLOCK_NOTE_BASS", "BLOCK_NOTE_BLOCK_BASS"), - NOTE_PIANO("NOTE_PIANO", "BLOCK_NOTE_HARP", "BLOCK_NOTE_BLOCK_HARP"), - NOTE_BASS_DRUM("NOTE_BASS_DRUM", "BLOCK_NOTE_BASEDRUM", "BLOCK_NOTE_BLOCK_BASEDRUM"), - NOTE_STICKS("NOTE_STICKS", "BLOCK_NOTE_HAT", "BLOCK_NOTE_BLOCK_HAT"), - NOTE_BASS_GUITAR("NOTE_BASS_GUITAR", "BLOCK_NOTE_GUITAR", "BLOCK_NOTE_BLOCK_GUITAR", "BLOCK_NOTE_BASS" /* 1.10 doesn't know guitar... */), - NOTE_SNARE_DRUM("NOTE_SNARE_DRUM", "BLOCK_NOTE_SNARE", "BLOCK_NOTE_BLOCK_SNARE"), - NOTE_PLING("NOTE_PLING", "BLOCK_NOTE_PLING", "BLOCK_NOTE_BLOCK_PLING"), - ORB_PICKUP("ORB_PICKUP", "ENTITY_EXPERIENCE_ORB_PICKUP"), - PISTON_EXTEND("PISTON_EXTEND", "BLOCK_PISTON_EXTEND"), - PISTON_RETRACT("PISTON_RETRACT", "BLOCK_PISTON_CONTRACT"), - PORTAL("PORTAL", "BLOCK_PORTAL_AMBIENT"), - PORTAL_TRAVEL("PORTAL_TRAVEL", "BLOCK_PORTAL_TRAVEL"), - PORTAL_TRIGGER("PORTAL_TRIGGER", "BLOCK_PORTAL_TRIGGER"), - SHOOT_ARROW("SHOOT_ARROW", "ENTITY_ARROW_SHOOT"), - SPLASH("SPLASH", "ENTITY_GENERIC_SPLASH"), - SPLASH2("SPLASH2", "ENTITY_BOBBER_SPLASH", "ENTITY_FISHING_BOBBER_SPLASH"), - STEP_GRASS("STEP_GRASS", "BLOCK_GRASS_STEP"), - STEP_GRAVEL("STEP_GRAVEL", "BLOCK_GRAVEL_STEP"), - STEP_LADDER("STEP_LADDER", "BLOCK_LADDER_STEP"), - STEP_SAND("STEP_SAND", "BLOCK_SAND_STEP"), - STEP_SNOW("STEP_SNOW", "BLOCK_SNOW_STEP"), - STEP_STONE("STEP_STONE", "BLOCK_STONE_STEP"), - STEP_WOOD("STEP_WOOD", "BLOCK_WOOD_STEP"), - STEP_WOOL("STEP_WOOL", "BLOCK_CLOTH_STEP", "BLOCK_WOOL_STEP"), - SWIM("SWIM", "ENTITY_GENERIC_SWIM"), - WATER("WATER", "BLOCK_WATER_AMBIENT"), - WOOD_CLICK("WOOD_CLICK", "BLOCK_WOOD_BUTTON_CLICK_ON", "BLOCK_WOODEN_BUTTON_CLICK_ON"), - BAT_DEATH("BAT_DEATH", "ENTITY_BAT_DEATH"), - BAT_HURT("BAT_HURT", "ENTITY_BAT_HURT"), - BAT_IDLE("BAT_IDLE", "ENTITY_BAT_AMBIENT"), - BAT_LOOP("BAT_LOOP", "ENTITY_BAT_LOOP"), - BAT_TAKEOFF("BAT_TAKEOFF", "ENTITY_BAT_TAKEOFF"), - BLAZE_BREATH("BLAZE_BREATH", "ENTITY_BLAZE_AMBIENT"), - BLAZE_DEATH("BLAZE_DEATH", "ENTITY_BLAZE_DEATH"), - BLAZE_HIT("BLAZE_HIT", "ENTITY_BLAZE_HURT"), - CAT_HISS("CAT_HISS", "ENTITY_CAT_HISS"), - CAT_HIT("CAT_HIT", "ENTITY_CAT_HURT"), - CAT_MEOW("CAT_MEOW", "ENTITY_CAT_AMBIENT"), - CAT_PURR("CAT_PURR", "ENTITY_CAT_PURR"), - CAT_PURREOW("CAT_PURREOW", "ENTITY_CAT_PURREOW"), - CHICKEN_IDLE("CHICKEN_IDLE", "ENTITY_CHICKEN_AMBIENT"), - CHICKEN_HURT("CHICKEN_HURT", "ENTITY_CHICKEN_HURT"), - CHICKEN_EGG_POP("CHICKEN_EGG_POP", "ENTITY_CHICKEN_EGG"), - CHICKEN_WALK("CHICKEN_WALK", "ENTITY_CHICKEN_STEP"), - COW_IDLE("COW_IDLE", "ENTITY_COW_AMBIENT"), - COW_HURT("COW_HURT", "ENTITY_COW_HURT"), - COW_WALK("COW_WALK", "ENTITY_COW_STEP"), - CREEPER_HISS("CREEPER_HISS", "ENTITY_CREEPER_PRIMED"), - CREEPER_DEATH("CREEPER_DEATH", "ENTITY_CREEPER_DEATH"), - ENDERDRAGON_DEATH("ENDERDRAGON_DEATH", "ENTITY_ENDERDRAGON_DEATH", "ENTITY_ENDER_DRAGON_DEATH"), - ENDERDRAGON_GROWL("ENDERDRAGON_GROWL", "ENTITY_ENDERDRAGON_GROWL", "ENTITY_ENDER_DRAGON_GROWL"), - ENDERDRAGON_HIT("ENDERDRAGON_HIT", "ENTITY_ENDERDRAGON_HURT", "ENTITY_ENDER_DRAGON_HURT"), - ENDERDRAGON_WINGS("ENDERDRAGON_WINGS", "ENTITY_ENDERDRAGON_FLAP", "ENTITY_ENDER_DRAGON_FLAP"), - ENDERMAN_DEATH("ENDERMAN_DEATH", "ENTITY_ENDERMEN_DEATH", "ENTITY_ENDERMAN_DEATH"), - ENDERMAN_HIT("ENDERMAN_HIT", "ENTITY_ENDERMEN_HURT", "ENTITY_ENDERMAN_HURT"), - ENDERMAN_IDLE("ENDERMAN_IDLE", "ENTITY_ENDERMEN_AMBIENT", "ENTITY_ENDERMAN_AMBIENT"), - ENDERMAN_TELEPORT("ENDERMAN_TELEPORT", "ENTITY_ENDERMEN_TELEPORT", "ENTITY_ENDERMAN_TELEPORT"), - ENDERMAN_SCREAM("ENDERMAN_SCREAM", "ENTITY_ENDERMEN_SCREAM", "ENTITY_ENDERMAN_SCREAM"), - ENDERMAN_STARE("ENDERMAN_STARE", "ENTITY_ENDERMEN_STARE", "ENTITY_ENDERMAN_STARE"), - GHAST_SCREAM("GHAST_SCREAM", "ENTITY_GHAST_SCREAM"), - GHAST_SCREAM2("GHAST_SCREAM2", "ENTITY_GHAST_HURT"), - GHAST_CHARGE("GHAST_CHARGE", "ENTITY_GHAST_WARN"), - GHAST_DEATH("GHAST_DEATH", "ENTITY_GHAST_DEATH"), - GHAST_FIREBALL("GHAST_FIREBALL", "ENTITY_GHAST_SHOOT"), - GHAST_MOAN("GHAST_MOAN", "ENTITY_GHAST_AMBIENT"), - IRONGOLEM_ATTACK("IRONGOLEM_THROW", "ENTITY_IRONGOLEM_ATTACK", "ENTITY_IRON_GOLEM_ATTACK"), - IRONGOLEM_DEATH("IRONGOLEM_DEATH", "ENTITY_IRONGOLEM_DEATH", "ENTITY_IRON_GOLEM_DEATH"), - IRONGOLEM_HIT("IRONGOLEM_HIT", "ENTITY_IRONGOLEM_HURT", "ENTITY_IRON_GOLEM_HURT"), - IRONGOLEM_WALK("IRONGOLEM_WALK", "ENTITY_IRONGOLEM_STEP", "ENTITY_IRON_GOLEM_STEP"), - MAGMACUBE_WALK("MAGMACUBE_WALK", "ENTITY_MAGMACUBE_SQUISH", "ENTITY_MAGMA_CUBE_SQUISH"), - MAGMACUBE_WALK2("MAGMACUBE_WALK2", "ENTITY_MAGMACUBE_SQUISH", "ENTITY_MAGMA_CUBE_SQUISH_SMALL"), - MAGMACUBE_JUMP("MAGMACUBE_JUMP", "ENTITY_MAGMACUBE_JUMP", "ENTITY_MAGMA_CUBE_JUMP"), - PIG_IDLE("PIG_IDLE", "ENTITY_PIG_AMBIENT"), - PIG_DEATH("PIG_DEATH", "ENTITY_PIG_DEATH"), - PIG_WALK("PIG_WALK", "ENTITY_PIG_STEP"), - SHEEP_IDLE("SHEEP_IDLE", "ENTITY_SHEEP_AMBIENT"), - SHEEP_SHEAR("SHEEP_SHEAR", "ENTITY_SHEEP_SHEAR"), - SHEEP_WALK("SHEEP_WALK", "ENTITY_SHEEP_STEP"), - SILVERFISH_HIT("SILVERFISH_HIT", "ENTITY_SILVERFISH_HURT"), - SILVERFISH_KILL("SILVERFISH_KILL", "ENTITY_SILVERFISH_DEATH"), - SILVERFISH_IDLE("SILVERFISH_IDLE", "ENTITY_SILVERFISH_AMBIENT"), - SILVERFISH_WALK("SILVERFISH_WALK", "ENTITY_SILVERFISH_STEP"), - SKELETON_IDLE("SKELETON_IDLE", "ENTITY_SKELETON_AMBIENT"), - SKELETON_DEATH("SKELETON_DEATH", "ENTITY_SKELETON_DEATH"), - SKELETON_HURT("SKELETON_HURT", "ENTITY_SKELETON_HURT"), - SKELETON_WALK("SKELETON_WALK", "ENTITY_SKELETON_STEP"), - SLIME_ATTACK("SLIME_ATTACK", "ENTITY_SLIME_ATTACK"), - SLIME_WALK("SLIME_WALK", "ENTITY_SLIME_JUMP"), - SLIME_WALK2("SLIME_WALK2", "ENTITY_SLIME_SQUISH"), - SPIDER_IDLE("SPIDER_IDLE", "ENTITY_SPIDER_AMBIENT"), - SPIDER_DEATH("SPIDER_DEATH", "ENTITY_SPIDER_DEATH"), - SPIDER_WALK("SPIDER_WALK", "ENTITY_SPIDER_STEP"), - WITHER_DEATH("WITHER_DEATH", "ENTITY_WITHER_DEATH"), - WITHER_HURT("WITHER_HURT", "ENTITY_WITHER_HURT"), - WITHER_IDLE("WITHER_IDLE", "ENTITY_WITHER_AMBIENT"), - WITHER_SHOOT("WITHER_SHOOT", "ENTITY_WITHER_SHOOT"), - WITHER_SPAWN("WITHER_SPAWN", "ENTITY_WITHER_SPAWN"), - WOLF_BARK("WOLF_BARK", "ENTITY_WOLF_AMBIENT"), - WOLF_DEATH("WOLF_DEATH", "ENTITY_WOLF_DEATH"), - WOLF_GROWL("WOLF_GROWL", "ENTITY_WOLF_GROWL"), - WOLF_HOWL("WOLF_HOWL", "ENTITY_WOLF_HOWL"), - WOLF_HURT("WOLF_HURT", "ENTITY_WOLF_HURT"), - WOLF_PANT("WOLF_PANT", "ENTITY_WOLF_PANT"), - WOLF_SHAKE("WOLF_SHAKE", "ENTITY_WOLF_SHAKE"), - WOLF_WALK("WOLF_WALK", "ENTITY_WOLF_STEP"), - WOLF_WHINE("WOLF_WHINE", "ENTITY_WOLF_WHINE"), - ZOMBIE_METAL("ZOMBIE_METAL", "ENTITY_ZOMBIE_ATTACK_IRON_DOOR"), - ZOMBIE_WOOD("ZOMBIE_WOOD", "ENTITY_ZOMBIE_ATTACK_DOOR_WOOD", "ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR"), - ZOMBIE_WOODBREAK("ZOMBIE_WOODBREAK", "ENTITY_ZOMBIE_BREAK_DOOR_WOOD", "ENTITY_ZOMBIE_BREAK_WOODEN_DOOR"), - ZOMBIE_IDLE("ZOMBIE_IDLE", "ENTITY_ZOMBIE_AMBIENT"), - ZOMBIE_DEATH("ZOMBIE_DEATH", "ENTITY_ZOMBIE_DEATH"), - ZOMBIE_HURT("ZOMBIE_HURT", "ENTITY_ZOMBIE_HURT"), - ZOMBIE_INFECT("ZOMBIE_INFECT", "ENTITY_ZOMBIE_INFECT"), - ZOMBIE_UNFECT("ZOMBIE_UNFECT", "ENTITY_ZOMBIE_VILLAGER_CONVERTED"), - ZOMBIE_REMEDY("ZOMBIE_REMEDY", "ENTITY_ZOMBIE_VILLAGER_CURE"), - ZOMBIE_WALK("ZOMBIE_WALK", "ENTITY_ZOMBIE_STEP"), - ZOMBIE_PIG_IDLE("ZOMBIE_PIG_IDLE", "ENTITY_ZOMBIE_PIG_AMBIENT", "ENTITY_ZOMBIE_PIGMAN_AMBIENT"), - ZOMBIE_PIG_ANGRY("ZOMBIE_PIG_ANGRY", "ENTITY_ZOMBIE_PIG_ANGRY", "ENTITY_ZOMBIE_PIGMAN_ANGRY"), - ZOMBIE_PIG_DEATH("ZOMBIE_PIG_DEATH", "ENTITY_ZOMBIE_PIG_DEATH", "ENTITY_ZOMBIE_PIGMAN_DEATH"), - ZOMBIE_PIG_HURT("ZOMBIE_PIG_HURT", "ENTITY_ZOMBIE_PIG_HURT", "ENTITY_ZOMBIE_PIGMAN_HURT"), - DIG_WOOL("DIG_WOOL", "BLOCK_CLOTH_BREAK", "BLOCK_WOOL_BREAK"), - DIG_GRASS("DIG_GRASS", "BLOCK_GRASS_BREAK"), - DIG_GRAVEL("DIG_GRAVEL", "BLOCK_GRAVEL_BREAK"), - DIG_SAND("DIG_SAND", "BLOCK_SAND_BREAK"), - DIG_SNOW("DIG_SNOW", "BLOCK_SNOW_BREAK"), - DIG_STONE("DIG_STONE", "BLOCK_STONE_BREAK"), - DIG_WOOD("DIG_WOOD", "BLOCK_WOOD_BREAK"), - FIREWORK_BLAST("FIREWORK_BLAST", "ENTITY_FIREWORK_BLAST", "ENTITY_FIREWORK_ROCKET_BLAST"), - FIREWORK_BLAST2("FIREWORK_BLAST2", "ENTITY_FIREWORK_BLAST_FAR", "ENTITY_FIREWORK_ROCKET_BLAST_FAR"), - FIREWORK_LARGE_BLAST("FIREWORK_LARGE_BLAST", "ENTITY_FIREWORK_LARGE_BLAST", "ENTITY_FIREWORK_ROCKET_LARGE_BLAST"), - FIREWORK_LARGE_BLAST2("FIREWORK_LARGE_BLAST2", "ENTITY_FIREWORK_LARGE_BLAST_FAR", "ENTITY_FIREWORK_ROCKET_LARGE_BLAST_FAR"), - FIREWORK_LAUNCH("FIREWORK_LAUNCH", "ENTITY_FIREWORK_LAUNCH", "ENTITY_FIREWORK_ROCKET_LAUNCH"), - FIREWORK_TWINKLE("FIREWORK_TWINKLE", "ENTITY_FIREWORK_TWINKLE", "ENTITY_FIREWORK_ROCKET_TWINKLE"), - FIREWORK_TWINKLE2("FIREWORK_TWINKLE2", "ENTITY_FIREWORK_TWINKLE_FAR", "ENTITY_FIREWORK_ROCKET_TWINKLE_FAR"), - SUCCESSFUL_HIT("SUCCESSFUL_HIT", "ENTITY_ARROW_HIT_PLAYER"), - HORSE_ANGRY("HORSE_ANGRY", "ENTITY_HORSE_ANGRY"), - HORSE_ARMOR("HORSE_ARMOR", "ENTITY_HORSE_ARMOR"), - HORSE_BREATHE("HORSE_BREATHE", "ENTITY_HORSE_BREATHE"), - HORSE_DEATH("HORSE_DEATH", "ENTITY_HORSE_DEATH"), - HORSE_GALLOP("HORSE_GALLOP", "ENTITY_HORSE_GALLOP"), - HORSE_HIT("HORSE_HIT", "ENTITY_HORSE_HURT"), - HORSE_IDLE("HORSE_IDLE", "ENTITY_HORSE_AMBIENT"), - HORSE_JUMP("HORSE_JUMP", "ENTITY_HORSE_JUMP"), - HORSE_LAND("HORSE_LAND", "ENTITY_HORSE_LAND"), - HORSE_SADDLE("HORSE_SADDLE", "ENTITY_HORSE_SADDLE"), - HORSE_SOFT("HORSE_SOFT", "ENTITY_HORSE_STEP"), - HORSE_WOOD("HORSE_WOOD", "ENTITY_HORSE_STEP_WOOD"), - DONKEY_ANGRY("DONKEY_ANGRY", "ENTITY_DONKEY_ANGRY"), - DONKEY_DEATH("DONKEY_DEATH", "ENTITY_DONKEY_DEATH"), - DONKEY_HIT("DONKEY_HIT", "ENTITY_DONKEY_HURT"), - DONKEY_IDLE("DONKEY_IDLE", "ENTITY_DONKEY_AMBIENT"), - HORSE_SKELETON_DEATH("HORSE_SKELETON_DEATH", "ENTITY_SKELETON_HORSE_DEATH"), - HORSE_SKELETON_HIT("HORSE_SKELETON_HIT", "ENTITY_SKELETON_HORSE_HURT"), - HORSE_SKELETON_IDLE("HORSE_SKELETON_IDLE", "ENTITY_SKELETON_HORSE_AMBIENT"), - HORSE_ZOMBIE_DEATH("HORSE_ZOMBIE_DEATH", "ENTITY_ZOMBIE_HORSE_DEATH"), - HORSE_ZOMBIE_HIT("HORSE_ZOMBIE_HIT", "ENTITY_ZOMBIE_HORSE_HURT"), - HORSE_ZOMBIE_IDLE("HORSE_ZOMBIE_IDLE", "ENTITY_ZOMBIE_HORSE_AMBIENT"), - VILLAGER_DEATH("VILLAGER_DEATH", "ENTITY_VILLAGER_DEATH"), - VILLAGER_TRADE("VILLAGER_HAGGLE", "ENTITY_VILLAGER_TRADING", "ENTITY_VILLAGER_TRADE"), - VILLAGER_HIT("VILLAGER_HIT", "ENTITY_VILLAGER_HURT"), - VILLAGER_IDLE("VILLAGER_IDLE", "ENTITY_VILLAGER_AMBIENT"), - VILLAGER_NO("VILLAGER_NO", "ENTITY_VILLAGER_NO"), - VILLAGER_YES("VILLAGER_YES", "ENTITY_VILLAGER_YES"), - - // New sounds - BLOCK_DISPENSER_LAUNCH("LEVEL_UP", "DISPENSER_LAUNCH", "BLOCK_DISPENSER_LAUNCH"), - ENTITY_ITEMFRAME_BREAK("STEP_WOOL", "BLOCK_CLOTH_STEP", "BLOCK_WOOL_STEP", "ENTITY_ITEMFRAME_BREAK"); - - private String[] versionDependentNames; - private org.bukkit.Sound cached = null; - - CompSound(String... versionDependentNames) { - this.versionDependentNames = versionDependentNames; - - // Assume most servers use the latest version so reverse for performance - ArrayUtils.reverse(this.versionDependentNames); - } - - /** - * Plays a sound for the given player with 1F volume and 1F pitch - * - * @param player - */ - public final void play(Player player) { - play(player, 1F, 1F); - } - - /** - * Plays a sound for the given player - * - * @param player - * @param sound - * @param volume - * @param pitch - */ - public final void play(Player player, float volume, float pitch) { - try { - player.playSound(player.getLocation(), getSound(), volume, pitch); - } catch (final Throwable t) { - // Fail-through - } - } - - /** - * Plays a sound at the given location with 1F volume and 1F pitch - * - * @param loc - */ - public final void play(Location loc) { - play(loc, 1F, 1F); - } - - /** - * Plays a sound on a specific location - * - * @param loc - * @param sound - * @param volume - * @param pitch - */ - public final void play(Location loc, float volume, float pitch) { - try { - loc.getWorld().playSound(loc, getSound(), volume, pitch); - } catch (final Throwable t) { - // Fail-through - } - } - - /** - * Get the bukkit sound for current server version - * <p> - * Caches sound on first call - * - * @return corresponding {@link org.bukkit.Sound} - */ - public final Sound getSound() { - if (cached != null) - return cached; - - for (final String name : versionDependentNames) - try { - return cached = org.bukkit.Sound.valueOf(name); - } catch (final IllegalArgumentException ex) { - // try next - } - - return getFallback(); - } - - /** - * Returns the level up sound for compatibility - * - * @return the level up sound - */ - public static final Sound getFallback() { - return Sound.valueOf(MinecraftVersion.atLeast(V.v1_9) ? "ENTITY_PLAYER_LEVELUP" : "LEVEL_UP"); - } - - /** - * Converts the string to a valid bukkit Sound - * - * @param soundName - * @return - */ - public static final Sound convert(String soundName) { - CompSound sound = null; - - // Test if we can convert it directly - if (MinecraftVersion.atLeast(V.v1_9)) - try { - return Sound.valueOf(soundName.toUpperCase()); - } catch (final IllegalArgumentException ex) { - } - - // If not, try to find the corresponding new sound - for (final CompSound compSound : values()) - for (final String name : compSound.versionDependentNames) - if (name.equalsIgnoreCase(soundName)) - sound = compSound; - - return sound != null ? sound.getSound() : getFallback(); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/NmsEntity.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/NmsEntity.java deleted file mode 100644 index 363da113d48349b6a50059a28cdfd108e2cae1af..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/NmsEntity.java +++ /dev/null @@ -1,225 +0,0 @@ -package org.mineacademy.fo.remain; - -import java.lang.reflect.Method; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.event.entity.CreatureSpawnEvent; -import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.ReflectionUtil.ReflectionException; -import org.mineacademy.fo.exception.FoException; - -import lombok.Getter; - -/** - * Advanced spawning of entities, enables manipulation of - * an entity before it's added to the world. - */ -public final class NmsEntity { - - /** - * The world to add the entity to - */ - private final World bukkitWorld; - - /** - * The NMS entity class - */ - @Getter - private final Object nmsEntity; - - /** - * Create an entity at X:0 Y:0 Z:0 in the first existing world - * You can use {@link EntityType#getEntityClass()} to get the class - * - * @param entityClass - */ - public NmsEntity(final Class<?> entityClass) { - this(new Location(Bukkit.getWorlds().get(0), 0, 0, 0), entityClass); - } - - /** - * Create an entity at the given location - * You can use {@link EntityType#getEntityClass()} to get the class - * - * @param location - * @param entityClass - */ - public NmsEntity(final Location location, final Class<?> entityClass) { - try { - NmsAccessor.call(); - } catch (final Throwable t) { - throw new FoException(t, "Failed to setup entity reflection! MC version: " + MinecraftVersion.getCurrent()); - } - - this.bukkitWorld = location.getWorld(); - this.nmsEntity = MinecraftVersion.equals(V.v1_7) ? getHandle(location, entityClass) : createEntity(location, entityClass); - } - - // - // Return the entity handle, used for MC 1.7.10 to add entity - // - private static Object getHandle(final Location location, final Class<?> entityClass) { - final Entity entity = new Location(location.getWorld(), -1, 0, -1).getWorld().spawn(location, (Class<? extends Entity>) entityClass); - - try { - return entity.getClass().getMethod("getHandle").invoke(entity); - } catch (final ReflectiveOperationException ex) { - throw new Error(ex); - } - } - - // - // Creates the entity and registers in the NMS server - // - private Object createEntity(final Location location, final Class<?> entityClass) { - try { - return NmsAccessor.createEntity.invoke(bukkitWorld, location, entityClass); - - } catch (final ReflectiveOperationException e) { - throw new FoException(e, "Error creating entity " + entityClass + " at " + location); - } - } - - /** - * Adds the entity to the world for the given spawn reason, calls Bukkit {@link CreatureSpawnEvent} - * - * @param <T> - * @param reason - * @return - */ - public <T extends Entity> T addEntity(final SpawnReason reason) { - try { - - return (T) NmsAccessor.addEntity(bukkitWorld, nmsEntity, reason); - - } catch (final ReflectiveOperationException e) { - throw new FoException(e, "Error creating entity " + nmsEntity + " for " + reason); - } - } - - /** - * Get the Bukkit entity - * - * @return - */ - public Entity getBukkitEntity() { - try { - return (Entity) NmsAccessor.getBukkitEntity.invoke(nmsEntity); - - } catch (final ReflectiveOperationException e) { - throw new FoException(e, "Error getting bukkit entity from " + nmsEntity); - } - } -} - -/** - * A helper class accessing NMS internals - */ -final class NmsAccessor { - - /** - * The create entity method - */ - static final Method createEntity; - - /** - * The get bukkit entity method - */ - static final Method getBukkitEntity; - - /** - * The add entity method - */ - static Method addEntity; - - /** - * Does the {@link #addEntity} field have consumer function input? - */ - private static volatile boolean hasEntityConsumer = false; - - /** - * Does the {@link #addEntity} field have randomize data boolean? 1.17+ - */ - private static volatile boolean hasRandomizeData = false; - - /** - * Is the current Minecraft version older than 1.8.8 ? - */ - private static volatile boolean olderThan18; - - /** - * Static block initializer - */ - static void call() { - } - - /** - * Load this class - */ - static { - try { - final Class<?> nmsEntity = ReflectionUtil.getNMSClass("Entity", "net.minecraft.world.entity.Entity"); - final Class<?> ofcWorld = ReflectionUtil.getOBCClass("CraftWorld"); - - olderThan18 = MinecraftVersion.olderThan(V.v1_8); - - createEntity = MinecraftVersion.newerThan(V.v1_7) ? ReflectionUtil.getDeclaredMethod(ofcWorld, "createEntity", Location.class, Class.class) : null; - getBukkitEntity = nmsEntity.getMethod("getBukkitEntity"); - - if (MinecraftVersion.newerThan(V.v1_10)) { - hasEntityConsumer = true; - - try { - addEntity = ReflectionUtil.getDeclaredMethod(ofcWorld, "addEntity", nmsEntity, SpawnReason.class, Class.forName("org.bukkit.util.Consumer")); - - } catch (final ReflectionException ex) { - addEntity = ReflectionUtil.getDeclaredMethod(ofcWorld, "addEntity", nmsEntity, SpawnReason.class, Class.forName("org.bukkit.util.Consumer"), boolean.class); - hasRandomizeData = true; - } - - } else if (MinecraftVersion.newerThan(V.v1_7)) - addEntity = ReflectionUtil.getDeclaredMethod(ofcWorld, "addEntity", nmsEntity, SpawnReason.class); - else - addEntity = ReflectionUtil.getNMSClass("World", "net.minecraft.world.level.World").getDeclaredMethod("addEntity", nmsEntity, SpawnReason.class); - - } catch (final ReflectiveOperationException ex) { - ex.printStackTrace(); - - Runtime.getRuntime().halt(-0__666_1); - - throw new FoException(ex, "Error setting up nms entity accessor!"); - } - } - - /** - * Adds an entity to the given world - * - * @param bukkitWorld - * @param nmsEntity - * @param reason - * @return - * @throws ReflectiveOperationException - */ - static Object addEntity(final World bukkitWorld, final Object nmsEntity, final SpawnReason reason) throws ReflectiveOperationException { - if (olderThan18) { - addEntity.invoke(Remain.getHandleWorld(bukkitWorld), nmsEntity, reason); - - return getBukkitEntity.invoke(nmsEntity); - } - - if (hasEntityConsumer) - if (hasRandomizeData) - return addEntity.invoke(bukkitWorld, nmsEntity, reason, null, false); - else - return addEntity.invoke(bukkitWorld, nmsEntity, reason, null); - - return addEntity.invoke(bukkitWorld, nmsEntity, reason); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/Remain.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/Remain.java deleted file mode 100644 index e721b33dfa30eca5700ba7a697427296028e5d8e..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/Remain.java +++ /dev/null @@ -1,2826 +0,0 @@ -package org.mineacademy.fo.remain; - -import static org.mineacademy.fo.ReflectionUtil.getNMSClass; -import static org.mineacademy.fo.ReflectionUtil.getOBCClass; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import java.util.UUID; -import java.util.function.Consumer; -import java.util.function.Function; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.GameRule; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.NamespacedKey; -import org.bukkit.OfflinePlayer; -import org.bukkit.Statistic; -import org.bukkit.Statistic.Type; -import org.bukkit.World; -import org.bukkit.advancement.Advancement; -import org.bukkit.advancement.AdvancementProgress; -import org.bukkit.block.Block; -import org.bukkit.block.BlockState; -import org.bukkit.block.Chest; -import org.bukkit.command.Command; -import org.bukkit.command.CommandMap; -import org.bukkit.command.CommandSender; -import org.bukkit.command.PluginCommand; -import org.bukkit.command.SimpleCommandMap; -import org.bukkit.configuration.InvalidConfigurationException; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.FallingBlock; -import org.bukkit.entity.Item; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.InventoryView; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.BookMeta; -import org.bukkit.inventory.meta.SpawnEggMeta; -import org.bukkit.plugin.Plugin; -import org.bukkit.potion.PotionEffect; -import org.bukkit.potion.PotionEffectType; -import org.bukkit.potion.PotionType; -import org.bukkit.scoreboard.Objective; -import org.bukkit.scoreboard.Score; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.EntityUtil; -import org.mineacademy.fo.FileUtil; -import org.mineacademy.fo.ItemUtil; -import org.mineacademy.fo.MathUtil; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.PlayerUtil; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.ReflectionUtil.ReflectionException; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.UUIDToNameConverter; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.internal.BossBarInternals; -import org.mineacademy.fo.remain.internal.ChatInternals; -import org.mineacademy.fo.remain.nbt.NBTInternals; -import org.mineacademy.fo.settings.SimpleYaml; - -import com.google.gson.Gson; -import com.google.gson.JsonObject; - -import net.md_5.bungee.api.ChatMessageType; -import net.md_5.bungee.api.chat.BaseComponent; -import net.md_5.bungee.api.chat.TextComponent; -import net.md_5.bungee.chat.ComponentSerializer; - -/** - * Our main cross-version compatibility class. - * <p> - * Look up for many methods enabling you to make your plugin - * compatible with MC 1.8.8 up to the latest version. - */ -public final class Remain { - - /** - * Pattern used to match encoded HEX colors &x&F&F&F&F&F&F - */ - private static final Pattern RGB_HEX_ENCODED_REGEX = Pattern.compile("(?i)(§x)((§[0-9A-F]){6})"); - - /** - * The Google Json instance - */ - private final static Gson gson = new Gson(); - - // ---------------------------------------------------------------------------------------------------- - // Methods below - // ---------------------------------------------------------------------------------------------------- - - /** - * The get players method stored here for performance - */ - private static final Method getPlayersMethod; - - /** - * The get player health method stored here for performance - */ - private static final Method getHealthMethod; - - /** - * The CraftPlayer.getHandle method - */ - private static Method getHandle; - - /** - * The EntityPlayer.playerConnection method - */ - private static Field fieldPlayerConnection; - - /** - * The PlayerConnection.sendPacket method - */ - private static Method sendPacket; - - // ---------------------------------------------------------------------------------------------------- - // Flags below - // ---------------------------------------------------------------------------------------------------- - - /** - * Does the current server version get player list as a collection? - */ - private static boolean isGetPlayersCollection = false; - - /** - * Does the current server version get player health as a double? - */ - private static boolean isGetHealthDouble = false; - - /** - * Does the current server version support title API that sends fadeIn, stay and fadeOut arguments? - */ - private static boolean hasExtendedPlayerTitleAPI = false; - - /** - * Does the current server version support particle API? - */ - private static boolean hasParticleAPI = true; - - /** - * Does the current server version support native scoreboard API? - */ - private static boolean newScoreboardAPI = true; - - /** - * Does the current server version support book event? - */ - private static boolean hasBookEvent = true; - - /** - * Does the current server version support getting inventorsy location? - */ - private static boolean hasInventoryLocation = true; - - /** - * Does the current server version support permanent scoreboard tags?M - */ - private static boolean hasScoreboardTags = true; - - /** - * Does the current server version support spawn egg meta? - */ - private static boolean hasSpawnEggMeta = true; - - /** - * Does the current server version support advancements? - */ - private static boolean hasAdvancements = true; - - /** - * Can you call {@link YamlConfiguration#load(java.io.Reader)} - */ - private static boolean hasYamlReaderLoad = true; - - /** - * Does the current server has the "net.md_5.bungee" library present? - */ - private static boolean bungeeApiPresent = true; - - /** - * Is org/bukkit/inventory/meta/ItemMeta class present? MC 1.4.7+ - */ - private static boolean hasItemMeta = true; - - /** - * Stores player cooldowns for old MC versions - */ - private final static StrictMap<UUID /*Player*/, StrictMap<Material, Integer>> cooldowns = new StrictMap<>(); - - /** - * The server-name from server.properties (is lacking on new Minecraft version so we have to readd it back) - */ - private static String serverName; - - // Singleton - private Remain() { - } - - /** - * Initialize all fields and methods automatically when we set the plugin - */ - static { - Valid.checkBoolean(MinecraftVersion.getCurrent().isTested(), "Your Minecraft version " + MinecraftVersion.getCurrent() + " is unsupported by " + SimplePlugin.getNamed()); - - // Check compatibility - try { - ChatInternals.callStatic(); - - if (MinecraftVersion.newerThan(V.v1_7)) - NBTInternals.checkCompatible(); - - CompParticle.CRIT.getClass(); - - for (final Material bukkitMaterial : Material.values()) - CompMaterial.fromString(bukkitMaterial.toString()); - - for (final CompMaterial compMaterial : CompMaterial.values()) - compMaterial.getMaterial(); - - getNMSClass("Entity", "net.minecraft.world.entity.Entity"); - - } catch (final Throwable t) { - Bukkit.getLogger().severe("** COMPATIBILITY TEST FAILED - THIS PLUGIN WILL NOT FUNCTION PROPERLY **"); - Bukkit.getLogger().severe("** YOUR MINECRAFT VERSION APPEARS UNSUPPORTED: " + MinecraftVersion.getCurrent() + " **"); - - t.printStackTrace(); - - Bukkit.getLogger().severe("***************************************************************"); - } - - try { - - final boolean hasNMS = MinecraftVersion.atLeast(V.v1_4); - - // Load optional parts - try { - - getHandle = getOBCClass("entity.CraftPlayer").getMethod("getHandle"); - - fieldPlayerConnection = getNMSClass("EntityPlayer", "net.minecraft.server.level.EntityPlayer") - .getField(MinecraftVersion.atLeast(V.v1_17) ? "b" : hasNMS ? "playerConnection" : "netServerHandler"); - - sendPacket = getNMSClass(hasNMS ? "PlayerConnection" : "NetServerHandler", "net.minecraft.server.network.PlayerConnection") - .getMethod("sendPacket", getNMSClass("Packet", "net.minecraft.network.protocol.Packet")); - - } catch (final Throwable t) { - Bukkit.getLogger().warning("Unable to find setup some parts of reflection. Plugin will still function."); - Bukkit.getLogger().warning("Error: " + t.getClass().getSimpleName() + ": " + t.getMessage()); - Bukkit.getLogger().warning("Ignore this if using Cauldron. Otherwise check if your server is compatibble."); - - fieldPlayerConnection = null; - sendPacket = null; - getHandle = null; - } - - // Load mandatory parts - getPlayersMethod = Bukkit.class.getMethod("getOnlinePlayers"); - isGetPlayersCollection = getPlayersMethod.getReturnType() == Collection.class; - - getHealthMethod = LivingEntity.class.getMethod("getHealth"); - isGetHealthDouble = getHealthMethod.getReturnType() == double.class; - - hasExtendedPlayerTitleAPI = MinecraftVersion.atLeast(V.v1_11); - - try { - World.class.getMethod("spawnParticle", org.bukkit.Particle.class, Location.class, int.class); - } catch (final NoClassDefFoundError | ReflectiveOperationException ex) { - hasParticleAPI = false; - } - - try { - Class.forName("net.md_5.bungee.chat.ComponentSerializer"); - } catch (final ClassNotFoundException ex) { - bungeeApiPresent = false; - - throw new FoException( - "&cYour server version (&f" + Bukkit.getBukkitVersion().replace("-SNAPSHOT", "") + "&c) doesn't\n" + - " &cinclude &elibraries required&c for this plugin to\n" + - " &crun. Install the following plugin for compatibility:\n" + - " &fhttps://mineacademy.org/plugins/#misc"); - } - - try { - Objective.class.getMethod("getScore", String.class); - } catch (final NoClassDefFoundError | NoSuchMethodException e) { - newScoreboardAPI = false; - } - - try { - Class.forName("org.bukkit.event.player.PlayerEditBookEvent").getName(); - } catch (final ClassNotFoundException ex) { - hasBookEvent = false; - } - - try { - Inventory.class.getMethod("getLocation"); - } catch (final ReflectiveOperationException ex) { - hasInventoryLocation = false; - } - - try { - Entity.class.getMethod("getScoreboardTags"); - } catch (final ReflectiveOperationException ex) { - hasScoreboardTags = false; - } - - try { - Class.forName("org.bukkit.inventory.meta.SpawnEggMeta"); - } catch (final ClassNotFoundException err) { - hasSpawnEggMeta = false; - } - - try { - Class.forName("org.bukkit.advancement.Advancement"); - Class.forName("org.bukkit.NamespacedKey"); - - } catch (final ClassNotFoundException err) { - hasAdvancements = false; - } - - try { - YamlConfiguration.class.getMethod("load", java.io.Reader.class); - - } catch (final NoSuchMethodException err) { - hasYamlReaderLoad = false; - } - - try { - Class.forName("org.bukkit.inventory.meta.ItemMeta"); - - } catch (final Exception ex) { - hasItemMeta = false; - } - - } catch (final ReflectiveOperationException ex) { - throw new UnsupportedOperationException("Failed to set up reflection, " + SimplePlugin.getNamed() + " won't work properly", ex); - } - } - - // ---------------------------------------------------------------------------------------------------- - // Various server functions - // ---------------------------------------------------------------------------------------------------- - - /** - * Returns Minecraft World class - * - * @param world - * @return - */ - public static Object getHandleWorld(final World world) { - Object nms = null; - final Method handle = ReflectionUtil.getMethod(world.getClass(), "getHandle"); - try { - nms = handle.invoke(world); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - return nms; - } - - /** - * Returns Minecraft Entity class - * - * @param entity - * @return - */ - public static Object getHandleEntity(final Entity entity) { - Object nms_entity = null; - final Method handle = ReflectionUtil.getMethod(entity.getClass(), "getHandle"); - - try { - nms_entity = handle.invoke(entity); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return nms_entity; - } - - /** - * Returns true if we are running a 1.8 protocol hack - * - * @return - */ - public static boolean isProtocol18Hack() { - if (MinecraftVersion.newerThan(V.v1_9)) - return false; - - try { - getNMSClass("PacketPlayOutEntityTeleport", "N/A").getConstructor(int.class, int.class, int.class, int.class, byte.class, byte.class, boolean.class, boolean.class); - - } catch (final Throwable t) { - return false; - } - - return true; - } - - /** - * Advanced: Sends a packet to the player - * - * @param player the player - * @param packet the packet - */ - public static void sendPacket(final Player player, final Object packet) { - if (getHandle == null || fieldPlayerConnection == null || sendPacket == null) { - Common.log("Cannot send packet " + packet.getClass().getSimpleName() + " on your server sofware (known to be broken on Cauldron)."); - - return; - } - - try { - final Object handle = getHandle.invoke(player); - final Object playerConnection = fieldPlayerConnection.get(handle); - - sendPacket.invoke(playerConnection, packet); - - } catch (final ReflectiveOperationException ex) { - throw new ReflectionException(ex, "Error sending packet " + packet.getClass() + " to player " + player.getName()); - } - } - - // ---------------------------------------------------------------------------------------------------- - // Compatibility methods below - // ---------------------------------------------------------------------------------------------------- - - /** - * Returns the health of an entity - * - * @param entity the entity - * @return the health - */ - public static int getHealth(final LivingEntity entity) { - return isGetHealthDouble ? (int) entity.getHealth() : getHealhLegacy(entity); - } - - /** - * Return the max health of an entity - * - * @param entity - * @return - */ - public static int getMaxHealth(final LivingEntity entity) { - return isGetHealthDouble ? (int) entity.getMaxHealth() : getMaxHealhLegacy(entity); - } - - /** - * Returns all online players - * - * @return the online players - */ - public static Collection<? extends Player> getOnlinePlayers() { - return isGetPlayersCollection ? Bukkit.getOnlinePlayers() : Arrays.asList(getPlayersLegacy()); - } - - /** - * Spawn a falling block at the given block location - * - * @param block - * @return - */ - public static FallingBlock spawnFallingBlock(final Block block) { - return spawnFallingBlock(block.getLocation().add(0.5, 0, 0.5) /* fix alignment */, block.getType(), block.getData()); - } - - /** - * Spawns a falling block at that location - * - * @param loc - * @param block - * @return - */ - public static FallingBlock spawnFallingBlock(final Location loc, final Block block) { - if (MinecraftVersion.atLeast(V.v1_13)) - return loc.getWorld().spawnFallingBlock(loc, block.getBlockData()); - else - try { - return (FallingBlock) loc.getWorld().getClass().getMethod("spawnFallingBlock", Location.class, int.class, byte.class).invoke(loc.getWorld(), loc, ReflectionUtil.invoke("getTypeId", block), block.getData()); - } catch (final ReflectiveOperationException ex) { - ex.printStackTrace(); - - return null; - } - } - - /** - * Spawns a falling block - * - * @param loc - * @param material - * @return - */ - public static FallingBlock spawnFallingBlock(final Location loc, final Material material) { - return spawnFallingBlock(loc, material, (byte) 0); - } - - /** - * Spawns a falling block. - * - * @param loc - * @param material - * @param data - * @return - */ - public static FallingBlock spawnFallingBlock(final Location loc, final Material material, final byte data) { - if (MinecraftVersion.atLeast(V.v1_13)) - return loc.getWorld().spawnFallingBlock(loc, material, data); - else - try { - return (FallingBlock) loc.getWorld().getClass().getMethod("spawnFallingBlock", Location.class, int.class, byte.class).invoke(loc.getWorld(), loc, material.getId(), data); - } catch (final ReflectiveOperationException ex) { - ex.printStackTrace(); - - return null; - } - } - - /** - * Attempts to drop the item allowing space for applying properties to the item - * before it is spawned - * - * @param location - * @param item - * @param modifier - * @return the item - * @deprecated use {@link EntityUtil#dropItem(Location, ItemStack, Consumer)} - */ - @Deprecated - public static Item spawnItem(final Location location, final ItemStack item, final Consumer<Item> modifier) { - try { - - final Class<?> nmsWorldClass = getNMSClass("World", "net.minecraft.world.level.World"); - final Class<?> nmsStackClass = getNMSClass("ItemStack", "net.minecraft.world.item.ItemStack"); - final Class<?> nmsEntityClass = getNMSClass("Entity", "net.minecraft.world.entity.Entity"); - final Class<?> nmsItemClass = getNMSClass("EntityItem", "net.minecraft.world.entity.item.EntityItem"); - - final Constructor<?> entityConstructor = nmsItemClass.getConstructor(nmsWorldClass, double.class, double.class, double.class, nmsStackClass); - - final Object nmsWorld = location.getWorld().getClass().getMethod("getHandle").invoke(location.getWorld()); - final Method asNmsCopy = getOBCClass("inventory.CraftItemStack").getMethod("asNMSCopy", ItemStack.class); - - final Object nmsEntity = entityConstructor.newInstance(nmsWorld, location.getX(), location.getY(), location.getZ(), asNmsCopy.invoke(null, item)); - - final Class<?> craftItemClass = getOBCClass("entity.CraftItem"); - final Class<?> craftServerClass = getOBCClass("CraftServer"); - - final Object bukkitItem = craftItemClass.getConstructor(craftServerClass, nmsItemClass).newInstance(Bukkit.getServer(), nmsEntity); - Valid.checkBoolean(bukkitItem instanceof Item, "Failed to make an dropped item, got " + bukkitItem.getClass().getSimpleName()); - - modifier.accept((Item) bukkitItem); - - { // add to the world + call event - final Method addEntity = location.getWorld().getClass().getMethod("addEntity", nmsEntityClass, SpawnReason.class); - addEntity.invoke(location.getWorld(), nmsEntity, SpawnReason.CUSTOM); - } - - return (Item) bukkitItem; - - } catch (final ReflectiveOperationException ex) { - Common.error(ex, "Error spawning item " + item.getType() + " at " + location); - - return null; - } - } - - /** - * Return NMS copy of the given itemstack - * - * @param itemStack - * @return - */ - public static Object asNMSCopy(ItemStack itemStack) { - try { - final Method asNmsCopy = getOBCClass("inventory.CraftItemStack").getMethod("asNMSCopy", ItemStack.class); - - return asNmsCopy.invoke(null, itemStack); - - } catch (final ReflectiveOperationException ex) { - Common.throwError(ex, "Unable to convert item to NMS item: " + itemStack); - - return null; - } - } - - /** - * Sets a data of a block in the world. - * - * @param block - * @param data - */ - public static void setData(final Block block, final int data) { - try { - Block.class.getMethod("setData", byte.class).invoke(block, (byte) data); - } catch (final NoSuchMethodException ex) { - block.setBlockData(Bukkit.getUnsafe().fromLegacy(block.getType(), (byte) data), true); - - } catch (final ReflectiveOperationException ex) { - ex.printStackTrace(); - } - } - - /** - * Sets a block type and its data, applying physics. - * - * @param block - * @param material - * @param data - */ - public static void setTypeAndData(final Block block, final CompMaterial material, final byte data) { - setTypeAndData(block, material.getMaterial(), data); - } - - /** - * Sets a block type and its data, applying physics. - * - * @param block - * @param material - * @param data - */ - public static void setTypeAndData(final Block block, final Material material, final byte data) { - setTypeAndData(block, material, data, true); - } - - /** - * Sets a block type and its data. - * - * @param block - * @param material - * @param data - */ - public static void setTypeAndData(final Block block, final Material material, final byte data, final boolean physics) { - if (MinecraftVersion.atLeast(V.v1_13)) { - block.setType(material); - block.setBlockData(Bukkit.getUnsafe().fromLegacy(material, data), physics); - - } else - try { - block.getClass().getMethod("setTypeIdAndData", int.class, byte.class, boolean.class).invoke(block, material.getId(), data, physics); - } catch (final ReflectiveOperationException ex) { - ex.printStackTrace(); - } - } - - /** - * Converts json string into legacy colored text - * - * @param json - * @return - * @throws InteractiveTextFoundException - */ - public static String toLegacyText(final String json) throws InteractiveTextFoundException { - return toLegacyText(json, true); - } - - /** - * Converts chat message in JSON (IChatBaseComponent) to one lined old style - * message with color codes. e.g. {text:"Hello world",color="red"} converts to - * &cHello world - * - * @param denyEvents if an exception should be thrown if hover/click event is - * found. - * @throws InteractiveTextFoundException if click/hover event are found. Such - * events would be removed, and therefore - * message containing them shall not be - * unpacked - */ - public static String toLegacyText(final String json, final boolean denyEvents) throws InteractiveTextFoundException { - Valid.checkBoolean(bungeeApiPresent, "(Un)packing chat requires Spigot 1.7.10 or newer"); - final StringBuilder text = new StringBuilder(); - - // Translate options does not want to work well with ChatControl - if (json.contains("\"translate\"")) - return text.append("").toString(); - - try { - for (final BaseComponent comp : ComponentSerializer.parse(json)) { - if ((comp.getHoverEvent() != null || comp.getClickEvent() != null) && denyEvents) - throw new InteractiveTextFoundException(); - - text.append(comp.toLegacyText()); - } - - } catch (final Throwable throwable) { - - // Do not catch our own exception - if (throwable instanceof InteractiveTextFoundException) - throw throwable; - - /*Debugger.saveError(throwable, - "Unable to parse JSON message.", - "JSON: " + json, - "Error: %error");*/ - } - - return text.toString(); - } - - /** - * Return the given list as JSON - * - * @param list - * @return - */ - public static String toJson(final Collection<String> list) { - return gson.toJson(list); - } - - /** - * Convert the given json into list - * - * @param json - * @param typeOf - * @return - */ - public static List<String> fromJsonList(String json) { - return gson.fromJson(json, List.class); - } - - /** - * Converts chat message with color codes to Json chat components e.g. &6Hello - * world converts to {text:"Hello world",color="gold"} - */ - public static String toJson(final String message) { - Valid.checkBoolean(bungeeApiPresent, "(Un)packing chat requires Spigot 1.7.10 or newer"); - - return toJson(TextComponent.fromLegacyText(message)); - } - - /** - * Converts base components into json - * - * @param comps - * @return - */ - public static String toJson(final BaseComponent... comps) { - Valid.checkBoolean(bungeeApiPresent, "(Un)packing chat requires Spigot 1.7.10 or newer"); - - String json; - - try { - json = ComponentSerializer.toString(comps); - - } catch (final Throwable t) { - json = new Gson().toJson(new TextComponent(comps).toLegacyText()); - } - - return json; - } - - /** - * Converts an {@link org.bukkit.inventory.ItemStack} to a Json string - * for sending with {@link net.md_5.bungee.api.chat.BaseComponent}'s. - * - * @param item the item to convert - * @return the Json string representation of the item - */ - public static String toJson(ItemStack item) { - // ItemStack methods to get a net.minecraft.server.ItemStack object for serialization - final Class<?> craftItemstack = ReflectionUtil.getOBCClass("inventory.CraftItemStack"); - final Method asNMSCopyMethod = ReflectionUtil.getMethod(craftItemstack, "asNMSCopy", ItemStack.class); - - // NMS Method to serialize a net.minecraft.server.ItemStack to a valid Json string - final Class<?> nmsItemStack = ReflectionUtil.getNMSClass("ItemStack", "net.minecraft.world.item.ItemStack"); - final Class<?> nbtTagCompound = ReflectionUtil.getNMSClass("NBTTagCompound", "net.minecraft.nbt.NBTTagCompound"); - final Method saveItemstackMethod = ReflectionUtil.getMethod(nmsItemStack, "save", nbtTagCompound); - - final Object nmsNbtTagCompoundObj = ReflectionUtil.instantiate(nbtTagCompound); - final Object nmsItemStackObj = ReflectionUtil.invoke(asNMSCopyMethod, null, item); - final Object itemAsJsonObject = ReflectionUtil.invoke(saveItemstackMethod, nmsItemStackObj, nmsNbtTagCompoundObj); - - // Return a string representation of the serialized object - return itemAsJsonObject.toString(); - } - - /** - * Converts json into base component array - * - * @param json - * @return - */ - public static BaseComponent[] toComponent(final String json) { - Valid.checkBoolean(bungeeApiPresent, "(Un)packing chat requires Spigot 1.7.10 or newer"); - - try { - return ComponentSerializer.parse(json); - - } catch (final Throwable t) { - Common.throwError(t, - "Failed to call toComponent!", - "Json: " + json, - "Error: %error%"); - - return null; - } - } - - /** - * Sends JSON component to sender - * - * @param sender - * @param json - * @param placeholders - */ - public static void sendJson(final CommandSender sender, final String json, final SerializedMap placeholders) { - try { - final BaseComponent[] components = ComponentSerializer.parse(json); - - if (MinecraftVersion.atLeast(V.v1_16)) - replaceHexPlaceholders(Arrays.asList(components), placeholders); - - sendComponent(sender, components); - - } catch (final RuntimeException ex) { - Common.error(ex, "Malformed JSON when sending message to " + sender.getName() + " with JSON: " + json); - } - } - - /* - * A helper Method for MC 1.16+ to partially solve the issue of HEX colors in JSON - * - * BaseComponent does not support colors when in text, they must be set at the color level - */ - private static void replaceHexPlaceholders(final List<BaseComponent> components, final SerializedMap placeholders) { - - for (final BaseComponent component : components) { - if (component instanceof TextComponent) { - final TextComponent textComponent = (TextComponent) component; - String text = textComponent.getText(); - - for (final Map.Entry<String, Object> entry : placeholders.entrySet()) { - String key = entry.getKey(); - String value = Common.simplify(entry.getValue()); - - // Detect HEX in placeholder - final Matcher match = RGB_HEX_ENCODED_REGEX.matcher(text); - - while (match.find()) { - - // Find the color - final String color = "#" + match.group(2).replace(ChatColor.COLOR_CHAR + "", ""); - - // Remove it from chat and bind it to TextComponent instead - value = match.replaceAll(""); - textComponent.setColor(net.md_5.bungee.api.ChatColor.of(color)); - } - - key = key.charAt(0) != '{' ? "{" + key : key; - key = key.charAt(key.length() - 1) != '}' ? key + "}" : key; - - text = text.replace(key, value); - textComponent.setText(text); - } - } - - if (component.getExtra() != null) - replaceHexPlaceholders(component.getExtra(), placeholders); - - if (component.getHoverEvent() != null) - replaceHexPlaceholders(Arrays.asList(component.getHoverEvent().getValue()), placeholders); - } - } - - /** - * Sends JSON component to sender - * - * @param sender - * @param json - */ - public static void sendJson(final CommandSender sender, final String json) { - try { - sendComponent(sender, ComponentSerializer.parse(json)); - - } catch (final Throwable t) { - - // Silence a bug in md_5's library - if (t.toString().contains("missing 'text' property")) - return; - - throw new RuntimeException("Malformed JSON when sending message to " + sender.getName() + " with JSON: " + json, t); - } - } - - /** - * Sends JSON component to sender - * - * @param sender - * @param comps - */ - public static void sendComponent(final CommandSender sender, final Object comps) { - BungeeChatProvider.sendComponent(sender, comps); - } - - /** - * Sends a title to the player (1.8+) for three seconds - * - * @param player - * @param title - * @param subtitle - */ - public static void sendTitle(final Player player, final String title, final String subtitle) { - sendTitle(player, 20, 3 * 20, 20, title, subtitle); - } - - /** - * Sends a title to the player (1.8+) Texts will be colorized. - * - * @param player the player - * @param fadeIn how long to fade in the title (in ticks) - * @param stay how long to make the title stay (in ticks) - * @param fadeOut how long to fade out (in ticks) - * @param title the title, will be colorized - * @param subtitle the subtitle, will be colorized - */ - public static void sendTitle(final Player player, final int fadeIn, final int stay, final int fadeOut, final String title, final String subtitle) { - if (MinecraftVersion.newerThan(V.v1_7)) - if (hasExtendedPlayerTitleAPI) - player.sendTitle(Common.colorize(title), Common.colorize(subtitle), fadeIn, stay, fadeOut); - else - ChatInternals.sendTitleLegacy(player, fadeIn, stay, fadeOut, title, subtitle); - else { - Common.tell(player, title); - Common.tell(player, subtitle); - } - } - - /** - * Resets the title that is being displayed to the player (1.8+) - * - * @param player the player - */ - public static void resetTitle(final Player player) { - if (hasExtendedPlayerTitleAPI) - player.resetTitle(); - else - ChatInternals.resetTitleLegacy(player); - } - - /** - * Sets tab-list header and/or footer. Header or footer can be null. (1.8+) - * Texts will be colorized. - * - * @param player the player - * @param header the header - * @param footer the footer - */ - public static void sendTablist(final Player player, final String header, final String footer) { - Valid.checkBoolean(MinecraftVersion.newerThan(V.v1_7), "Sending tab list requires Minecraft 1.8x or newer!"); - - if (MinecraftVersion.atLeast(V.v1_13)) - player.setPlayerListHeaderFooter(Common.colorize(header), Common.colorize(footer)); - else - ChatInternals.sendTablistLegacy(player, header, footer); - } - - /** - * Displays message above player's health and hunger bar. (1.8+) Text will be - * colorized. - * - * @param player the player - * @param text the text - */ - public static void sendActionBar(final Player player, final String text) { - if (!MinecraftVersion.newerThan(V.v1_7)) { - Common.tell(player, text); - return; - } - - try { - player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(Common.colorize(text))); - - } catch (final NoSuchMethodError err) { - ChatInternals.sendActionBarLegacy(player, text); - } - } - - /** - * Send boss bar as percent - * - * @param player - * @param message - * @param percent - */ - public static void sendBossbarPercent(final Player player, final String message, final float percent) { - sendBossbarPercent(player, message, percent, null, null); - } - - /** - * Send boss bar as percent - * - * @param player - * @param message - * @param percent - * @param color - * @param style - */ - public static void sendBossbarPercent(final Player player, final String message, final float percent, final CompBarColor color, final CompBarStyle style) { - BossBarInternals.getInstance().setMessage(player, message, percent, color, style); - } - - /** - * Send boss bar only for limited time - * - * @param player - * @param message - * @param seconds - */ - public static void sendBossbarTimed(final Player player, final String message, final int seconds) { - sendBossbarTimed(player, message, seconds, null, null); - } - - /** - * Send boss bar only for limited time - * - * @param player - * @param message - * @param seconds - * @param color - * @param style - */ - public static void sendBossbarTimed(final Player player, final String message, final int seconds, final CompBarColor color, final CompBarStyle style) { - BossBarInternals.getInstance().setMessage(player, message, seconds, color, style); - } - - /** - * Attempts to remove a boss bar from player. - * <p> - * Only works if you rendered it through methods in this class! - * - * @param player - */ - public static void removeBar(final Player player) { - BossBarInternals.getInstance().removeBar(player); - } - - /** - * Broadcast a chest open animation at the given block, - * the block must be a chest! - * - * @param block - */ - public static void sendChestClose(Block block) { - sendChestAction(block, 0); - } - - /** - * Broadcast a chest open animation at the given block, - * the block must be a chest! - * - * @param location - */ - public static void sendChestOpen(Block block) { - sendChestAction(block, 1); - } - - /* - * A helper method - */ - private static void sendChestAction(Block block, int action) { - - final BlockState state = block.getState(); - Valid.checkBoolean(state instanceof Chest, "You can only send chest action packet for chests not " + block); - - try { - if (action == 1) - ((Chest) state).open(); - else - ((Chest) state).close(); - - } catch (final NoSuchMethodError t) { - final Location location = block.getLocation(); - - final Class<?> blockClass = getNMSClass("Block"); - final Class<?> blocks = getNMSClass("Blocks"); - - final Object position = ReflectionUtil.instantiate(ReflectionUtil.getConstructorNMS("BlockPosition", double.class, double.class, double.class), location.getX(), location.getY(), location.getZ()); - final Object packet = ReflectionUtil.instantiate(ReflectionUtil.getConstructorNMS("PacketPlayOutBlockAction", - ReflectionUtil.getNMSClass("BlockPosition"), blockClass, int.class, int.class), position, ReflectionUtil.getStaticFieldContent(blocks, "CHEST"), 1, action); - - for (final Player player : getOnlinePlayers()) - sendPacket(player, packet); - } - } - - /** - * Creates new plugin command from given label - * - * @param label - * @return - */ - public static PluginCommand newCommand(final String label) { - try { - final Constructor<PluginCommand> con = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class); - con.setAccessible(true); - - return con.newInstance(label, SimplePlugin.getInstance()); - - } catch (final ReflectiveOperationException ex) { - throw new FoException(ex, "Unable to create command: /" + label); - } - } - - /** - * Sets a custom command name - * - * @param command - * @param name - */ - public static void setCommandName(final PluginCommand command, final String name) { - try { - command.setName(name); - } catch (final NoSuchMethodError ex) { - } - } - - /** - * Injects an existing command into the command map - * - * @param command - */ - public static void registerCommand(final Command command) { - final CommandMap commandMap = getCommandMap(); - commandMap.register(command.getLabel(), command); - - Valid.checkBoolean(command.isRegistered(), "Command /" + command.getLabel() + " could not have been registered properly!"); - } - - /** - * Removes a command by its label from command map, includes all aliases - * - * @param label the label - */ - public static void unregisterCommand(final String label) { - unregisterCommand(label, true); - } - - /** - * Removes a command by its label from command map, optionally can also remove - * aliases - * - * @param label the label - * @param removeAliases, also remove aliases? - */ - public static void unregisterCommand(final String label, final boolean removeAliases) { - try { - // Unregister the commandMap from the command itself. - final PluginCommand command = Bukkit.getPluginCommand(label); - - if (command != null) { - final Field commandField = Command.class.getDeclaredField("commandMap"); - commandField.setAccessible(true); - - if (command.isRegistered()) - command.unregister((CommandMap) commandField.get(command)); - } - - // Delete command + aliases from server's command map. - final Field f = SimpleCommandMap.class.getDeclaredField("knownCommands"); - f.setAccessible(true); - - final Map<String, Command> cmdMap = (Map<String, Command>) f.get(getCommandMap()); - - cmdMap.remove(label); - - if (command != null && removeAliases) - for (final String alias : command.getAliases()) - cmdMap.remove(alias); - - } catch (final ReflectiveOperationException ex) { - throw new FoException(ex, "Failed to unregister command /" + label); - } - } - - /** - * Return the server's command map - * - * @return - */ - public static SimpleCommandMap getCommandMap() { - try { - return (SimpleCommandMap) getOBCClass("CraftServer").getDeclaredMethod("getCommandMap").invoke(Bukkit.getServer()); - - } catch (final ReflectiveOperationException ex) { - throw new FoException(ex, "Unable to get the command map"); - } - } - - /** - * Register a new enchantment in Bukkit, unregistering it first to avoid errors - * - * @param enchantment - */ - public static void registerEnchantment(final Enchantment enchantment) { - unregisterEnchantment(enchantment); - - ReflectionUtil.setStaticField(Enchantment.class, "acceptingNew", true); - Enchantment.registerEnchantment(enchantment); - - } - - /** - * Unregister an enchantment from Bukkit. Works even for vanilla MC enchantments (found in Enchantment class) - * - * @param enchantment - */ - public static void unregisterEnchantment(final Enchantment enchantment) { - - if (MinecraftVersion.atLeast(V.v1_13)) { // Unregister by key - final Map<NamespacedKey, Enchantment> byKey = ReflectionUtil.getStaticFieldContent(Enchantment.class, "byKey"); - - byKey.remove(enchantment.getKey()); - } - - { // Unregister by name - final Map<String, Enchantment> byName = ReflectionUtil.getStaticFieldContent(Enchantment.class, "byName"); - - byName.remove(enchantment.getName()); - } - } - - /** - * Returns the inventory location - * - * @param inv the inventory - * @return the location - */ - public static Location getLocation(final Inventory inv) { - if (hasInventoryLocation) - try { - return inv.getLocation(); - - } catch (final NullPointerException ex) { // EnderChest throws this - return null; - } - - return inv.getHolder() instanceof BlockState ? ((BlockState) inv.getHolder()).getLocation() : !inv.getViewers().isEmpty() ? inv.getViewers().iterator().next().getLocation() : null; - } - - /** - * Return the language of the player's Minecraft client - * <p> - * See {@link Player#getLocale()} - * <p> - * Returns null if not available for your MC version - * - * @param player - * @return - */ - public static String getLocale(final Player player) { - try { - return player.getLocale(); - - } catch (final Throwable t) { - try { - final Player.Spigot spigot = player.spigot(); - final Method method = ReflectionUtil.getMethod(spigot.getClass(), "getLocale"); - - return (String) ReflectionUtil.invoke(method, spigot); - - } catch (final Throwable tt) { - return null; - } - } - } - - /** - * Return the NMS statistic name for the given statistic - * - * @param stat - * @param mat - * @param en - * @return - */ - public static String getNMSStatisticName(final Statistic stat, final Material mat, final EntityType en) { - final Class<?> craftStatistic = getOBCClass("CraftStatistic"); - Object nmsStatistic = null; - - try { - if (stat.getType() == Type.UNTYPED) - nmsStatistic = craftStatistic.getMethod("getNMSStatistic", stat.getClass()).invoke(null, stat); - - else if (stat.getType() == Type.ENTITY) - nmsStatistic = craftStatistic.getMethod("getEntityStatistic", stat.getClass(), en.getClass()).invoke(null, stat, en); - - else - nmsStatistic = craftStatistic.getMethod("getMaterialStatistic", stat.getClass(), mat.getClass()).invoke(null, stat, mat); - - Valid.checkNotNull(nmsStatistic, "Could not get NMS statistic from Bukkit's " + stat); - - if (MinecraftVersion.equals(V.v1_8)) { - final Field f = nmsStatistic.getClass().getField("name"); - f.setAccessible(true); - return f.get(nmsStatistic).toString(); - } - - return (String) nmsStatistic.getClass().getMethod("getName").invoke(nmsStatistic); - } catch (final Throwable t) { - throw new FoException(t, "Error getting NMS statistic name from " + stat); - } - } - - /** - * Attempts to respawn the player after 2 ticks, either via native method or reflection - * - * @param player - */ - public static void respawn(final Player player) { - respawn(player, 2); - } - - /** - * Attempts to respawn the player, either via native method or reflection - * - * @param player - * @param delayTicks how long to way before respawning, minimum 1 tick - */ - public static void respawn(final Player player, final int delayTicks) { - Common.runLater(delayTicks, () -> { - try { - player.spigot().respawn(); - - } catch (final NoSuchMethodError err) { - try { - final Object respawnEnum = getNMSClass("EnumClientCommand", "N/A").getEnumConstants()[0]; - final Constructor<?>[] constructors = getNMSClass("PacketPlayInClientCommand", "N/A").getConstructors(); - - for (final Constructor<?> constructor : constructors) { - final Class<?>[] args = constructor.getParameterTypes(); - if (args.length == 1 && args[0] == respawnEnum.getClass()) { - final Object packet = getNMSClass("PacketPlayInClientCommand", "N/A").getConstructor(args).newInstance(respawnEnum); - - sendPacket(player, packet); - break; - } - } - - } catch (final Throwable e) { - throw new FoException(e, "Failed to send respawn packet to " + player.getName()); - } - } - }); - } - - /** - * Opens the book for the player given the book is a WRITTEN_BOOK - * - * @param player - * @param book - */ - public static void openBook(Player player, ItemStack book) { - Valid.checkBoolean(MinecraftVersion.atLeast(V.v1_8), "Opening books is only supported on MC 1.8 and greater"); - Valid.checkBoolean(book.getItemMeta() instanceof BookMeta, "openBook method called for not a book item: " + book); - - // Fix "Invalid book tag" error when author/title is empty - final BookMeta meta = (BookMeta) book.getItemMeta(); - - if (meta.getAuthor() == null) - meta.setAuthor(""); - - if (meta.getTitle() == null) - meta.setTitle(""); - - book.setItemMeta(meta); - - try { - - player.openBook(book); - - } catch (final NoSuchMethodError ex) { - final ItemStack oldItem = player.getItemInHand(); - - // Set the book temporarily to hands - player.setItemInHand(book); - - final Object craftPlayer = getHandleEntity(player); - final Object nmsItemstack = asNMSCopy(book); - - Common.runLater(() -> { - final Method openInventory = ReflectionUtil.getMethod(craftPlayer.getClass(), "openBook", nmsItemstack.getClass()); - ReflectionUtil.invoke(openInventory, craftPlayer, nmsItemstack); - - // Reset hands - player.setItemInHand(oldItem); - }); - } - } - - /** - * Update the player's inventory title without closing the window - * - * @param player the player - * @param title the new title - * @deprecated use {@link PlayerUtil#updateInventoryTitle(Player, String)} - */ - @Deprecated - public static void updateInventoryTitle(final Player player, String title) { - - try { - if (MinecraftVersion.atLeast(V.v1_17)) { - final Object nmsPlayer = Remain.getHandleEntity(player); - final Object chatComponent = toIChatBaseComponentPlain(ChatColor.translateAlternateColorCodes('&', title)); - - final int inventorySize = player.getOpenInventory().getTopInventory().getSize() / 9; - String containerName; - - if (inventorySize == 1) - containerName = "a"; - - else if (inventorySize == 2) - containerName = "b"; - - else if (inventorySize == 3) - containerName = "c"; - - else if (inventorySize == 4) - containerName = "d"; - - else if (inventorySize == 5) - containerName = "e"; - - else if (inventorySize == 6) - containerName = "f"; - else - throw new FoException("Cannot generate NMS container class to update inventory of size " + inventorySize); - - final Object container = ReflectionUtil.getStaticFieldContent(ReflectionUtil.lookupClass("net.minecraft.world.inventory.Containers"), containerName); - - final Constructor<?> packetConstructor = ReflectionUtil.getConstructor( - "net.minecraft.network.protocol.game.PacketPlayOutOpenWindow", - int.class, - container.getClass(), - ReflectionUtil.lookupClass("net.minecraft.network.chat.IChatBaseComponent")); - - final Object activeContainer = ReflectionUtil.getFieldContent(nmsPlayer, "bV"); - final int windowId = ReflectionUtil.getFieldContent(activeContainer, "j"); - - Remain.sendPacket(player, ReflectionUtil.instantiate(packetConstructor, windowId, container, chatComponent)); - ReflectionUtil.invoke("initMenu", nmsPlayer, activeContainer); - - return; - } - - if (MinecraftVersion.olderThan(V.v1_9) && title.length() > 32) - title = title.substring(0, 32); - - final Object entityPlayer = getHandleEntity(player); - final Object activeContainer = entityPlayer.getClass().getField("activeContainer").get(entityPlayer); - final Object windowId = activeContainer.getClass().getField("windowId").get(activeContainer); - - final Object packetOpenWindow; - - if (MinecraftVersion.atLeast(V.v1_8)) { - final Constructor<?> chatMessageConst = getNMSClass("ChatMessage", "net.minecraft.network.chat.ChatMessage").getConstructor(String.class, Object[].class); - final Object chatMessage = chatMessageConst.newInstance(ChatColor.translateAlternateColorCodes('&', title), new Object[0]); - - if (MinecraftVersion.newerThan(V.v1_13)) { - final int inventorySize = player.getOpenInventory().getTopInventory().getSize() / 9; - - if (inventorySize < 1 || inventorySize > 6) { - Common.log("Cannot update title for " + player.getName() + " as their inventory has non typical size: " + inventorySize + " rows"); - - return; - } - - final Class<?> containersClass = getNMSClass("Containers", "net.minecraft.world.inventory.Containers"); - final Constructor<?> packetConst = getNMSClass("PacketPlayOutOpenWindow", "net.minecraft.network.protocol.game.PacketPlayOutOpenWindow") - .getConstructor(/*windowID*/int.class, /*containers*/containersClass, /*msg*/getNMSClass("IChatBaseComponent", "net.minecraft.network.chat.IChatBaseComponent")); - - final String containerName = "GENERIC_9X" + inventorySize; - - final Object container = containersClass.getField(containerName).get(null); - - packetOpenWindow = packetConst.newInstance(windowId, container, chatMessage); - - } else { - final Constructor<?> packetConst = getNMSClass("PacketPlayOutOpenWindow", "N/A").getConstructor(int.class, String.class, getNMSClass("IChatBaseComponent", "net.minecraft.network.chat.IChatBaseComponent"), int.class); - - packetOpenWindow = packetConst.newInstance(windowId, "minecraft:chest", chatMessage, player.getOpenInventory().getTopInventory().getSize()); - } - } else { - final Constructor<?> openWindow = ReflectionUtil.getConstructor( - getNMSClass(MinecraftVersion.atLeast(V.v1_7) ? "PacketPlayOutOpenWindow" : "Packet100OpenWindow", "N/A"), int.class, int.class, String.class, int.class, boolean.class); - - packetOpenWindow = ReflectionUtil.instantiate(openWindow, windowId, 0, ChatColor.translateAlternateColorCodes('&', title), player.getOpenInventory().getTopInventory().getSize(), true); - } - - sendPacket(player, packetOpenWindow); - entityPlayer.getClass().getMethod("updateInventory", getNMSClass("Container", "net.minecraft.world.inventory.Container")).invoke(entityPlayer, activeContainer); - - } catch (final ReflectiveOperationException ex) { - Common.error(ex, "Error updating " + player.getName() + " inventory title to '" + title + "'"); - } - } - - /** - * Sends a fake block update to a certain location, and than reverts it back to - * the real block after a while. - * - * @param delayTicks the pause between reverting back - * @param player the player - * @param location the location - * @param material the material - */ - public static void sendBlockChange(final int delayTicks, final Player player, final Location location, final CompMaterial material) { - if (delayTicks > 0) - Common.runLater(delayTicks, () -> sendBlockChange0(player, location, material)); - else - sendBlockChange0(player, location, material); - } - - private static void sendBlockChange0(final Player player, final Location location, final CompMaterial material) { - try { - player.sendBlockChange(location, material.getMaterial().createBlockData()); - } catch (final NoSuchMethodError ex) { - player.sendBlockChange(location, material.getMaterial(), material.getData()); - } - } - - /** - * Sends to the player the block update packet of the given block, typically - * to reset it back to the real state - * - * @param delayTicks - * @param player - * @param block - */ - public static void sendBlockChange(final int delayTicks, final Player player, final Block block) { - if (delayTicks > 0) - Common.runLater(delayTicks, () -> sendBlockChange0(player, block)); - else - sendBlockChange0(player, block); - } - - private static void sendBlockChange0(final Player player, final Block block) { - try { - player.sendBlockChange(block.getLocation(), block.getBlockData()); - } catch (final NoSuchMethodError ex) { - player.sendBlockChange(block.getLocation(), block.getType(), block.getData()); - } - } - - /** - * Return how long the player has played on this server (pulled from your world statistics file) - * in minutes - * - * @param player - * @return - */ - public static int getPlaytimeMinutes(final Player player) { - final Statistic stat = getPlayTimeStatisticName(); - - return player.getStatistic(stat) / (stat.name().contains("TICK") ? 20 * 60 : 60 * 60); - } - - /** - * Return either PLAY_ONE_TICK for MC <1.13 or PLAY_ONE_MINUTE for 1.13+ - * - * @return - */ - public static Statistic getPlayTimeStatisticName() { - return Statistic.valueOf(MinecraftVersion.olderThan(V.v1_13) ? "PLAY_ONE_TICK" : "PLAY_ONE_MINUTE"); - } - - /** - * Return if the play time statistic is measured in ticks - * - * @return - */ - public static boolean isPlaytimeStatisticTicks() { - return MinecraftVersion.olderThan(V.v1_13); - } - - /** - * Since Minecraft introduced double yelding, it fires two events for - * interaction for each hand. Return if the event was fired for the main hand. - * <p> - * Backwards compatible. - * - * @param e, the event - * @return if the event was fired for main hand only - */ - public static boolean isInteractEventPrimaryHand(final PlayerInteractEvent e) { - try { - return e.getHand() != null && e.getHand() == org.bukkit.inventory.EquipmentSlot.HAND; - - } catch (final NoSuchMethodError err) { - return true; // Older MC, always true since there was no off-hand - } - } - - /** - * See {@link #isInteractEventPrimaryHand(PlayerInteractEvent)} - * - * @param e - * @return - */ - public static boolean isInteractEventPrimaryHand(final PlayerInteractEntityEvent e) { - try { - return e.getHand() != null && e.getHand() == org.bukkit.inventory.EquipmentSlot.HAND; - } catch (final NoSuchMethodError err) { - return true; // Older MC, always true since there was no off-hand - } - } - - /** - * Returns a scoreboard score - * - * @param obj - * @param entry - * @return - */ - public static Score getScore(final Objective obj, String entry) { - Valid.checkNotNull(obj, "Objective cannot be null"); - - entry = Common.colorize(entry); - - try { - return obj.getScore(entry); - - } catch (final NoSuchMethodError err) { - return obj.getScore(Bukkit.getOfflinePlayer(entry)); - } - } - - /** - * Tries to find offline player by uuid - * - * @param id - * @return - */ - public static OfflinePlayer getOfflinePlayerByUUID(final UUID id) { - try { - return Bukkit.getOfflinePlayer(id); - - } catch (final NoSuchMethodError err) { - if (Bukkit.isPrimaryThread()) - Common.log("getOfflinePlayerByUUID required two blocking calls on main thread - please notify " + SimplePlugin.getNamed() + " plugin authors."); - - final UUIDToNameConverter f = new UUIDToNameConverter(id); - - try { - final String name = f.call(); - - return Bukkit.getOfflinePlayer(name); - } catch (final Throwable t) { - return null; - } - } - } - - /** - * Tries to find online player by uuid - * - * @param id - * @return - */ - public static Player getPlayerByUUID(final UUID id) { - try { - return Bukkit.getPlayer(id); - - } catch (final NoSuchMethodError err) { - for (final Player online : getOnlinePlayers()) - if (online.getUniqueId().equals(id)) - return online; - - return null; - } - } - - /** - * Gets the final damage of an event - * - * @param e - * @return - */ - public static double getFinalDamage(final EntityDamageEvent e) { - try { - return e.getFinalDamage(); - - } catch (final NoSuchMethodError err) { - return e.getDamage(); - } - } - - /** - * Return the correct inventory that was clicked (either bottom or top inventory - * or null if clicked outside) - * - * @param e the inventory click event - * @return the actual inventory clicked, either bottom or top, or null if - * clicked outside - */ - public static Inventory getClickedInventory(final InventoryClickEvent e) { - final int slot = e.getRawSlot(); - final InventoryView view = e.getView(); - - return slot < 0 ? null : view.getTopInventory() != null && slot < view.getTopInventory().getSize() ? view.getTopInventory() : view.getBottomInventory(); - } - - /** - * Return a list of pages (new MC also will expose interactive elements) - * in a book - * - * @param meta - * @return - */ - public static List<BaseComponent[]> getPages(BookMeta meta) { - try { - return meta.spigot().getPages(); - - } catch (final NoSuchMethodError ex) { - final List<BaseComponent[]> list = new ArrayList<>(); - - for (final String page : meta.getPages()) - list.add(TextComponent.fromLegacyText(page)); - - return list; - } - } - - /** - * Attempts to set the book pages from the given list - * - * @param meta - * @param pages - */ - public static void setPages(BookMeta meta, List<BaseComponent[]> pages) { - try { - meta.spigot().setPages(pages); - - } catch (final NoSuchMethodError ex) { - /*final List<String> list = new ArrayList<>(); - - for (final BaseComponent[] page : pages) - list.add(TextComponent.toLegacyText(page)); - - meta.setPages(list);*/ - - try { - final List<Object> chatComponentPages = (List<Object>) ReflectionUtil.getFieldContent(ReflectionUtil.getOBCClass("inventory.CraftMetaBook"), "pages", meta); - - for (final BaseComponent[] text : pages) - chatComponentPages.add(toIChatBaseComponent(text)); - - } catch (final Exception e) { - e.printStackTrace(); - } - } - } - - /** - * Return IChatBaseComponent from the given plain text - * - * @param text - * @return - */ - public static Object toIChatBaseComponentPlain(String text) { - return toIChatBaseComponent(TextComponent.fromLegacyText(text)); - } - - /** - * Return IChatBaseComponent from the given component list - * - * @param baseComponents - * @return - */ - public static Object toIChatBaseComponent(BaseComponent[] baseComponents) { - return toIChatBaseComponent(toJson(baseComponents)); - } - - /** - * Return IChatBaseComponent from the given JSON - * - * @param json - * @return - */ - public static Object toIChatBaseComponent(String json) { - Valid.checkBoolean(MinecraftVersion.atLeast(V.v1_7), "Serializing chat components requires Minecraft 1.7.10 and greater"); - - final Class<?> chatSerializer = ReflectionUtil.getNMSClass((MinecraftVersion.equals(V.v1_7) ? "" : "IChatBaseComponent$") + "ChatSerializer", "net.minecraft.network.chat.IChatBaseComponent$ChatSerializer"); - final Method a = ReflectionUtil.getMethod(chatSerializer, "a", String.class); - - return ReflectionUtil.invoke(a, null, json); - } - - /** - * Return the name of the entity - * - * @param entity - * @return - */ - public static String getName(final Entity entity) { - try { - return entity.getName(); - - } catch (final NoSuchMethodError t) { - return entity instanceof Player ? ((Player) entity).getName() : ItemUtil.bountifyCapitalized(entity.getType()); - } - } - - /** - * Sets a custom name to entity - * - * @param en - * @param name - */ - public static void setCustomName(final Entity en, final String name) { - try { - en.setCustomNameVisible(true); - en.setCustomName(Common.colorize(name)); - } catch (final NoSuchMethodError er) { - } - } - - /** - * Calls NMS to find out if the entity is invisible, works for any entity, - * better than Bukkit since it has extreme downwards compatibility and does not require LivingEntity - * - * @param entity - * @return - */ - public static boolean isInvisible(Entity entity) { - Valid.checkBoolean(MinecraftVersion.atLeast(V.v1_4), "Entity#isInvisible requires Minecraft 1.4.7 or greater"); - - if (entity instanceof LivingEntity && MinecraftVersion.atLeast(V.v1_16)) - return ((LivingEntity) entity).isInvisible(); - - else { - final Object nmsEntity = getHandleEntity(entity); - - return (boolean) ReflectionUtil.invoke("isInvisible", nmsEntity); - } - } - - /** - * Calls NMS to set invisibility status of any entity, - * better than Bukkit since it has extreme downwards compatibility and does not require LivingEntity - * - * @param entity - * @param invisible - */ - public static void setInvisible(Object entity, boolean invisible) { - Valid.checkBoolean(MinecraftVersion.atLeast(V.v1_4), "Entity#setInvisible requires Minecraft 1.4.7 or greater"); - - if (entity instanceof LivingEntity && MinecraftVersion.atLeast(V.v1_16)) - ((LivingEntity) entity).setInvisible(invisible); - - else { - final Object nmsEntity = entity.getClass().toString().contains("net.minecraft.server") ? entity : entity instanceof LivingEntity ? getHandleEntity((LivingEntity) entity) : null; - Valid.checkNotNull(nmsEntity, "setInvisible requires either a LivingEntity or a NMS Entity, got: " + entity.getClass()); - - // https://www.spigotmc.org/threads/how-do-i-make-an-entity-go-invisible-without-using-potioneffects.321227/ - Common.runLater(2, () -> ReflectionUtil.invoke("setInvisible", nmsEntity, invisible)); - } - } - - /** - * Tries to get the first material, or return the second as fall back - * - * @param material - * @param fallback - * @return - */ - public static CompMaterial getMaterial(final String material, final CompMaterial fallback) { - Material mat = null; - - try { - mat = Material.getMaterial(material); - } catch (final Throwable t) { - } - - return mat != null ? CompMaterial.fromMaterial(mat) : fallback; - } - - /** - * Tries to get the new material by name, or returns the old one as a fall back - * - * @param newMaterial - * @param oldMaterial - * @return - */ - public static Material getMaterial(final String newMaterial, final String oldMaterial) { - try { - return Material.getMaterial(newMaterial); - - } catch (final Throwable t) { - return Material.getMaterial(oldMaterial); - } - } - - /** - * Get the target block for player - * - * @param en - * @param radius - * @return - */ - public static Block getTargetBlock(final LivingEntity en, final int radius) { - try { - return en.getTargetBlock((Set<Material>) null, radius); - - } catch (final Throwable t) { - if (t instanceof IllegalStateException) - return null; - - try { - return (Block) en.getClass().getMethod("getTargetBlock", HashSet.class, int.class).invoke(en, (HashSet<Byte>) null, radius); - - } catch (final ReflectiveOperationException ex2) { - throw new FoException(t, "Unable to get target block for " + en); - } - } - } - - /** - * Send a "toast" notification. This is an advancement notification that cannot - * be modified that much. It imposes a slight performance penalty. - * - * @param receiver - * @param message - */ - public static void sendToast(final Player receiver, final String message) { - sendToast(receiver, message, CompMaterial.BOOK); - } - - /** - * Send a "toast" notification. This is an advancement notification that cannot - * be modified that much. It imposes a slight performance penalty. - * - * @param receiver - * @param message - * @param icon - */ - public static void sendToast(final Player receiver, final String message, final CompMaterial icon) { - if (message != null && !message.isEmpty()) { - final String colorized = Common.colorize(message); - - if (!colorized.isEmpty()) { - Valid.checkSync("Toasts may only be sent from the main thread"); - - if (hasAdvancements) - new AdvancementAccessor(colorized, icon.toString().toLowerCase()).show(receiver); - - else - receiver.sendMessage(colorized); - } - } - } - - /** - * Send a "toast" notification to the given receivers. This is an advancement notification that cannot - * be modified that much. It imposes a slight performance penalty the more players to send to. - * - * Each player sending is delayed by 0.1s - * - * @param receiver - * @param message you can replace player-specific variables in the message here - * @param icon - */ - public static void sendToast(final List<Player> receivers, final Function<Player, String> message, final CompMaterial icon) { - - if (hasAdvancements) { - Common.runLaterAsync(() -> { - for (final Player receiver : receivers) { - - // Sleep to mitigate sending not working at once - Common.sleep(100); - - Common.runLater(() -> { - final String colorized = Common.colorize(message.apply(receiver)); - - if (!colorized.isEmpty()) { - final AdvancementAccessor accessor = new AdvancementAccessor(colorized, icon.toString().toLowerCase()); - - if (receiver.isOnline()) - accessor.show(receiver); - } - }); - } - }); - - } else - for (final Player receiver : receivers) { - final String colorized = Common.colorize(message.apply(receiver)); - - if (!colorized.isEmpty()) - receiver.sendMessage(colorized); - } - - } - - /** - * Set the visual cooldown for the given material, see {@link Player#setCooldown(Material, int)} - * You still have to implement custom handling of it - * <p> - * Old MC versions are supported and handled by us - * however there is no visual effect - * - * @param player - * @param material - * @param cooldownTicks - */ - public static void setCooldown(final Player player, final Material material, final int cooldownTicks) { - try { - player.setCooldown(material, cooldownTicks); - - } catch (final Throwable t) { - final StrictMap<Material, Integer> cooldown = getCooldown(player); - - cooldown.override(material, cooldownTicks); - cooldowns.override(player.getUniqueId(), cooldown); - } - } - - /** - * See {@link Player#hasCooldown(Material)} - * <p> - * Old MC versions are supported and handled by us - * however there is no visual effect - * - * @param player - * @param material - * @return - */ - public static boolean hasCooldown(final Player player, final Material material) { - try { - return player.hasCooldown(material); - - } catch (final Throwable t) { - final StrictMap<Material, Integer> cooldown = getCooldown(player); - - return cooldown.contains(material); - } - } - - /** - * Return the item cooldown as specified in {@link Player#getCooldown(Material)} - * <p> - * Old MC versions are supported and handled by us - * however there is no visual effect - * - * @param player - * @param material - * @return - */ - public static int getCooldown(final Player player, final Material material) { - try { - return player.getCooldown(material); - - } catch (final Throwable t) { - final StrictMap<Material, Integer> cooldown = getCooldown(player); - - return cooldown.getOrDefault(material, 0); - } - } - - // Internal method to get a players cooldown map - private static StrictMap<Material, Integer> getCooldown(final Player player) { - return cooldowns.getOrDefault(player.getUniqueId(), new StrictMap<>()); - } - - /** - * Return the entity by UUID - * - * @param uuid - * @return - */ - public static Entity getEntity(final UUID uuid) { - Valid.checkSync("Remain#getEntity must be called on the main thread"); - - for (final World world : Bukkit.getWorlds()) - for (final Entity entity : world.getEntities()) - if (entity.getUniqueId().equals(uuid)) - return entity; - - return null; - } - - /** - * Return nearby entities in a location - * - * @param location - * @param radius - * @return - */ - public static Collection<Entity> getNearbyEntities(final Location location, final double radius) { - try { - return location.getWorld().getNearbyEntities(location, radius, radius, radius); - - } catch (final Throwable t) { - final List<Entity> found = new ArrayList<>(); - - for (final Entity e : location.getWorld().getEntities()) - if (e.getLocation().distance(location) <= radius) - found.add(e); - - return found; - } - } - - /** - * Takes one piece of the hand item - * - * @param player - */ - public static void takeHandItem(final Player player) { - takeItemAndSetAsHand(player, player.getItemInHand()); - } - - /** - * Takes one piece of the given item and sets it as hand - * - * @param player - * @param item - */ - public static void takeItemAndSetAsHand(final Player player, final ItemStack item) { - if (item.getAmount() > 1) { - item.setAmount(item.getAmount() - 1); - player.getInventory().setItemInHand(item); - - } else - player.getInventory().setItemInHand(null); - - player.updateInventory(); - } - - /** - * Takes 1 piece of the item from players inventory - * - * @param player - * @param item - */ - public static void takeItemOnePiece(final Player player, final ItemStack item) { - if (MinecraftVersion.atLeast(V.v1_15)) - item.setAmount(item.getAmount() - 1); - - else - Common.runLater(() -> { - if (item.getAmount() > 1) - item.setAmount(item.getAmount() - 1); - else if (MinecraftVersion.atLeast(V.v1_9)) - item.setAmount(0); - - // Explanation: For some weird reason there is a bug not removing 1 piece of ItemStack in 1.8.8 - else { - final ItemStack[] content = player.getInventory().getContents(); - - for (int i = 0; i < content.length; i++) { - final ItemStack c = content[i]; - - if (c != null && c.equals(item)) { - content[i] = null; - - break; - } - } - - player.getInventory().setContents(content); - } - - player.updateInventory(); - }); - } - - /** - * Attempts to insert a certain potion to the given item - * - * @param item - * @param type - * @param level - */ - public static void setPotion(final ItemStack item, final PotionEffectType type, final int level) { - if (hasItemMeta) - PotionSetter.setPotion(item, type, level); - } - - /** - * Attempts to return the I18N localized display name, or returns the - * capitalized Material name if fails. - * <p> - * Requires PaperSpigot. - * - * @param item the {@link ItemStack} to get I18N name from - * @return the I18N localized name or Material name - */ - public static String getI18NDisplayName(final ItemStack item) { - try { - return (String) item.getClass().getDeclaredMethod("getI18NDisplayName").invoke(item); - - } catch (final Throwable t) { - return ItemUtil.bountifyCapitalized(item.getType()); - } - } - - /** - * Load YAML configuration from stream, throwing any errors - * - * @param is the input stream - * @return the configuration - */ - public static SimpleYaml loadConfiguration(final InputStream is) { - Valid.checkNotNull(is, "Could not load configuration from a null input stream!"); - - SimpleYaml conf = null; - - try { - conf = loadConfigurationStrict(is); - - } catch (final Throwable ex) { - ex.printStackTrace(); - } - - Valid.checkNotNull(conf, "Could not load configuration from " + is); - return conf; - } - - /** - * Load YAML configuration from stream as unicode, throwing any errors - * - * @param is the input stream - * @return the configuration - * @throws Throwable when any error occurs - */ - public static SimpleYaml loadConfigurationStrict(final InputStream is) throws Throwable { - final SimpleYaml conf = new SimpleYaml(); - - try { - conf.load(new InputStreamReader(is, StandardCharsets.UTF_8)); - - } catch (final NoSuchMethodError ex) { - loadConfigurationFromString(is, conf); - } - - return conf; - } - - /** - * Load the YAML configuration from stream - * - * @param stream - * @param conf - * @throws IOException - * @throws InvalidConfigurationException - */ - public static SimpleYaml loadConfigurationFromString(final InputStream stream, final SimpleYaml conf) throws IOException, InvalidConfigurationException { - Valid.checkNotNull(stream, "Stream cannot be null"); - - final StringBuilder builder = new StringBuilder(); - final InputStreamReader reader = new InputStreamReader(stream, StandardCharsets.UTF_8); - - try (final BufferedReader input = new BufferedReader(reader)) { - String line; - - while ((line = input.readLine()) != null) { - builder.append(line); - builder.append('\n'); - } - } - - conf.loadFromString(builder.toString()); - return conf; - } - - /** - * Return the max health configure from spigot - * - * @return max health, or 2048 if not found - */ - public static double getMaxHealth() { - try { - final String health = String.valueOf(Class.forName("org.spigotmc.SpigotConfig").getField("maxHealth").get(null)); - - return health.contains(".") ? Double.parseDouble(health) : Integer.parseInt(health); - - } catch (final Throwable t) { - return 2048.0; - } - } - - /** - * Returns if statistics do not save - * - * @return true if stat saving was disabled, false if not or if not running - * Spigot - */ - public static boolean isStatSavingDisabled() { - try { - return (boolean) Class.forName("org.spigotmc.SpigotConfig").getField("disableStatSaving").get(null); - - } catch (final ReflectiveOperationException ex) { - try { - final YamlConfiguration cfg = YamlConfiguration.loadConfiguration(new File("spigot.yml")); - - return cfg.isSet("stats.disable-saving") ? cfg.getBoolean("stats.disable-saving") : false; - } catch (final Throwable t) { - // No Spigot - } - } - - return false; - } - - /** - * Converts an unchecked exception into checked - * - * @param throwable - */ - public static void sneaky(final Throwable throwable) { - try { - SneakyThrow.sneaky(throwable); - - } catch (final NoClassDefFoundError | NoSuchFieldError | NoSuchMethodError err) { - throw new FoException(throwable); - } - } - - /** - * Sets a game rule - * - * @param world world to set game rule in - * @param gameRule game rule - * @param value value to set (true/false) - */ - @SuppressWarnings("rawtypes") - public static void setGameRule(final World world, final String gameRule, final boolean value) { - try { - if (MinecraftVersion.newerThan(V.v1_13)) { - final GameRule rule = GameRule.getByName(gameRule); - - world.setGameRule(rule, value); - } else - world.setGameRuleValue(gameRule, "" + value); - - } catch (final Throwable t) { - Common.error(t, "Game rule " + gameRule + " not found."); - } - } - - /** - * New Minecraft versions lack server-name that we rely on for BungeeCord, - * restore it back - */ - public static void injectServerName() { - final Properties properties = new Properties(); - final File props = new File(SimplePlugin.getData().getParentFile().getParentFile(), "server.properties"); - - // If user has Bungee_Server_Name in their settings, move it automatically - final File settingsFile = FileUtil.getFile("settings.yml"); - String previousName = null; - - if (settingsFile.exists()) { - final SimpleYaml settings = FileUtil.loadConfigurationStrict(settingsFile); - final String previousNameRaw = settings.getString("Bungee_Server_Name"); - - if (previousNameRaw != null && !previousNameRaw.isEmpty() && !"none".equals(previousNameRaw) && !"undefined".equals(previousNameRaw)) { - Common.warning("Detected Bungee_Server_Name being used in your settings.yml that is now located in server.properties." + - " It has been moved there and you can now delete this key from settings.yml if it was not deleted already."); - - previousName = previousNameRaw; - } - } - - try (final FileReader fileReader = new FileReader(props)) { - properties.load(fileReader); - - if (!properties.containsKey("server-name") || previousName != null) { - properties.setProperty("server-name", previousName != null ? previousName : "Undefined - see mineacademy.org/server-properties to configure"); - - try (FileWriter fileWriter = new FileWriter(props)) { - properties.store(fileWriter, "Minecraft server properties\nModified by " + SimplePlugin.getNamed() + ", see mineacademy.org/server-properties for more information"); - } - } - - serverName = properties.getProperty("server-name"); - - } catch (final Throwable e) { - e.printStackTrace(); - } - } - - /** - * Return the server name identifier (used for BungeeCord) - * - * @return - */ - public static String getServerName() { - Valid.checkBoolean(isServerNameChanged(), "Detected getServerName call, please configure your 'server-name' in server.properties according to mineacademy.org/server-properties"); - - return serverName; - } - - /** - * Return true if the server-name property in server.properties got modified - * - * @return - */ - public static boolean isServerNameChanged() { - return !"see mineacademy.org/server-properties to configure".contains(serverName) && !"undefined".equals(serverName) && !"Unknown Server".equals(serverName); - } - - /** - * Return the corresponding major Java version such as 8 for Java 1.8, or 11 for Java 11. - * - * @return - */ - public static int getJavaVersion() { - String version = System.getProperty("java.version"); - - if (version.startsWith("1.")) - version = version.substring(2, 3); - - else { - final int dot = version.indexOf("."); - - if (dot != -1) - version = version.substring(0, dot); - } - - if (version.contains("-")) - version = version.split("\\-")[0]; - - return Integer.parseInt(version); - } - - /** - * Return the server's ticks per second (requires Paper otherwise we return 20) - * - * @return - */ - public static int getTPS() { - - try { - final Method getTPS = Bukkit.class.getDeclaredMethod("getTPS", double[].class); - - return (int) MathUtil.floor(getTPS == null ? 20 : ((double[]) getTPS.invoke(null))[0]); - } catch (final ReflectiveOperationException ex) { - - // Unsupported - return 20; - } - } - - // ---------------------------------------------------------------------------------------------------- - // Getters for various server functions - // ---------------------------------------------------------------------------------------------------- - - /** - * Return if the server is running Paper, formerly PaperSpigot software. - * <p> - * Paper is a fork of Spigot compatible with most Bukkit plugins. - * <p> - * We use the method getTPS to determine if Paper is installed. - * - * @return true if the server is running Paper(Spigot) - */ - public static boolean isPaper() { - try { - Class.forName("co.aikar.timings.Timing"); - - return true; - - } catch (final Throwable e) { - return false; - } - } - - /** - * Is 'net.md_5.bungee.api.chat' package present? Spigot 1.7.10 and never. - * - * @return if the bungee chat API is present - */ - public static boolean isBungeeApiPresent() { - return bungeeApiPresent; - } - - /** - * Is this server supporting native scoreboard api? - * - * @return if server supports native scoreboard api - */ - public static boolean hasNewScoreboardAPI() { - return newScoreboardAPI; - } - - /** - * Is this server supporting particles? - * - * @return if server supports native particle api - */ - public static boolean hasParticleAPI() { - return hasParticleAPI; - } - - /** - * Is this server supporting book event? - * - * @return if server supports book event - */ - public static boolean hasBookEvent() { - return hasBookEvent; - } - - /** - * Is this server supporting permanent scoreboard tags? - * - * @return if server supports permanent scoreboard tags - */ - public static boolean hasScoreboardTags() { - return hasScoreboardTags; - } - - /** - * Return if the server version supports {@link SpawnEggMeta} - * - * @return true if egg meta are supported - */ - public static boolean hasSpawnEggMeta() { - return hasSpawnEggMeta; - } - - /** - * Return if the server version supports {@link YamlConfiguration#load(java.io.Reader)} - * otherwise you need to use just {@link InputStream} - * - * @return - */ - public static boolean hasYamlReaderLoad() { - return hasYamlReaderLoad; - } - - /** - * Return if this MC is likely 1.3.2 and greater - * - * @return - */ - public static boolean hasItemMeta() { - return hasItemMeta; - } - - /** - * Return if the MC version is 1.16+ that supports HEX RGB colors - * - * @return - */ - public static boolean hasHexColors() { - return MinecraftVersion.atLeast(V.v1_16); - } - - // ------------------------ Legacy ------------------------ - - // return the legacy online player array - private static Player[] getPlayersLegacy() { - try { - return (Player[]) getPlayersMethod.invoke(null); - } catch (final ReflectiveOperationException ex) { - throw new FoException(ex, "Reflection malfunction"); - } - } - - // return the legacy get health int method - private static int getHealhLegacy(final LivingEntity entity) { - try { - return (int) getHealthMethod.invoke(entity); - } catch (final ReflectiveOperationException ex) { - throw new FoException(ex, "Reflection malfunction"); - } - } - - // return the legacy get health int method - private static int getMaxHealhLegacy(final LivingEntity entity) { - try { - final Object number = LivingEntity.class.getMethod("getMaxHealth").invoke(entity); - - if (number instanceof Double) - return ((Double) number).intValue(); - if (number instanceof Integer) - return (Integer) number; - - return (int) Double.parseDouble(number.toString()); - - } catch (final ReflectiveOperationException ex) { - throw new FoException(ex, "Reflection malfunction"); - } - } - - // ------------------------ Utility ------------------------ - - /** - * Thrown when message contains hover or click events which would otherwise got - * removed. - * <p> - * Such message is not checked. - */ - public static class InteractiveTextFoundException extends RuntimeException { - private static final long serialVersionUID = 1L; - - private InteractiveTextFoundException() { - } - } -} - -/** - * A wrapper for Spigot - */ -class SneakyThrow { - - public static void sneaky(final Throwable t) { - throw SneakyThrow.<RuntimeException>superSneaky(t); - } - - private static <T extends Throwable> T superSneaky(final Throwable t) throws T { - throw (T) t; - } -} - -/** - * A wrapper for bungee chat component library - */ -class BungeeChatProvider { - - static void sendComponent(final CommandSender sender, final Object comps) { - if (comps instanceof TextComponent) - sendComponent0(sender, (TextComponent) comps); - - else - sendComponent0(sender, (BaseComponent[]) comps); - } - - private static void sendComponent0(final CommandSender sender, final BaseComponent... comps) { - final StringBuilder plainMessage = new StringBuilder(); - - for (final BaseComponent comp : comps) - plainMessage.append(comp.toLegacyText().replaceAll(ChatColor.COLOR_CHAR + "x", "")); - - if (!(sender instanceof Player)) { - tell0(sender, plainMessage.toString()); - - return; - } - - try { - if (MinecraftVersion.equals(V.v1_7)) { - final Class<?> chatBaseComponentClass = getNMSClass("IChatBaseComponent", "N/A"); - final Class<?> packetClass = getNMSClass("PacketPlayOutChat", "N/A"); - - final Object chatBaseComponent = Remain.toIChatBaseComponent(comps); - final Object packet = ReflectionUtil.instantiate(ReflectionUtil.getConstructor(packetClass, chatBaseComponentClass), chatBaseComponent); - - Remain.sendPacket((Player) sender, packet); - - } else - ((Player) sender).spigot().sendMessage(comps); - - } catch (final Throwable ex) { - - // This is the minimum MC version that supports interactive chat - // Ignoring Cauldron - if (MinecraftVersion.atLeast(V.v1_7) && !Bukkit.getName().contains("Cauldron")) - Common.throwError(ex, "Failed to send component: " + plainMessage.toString() + " to " + sender.getName()); - - tell0(sender, plainMessage.toString()); - } - } - - private static void tell0(final CommandSender sender, final String msg) { - Valid.checkNotNull(sender, "Sender cannot be null"); - - if (msg.isEmpty() || "none".equals(msg)) - return; - - final String stripped = msg.startsWith("[JSON]") ? msg.replaceFirst("\\[JSON\\]", "").trim() : msg; - - for (final String part : stripped.split("\n")) - sender.sendMessage(part); - } -} - -/** - * A wrapper for advancements - */ -class AdvancementAccessor { - - private final NamespacedKey key; - private final String icon; - private final String message; - - AdvancementAccessor(final String message, final String icon) { - this.key = new NamespacedKey(SimplePlugin.getInstance(), UUID.randomUUID().toString()); - this.message = message; - this.icon = icon; - } - - public void show(final Player player) { - loadAdvancement(); - grantAdvancement(player); - - Common.runLater(10, () -> { - revokeAdvancement(player); - removeAdvancement(); - }); - } - - private void loadAdvancement() { - Bukkit.getUnsafe().loadAdvancement(key, compileJson0()); - } - - private String compileJson0() { - final JsonObject json = new JsonObject(); - - final JsonObject icon = new JsonObject(); - icon.addProperty("item", this.icon); - - final JsonObject display = new JsonObject(); - display.add("icon", icon); - display.addProperty("title", message); - display.addProperty("description", ""); - display.addProperty("background", "minecraft:textures/gui/advancements/backgrounds/adventure.png"); - display.addProperty("frame", "goal"); - display.addProperty("announce_to_chat", false); - display.addProperty("show_toast", true); - display.addProperty("hidden", true); - - final JsonObject criteria = new JsonObject(); - - final JsonObject trigger = new JsonObject(); - trigger.addProperty("trigger", "minecraft:impossible"); - - criteria.add("impossible", trigger); - - json.add("criteria", criteria); - json.add("display", display); - - return new Gson().toJson(json); - } - - private void grantAdvancement(final Player plazer) { - final Advancement adv = getAdvancement(); - final AdvancementProgress progress = plazer.getAdvancementProgress(adv); - - if (!progress.isDone()) - progress.getRemainingCriteria().forEach(crit -> progress.awardCriteria(crit)); - } - - private void revokeAdvancement(final Player plazer) { - final Advancement adv = getAdvancement(); - final AdvancementProgress prog = plazer.getAdvancementProgress(adv); - - if (prog.isDone()) - prog.getAwardedCriteria().forEach(crit -> prog.revokeCriteria(crit)); - } - - private void removeAdvancement() { - Bukkit.getUnsafe().removeAdvancement(key); - } - - private Advancement getAdvancement() { - return Bukkit.getAdvancement(key); - } -} - -class PotionSetter { - - /** - * Attempts to insert a certain potion to the given item - * - * @param item - * @param type - * @param level - */ - public static void setPotion(final ItemStack item, final PotionEffectType type, final int level) { - Valid.checkBoolean(item.getItemMeta() instanceof org.bukkit.inventory.meta.PotionMeta, "Can only use setPotion for items with PotionMeta not: " + item.getItemMeta()); - - final PotionType wrapped = PotionType.getByEffect(type); - final org.bukkit.inventory.meta.PotionMeta meta = (org.bukkit.inventory.meta.PotionMeta) item.getItemMeta(); - - try { - final org.bukkit.potion.PotionData data = new org.bukkit.potion.PotionData(level > 0 && wrapped != null ? wrapped : PotionType.WATER); - - if (level > 0 && wrapped == null) - meta.addEnchant(Enchantment.DURABILITY, 1, true); - - meta.setBasePotionData(data); - - } catch (final NoSuchMethodError | NoClassDefFoundError ex) { - meta.setMainEffect(type); - meta.addCustomEffect(new PotionEffect(type, Integer.MAX_VALUE, level - 1), true); - } - - item.setItemMeta(meta); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/BossBarInternals.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/BossBarInternals.java deleted file mode 100644 index 8c1cf530c8d8d992e36bae3ce7e776d1fcf9ee51..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/BossBarInternals.java +++ /dev/null @@ -1,399 +0,0 @@ -package org.mineacademy.fo.remain.internal; - -import java.util.HashMap; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerKickEvent; -import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.event.player.PlayerRespawnEvent; -import org.bukkit.event.player.PlayerTeleportEvent; -import org.bukkit.event.server.PluginDisableEvent; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompBarColor; -import org.mineacademy.fo.remain.CompBarStyle; -import org.mineacademy.fo.remain.Remain; - -import lombok.Getter; - -/** - * The classes handling Boss Bar cross-server compatibility are based off of the - * code by SoThatsIt. - * <p> - * http://forums.bukkit.org/threads/tutorial-utilizing-the-boss-health-bar.158018/page-2#post-1760928 - */ -public final class BossBarInternals implements Listener { - - /** - * The singleton instance - */ - @Getter - private static BossBarInternals instance = new BossBarInternals(); - - /** - * The fake dragon class - */ - private final Class<?> entityClass; - - /** - * Does the current MC version require us to spawn the dragon below ground? - */ - private final boolean isBelowGround; - - /** - * The player currently viewing the boss bar - */ - private final HashMap<UUID, NMSDragon> players = new HashMap<>(); - - /** - * Currently running timers (for temporary boss bars) - */ - private final HashMap<UUID, Integer> timers = new HashMap<>(); - - // Singleton - private BossBarInternals() { - - if (MinecraftVersion.olderThan(V.v1_6)) { - this.entityClass = null; - this.isBelowGround = false; - } - - else if (Remain.isProtocol18Hack()) { - this.entityClass = NMSDragon_v1_8Hack.class; - this.isBelowGround = false; - - } else if (MinecraftVersion.equals(V.v1_6)) { - this.entityClass = NMSDragon_v1_6.class; - this.isBelowGround = true; - - } else if (MinecraftVersion.equals(V.v1_7)) { - this.entityClass = NMSDragon_v1_7.class; - this.isBelowGround = true; - - } else if (MinecraftVersion.equals(V.v1_8)) { - this.entityClass = NMSDragon_v1_8.class; - this.isBelowGround = false; - - } else { - this.entityClass = NMSDragon_v1_9.class; - this.isBelowGround = true; - } - - if (MinecraftVersion.atLeast(V.v1_6)) { - Valid.checkNotNull(entityClass, "Compatible does not support Boss bar on MC version " + MinecraftVersion.getServerVersion() + "!"); - - Common.registerEvents(this); - - if (Remain.isProtocol18Hack()) - Common.runTimer(5, () -> { - for (final UUID uuid : players.keySet()) { - final Player player = Remain.getPlayerByUUID(uuid); - - Remain.sendPacket(player, players.get(uuid).getTeleportPacket(getDragonLocation(player.getLocation()))); - } - }); - } - } - - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void onPluginDisable(final PluginDisableEvent event) { - if (event.getPlugin().equals(SimplePlugin.getInstance())) - this.stop(); - } - - // Removes bars from all players - private void stop() { - for (final Player player : Remain.getOnlinePlayers()) - this.removeBar(player); - - this.players.clear(); - - for (final int timerID : this.timers.values()) - Bukkit.getScheduler().cancelTask(timerID); - - this.timers.clear(); - } - - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void onPlayerQuit(final PlayerQuitEvent event) { - this.removeBar(event.getPlayer()); - } - - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void onPlayerKick(final PlayerKickEvent event) { - this.removeBar(event.getPlayer()); - } - - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void onPlayerTeleport(final PlayerTeleportEvent event) { - this.handleTeleport(event.getPlayer(), event.getTo().clone()); - } - - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void onPlayerTeleport(final PlayerRespawnEvent event) { - this.handleTeleport(event.getPlayer(), event.getRespawnLocation().clone()); - } - - // Fixes bar disappearing on teleport - private void handleTeleport(final Player player, final Location loc) { - if (!this.hasBar(player)) - return; - - final NMSDragon oldDragon = this.getDragon(player, ""); - - if (oldDragon instanceof NMSDragon_v1_9) - return; - - Common.runLater(2, () -> { - if (!this.hasBar(player)) - return; - - final float health = oldDragon.getHealth(); - final String message = oldDragon.getName(); - - Remain.sendPacket(player, this.getDragon(player, "").getDestroyPacket()); - - this.players.remove(player.getUniqueId()); - - final NMSDragon dragon = this.addDragon(player, loc, message); - dragon.setHealthF(health); - - this.sendDragon(dragon, player); - }); - } - - /** - * Set a message for the given player.<br> - * It will remain there until the player logs off or another plugin overrides - * it.<br> - * This method will show a health bar using the given percentage value and will - * cancel any running timers. - * - * @param player The player who should see the given message. - * @param message The message shown to the player.<br> - * Due to limitations in Minecraft this message cannot be longer - * than 64 characters.<br> - * It will be cut to that size automatically. - * @param percent The percentage of the health bar filled.<br> - * This value must be between 0F (inclusive) and 100F - * (inclusive). - * @throws IllegalArgumentException If the percentage is not within valid - * bounds. - */ - public void setMessage(final Player player, final String message, final float percent, final CompBarColor color, final CompBarStyle style) { - Valid.checkBoolean(0F <= percent && percent <= 100F, "Percent must be between 0F and 100F, but was: " + percent); - - if (this.entityClass == null) - return; - - if (hasBar(player)) - removeBar(player); - - final NMSDragon dragon = getDragon(player, message); - - dragon.setName(cleanMessage(message)); - dragon.setHealthF(percent / 100f * dragon.getMaxHealth()); - - if (color != null) - dragon.barColor = color; - - if (style != null) - dragon.barStyle = style; - - cancelTimer(player); - - sendDragon(dragon, player); - } - - /** - * Set a message for the given player.<br> - * It will remain there until the player logs off or another plugin overrides - * it.<br> - * This method will use the health bar as a decreasing timer, all previously - * started timers will be cancelled.<br> - * The timer starts with a full bar.<br> - * The health bar will be removed automatically if it hits zero. - * - * @param player The player who should see the given timer/message. - * @param message The message shown to the player.<br> - * Due to limitations in Minecraft this message cannot be longer - * than 64 characters.<br> - * It will be cut to that size automatically. - * @param seconds The amount of seconds displayed by the timer.<br> - * Supports values above 1 (inclusive). - * @throws IllegalArgumentException If seconds is zero or below. - */ - public void setMessage(final Player player, final String message, final int seconds, final CompBarColor color, final CompBarStyle style) { - Valid.checkBoolean(seconds > 0, "Seconds must be > 1 "); - - if (this.entityClass == null) - return; - - if (hasBar(player)) - removeBar(player); - - final NMSDragon dragon = getDragon(player, message); - - dragon.setName(cleanMessage(message)); - dragon.setHealthF(dragon.getMaxHealth()); - - if (color != null) - dragon.barColor = color; - if (style != null) - dragon.barStyle = style; - - final float dragonHealthMinus = dragon.getMaxHealth() / seconds; - - cancelTimer(player); - - this.timers.put(player.getUniqueId(), Common.runTimer(20, 20, () -> { - final NMSDragon drag = getDragon(player, ""); - drag.setHealthF(drag.getHealth() - dragonHealthMinus); - - if (drag.getHealth() <= 1) { - removeBar(player); - cancelTimer(player); - } else - sendDragon(drag, player); - - }).getTaskId()); - - sendDragon(dragon, player); - } - - /** - * Removes the bar from the given player - * - * @param player - */ - public void removeBar(final Player player) { - - if (this.entityClass == null) - return; - - if (!hasBar(player)) - return; - - final NMSDragon dragon = getDragon(player, ""); - - if (dragon instanceof NMSDragon_v1_9) - ((NMSDragon_v1_9) dragon).removePlayer(player); - else - Remain.sendPacket(player, getDragon(player, "").getDestroyPacket()); - - this.players.remove(player.getUniqueId()); - - cancelTimer(player); - } - - private boolean hasBar(final Player player) { - return this.players.containsKey(player.getUniqueId()); - } - - private static String cleanMessage(String message) { - if (message.length() > 64) - message = message.substring(0, 63); - - return message; - } - - private void cancelTimer(final Player player) { - final Integer timerID = this.timers.remove(player.getUniqueId()); - - if (timerID != null) - Bukkit.getScheduler().cancelTask(timerID); - } - - private void sendDragon(final NMSDragon dragon, final Player player) { - if (dragon instanceof NMSDragon_v1_9) { - final NMSDragon_v1_9 bar = (NMSDragon_v1_9) dragon; - - bar.addPlayer(player); - bar.setProgress(dragon.getHealth() / dragon.getMaxHealth()); - - } else { - Remain.sendPacket(player, dragon.getMetaPacket(dragon.getWatcher())); - Remain.sendPacket(player, dragon.getTeleportPacket(getDragonLocation(player.getLocation()))); - } - } - - private NMSDragon getDragon(final Player player, final String message) { - if (this.hasBar(player)) - return this.players.get(player.getUniqueId()); - - return addDragon(player, cleanMessage(message)); - } - - private NMSDragon addDragon(final Player player, final String message) { - return this.addDragon(player, player.getLocation(), message); - } - - private NMSDragon addDragon(final Player player, final Location loc, final String message) { - final NMSDragon dragon = newDragon(message, getDragonLocation(loc)); - - if (dragon instanceof NMSDragon_v1_9) - ((NMSDragon_v1_9) dragon).addPlayer(player); - - else - Remain.sendPacket(player, dragon.getSpawnPacket()); - - this.players.put(player.getUniqueId(), dragon); - - return dragon; - } - - private Location getDragonLocation(Location loc) { - if (this.isBelowGround) { - loc.subtract(0, 300, 0); - return loc; - } - - final float pitch = loc.getPitch(); - - if (pitch >= 55) - loc.add(0, -300, 0); - else if (pitch <= -55) - loc.add(0, 300, 0); - else - loc = loc.getBlock().getRelative(getDirection(loc), Bukkit.getViewDistance() * 16).getLocation(); - - loc.subtract(0, 150, 0); - - return loc; - } - - private static BlockFace getDirection(final Location loc) { - final float dir = Math.round(loc.getYaw() / 90); - if (dir == -4 || dir == 0 || dir == 4) - return BlockFace.SOUTH; - if (dir == -1 || dir == 3) - return BlockFace.EAST; - if (dir == -2 || dir == 2) - return BlockFace.NORTH; - if (dir == -3 || dir == 1) - return BlockFace.WEST; - return null; - } - - private NMSDragon newDragon(final String message, final Location loc) { - NMSDragon fakeDragon = null; - - try { - fakeDragon = (NMSDragon) this.entityClass.getConstructor(String.class, Location.class).newInstance(message, loc); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return fakeDragon; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/ChatInternals.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/ChatInternals.java deleted file mode 100644 index 2e6b1feef934b4db79d97f01d64ae9ced20ecc11..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/ChatInternals.java +++ /dev/null @@ -1,251 +0,0 @@ -package org.mineacademy.fo.remain.internal; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.bukkit.Bukkit; -import org.bukkit.entity.Player; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.ReflectionUtil.ReflectionException; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.remain.Remain; - -/** - * Reflection class for handling chat-related methods - * - * @deprecated internal use only, please use {@link Remain} - * to call methods from this class for best performance - */ -@Deprecated -public class ChatInternals { - - private static Object enumTitle; - private static Object enumSubtitle; - private static Object enumReset; - - private static Constructor<?> tabConstructor; - - private static Constructor<?> titleTimesConstructor; - private static Constructor<?> titleConstructor; - private static Constructor<?> subtitleConstructor; - private static Constructor<?> resetTitleConstructor; - - private static Method componentSerializer; - private static Constructor<?> chatMessageConstructor; - - // Prevent new instance, always call static methods - public ChatInternals() { - } - - static { - - // New MC versions have native API's - if (MinecraftVersion.newerThan(V.v1_6) && MinecraftVersion.olderThan(V.v1_12)) - try { - - final Class<?> chatBaseComponent = ReflectionUtil.getNMSClass("IChatBaseComponent", "N/A"); - - Class<?> serializer = null; - if (MinecraftVersion.newerThan(V.v1_7)) - serializer = chatBaseComponent.getDeclaredClasses()[0]; - else - serializer = ReflectionUtil.getNMSClass("ChatSerializer", "N/A"); - - componentSerializer = serializer.getMethod("a", String.class); - - final Class<?> chatPacket = ReflectionUtil.getNMSClass("PacketPlayOutChat", "N/A"); - - if (MinecraftVersion.newerThan(V.v1_11)) - chatMessageConstructor = chatPacket.getConstructor(chatBaseComponent, ReflectionUtil.getNMSClass("ChatMessageType", "N/A")); - else - chatMessageConstructor = MinecraftVersion.newerThan(V.v1_7) ? chatPacket.getConstructor(chatBaseComponent, byte.class) : chatPacket.getConstructor(chatBaseComponent); - - if (MinecraftVersion.newerThan(V.v1_7)) { - final Class<?> titlePacket = ReflectionUtil.getNMSClass("PacketPlayOutTitle", "N/A"); - final Class<?> enumAction = titlePacket.getDeclaredClasses()[0]; - - enumTitle = enumAction.getField("TITLE").get(null); - enumSubtitle = enumAction.getField("SUBTITLE").get(null); - enumReset = enumAction.getField("RESET").get(null); - - tabConstructor = ReflectionUtil.getNMSClass("PacketPlayOutPlayerListHeaderFooter", "N/A").getConstructor(chatBaseComponent); - - titleTimesConstructor = titlePacket.getConstructor(int.class, int.class, int.class); - titleConstructor = titlePacket.getConstructor(enumAction, chatBaseComponent); - subtitleConstructor = titlePacket.getConstructor(enumAction, chatBaseComponent); - resetTitleConstructor = titlePacket.getConstructor(enumAction, chatBaseComponent); - } - - } catch (final Exception ex) { - if (MinecraftVersion.olderThan(V.v1_8)) - Common.log("Error initiating Chat/Title/ActionBAR API. Assuming Thermos or modded. Some features will not work."); - - else { - ex.printStackTrace(); - - throw new ReflectionException(ex, "Error initiating Chat/Title/ActionBAR API (incompatible Craftbukkit? - " + Bukkit.getVersion() + " / " + Bukkit.getBukkitVersion() + " / " + MinecraftVersion.getServerVersion() + ")"); - } - } - } - - /** - * Send a title to player - * - * @param player - * @param fadeIn - * @param stay - * @param fadeOut - * @param title - * @param subtitle - */ - public static void sendTitleLegacy(final Player player, final int fadeIn, final int stay, final int fadeOut, final String title, final String subtitle) { - Valid.checkBoolean(MinecraftVersion.olderThan(V.v1_12), "This method is unsupported on MC 1.13 and later"); - - try { - if (titleConstructor == null) - return; - - resetTitleLegacy(player); - - if (titleTimesConstructor != null) { - final Object packet = titleTimesConstructor.newInstance(fadeIn, stay, fadeOut); - - Remain.sendPacket(player, packet); - } - - if (title != null) { - final Object chatTitle = serializeText(title); - final Object packet = titleConstructor.newInstance(enumTitle, chatTitle); - - Remain.sendPacket(player, packet); - } - - if (subtitle != null) { - final Object chatSubtitle = serializeText(subtitle); - final Object packet = subtitleConstructor.newInstance(enumSubtitle, chatSubtitle); - - Remain.sendPacket(player, packet); - } - } catch (final ReflectiveOperationException ex) { - throw new ReflectionException(ex, "Error sending title to: " + player.getName() + ", title: " + title + ", subtitle: " + subtitle); - } - } - - /** - * Reset title for player - * - * @param player - */ - public static void resetTitleLegacy(final Player player) { - Valid.checkBoolean(MinecraftVersion.olderThan(V.v1_12), "This method is unsupported on MC 1.13 and later"); - - try { - if (resetTitleConstructor == null) - return; - - final Object packet = resetTitleConstructor.newInstance(enumReset, null); - - Remain.sendPacket(player, packet); - } catch (final ReflectiveOperationException ex) { - throw new ReflectionException("Error resetting title to: " + player.getName()); - } - } - - /** - * Send tablist to player - * - * @param player - * @param headerRaw - * @param footerRaw - */ - public static void sendTablistLegacy(final Player player, final String headerRaw, final String footerRaw) { - Valid.checkBoolean(MinecraftVersion.olderThan(V.v1_12), "This method is unsupported on MC 1.13 and later"); - - try { - if (tabConstructor == null) - return; - - final Object header = serializeText(headerRaw); - final Object packet = tabConstructor.newInstance(header); - - if (footerRaw != null) { - final Object footer = serializeText(footerRaw); - - final Field f = packet.getClass().getDeclaredField("b"); // setFooter - f.setAccessible(true); - f.set(packet, footer); - } - - Remain.sendPacket(player, packet); - - } catch (final ReflectiveOperationException ex) { - Common.error(ex, "Failed to send tablist to " + player.getName() + ", title: " + headerRaw + " " + footerRaw); - } - } - - /** - * Send action bar to player - * - * @param player - * @param message - */ - public static void sendActionBarLegacy(final Player player, final String message) { - Valid.checkBoolean(MinecraftVersion.olderThan(V.v1_12), "This method is unsupported on MC 1.13 and later"); - - sendChat(player, message, (byte) 2); - } - - // http://wiki.vg/Protocol#Chat_Message - private static void sendChat(final Player pl, final String text, final byte type) { - try { - final Object message = serializeText(text); - Valid.checkNotNull(message, "Message cannot be null!"); - - final Object packet; - - if (MinecraftVersion.atLeast(V.v1_12)) { - final Class<?> chatMessageTypeEnum = ReflectionUtil.getNMSClass("ChatMessageType", "net.minecraft.network.chat.ChatMessageType"); - - packet = chatMessageConstructor.newInstance(message, chatMessageTypeEnum.getMethod("a", byte.class).invoke(null, type)); - - } else - packet = chatMessageConstructor.newInstance(message, type); - - Remain.sendPacket(pl, packet); - - } catch (final ReflectiveOperationException ex) { - Common.error(ex, "Failed to send chat packet type " + type + " to " + pl.getName() + ", message: " + text); - } - } - - private static Object serializeText(String text) throws ReflectiveOperationException { - text = removeBracketsAndColorize(text); - - try { - return componentSerializer.invoke(null, SerializedMap.of("text", text).toJson()); - - } catch (final Throwable t) { - throw new FoException(t, "Failed to serialize text: " + text); - } - } - - private static String removeBracketsAndColorize(String text) { - if (text == null) - return ""; - - if (text.startsWith("\"") && text.endsWith("\"") || text.startsWith("'") && text.endsWith("'")) - text = text.substring(1, text.length() - 1); - - return Common.colorize(text); - } - - public static void callStatic() { - // Test compatibility - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon.java deleted file mode 100644 index 9a1aef709837ffb43adf203054106806256dcd35..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.mineacademy.fo.remain.internal; - -import org.bukkit.Location; -import org.mineacademy.fo.remain.CompBarColor; -import org.mineacademy.fo.remain.CompBarStyle; -import org.mineacademy.fo.remain.Remain; - -import lombok.Getter; -import lombok.Setter; - -/** - * Represents the fake dragon entity - * <p> - * Typically you dont have to use this at all. - */ -@Getter -@Setter -abstract class NMSDragon { - - private float maxHealth = 200; - private int x; - private int y; - private int z; - - private int pitch = 0; - private int yaw = 0; - private byte xvel = 0; - private byte yvel = 0; - private byte zvel = 0; - private float health = 0; - private boolean visible = false; - private String name; - private Object world; - - protected CompBarColor barColor; - protected CompBarStyle barStyle; - - NMSDragon(String name, Location loc, int percent) { - this.name = name; - this.x = loc.getBlockX(); - this.y = loc.getBlockY(); - this.z = loc.getBlockZ(); - this.health = percent / 100F * maxHealth; - this.world = Remain.getHandleWorld(loc.getWorld()); - } - - NMSDragon(String name, Location loc) { - this.name = name; - this.x = loc.getBlockX(); - this.y = loc.getBlockY(); - this.z = loc.getBlockZ(); - this.world = Remain.getHandleWorld(loc.getWorld()); - } - - void setHealth(int percent) { - this.health = percent / 100F * maxHealth; - } - - void setHealthF(float health) { - this.health = health; - } - - abstract Object getSpawnPacket(); - - abstract Object getDestroyPacket(); - - abstract Object getMetaPacket(Object watcher); - - abstract Object getTeleportPacket(Location loc); - - abstract Object getWatcher(); - - abstract Object getNMSEntity(); -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon_v1_6.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon_v1_6.java deleted file mode 100644 index 4753708b66f444194239237db5b98af8977b60db..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon_v1_6.java +++ /dev/null @@ -1,192 +0,0 @@ -package org.mineacademy.fo.remain.internal; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.bukkit.Location; -import org.bukkit.entity.EntityType; -import org.mineacademy.fo.ReflectionUtil; - -/** - * Represents a fake dragon entity for Minecraft 1.6.x - */ -class NMSDragon_v1_6 extends NMSDragon { - - private static final Integer EntityID = 6000; - - public NMSDragon_v1_6(String name, Location loc) { - super(name, loc); - } - - @Override - public Object getSpawnPacket() { - final Class<?> mob_class = ReflectionUtil.getNMSClass("Packet24MobSpawn", "N/A"); - Object mobPacket = null; - try { - mobPacket = mob_class.newInstance(); - - final Field a = ReflectionUtil.getDeclaredField(mob_class, "a"); - a.setAccessible(true); - a.set(mobPacket, EntityID);// Entity ID - - final Field b = ReflectionUtil.getDeclaredField(mob_class, "b"); - b.setAccessible(true); - b.set(mobPacket, EntityType.ENDER_DRAGON.getTypeId());// Mob type - - // (ID: 64) - final Field c = ReflectionUtil.getDeclaredField(mob_class, "c"); - c.setAccessible(true); - c.set(mobPacket, getX());// X position - - final Field d = ReflectionUtil.getDeclaredField(mob_class, "d"); - d.setAccessible(true); - d.set(mobPacket, getY());// Y position - - final Field e = ReflectionUtil.getDeclaredField(mob_class, "e"); - e.setAccessible(true); - e.set(mobPacket, getZ());// Z position - - final Field f = ReflectionUtil.getDeclaredField(mob_class, "f"); - f.setAccessible(true); - f.set(mobPacket, (byte) (int) (getPitch() * 256.0F / 360.0F));// Pitch - - final Field g = ReflectionUtil.getDeclaredField(mob_class, "g"); - g.setAccessible(true); - g.set(mobPacket, (byte) 0);// Head - - // Pitch - final Field h = ReflectionUtil.getDeclaredField(mob_class, "h"); - h.setAccessible(true); - h.set(mobPacket, (byte) (int) (getYaw() * 256.0F / 360.0F));// Yaw - - final Field i = ReflectionUtil.getDeclaredField(mob_class, "i"); - i.setAccessible(true); - i.set(mobPacket, getXvel());// X velocity - - final Field j = ReflectionUtil.getDeclaredField(mob_class, "j"); - j.setAccessible(true); - j.set(mobPacket, getYvel());// Y velocity - - final Field k = ReflectionUtil.getDeclaredField(mob_class, "k"); - k.setAccessible(true); - k.set(mobPacket, getZvel());// Z velocity - - final Object watcher = getWatcher(); - final Field t = ReflectionUtil.getDeclaredField(mob_class, "t"); - t.setAccessible(true); - t.set(mobPacket, watcher); - - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return mobPacket; - } - - @Override - public Object getDestroyPacket() { - final Class<?> packet_class = ReflectionUtil.getNMSClass("Packet29DestroyEntity", "N/A"); - Object packet = null; - - try { - packet = packet_class.newInstance(); - - final Field a = ReflectionUtil.getDeclaredField(packet_class, "a"); - a.setAccessible(true); - a.set(packet, new int[] { EntityID }); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return packet; - } - - @Override - public Object getMetaPacket(Object watcher) { - final Class<?> packet_class = ReflectionUtil.getNMSClass("Packet40EntityMetadata", "N/A"); - Object packet = null; - - try { - packet = packet_class.newInstance(); - - final Field a = ReflectionUtil.getDeclaredField(packet_class, "a"); - a.setAccessible(true); - a.set(packet, EntityID); - - final Method watcher_c = ReflectionUtil.getMethod(watcher.getClass(), "c"); - final Field b = ReflectionUtil.getDeclaredField(packet_class, "b"); - b.setAccessible(true); - b.set(packet, watcher_c.invoke(watcher)); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return packet; - } - - @Override - public Object getTeleportPacket(Location loc) { - final Class<?> packet_class = ReflectionUtil.getNMSClass("Packet34EntityTeleport", "N/A"); - Object packet = null; - - try { - packet = packet_class.newInstance(); - - final Field a = ReflectionUtil.getDeclaredField(packet_class, "a"); - a.setAccessible(true); - a.set(packet, EntityID); - - final Field b = ReflectionUtil.getDeclaredField(packet_class, "b"); - b.setAccessible(true); - b.set(packet, (int) Math.floor(loc.getX() * 32.0D)); - - final Field c = ReflectionUtil.getDeclaredField(packet_class, "c"); - c.setAccessible(true); - c.set(packet, (int) Math.floor(loc.getY() * 32.0D)); - - final Field d = ReflectionUtil.getDeclaredField(packet_class, "d"); - d.setAccessible(true); - d.set(packet, (int) Math.floor(loc.getZ() * 32.0D)); - - final Field e = ReflectionUtil.getDeclaredField(packet_class, "e"); - e.setAccessible(true); - e.set(packet, (byte) (int) (loc.getYaw() * 256.0F / 360.0F)); - - final Field f = ReflectionUtil.getDeclaredField(packet_class, "f"); - f.setAccessible(true); - f.set(packet, (byte) (int) (loc.getPitch() * 256.0F / 360.0F)); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - return packet; - } - - @Override - public Object getWatcher() { - final Class<?> watcher_class = ReflectionUtil.getNMSClass("DataWatcher", "N/A"); - Object watcher = null; - - try { - watcher = watcher_class.newInstance(); - - final Method a = ReflectionUtil.getMethod(watcher_class, "a", int.class, Object.class); - a.setAccessible(true); - - a.invoke(watcher, 0, isVisible() ? (byte) 0 : (byte) 0x20); - a.invoke(watcher, 6, getHealth()); - a.invoke(watcher, 7, 0); - a.invoke(watcher, 8, (byte) 0); - a.invoke(watcher, 10, getName()); - a.invoke(watcher, 11, (byte) 1); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return watcher; - } - - @Override - Object getNMSEntity() { - return null; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon_v1_7.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon_v1_7.java deleted file mode 100644 index 70fcca3a90e716066c59dcc46145a41e24c083f1..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon_v1_7.java +++ /dev/null @@ -1,138 +0,0 @@ -package org.mineacademy.fo.remain.internal; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.bukkit.Location; -import org.mineacademy.fo.ReflectionUtil; - -/** - * Represents a fake dragon entity for Minecraft 1.7.x - */ -class NMSDragon_v1_7 extends NMSDragon { - - private Object dragon; - private int id; - - public NMSDragon_v1_7(String name, Location loc) { - super(name, loc); - } - - @Override - public Object getSpawnPacket() { - final Class<?> Entity = ReflectionUtil.getNMSClass("Entity", "N/A"); - final Class<?> EntityLiving = ReflectionUtil.getNMSClass("EntityLiving", "N/A"); - final Class<?> EntityEnderDragon = ReflectionUtil.getNMSClass("EntityEnderDragon", "N/A"); - Object packet = null; - try { - dragon = EntityEnderDragon.getConstructor(ReflectionUtil.getNMSClass("World", "N/A")).newInstance(getWorld()); - - final Method setLocation = ReflectionUtil.getMethod(EntityEnderDragon, "setLocation", double.class, double.class, double.class, float.class, float.class); - setLocation.invoke(dragon, getX(), getY(), getZ(), getPitch(), getYaw()); - - final Method setInvisible = ReflectionUtil.getMethod(EntityEnderDragon, "setInvisible", boolean.class); - setInvisible.invoke(dragon, isVisible()); - - final Method setCustomName = ReflectionUtil.getMethod(EntityEnderDragon, "setCustomName", String.class); - setCustomName.invoke(dragon, getName()); - - final Method setHealth = ReflectionUtil.getMethod(EntityEnderDragon, "setHealth", float.class); - setHealth.invoke(dragon, getHealth()); - - final Field motX = ReflectionUtil.getDeclaredField(Entity, "motX"); - motX.set(dragon, getXvel()); - - final Field motY = ReflectionUtil.getDeclaredField(Entity, "motY"); - motY.set(dragon, getYvel()); - - final Field motZ = ReflectionUtil.getDeclaredField(Entity, "motZ"); - motZ.set(dragon, getZvel()); - - final Method getId = ReflectionUtil.getMethod(EntityEnderDragon, "getId"); - this.id = (Integer) getId.invoke(dragon); - - final Class<?> PacketPlayOutSpawnEntityLiving = ReflectionUtil.getNMSClass("PacketPlayOutSpawnEntityLiving", "N/A"); - - packet = PacketPlayOutSpawnEntityLiving.getConstructor(EntityLiving).newInstance(dragon); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return packet; - } - - @Override - public Object getDestroyPacket() { - final Class<?> PacketPlayOutEntityDestroy = ReflectionUtil.getNMSClass("PacketPlayOutEntityDestroy", "N/A"); - - Object packet = null; - try { - packet = PacketPlayOutEntityDestroy.newInstance(); - final Field a = PacketPlayOutEntityDestroy.getDeclaredField("a"); - a.setAccessible(true); - a.set(packet, new int[] { id }); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return packet; - } - - @Override - public Object getMetaPacket(Object watcher) { - final Class<?> DataWatcher = ReflectionUtil.getNMSClass("DataWatcher", "N/A"); - - final Class<?> PacketPlayOutEntityMetadata = ReflectionUtil.getNMSClass("PacketPlayOutEntityMetadata", "N/A"); - - Object packet = null; - try { - packet = PacketPlayOutEntityMetadata.getConstructor(int.class, DataWatcher, boolean.class).newInstance(id, watcher, true); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return packet; - } - - @Override - public Object getTeleportPacket(Location loc) { - final Class<?> PacketPlayOutEntityTeleport = ReflectionUtil.getNMSClass("PacketPlayOutEntityTeleport", "N/A"); - - Object packet = null; - - try { - packet = PacketPlayOutEntityTeleport.getConstructor(int.class, int.class, int.class, int.class, byte.class, byte.class).newInstance(this.id, loc.getBlockX() * 32, loc.getBlockY() * 32, loc.getBlockZ() * 32, (byte) ((int) loc.getYaw() * 256 / 360), (byte) ((int) loc.getPitch() * 256 / 360)); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return packet; - } - - @Override - public Object getWatcher() { - final Class<?> Entity = ReflectionUtil.getNMSClass("Entity", "N/A"); - final Class<?> DataWatcher = ReflectionUtil.getNMSClass("DataWatcher", "N/A"); - - Object watcher = null; - try { - watcher = DataWatcher.getConstructor(Entity).newInstance(dragon); - final Method a = ReflectionUtil.getMethod(DataWatcher, "a", int.class, Object.class); - - a.invoke(watcher, 0, isVisible() ? (byte) 0 : (byte) 0x20); - a.invoke(watcher, 6, getHealth()); - a.invoke(watcher, 7, 0); - a.invoke(watcher, 8, (byte) 0); - a.invoke(watcher, 10, getName()); - a.invoke(watcher, 11, (byte) 1); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - return watcher; - } - - @Override - Object getNMSEntity() { - return this.dragon; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon_v1_8.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon_v1_8.java deleted file mode 100644 index 58208a5b12308b97b1de1212acf83234a4d88a29..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon_v1_8.java +++ /dev/null @@ -1,136 +0,0 @@ -package org.mineacademy.fo.remain.internal; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.bukkit.Location; -import org.mineacademy.fo.ReflectionUtil; - -/** - * Represents a fake dragon entity for Minecraft 1.8.x - */ -class NMSDragon_v1_8 extends NMSDragon { - private Object dragon; - private int id; - - public NMSDragon_v1_8(String name, Location loc) { - super(name, loc); - } - - @Override - public Object getSpawnPacket() { - final Class<?> Entity = ReflectionUtil.getNMSClass("Entity", "N/A"); - final Class<?> EntityLiving = ReflectionUtil.getNMSClass("EntityLiving", "N/A"); - final Class<?> EntityEnderDragon = ReflectionUtil.getNMSClass("EntityEnderDragon", "N/A"); - Object packet = null; - - try { - dragon = EntityEnderDragon.getConstructor(ReflectionUtil.getNMSClass("World", "N/A")).newInstance(getWorld()); - - final Method setLocation = ReflectionUtil.getMethod(EntityEnderDragon, "setLocation", double.class, double.class, double.class, float.class, float.class); - setLocation.invoke(dragon, getX(), getY(), getZ(), getPitch(), getYaw()); - - final Method setInvisible = ReflectionUtil.getMethod(EntityEnderDragon, "setInvisible", boolean.class); - setInvisible.invoke(dragon, true); - - final Method setCustomName = ReflectionUtil.getMethod(EntityEnderDragon, "setCustomName", String.class); - setCustomName.invoke(dragon, getName()); - - final Method setHealth = ReflectionUtil.getMethod(EntityEnderDragon, "setHealth", float.class); - setHealth.invoke(dragon, getHealth()); - - final Field motX = ReflectionUtil.getDeclaredField(Entity, "motX"); - motX.set(dragon, getXvel()); - - final Field motY = ReflectionUtil.getDeclaredField(Entity, "motY"); - motY.set(dragon, getYvel()); - - final Field motZ = ReflectionUtil.getDeclaredField(Entity, "motZ"); - motZ.set(dragon, getZvel()); - - final Method getId = ReflectionUtil.getMethod(EntityEnderDragon, "getId"); - this.id = (Integer) getId.invoke(dragon); - - packet = ReflectionUtil.getNMSClass("PacketPlayOutSpawnEntityLiving", "N/A").getConstructor(EntityLiving).newInstance(dragon); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return packet; - } - - @Override - public Object getDestroyPacket() { - final Class<?> PacketPlayOutEntityDestroy = ReflectionUtil.getNMSClass("PacketPlayOutEntityDestroy", "N/A"); - - Object packet = null; - try { - packet = PacketPlayOutEntityDestroy.newInstance(); - final Field a = PacketPlayOutEntityDestroy.getDeclaredField("a"); - a.setAccessible(true); - a.set(packet, new int[] { id }); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return packet; - } - - @Override - public Object getMetaPacket(Object watcher) { - final Class<?> DataWatcher = ReflectionUtil.getNMSClass("DataWatcher", "N/A"); - - final Class<?> PacketPlayOutEntityMetadata = ReflectionUtil.getNMSClass("PacketPlayOutEntityMetadata", "N/A"); - - Object packet = null; - try { - packet = PacketPlayOutEntityMetadata.getConstructor(int.class, DataWatcher, boolean.class).newInstance(id, watcher, true); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return packet; - } - - @Override - public Object getTeleportPacket(Location loc) { - final Class<?> PacketPlayOutEntityTeleport = ReflectionUtil.getNMSClass("PacketPlayOutEntityTeleport", "N/A"); - Object packet = null; - - try { - packet = PacketPlayOutEntityTeleport.getConstructor(int.class, int.class, int.class, int.class, byte.class, byte.class, boolean.class).newInstance(this.id, loc.getBlockX() * 32, loc.getBlockY() * 32, loc.getBlockZ() * 32, (byte) ((int) loc.getYaw() * 256 / 360), (byte) ((int) loc.getPitch() * 256 / 360), false); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return packet; - } - - @Override - public Object getWatcher() { - final Class<?> Entity = ReflectionUtil.getNMSClass("Entity", "N/A"); - final Class<?> DataWatcher = ReflectionUtil.getNMSClass("DataWatcher", "N/A"); - - Object watcher = null; - try { - watcher = DataWatcher.getConstructor(Entity).newInstance(dragon); - final Method a = ReflectionUtil.getMethod(DataWatcher, "a", int.class, Object.class); - - a.invoke(watcher, 5, isVisible() ? (byte) 0 : (byte) 0x20); - a.invoke(watcher, 6, getHealth()); - a.invoke(watcher, 7, 0); - a.invoke(watcher, 8, (byte) 0); - a.invoke(watcher, 10, getName()); - a.invoke(watcher, 11, (byte) 1); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return watcher; - } - - @Override - Object getNMSEntity() { - return this.dragon; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon_v1_8Hack.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon_v1_8Hack.java deleted file mode 100644 index 6acd742df6ca864e8df3177adfb39bdae024dfb6..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon_v1_8Hack.java +++ /dev/null @@ -1,136 +0,0 @@ -package org.mineacademy.fo.remain.internal; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.bukkit.Location; -import org.mineacademy.fo.ReflectionUtil; - -/** - * Represents a fake dragon entity for Minecraft 1.8 protocol hack - */ -class NMSDragon_v1_8Hack extends NMSDragon { - - private Object dragon; - private int id; - - public NMSDragon_v1_8Hack(String name, Location loc) { - super(name, loc); - } - - @Override - public Object getSpawnPacket() { - final Class<?> Entity = ReflectionUtil.getNMSClass("Entity", "N/A"); - final Class<?> EntityLiving = ReflectionUtil.getNMSClass("EntityLiving", "N/A"); - final Class<?> EntityEnderDragon = ReflectionUtil.getNMSClass("EntityEnderDragon", "N/A"); - Object packet = null; - try { - dragon = EntityEnderDragon.getConstructor(ReflectionUtil.getNMSClass("World", "N/A")).newInstance(getWorld()); - - final Method setLocation = ReflectionUtil.getMethod(EntityEnderDragon, "setLocation", double.class, double.class, double.class, float.class, float.class); - setLocation.invoke(dragon, getX(), getY(), getZ(), getPitch(), getYaw()); - - final Method setInvisible = ReflectionUtil.getMethod(EntityEnderDragon, "setInvisible", boolean.class); - setInvisible.invoke(dragon, true); - - final Method setCustomName = ReflectionUtil.getMethod(EntityEnderDragon, "setCustomName", String.class); - setCustomName.invoke(dragon, getName()); - - final Method setHealth = ReflectionUtil.getMethod(EntityEnderDragon, "setHealth", float.class); - setHealth.invoke(dragon, getHealth()); - - final Field motX = ReflectionUtil.getDeclaredField(Entity, "motX"); - motX.set(dragon, getXvel()); - - final Field motY = ReflectionUtil.getDeclaredField(Entity, "motY"); - motY.set(dragon, getYvel()); - - final Field motZ = ReflectionUtil.getDeclaredField(Entity, "motZ"); - motZ.set(dragon, getZvel()); - - final Method getId = ReflectionUtil.getMethod(EntityEnderDragon, "getId"); - this.id = (Integer) getId.invoke(dragon); - - final Class<?> PacketPlayOutSpawnEntityLiving = ReflectionUtil.getNMSClass("PacketPlayOutSpawnEntityLiving", "N/A"); - - packet = PacketPlayOutSpawnEntityLiving.getConstructor(EntityLiving).newInstance(dragon); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return packet; - } - - @Override - public Object getDestroyPacket() { - final Class<?> PacketPlayOutEntityDestroy = ReflectionUtil.getNMSClass("PacketPlayOutEntityDestroy", "N/A"); - - Object packet = null; - try { - packet = PacketPlayOutEntityDestroy.newInstance(); - final Field a = PacketPlayOutEntityDestroy.getDeclaredField("a"); - a.setAccessible(true); - a.set(packet, new int[] { id }); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return packet; - } - - @Override - public Object getMetaPacket(Object watcher) { - final Class<?> DataWatcher = ReflectionUtil.getNMSClass("DataWatcher", "N/A"); - - final Class<?> PacketPlayOutEntityMetadata = ReflectionUtil.getNMSClass("PacketPlayOutEntityMetadata", "N/A"); - - Object packet = null; - try { - packet = PacketPlayOutEntityMetadata.getConstructor(int.class, DataWatcher, boolean.class).newInstance(id, watcher, true); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - return packet; - } - - @Override - public Object getTeleportPacket(Location loc) { - final Class<?> PacketPlayOutEntityTeleport = ReflectionUtil.getNMSClass("PacketPlayOutEntityTeleport", "N/A"); - Object packet = null; - - try { - packet = PacketPlayOutEntityTeleport.getConstructor(int.class, int.class, int.class, int.class, byte.class, byte.class, boolean.class, boolean.class).newInstance(this.id, loc.getBlockX() * 32, loc.getBlockY() * 32, loc.getBlockZ() * 32, (byte) ((int) loc.getYaw() * 256 / 360), (byte) ((int) loc.getPitch() * 256 / 360), false, false); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - return packet; - } - - @Override - public Object getWatcher() { - final Class<?> Entity = ReflectionUtil.getNMSClass("Entity", "N/A"); - final Class<?> DataWatcher = ReflectionUtil.getNMSClass("DataWatcher", "N/A"); - - Object watcher = null; - try { - watcher = DataWatcher.getConstructor(Entity).newInstance(dragon); - final Method a = ReflectionUtil.getMethod(DataWatcher, "a", int.class, Object.class); - - a.invoke(watcher, 5, isVisible() ? (byte) 0 : (byte) 0x20); - a.invoke(watcher, 6, getHealth()); - a.invoke(watcher, 7, 0); - a.invoke(watcher, 8, (byte) 0); - a.invoke(watcher, 10, getName()); - a.invoke(watcher, 11, (byte) 1); - } catch (final ReflectiveOperationException e) { - e.printStackTrace(); - } - - return watcher; - } - - @Override - Object getNMSEntity() { - return this.dragon; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon_v1_9.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon_v1_9.java deleted file mode 100644 index d3ed3d61967585bf3f2790db1abf69caa67fde50..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/NMSDragon_v1_9.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.mineacademy.fo.remain.internal; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.boss.BarColor; -import org.bukkit.boss.BarStyle; -import org.bukkit.boss.BossBar; -import org.bukkit.entity.Player; - -/** - * Represents the native boss bar api for Minecraft 1.9 and newer - */ -class NMSDragon_v1_9 extends NMSDragon { - - private final BossBar bar; - - public NMSDragon_v1_9(String name, Location loc) { - super(name, loc); - - bar = Bukkit.createBossBar(name, BarColor.PINK, BarStyle.SOLID); - } - - public final void removePlayer(Player player) { - getBar().removePlayer(player); - } - - public final void addPlayer(Player player) { - getBar().addPlayer(player); - } - - public final void setProgress(double progress) { - getBar().setProgress(progress); - } - - private BossBar getBar() { - if (barColor != null) - bar.setColor(BarColor.valueOf(barColor.toString())); - - if (barStyle != null) - bar.setStyle(BarStyle.valueOf(barStyle.toString())); - - return bar; - } - - @Override - public Object getSpawnPacket() { - return null; - } - - @Override - public Object getDestroyPacket() { - return null; - } - - @Override - public Object getMetaPacket(Object watcher) { - return null; - } - - @Override - public Object getTeleportPacket(Location loc) { - return null; - } - - @Override - public Object getWatcher() { - return null; - } - - @Override - Object getNMSEntity() { - return null; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/package-info.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/package-info.java deleted file mode 100644 index b6b9b2bb0474ed1c4aa9c5122c5e49f6a37aa0e2..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/internal/package-info.java +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Classes in this package are for internal use only. Do not call them. - * <p> - * The reason is that we no longer need to use reflection or packets - * as much as before since many methods are covered nativelly - * in Spigot or PaperSpigot. - * <p> - * For best performance practises you should always look for relevant - * methods in {@link org.mineacademy.fo.remain.Remain} instead. - */ -package org.mineacademy.fo.remain.internal; diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/ClassWrapper.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/ClassWrapper.java deleted file mode 100644 index 603f2177e34186870e899d32f2f8be72a15a6a4a..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/ClassWrapper.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import org.bukkit.Bukkit; -import org.mineacademy.fo.Common; - -/** - * Wraps NMS and CRAFT classes - * - * @author tr7zw - * - */ -enum ClassWrapper { - CRAFT_ITEMSTACK(PackageWrapper.CRAFTBUKKIT, "inventory.CraftItemStack", null, null), - CRAFT_METAITEM(PackageWrapper.CRAFTBUKKIT, "inventory.CraftMetaItem", null, null), - CRAFT_ENTITY(PackageWrapper.CRAFTBUKKIT, "entity.CraftEntity", null, null), - CRAFT_WORLD(PackageWrapper.CRAFTBUKKIT, "CraftWorld", null, null), - CRAFT_PERSISTENTDATACONTAINER(PackageWrapper.CRAFTBUKKIT, "persistence.CraftPersistentDataContainer", - MinecraftVersion.MC1_14_R1, null), - NMS_NBTBASE(PackageWrapper.NMS, "NBTBase", null, null, "net.minecraft.nbt"), - NMS_NBTTAGSTRING(PackageWrapper.NMS, "NBTTagString", null, null, "net.minecraft.nbt"), - NMS_NBTTAGINT(PackageWrapper.NMS, "NBTTagInt", null, null, "net.minecraft.nbt"), - NMS_NBTTAGFLOAT(PackageWrapper.NMS, "NBTTagFloat", null, null, "net.minecraft.nbt"), - NMS_NBTTAGDOUBLE(PackageWrapper.NMS, "NBTTagDouble", null, null, "net.minecraft.nbt"), - NMS_NBTTAGLONG(PackageWrapper.NMS, "NBTTagLong", null, null, "net.minecraft.nbt"), - NMS_ITEMSTACK(PackageWrapper.NMS, "ItemStack", null, null, "net.minecraft.world.item"), - NMS_NBTTAGCOMPOUND(PackageWrapper.NMS, "NBTTagCompound", null, null, "net.minecraft.nbt"), - NMS_NBTTAGLIST(PackageWrapper.NMS, "NBTTagList", null, null, "net.minecraft.nbt"), - NMS_NBTCOMPRESSEDSTREAMTOOLS(PackageWrapper.NMS, "NBTCompressedStreamTools", null, null, "net.minecraft.nbt"), - NMS_MOJANGSONPARSER(PackageWrapper.NMS, "MojangsonParser", null, null, "net.minecraft.nbt"), - NMS_TILEENTITY(PackageWrapper.NMS, "TileEntity", null, null, "net.minecraft.world.level.block.entity"), - NMS_BLOCKPOSITION(PackageWrapper.NMS, "BlockPosition", MinecraftVersion.MC1_8_R3, null, "net.minecraft.core"), - NMS_WORLDSERVER(PackageWrapper.NMS, "WorldServer", null, null, "net.minecraft.server.level"), - NMS_MINECRAFTSERVER(PackageWrapper.NMS, "MinecraftServer", null, null, "net.minecraft.server"), - NMS_WORLD(PackageWrapper.NMS, "World", null, null, "net.minecraft.world.level"), - NMS_ENTITY(PackageWrapper.NMS, "Entity", null, null, "net.minecraft.world.entity"), - NMS_ENTITYTYPES(PackageWrapper.NMS, "EntityTypes", null, null, "net.minecraft.world.entity"), - NMS_REGISTRYSIMPLE(PackageWrapper.NMS, "RegistrySimple", MinecraftVersion.MC1_11_R1, MinecraftVersion.MC1_12_R1), - NMS_REGISTRYMATERIALS(PackageWrapper.NMS, "RegistryMaterials", null, null, "net.minecraft.core"), - NMS_IREGISTRY(PackageWrapper.NMS, "IRegistry", null, null, "net.minecraft.core"), - NMS_MINECRAFTKEY(PackageWrapper.NMS, "MinecraftKey", MinecraftVersion.MC1_8_R3, null, "net.minecraft.resources"), - NMS_GAMEPROFILESERIALIZER(PackageWrapper.NMS, "GameProfileSerializer", null, null, "net.minecraft.nbt"), - NMS_IBLOCKDATA(PackageWrapper.NMS, "IBlockData", MinecraftVersion.MC1_8_R3, null, - "net.minecraft.world.level.block.state"), - GAMEPROFILE(PackageWrapper.NONE, "com.mojang.authlib.GameProfile", MinecraftVersion.MC1_8_R3, null); - - private Class<?> clazz; - private boolean enabled = false; - - ClassWrapper(PackageWrapper packageId, String clazzName, MinecraftVersion from, MinecraftVersion to) { - this(packageId, clazzName, from, to, null); - } - - ClassWrapper(PackageWrapper packageId, String clazzName, MinecraftVersion from, MinecraftVersion to, - String mojangMap) { - if (from != null && MinecraftVersion.getVersion().getVersionId() < from.getVersionId()) { - return; - } - if (to != null && MinecraftVersion.getVersion().getVersionId() > to.getVersionId()) { - return; - } - enabled = true; - try { - if (MinecraftVersion.isAtLeastVersion(MinecraftVersion.MC1_17_R1) && mojangMap != null) { - clazz = Class.forName(mojangMap + "." + clazzName); - } else if (packageId == PackageWrapper.NONE) { - clazz = Class.forName(clazzName); - } else { - final String version = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3]; - clazz = Class.forName(packageId.getUri() + "." + version + "." + clazzName); - } - } catch (final Exception ex) { - Common.error(ex, "[NBTAPI] Error while trying to resolve the class '" + clazzName + "'!"); - } - } - - /** - * @return The wrapped class - */ - public Class<?> getClazz() { - return clazz; - } - - /** - * @return Is this class available in this Version - */ - public boolean isEnabled() { - return enabled; - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/GsonWrapper.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/GsonWrapper.java deleted file mode 100644 index 1433b6295d0f24991b022db940f2b23eba6fccc6..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/GsonWrapper.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import com.google.gson.Gson; - -/** - * Helper class for 1.7 servers without Gson - * - * @author tr7zw - * - */ -class GsonWrapper { - - /** - * Private constructor - */ - private GsonWrapper() { - - } - - private static final Gson gson = new Gson(); - - /** - * Turns Objects into Json Strings - * - * @param obj - * @return Json, representing the Object - */ - public static String getString(Object obj) { - return gson.toJson(obj); - } - - /** - * Creates an Object of the given type using the Json String - * - * @param json - * @param type - * @return Object that got created, or null if the json is null - */ - public static <T> T deserializeJson(String json, Class<T> type) { - try { - if (json == null) { - return null; - } - - final T obj = gson.fromJson(json, type); - return type.cast(obj); - } catch (final Exception ex) { - throw new NbtApiException("Error while converting json to " + type.getName(), ex); - } - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/MinecraftVersion.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/MinecraftVersion.java deleted file mode 100644 index 76f065b9b980b36b7bb9e4699b5baadd0398df33..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/MinecraftVersion.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import org.bukkit.Bukkit; - -/** - * This class acts as the "Brain" of the NBTApi. It contains the main logger for - * other classes,registers bStats and checks rather Maven shading was done - * correctly. - * - * @author tr7zw - * - */ -enum MinecraftVersion { - UNKNOWN(Integer.MAX_VALUE), // Use the newest known mappings - MC1_7_R4(174), - MC1_8_R3(183), - MC1_9_R1(191), - MC1_9_R2(192), - MC1_10_R1(1101), - MC1_11_R1(1111), - MC1_12_R1(1121), - MC1_13_R1(1131), - MC1_13_R2(1132), - MC1_14_R1(1141), - MC1_15_R1(1151), - MC1_16_R1(1161), - MC1_16_R2(1162), - MC1_16_R3(1163), - MC1_17_R1(1171); - - private static MinecraftVersion version; - - private final int versionId; - - MinecraftVersion(int versionId) { - this.versionId = versionId; - } - - /** - * @return A simple comparable Integer, representing the version. - */ - public int getVersionId() { - return versionId; - } - - /** - * Returns true if the current versions is at least the given Version - * - * @param version The minimum version - * @return - */ - public static boolean isAtLeastVersion(MinecraftVersion version) { - return getVersion().getVersionId() >= version.getVersionId(); - } - - /** - * Returns true if the current versions newer (not equal) than the given version - * - * @param version The minimum version - * @return - */ - public static boolean isNewerThan(MinecraftVersion version) { - return getVersion().getVersionId() > version.getVersionId(); - } - - /** - * Getter for this servers MinecraftVersion. Also init's bStats and checks the - * shading. - * - * @return The enum for the MinecraftVersion this server is running - */ - public static MinecraftVersion getVersion() { - if (version != null) { - return version; - } - - final String ver = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3]; - - try { - version = MinecraftVersion.valueOf(ver.replace("v", "MC")); - } catch (final IllegalArgumentException ex) { - version = MinecraftVersion.UNKNOWN; - } - - return version; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTBlock.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTBlock.java deleted file mode 100644 index ea62244609250d86463a21aa11fcd5ad616c1de8..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTBlock.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import org.bukkit.block.Block; - -public class NBTBlock { - - private final Block block; - private final NBTChunk nbtChunk; - - public NBTBlock(Block block) { - this.block = block; - if (!MinecraftVersion.isAtLeastVersion(MinecraftVersion.MC1_16_R3)) { - throw new NbtApiException("NBTBlock is only working for 1.16.4+!"); - } - nbtChunk = new NBTChunk(block.getChunk()); - } - - public NBTCompound getData() { - return nbtChunk.getPersistentDataContainer().getOrCreateCompound("blocks").getOrCreateCompound(block.getX() + "_" + block.getY() + "_" + block.getZ()); - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTChunk.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTChunk.java deleted file mode 100644 index acf1048d757e3f4b6fdf2ddb50686f1e1a6b317e..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTChunk.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import org.bukkit.Chunk; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.exception.FoException; - -public class NBTChunk { - - private final Chunk chunk; - - public NBTChunk(Chunk chunk) { - this.chunk = chunk; - } - - /** - * Gets the NBTCompound used by spigots PersistentDataAPI. This method is only - * available for 1.16.4+! - * - * @return NBTCompound containing the data of the PersistentDataAPI - */ - public NBTCompound getPersistentDataContainer() { - - if (org.mineacademy.fo.MinecraftVersion.olderThan(V.v1_16)) - throw new FoException("getPersistentDataContainer requires MC 1.16 or newer"); - - return new NBTPersistentDataContainer(chunk.getPersistentDataContainer()); - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTCompound.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTCompound.java deleted file mode 100644 index 11969b5f2763aad453368697d773ad9dd19c72dd..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTCompound.java +++ /dev/null @@ -1,836 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import java.io.OutputStream; -import java.io.Serializable; -import java.util.Arrays; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; - -import org.bukkit.inventory.ItemStack; - -/** - * Base class representing NMS Compounds. For a standalone implementation check - * {@link NBTContainer} - * - * @author tr7zw - * - */ -public class NBTCompound { - - private final ReadWriteLock readWriteLock = new ReentrantReadWriteLock(); - private final Lock readLock = readWriteLock.readLock(); - private final Lock writeLock = readWriteLock.writeLock(); - - private final String compundName; - private final NBTCompound parent; - - protected NBTCompound(NBTCompound owner, String name) { - this.compundName = name; - this.parent = owner; - } - - protected Lock getReadLock() { - return readLock; - } - - protected Lock getWriteLock() { - return writeLock; - } - - protected void saveCompound() { - if (parent != null) - parent.saveCompound(); - } - - /** - * @return The Compound name - */ - public String getName() { - return compundName; - } - - /** - * @return The NMS Compound behind this Object - */ - public Object getCompound() { - return parent.getCompound(); - } - - protected void setCompound(Object compound) { - parent.setCompound(compound); - } - - /** - * @return The parent Compound - */ - public NBTCompound getParent() { - return parent; - } - - /** - * Merges all data from comp into this compound. This is done in one action, so - * it also works with Tiles/Entities - * - * @param comp - */ - public void mergeCompound(NBTCompound comp) { - try { - writeLock.lock(); - NBTReflectionUtil.mergeOtherNBTCompound(this, comp); - saveCompound(); - } finally { - writeLock.unlock(); - } - } - - /** - * Setter - * - * @param key - * @param value - */ - public void setString(String key, String value) { - try { - writeLock.lock(); - NBTReflectionUtil.setData(this, ReflectionMethod.COMPOUND_SET_STRING, key, value); - saveCompound(); - } finally { - writeLock.unlock(); - } - } - - /** - * Getter - * - * @param key - * @return The stored value or NMS fallback - */ - public String getString(String key) { - try { - readLock.lock(); - return (String) NBTReflectionUtil.getData(this, ReflectionMethod.COMPOUND_GET_STRING, key); - } finally { - readLock.unlock(); - } - } - - protected String getContent(String key) { - return NBTReflectionUtil.getContent(this, key); - } - - /** - * Setter - * - * @param key - * @param value - */ - public void setInteger(String key, Integer value) { - try { - writeLock.lock(); - NBTReflectionUtil.setData(this, ReflectionMethod.COMPOUND_SET_INT, key, value); - saveCompound(); - } finally { - writeLock.unlock(); - } - } - - /** - * Getter - * - * @param key - * @return The stored value or NMS fallback - */ - public Integer getInteger(String key) { - try { - readLock.lock(); - return (Integer) NBTReflectionUtil.getData(this, ReflectionMethod.COMPOUND_GET_INT, key); - } finally { - readLock.unlock(); - } - } - - /** - * Setter - * - * @param key - * @param value - */ - public void setDouble(String key, Double value) { - try { - writeLock.lock(); - NBTReflectionUtil.setData(this, ReflectionMethod.COMPOUND_SET_DOUBLE, key, value); - saveCompound(); - } finally { - writeLock.unlock(); - } - } - - /** - * Getter - * - * @param key - * @return The stored value or NMS fallback - */ - public Double getDouble(String key) { - try { - readLock.lock(); - return (Double) NBTReflectionUtil.getData(this, ReflectionMethod.COMPOUND_GET_DOUBLE, key); - } finally { - readLock.unlock(); - } - } - - /** - * Setter - * - * @param key - * @param value - */ - public void setByte(String key, Byte value) { - try { - writeLock.lock(); - NBTReflectionUtil.setData(this, ReflectionMethod.COMPOUND_SET_BYTE, key, value); - saveCompound(); - } finally { - writeLock.unlock(); - } - } - - /** - * Getter - * - * @param key - * @return The stored value or NMS fallback - */ - public Byte getByte(String key) { - try { - readLock.lock(); - return (Byte) NBTReflectionUtil.getData(this, ReflectionMethod.COMPOUND_GET_BYTE, key); - } finally { - readLock.unlock(); - } - } - - /** - * Setter - * - * @param key - * @param value - */ - public void setShort(String key, Short value) { - try { - writeLock.lock(); - NBTReflectionUtil.setData(this, ReflectionMethod.COMPOUND_SET_SHORT, key, value); - saveCompound(); - } finally { - writeLock.unlock(); - } - } - - /** - * Getter - * - * @param key - * @return The stored value or NMS fallback - */ - public Short getShort(String key) { - try { - readLock.lock(); - return (Short) NBTReflectionUtil.getData(this, ReflectionMethod.COMPOUND_GET_SHORT, key); - } finally { - readLock.unlock(); - } - } - - /** - * Setter - * - * @param key - * @param value - */ - public void setLong(String key, Long value) { - try { - writeLock.lock(); - NBTReflectionUtil.setData(this, ReflectionMethod.COMPOUND_SET_LONG, key, value); - saveCompound(); - } finally { - writeLock.unlock(); - } - } - - /** - * Getter - * - * @param key - * @return The stored value or NMS fallback - */ - public Long getLong(String key) { - try { - readLock.lock(); - return (Long) NBTReflectionUtil.getData(this, ReflectionMethod.COMPOUND_GET_LONG, key); - } finally { - readLock.unlock(); - } - } - - /** - * Setter - * - * @param key - * @param value - */ - public void setFloat(String key, Float value) { - try { - writeLock.lock(); - NBTReflectionUtil.setData(this, ReflectionMethod.COMPOUND_SET_FLOAT, key, value); - saveCompound(); - } finally { - writeLock.unlock(); - } - } - - /** - * Getter - * - * @param key - * @return The stored value or NMS fallback - */ - public Float getFloat(String key) { - try { - readLock.lock(); - return (Float) NBTReflectionUtil.getData(this, ReflectionMethod.COMPOUND_GET_FLOAT, key); - } finally { - readLock.unlock(); - } - } - - /** - * Setter - * - * @param key - * @param value - */ - public void setByteArray(String key, byte[] value) { - try { - writeLock.lock(); - NBTReflectionUtil.setData(this, ReflectionMethod.COMPOUND_SET_BYTEARRAY, key, value); - saveCompound(); - } finally { - writeLock.unlock(); - } - } - - /** - * Getter - * - * @param key - * @return The stored value or NMS fallback - */ - public byte[] getByteArray(String key) { - try { - readLock.lock(); - return (byte[]) NBTReflectionUtil.getData(this, ReflectionMethod.COMPOUND_GET_BYTEARRAY, key); - } finally { - readLock.unlock(); - } - } - - /** - * Setter - * - * @param key - * @param value - */ - public void setIntArray(String key, int[] value) { - try { - writeLock.lock(); - NBTReflectionUtil.setData(this, ReflectionMethod.COMPOUND_SET_INTARRAY, key, value); - saveCompound(); - } finally { - writeLock.unlock(); - } - } - - /** - * Getter - * - * @param key - * @return The stored value or NMS fallback - */ - public int[] getIntArray(String key) { - try { - readLock.lock(); - return (int[]) NBTReflectionUtil.getData(this, ReflectionMethod.COMPOUND_GET_INTARRAY, key); - } finally { - readLock.unlock(); - } - } - - /** - * Setter - * - * @param key - * @param value - */ - public void setBoolean(String key, Boolean value) { - try { - writeLock.lock(); - NBTReflectionUtil.setData(this, ReflectionMethod.COMPOUND_SET_BOOLEAN, key, value); - saveCompound(); - } finally { - writeLock.unlock(); - } - } - - protected void set(String key, Object val) { - NBTReflectionUtil.set(this, key, val); - saveCompound(); - } - - /** - * Getter - * - * @param key - * @return The stored value or NMS fallback - */ - public Boolean getBoolean(String key) { - try { - readLock.lock(); - return (Boolean) NBTReflectionUtil.getData(this, ReflectionMethod.COMPOUND_GET_BOOLEAN, key); - } finally { - readLock.unlock(); - } - } - - /** - * Uses Gson to store an {@link Serializable} Object - * - * @param key - * @param value - */ - public void setObject(String key, Object value) { - try { - writeLock.lock(); - NBTReflectionUtil.setObject(this, key, value); - saveCompound(); - } finally { - writeLock.unlock(); - } - } - - /** - * Uses Gson to retrieve a stored Object - * - * @param key - * @param type Class of the Object - * @return The created Object or null if empty - */ - public <T> T getObject(String key, Class<T> type) { - try { - readLock.lock(); - return NBTReflectionUtil.getObject(this, key, type); - } finally { - readLock.unlock(); - } - } - - /** - * Save an ItemStack as a compound under a given key - * - * @param key - * @param item - */ - public void setItemStack(String key, ItemStack item) { - try { - writeLock.lock(); - removeKey(key); - addCompound(key).mergeCompound(NBTItem.convertItemtoNBT(item)); - } finally { - writeLock.unlock(); - } - } - - /** - * Get an ItemStack that was saved at the given key - * - * @param key - * @return - */ - public ItemStack getItemStack(String key) { - try { - readLock.lock(); - final NBTCompound comp = getCompound(key); - return NBTItem.convertNBTtoItem(comp); - } finally { - readLock.unlock(); - } - } - - /** - * Setter - * - * @param key - * @param value - */ - public void setUUID(String key, UUID value) { - try { - writeLock.lock(); - NBTReflectionUtil.setData(this, ReflectionMethod.COMPOUND_SET_UUID, key, value); - saveCompound(); - } finally { - writeLock.unlock(); - } - } - - /** - * Getter - * - * @param key - * @return The stored value or NMS fallback - */ - public UUID getUUID(String key) { - try { - readLock.lock(); - return (UUID) NBTReflectionUtil.getData(this, ReflectionMethod.COMPOUND_GET_UUID, key); - } finally { - readLock.unlock(); - } - } - - /** - * @param key - * @return True if the key is set - */ - public Boolean hasKey(String key) { - try { - readLock.lock(); - final Boolean b = (Boolean) NBTReflectionUtil.getData(this, ReflectionMethod.COMPOUND_HAS_KEY, key); - if (b == null) - return false; - return b; - } finally { - readLock.unlock(); - } - } - - /** - * @param key Deletes the given Key - */ - public void removeKey(String key) { - try { - writeLock.lock(); - NBTReflectionUtil.remove(this, key); - saveCompound(); - } finally { - writeLock.unlock(); - } - } - - /** - * @return Set of all stored Keys - */ - public Set<String> getKeys() { - try { - readLock.lock(); - return NBTReflectionUtil.getKeys(this); - } finally { - readLock.unlock(); - } - } - - /** - * Creates a subCompound, or returns it if already provided - * - * @param name Key to use - * @return The subCompound Object - */ - public NBTCompound addCompound(String name) { - try { - writeLock.lock(); - if (getType(name) == NBTType.NBTTagCompound) - return getCompound(name); - NBTReflectionUtil.addNBTTagCompound(this, name); - final NBTCompound comp = getCompound(name); - if (comp == null) - throw new NbtApiException("Error while adding Compound, got null!"); - saveCompound(); - return comp; - } finally { - writeLock.unlock(); - } - } - - /** - * @param name - * @return The Compound instance or null - */ - public NBTCompound getCompound(String name) { - try { - readLock.lock(); - if (getType(name) != NBTType.NBTTagCompound) - return null; - final NBTCompound next = new NBTCompound(this, name); - if (NBTReflectionUtil.valideCompound(next)) - return next; - return null; - } finally { - readLock.unlock(); - } - } - - /** - * The same as addCompound, just with a name that better reflects what it does - * - * @param name - * @return - */ - public NBTCompound getOrCreateCompound(String name) { - return addCompound(name); - } - - /** - * @param name - * @return The retrieved String List - */ - public NBTList<String> getStringList(String name) { - try { - writeLock.lock(); - final NBTList<String> list = NBTReflectionUtil.getList(this, name, NBTType.NBTTagString, String.class); - saveCompound(); - return list; - } finally { - writeLock.unlock(); - } - } - - /** - * @param name - * @return The retrieved Integer List - */ - public NBTList<Integer> getIntegerList(String name) { - try { - writeLock.lock(); - final NBTList<Integer> list = NBTReflectionUtil.getList(this, name, NBTType.NBTTagInt, Integer.class); - saveCompound(); - return list; - } finally { - writeLock.unlock(); - } - } - - /** - * @param name - * @return The retrieved Float List - */ - public NBTList<Float> getFloatList(String name) { - try { - writeLock.lock(); - final NBTList<Float> list = NBTReflectionUtil.getList(this, name, NBTType.NBTTagFloat, Float.class); - saveCompound(); - return list; - } finally { - writeLock.unlock(); - } - } - - /** - * @param name - * @return The retrieved Double List - */ - public NBTList<Double> getDoubleList(String name) { - try { - writeLock.lock(); - final NBTList<Double> list = NBTReflectionUtil.getList(this, name, NBTType.NBTTagDouble, Double.class); - saveCompound(); - return list; - } finally { - writeLock.unlock(); - } - } - - /** - * @param name - * @return The retrieved Long List - */ - public NBTList<Long> getLongList(String name) { - try { - writeLock.lock(); - final NBTList<Long> list = NBTReflectionUtil.getList(this, name, NBTType.NBTTagLong, Long.class); - saveCompound(); - return list; - } finally { - writeLock.unlock(); - } - } - - /** - * Returns the type of the list, null if not a list - * - * @param name - * @return - */ - public NBTType getListType(String name) { - try { - readLock.lock(); - if (getType(name) != NBTType.NBTTagList) - return null; - return NBTReflectionUtil.getListType(this, name); - } finally { - readLock.unlock(); - } - } - - /** - * @param name - * @return The retrieved Compound List - */ - public NBTCompoundList getCompoundList(String name) { - try { - writeLock.lock(); - final NBTCompoundList list = (NBTCompoundList) NBTReflectionUtil.getList(this, name, NBTType.NBTTagCompound, - NBTListCompound.class); - saveCompound(); - return list; - } finally { - writeLock.unlock(); - } - } - - /** - * @param name - * @return The type of the given stored key or null - */ - public NBTType getType(String name) { - try { - readLock.lock(); - if (MinecraftVersion.getVersion() == MinecraftVersion.MC1_7_R4) { - final Object nbtbase = NBTReflectionUtil.getData(this, ReflectionMethod.COMPOUND_GET, name); - if (nbtbase == null) - return null; - return NBTType.valueOf((byte) ReflectionMethod.COMPOUND_OWN_TYPE.run(nbtbase)); - } - final Object o = NBTReflectionUtil.getData(this, ReflectionMethod.COMPOUND_GET_TYPE, name); - if (o == null) - return null; - return NBTType.valueOf((byte) o); - } finally { - readLock.unlock(); - } - } - - public void writeCompound(OutputStream stream) { - try { - writeLock.lock(); - NBTReflectionUtil.writeApiNBT(this, stream); - } finally { - writeLock.unlock(); - } - } - - @Override - public String toString() { - /* - * StringBuilder result = new StringBuilder(); for (String key : getKeys()) { - * result.append(toString(key)); } return result.toString(); - */ - return asNBTString(); - } - - /** - * @deprecated Just use toString() - * @param key - * @return A string representation of the given key - */ - @Deprecated - public String toString(String key) { - /* - * StringBuilder result = new StringBuilder(); NBTCompound compound = this; - * while (compound.getParent() != null) { result.append(" "); compound = - * compound.getParent(); } if (this.getType(key) == NBTType.NBTTagCompound) { - * return this.getCompound(key).toString(); } else { return result + "-" + key + - * ": " + getContent(key) + System.lineSeparator(); } - */ - return asNBTString(); - } - - /** - * @deprecated Just use toString() - * @return A {@link String} representation of the NBT in Mojang JSON. This is different from normal JSON! - */ - @Deprecated - public String asNBTString() { - try { - readLock.lock(); - final Object comp = NBTReflectionUtil.gettoCompount(getCompound(), this); - if (comp == null) - return "{}"; - return comp.toString(); - } finally { - readLock.unlock(); - } - } - - @Override - public int hashCode() { - return toString().hashCode(); - } - - /** - * Does a deep compare to check if everything is the same - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (obj instanceof NBTCompound) { - final NBTCompound other = (NBTCompound) obj; - if (getKeys().equals(other.getKeys())) { - for (final String key : getKeys()) { - if (!isEqual(this, other, key)) { - return false; - } - return true; - } - } - } - return false; - } - - protected static boolean isEqual(NBTCompound compA, NBTCompound compB, String key) { - if (compA.getType(key) != compB.getType(key)) - return false; - switch (compA.getType(key)) { - case NBTTagByte: - return compA.getByte(key).equals(compB.getByte(key)); - case NBTTagByteArray: - return Arrays.equals(compA.getByteArray(key), compB.getByteArray(key)); - case NBTTagCompound: - return compA.getCompound(key).equals(compB.getCompound(key)); - case NBTTagDouble: - return compA.getDouble(key).equals(compB.getDouble(key)); - case NBTTagEnd: - return true; //?? - case NBTTagFloat: - return compA.getFloat(key).equals(compB.getFloat(key)); - case NBTTagInt: - return compA.getInteger(key).equals(compB.getInteger(key)); - case NBTTagIntArray: - return Arrays.equals(compA.getIntArray(key), compB.getIntArray(key)); - case NBTTagList: - return NBTReflectionUtil.getEntry(compA, key).toString().equals(NBTReflectionUtil.getEntry(compB, key).toString()); // Just string compare the 2 lists - case NBTTagLong: - return compA.getLong(key).equals(compB.getLong(key)); - case NBTTagShort: - return compA.getShort(key).equals(compB.getShort(key)); - case NBTTagString: - return compA.getString(key).equals(compB.getString(key)); - } - return false; - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTCompoundList.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTCompoundList.java deleted file mode 100644 index 1a2b662eee6d6343f65cc6f24196a821c5709aa3..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTCompoundList.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import org.apache.commons.lang.NotImplementedException; - -/** - * {@link NBTListCompound} implementation for NBTLists - * - * @author tr7zw - * - */ -public class NBTCompoundList extends NBTList<NBTListCompound> { - - protected NBTCompoundList(NBTCompound owner, String name, NBTType type, Object list) { - super(owner, name, type, list); - } - - /** - * Adds a new Compound to the end of the List and returns it. - * - * @return The added {@link NBTListCompound} - */ - public NBTListCompound addCompound() { - return (NBTListCompound) addCompound(null); - } - - /** - * Adds a copy of the Compound to the end of the List and returns it. - * When null is given, a new Compound will be created - * - * @param comp - * @return - */ - public NBTCompound addCompound(NBTCompound comp) { - try { - final Object compound = ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz().newInstance(); - if (MinecraftVersion.getVersion().getVersionId() >= MinecraftVersion.MC1_14_R1.getVersionId()) { - ReflectionMethod.LIST_ADD.run(listObject, size(), compound); - } else { - ReflectionMethod.LEGACY_LIST_ADD.run(listObject, compound); - } - getParent().saveCompound(); - final NBTListCompound listcomp = new NBTListCompound(this, compound); - if (comp != null) { - listcomp.mergeCompound(comp); - } - return listcomp; - } catch (final Exception ex) { - throw new NbtApiException(ex); - } - } - - /** - * Adds a new Compound to the end of the List. - * - * - * @deprecated Please use addCompound! - * @param empty - * @return True, if compound was added - */ - @Override - @Deprecated - public boolean add(NBTListCompound empty) { - return addCompound(empty) != null; - } - - @Override - public void add(int index, NBTListCompound element) { - if (element != null) { - throw new NotImplementedException("You need to pass null! ListCompounds from other lists won't work."); - } - try { - final Object compound = ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz().newInstance(); - if (MinecraftVersion.getVersion().getVersionId() >= MinecraftVersion.MC1_14_R1.getVersionId()) { - ReflectionMethod.LIST_ADD.run(listObject, index, compound); - } else { - ReflectionMethod.LEGACY_LIST_ADD.run(listObject, compound); - } - super.getParent().saveCompound(); - } catch (final Exception ex) { - throw new NbtApiException(ex); - } - } - - @Override - public NBTListCompound get(int index) { - try { - final Object compound = ReflectionMethod.LIST_GET_COMPOUND.run(listObject, index); - return new NBTListCompound(this, compound); - } catch (final Exception ex) { - throw new NbtApiException(ex); - } - } - - @Override - public NBTListCompound set(int index, NBTListCompound element) { - throw new NotImplementedException("This method doesn't work in the ListCompound context."); - } - - @Override - protected Object asTag(NBTListCompound object) { - return null; - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTContainer.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTContainer.java deleted file mode 100644 index 3e876ff28ed99771ce36d7b2de0299c485d66f49..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTContainer.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import java.io.InputStream; - -/** - * A Standalone {@link NBTCompound} implementation. All data is just kept inside - * this Object. - * - * @author tr7zw - * - */ -public class NBTContainer extends NBTCompound { - - private Object nbt; - - /** - * Creates an empty, standalone NBTCompound - */ - public NBTContainer() { - super(null, null); - nbt = ObjectCreator.NMS_NBTTAGCOMPOUND.getInstance(); - } - - /** - * Takes in any NMS Compound to wrap it - * - * @param nbt - */ - public NBTContainer(Object nbt) { - super(null, null); - if (nbt == null) { - throw new NullPointerException("The NBT-Object can't be null!"); - } - if (!ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz().isAssignableFrom(nbt.getClass())) { - throw new NbtApiException("The object '" + nbt.getClass() + "' is not a valid NBT-Object!"); - } - this.nbt = nbt; - } - - /** - * Reads in a NBT InputStream - * - * @param inputsteam - */ - public NBTContainer(InputStream inputsteam) { - super(null, null); - this.nbt = NBTReflectionUtil.readNBT(inputsteam); - } - - /** - * Parses in a NBT String to a standalone {@link NBTCompound}. Can throw a - * {@link NbtApiException} in case something goes wrong. - * - * @param nbtString - */ - public NBTContainer(String nbtString) { - super(null, null); - if (nbtString == null) { - throw new NullPointerException("The String can't be null!"); - } - try { - nbt = ReflectionMethod.PARSE_NBT.run(null, nbtString); - } catch (final Exception ex) { - throw new NbtApiException("Unable to parse Malformed Json!", ex); - } - } - - @Override - public Object getCompound() { - return nbt; - } - - @Override - public void setCompound(Object tag) { - nbt = tag; - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTDoubleList.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTDoubleList.java deleted file mode 100644 index 926d51b63d69c90db3d1f3bad7079e813975445c..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTDoubleList.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -/** - * Double implementation for NBTLists - * - * @author tr7zw - * - */ -public class NBTDoubleList extends NBTList<Double> { - - protected NBTDoubleList(NBTCompound owner, String name, NBTType type, Object list) { - super(owner, name, type, list); - } - - @Override - protected Object asTag(Double object) { - try { - final Constructor<?> con = ClassWrapper.NMS_NBTTAGDOUBLE.getClazz().getDeclaredConstructor(double.class); - con.setAccessible(true); - return con.newInstance(object); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException - | NoSuchMethodException | SecurityException e) { - throw new NbtApiException("Error while wrapping the Object " + object + " to it's NMS object!", e); - } - } - - @Override - public Double get(int index) { - try { - final Object obj = ReflectionMethod.LIST_GET.run(listObject, index); - return Double.valueOf(obj.toString()); - } catch (final NumberFormatException nf) { - return 0d; - } catch (final Exception ex) { - throw new NbtApiException(ex); - } - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTEntity.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTEntity.java deleted file mode 100644 index ecdfd372346f3d7e6640c1230d431c3a8fbe9add..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTEntity.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import org.bukkit.entity.Entity; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.exception.FoException; - -/** - * NBT class to access vanilla tags from Entities. Entities don't support custom - * tags. Use the NBTInjector for custom tags. Changes will be instantly applied - * to the Entity, use the merge method to do many things at once. - * - * @author tr7zw - * - */ -public class NBTEntity extends NBTCompound { - - private final Entity ent; - - /** - * @param entity Any valid Bukkit Entity - */ - public NBTEntity(Entity entity) { - super(null, null); - if (entity == null) { - throw new NullPointerException("Entity can't be null!"); - } - ent = entity; - } - - @Override - public Object getCompound() { - return NBTReflectionUtil.getEntityNBTTagCompound(NBTReflectionUtil.getNMSEntity(ent)); - } - - @Override - protected void setCompound(Object compound) { - NBTReflectionUtil.setEntityNBTTag(compound, NBTReflectionUtil.getNMSEntity(ent)); - } - - /** - * Gets the NBTCompound used by spigots PersistentDataAPI. This method is only - * available for 1.14+! - * - * @return NBTCompound containing the data of the PersistentDataAPI - */ - public NBTCompound getPersistentDataContainer() { - - if (org.mineacademy.fo.MinecraftVersion.olderThan(V.v1_14)) - throw new FoException("getPersistentDataContainer requires MC 1.14 or newer"); - - return new NBTPersistentDataContainer(ent.getPersistentDataContainer()); - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTFile.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTFile.java deleted file mode 100644 index 772b707e1efb7c93c1f6a51f153bfd7b656f0f93..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTFile.java +++ /dev/null @@ -1,78 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; - -/** - * {@link NBTCompound} implementation backed by a {@link File} - * - * @author tr7zw - * - */ -public class NBTFile extends NBTCompound { - - private final File file; - private Object nbt; - - /** - * Creates a NBTFile that uses @param file to store it's data. If this file - * exists, the data will be loaded. - * - * @param file - * @throws IOException - */ - public NBTFile(File file) throws IOException { - super(null, null); - if (file == null) { - throw new NullPointerException("File can't be null!"); - } - this.file = file; - if (file.exists()) { - FileInputStream inputsteam = new FileInputStream(file); - nbt = NBTReflectionUtil.readNBT(inputsteam); - } else { - nbt = ObjectCreator.NMS_NBTTAGCOMPOUND.getInstance(); - save(); - } - } - - /** - * Saves the data to the file - * - * @throws IOException - */ - public void save() throws IOException { - try { - getWriteLock().lock(); - if (!file.exists()) { - file.getParentFile().mkdirs(); - if (!file.createNewFile()) - throw new IOException("Unable to create file at " + file.getAbsolutePath()); - } - FileOutputStream outStream = new FileOutputStream(file); - NBTReflectionUtil.writeNBT(nbt, outStream); - } finally { - getWriteLock().unlock(); - } - } - - /** - * @return The File used to store the data - */ - public File getFile() { - return file; - } - - @Override - public Object getCompound() { - return nbt; - } - - @Override - protected void setCompound(Object compound) { - nbt = compound; - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTFloatList.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTFloatList.java deleted file mode 100644 index 7d9bd6b37a6dc60e096110d6f55f878e077eae58..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTFloatList.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -/** - * Float implementation for NBTLists - * - * @author tr7zw - * - */ -public class NBTFloatList extends NBTList<Float> { - - protected NBTFloatList(NBTCompound owner, String name, NBTType type, Object list) { - super(owner, name, type, list); - } - - @Override - protected Object asTag(Float object) { - try { - Constructor<?> con = ClassWrapper.NMS_NBTTAGFLOAT.getClazz().getDeclaredConstructor(float.class); - con.setAccessible(true); - return con.newInstance(object); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException - | NoSuchMethodException | SecurityException e) { - throw new NbtApiException("Error while wrapping the Object " + object + " to it's NMS object!", e); - } - } - - @Override - public Float get(int index) { - try { - Object obj = ReflectionMethod.LIST_GET.run(listObject, index); - return Float.valueOf(obj.toString()); - } catch (NumberFormatException nf) { - return 0f; - } catch (Exception ex) { - throw new NbtApiException(ex); - } - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTIntegerList.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTIntegerList.java deleted file mode 100644 index 1ebbbe035cb5a01551eea4434d82d65c3c72b33c..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTIntegerList.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -/** - * Integer implementation for NBTLists - * - * @author tr7zw - * - */ -public class NBTIntegerList extends NBTList<Integer> { - - protected NBTIntegerList(NBTCompound owner, String name, NBTType type, Object list) { - super(owner, name, type, list); - } - - @Override - protected Object asTag(Integer object) { - try { - Constructor<?> con = ClassWrapper.NMS_NBTTAGINT.getClazz().getDeclaredConstructor(int.class); - con.setAccessible(true); - return con.newInstance(object); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException - | NoSuchMethodException | SecurityException e) { - throw new NbtApiException("Error while wrapping the Object " + object + " to it's NMS object!", e); - } - } - - @Override - public Integer get(int index) { - try { - Object obj = ReflectionMethod.LIST_GET.run(listObject, index); - return Integer.valueOf(obj.toString()); - } catch (NumberFormatException nf) { - return 0; - } catch (Exception ex) { - throw new NbtApiException(ex); - } - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTInternals.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTInternals.java deleted file mode 100644 index 0c029126cdf243c3a6ce28dc5418e153d6c7695c..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTInternals.java +++ /dev/null @@ -1,181 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; - -/** - * Utility class to test NBT library's compatibility - * - * @deprecated internal use only, please use {@link NBTEntity}, - * {@link NBTTileEntity} and {@link NBTItem} to modify entity and - * items - */ -@Deprecated -public class NBTInternals { - - // Holds all test keys - private static final String STRING_KEY = "stringTest"; - private static final String INT_KEY = "intTest"; - private static final String DOUBLE_KEY = "doubleTest"; - private static final String BOOLEAN_KEY = "booleanTest"; - private static final String COMPONENT_KEY = "componentTest"; - private static final String SHORT_KEY = "shortTest"; - private static final String BYTE_KEY = "byteTest"; - private static final String FLOAT_KEY = "floatTest"; - private static final String LONG_KEY = "longTest"; - private static final String INTARRAY_KEY = "intarrayTest"; - private static final String BYTEARRAY_KEY = "bytearrayTest"; - - // Holds all test values - private static final String STRING_VALUE = "TestString"; - private static final int INT_VALUE = 42; - private static final double DOUBLE_VALUE = 1.5d; - private static final boolean BOOLEAN_VALUE = true; - private static final short SHORT_VALUE = 64; - private static final byte BYTE_VALUE = 7; - private static final float FLOAT_VALUE = 13.37f; - private static final long LONG_VALUE = Integer.MAX_VALUE + 42L; - private static final int[] INTARRAY_VALUE = new int[] { 1337, 42, 69 }; - private static final byte[] BYTEARRAY_VALUE = new byte[] { 8, 7, 3, 2 }; - - /** - * Checks if the NBT library is working properly - */ - @SuppressWarnings("rawtypes") - public static boolean checkCompatible() { - boolean compatible = true; - final boolean jsonCompatible = true; - - ItemStack item = new ItemStack(Material.STONE, 1); - NBTItem nbtItem = new NBTItem(item); - - nbtItem.setString(STRING_KEY, STRING_VALUE); - nbtItem.setInteger(INT_KEY, INT_VALUE); - nbtItem.setDouble(DOUBLE_KEY, DOUBLE_VALUE); - nbtItem.setBoolean(BOOLEAN_KEY, BOOLEAN_VALUE); - nbtItem.setByte(BYTE_KEY, BYTE_VALUE); - nbtItem.setShort(SHORT_KEY, SHORT_VALUE); - nbtItem.setLong(LONG_KEY, LONG_VALUE); - nbtItem.setFloat(FLOAT_KEY, FLOAT_VALUE); - nbtItem.setIntArray(INTARRAY_KEY, INTARRAY_VALUE); - nbtItem.setByteArray(BYTEARRAY_KEY, BYTEARRAY_VALUE); - nbtItem.addCompound(COMPONENT_KEY); - - NBTCompound comp = nbtItem.getCompound(COMPONENT_KEY); - comp.setString(STRING_KEY, STRING_VALUE + "2"); - comp.setInteger(INT_KEY, INT_VALUE * 2); - comp.setDouble(DOUBLE_KEY, DOUBLE_VALUE * 2); - - NBTList list = comp.getStringList("testlist"); - list.add("test1"); - list.add("test2"); - list.add("test3"); - list.add("test4"); - list.set(2, "test42"); - list.remove(1); - - NBTCompoundList taglist = comp.getCompoundList("complist"); - NBTListCompound lcomp = taglist.addCompound(); - - lcomp.setDouble("double1", 0.3333); - lcomp.setInteger("int1", 42); - lcomp.setString("test1", "test1"); - lcomp.setString("test2", "test2"); - lcomp.removeKey("test1"); - - item = nbtItem.getItem(); - nbtItem = null; - comp = null; - list = null; - nbtItem = new NBTItem(item); - - if (!nbtItem.hasKey(STRING_KEY)) { - Common.log("NBTAPI was not able to check a key!"); - - compatible = false; - } - - if (!STRING_VALUE.equals(nbtItem.getString(STRING_KEY)) - || nbtItem.getInteger(INT_KEY) != INT_VALUE - || nbtItem.getDouble(DOUBLE_KEY) != DOUBLE_VALUE - || nbtItem.getByte(BYTE_KEY) != BYTE_VALUE - || nbtItem.getShort(SHORT_KEY) != SHORT_VALUE - || nbtItem.getFloat(FLOAT_KEY) != FLOAT_VALUE - || nbtItem.getLong(LONG_KEY) != LONG_VALUE - || nbtItem.getIntArray(INTARRAY_KEY).length != INTARRAY_VALUE.length - || nbtItem.getByteArray(BYTEARRAY_KEY).length != BYTEARRAY_VALUE.length - || !nbtItem.getBoolean(BOOLEAN_KEY).equals(BOOLEAN_VALUE)) { - Common.log("One key does not equal the original value!"); - - compatible = false; - } - nbtItem.setString(STRING_KEY, null); - if (nbtItem.getKeys().size() != 10) { - Common.log("Wasn't able to remove a key (Got " + nbtItem.getKeys().size() + " when expecting 10)!"); - - compatible = false; - } - comp = nbtItem.getCompound(COMPONENT_KEY); - if (comp == null) { - Common.log("Wasn't able to get the NBTCompound!!"); - - compatible = false; - } - if (!comp.hasKey(STRING_KEY)) { - Common.log("Wasn't able to check a compound key!"); - - compatible = false; - } - if (!(STRING_VALUE + "2").equals(comp.getString(STRING_KEY)) - || comp.getInteger(INT_KEY) != INT_VALUE * 2 - || comp.getDouble(DOUBLE_KEY) != DOUBLE_VALUE * 2 - || comp.getBoolean(BOOLEAN_KEY) == BOOLEAN_VALUE) { - Common.log("One key does not equal the original compound value!"); - - compatible = false; - } - - list = comp.getStringList("testlist"); - if (comp.getType("testlist") != NBTType.NBTTagList) { - Common.log("Wasn't able to get the correct Tag type!"); - - compatible = false; - } - if (!list.get(1).equals("test42") || list.size() != 3) - Common.log("The List support got an error, and may not work!"); - taglist = comp.getCompoundList("complist"); - if (taglist.size() == 1) { - lcomp = taglist.get(0); - if (lcomp.getKeys().size() != 3) { - Common.log("Wrong key amount in Taglist (" + lcomp.getKeys().size() + ")!"); - - compatible = false; - } else if (lcomp.getDouble("double1") == 0.3333 && lcomp.getInteger("int1") == 42 && lcomp.getString("test2").equals("test2") - && !lcomp.hasKey("test1")) { - //ok - } else { - Common.log("One key in the Taglist changed!"); - - compatible = false; - } - } else { - Common.log("Taglist is empty!"); - - compatible = false; - } - - if ((!compatible || !jsonCompatible) && MinecraftVersion.newerThan(V.v1_7)) { - Common.log("WARNING"); - Common.log("The NBT library seems to be broken with your"); - Common.log("Spigot version " + MinecraftVersion.getServerVersion()); - Common.log(); - Common.log("Please contact the developer of this library."); - } - - return compatible && jsonCompatible; - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTItem.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTItem.java deleted file mode 100644 index 2c10a478e904846bb8379b1e265ecaa7aa08c1c6..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTItem.java +++ /dev/null @@ -1,163 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import org.bukkit.Material; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; - -/** - * NBT class to access vanilla/custom tags on ItemStacks. This class doesn't - * autosave to the Itemstack, use getItem to get the changed ItemStack - * - * @author tr7zw - * - */ -public class NBTItem extends NBTCompound { - - private ItemStack bukkitItem; - private boolean directApply; - private ItemStack originalSrcStack = null; - - /** - * Constructor for NBTItems. The ItemStack will be cloned! - * - * @param item - */ - public NBTItem(ItemStack item) { - this(item, false); - } - - /** - * Constructor for NBTItems. The ItemStack will be cloned! If directApply is true, - * all changed will be mapped to the original item. Changes to the NBTItem will overwrite changes done - * to the original item in that case. - * - * @param item - * @param directApply - */ - public NBTItem(ItemStack item, boolean directApply) { - super(null, null); - if (item == null || item.getType() == Material.AIR) { - throw new NullPointerException("ItemStack can't be null/Air!"); - } - this.directApply = directApply; - bukkitItem = item.clone(); - if(directApply) { - this.originalSrcStack = item; - } - } - - @Override - public Object getCompound() { - return NBTReflectionUtil.getItemRootNBTTagCompound(ReflectionMethod.ITEMSTACK_NMSCOPY.run(null, bukkitItem)); - } - - @Override - protected void setCompound(Object compound) { - Object stack = ReflectionMethod.ITEMSTACK_NMSCOPY.run(null, bukkitItem); - ReflectionMethod.ITEMSTACK_SET_TAG.run(stack, compound); - bukkitItem = (ItemStack) ReflectionMethod.ITEMSTACK_BUKKITMIRROR.run(null, stack); - } - - /** - * Apply stored NBT tags to the provided ItemStack. - * <p> - * Note: This will completely override current item's {@link ItemMeta}. - * If you still want to keep the original item's NBT tags, see - * {@link #mergeNBT(ItemStack)} and {@link #mergeCustomNBT(ItemStack)}. - * - * @param item ItemStack that should get the new NBT data - */ - public void applyNBT(ItemStack item) { - if (item == null || item.getType() == Material.AIR) { - throw new NullPointerException("ItemStack can't be null/Air!"); - } - NBTItem nbti = new NBTItem(new ItemStack(item.getType())); - nbti.mergeCompound(this); - item.setItemMeta(nbti.getItem().getItemMeta()); - } - - /** - * Merge all NBT tags to the provided ItemStack. - * - * @param item ItemStack that should get the new NBT data - */ - public void mergeNBT(ItemStack item) { - NBTItem nbti = new NBTItem(item); - nbti.mergeCompound(this); - item.setItemMeta(nbti.getItem().getItemMeta()); - } - - /** - * Merge only custom (non-vanilla) NBT tags to the provided ItemStack. - * - * @param item ItemStack that should get the new NBT data - */ - public void mergeCustomNBT(ItemStack item) { - if (item == null || item.getType() == Material.AIR) { - throw new NullPointerException("ItemStack can't be null/Air!"); - } - ItemMeta meta = item.getItemMeta(); - NBTReflectionUtil.getUnhandledNBTTags(meta).putAll(NBTReflectionUtil.getUnhandledNBTTags(bukkitItem.getItemMeta())); - item.setItemMeta(meta); - } - - /** - * Remove all custom (non-vanilla) NBT tags from the NBTItem. - */ - public void clearCustomNBT() { - ItemMeta meta = bukkitItem.getItemMeta(); - NBTReflectionUtil.getUnhandledNBTTags(meta).clear(); - bukkitItem.setItemMeta(meta); - } - - /** - * @return The modified ItemStack - */ - public ItemStack getItem() { - return bukkitItem; - } - - protected void setItem(ItemStack item) { - bukkitItem = item; - } - - /** - * This may return true even when the NBT is empty. - * - * @return Does the ItemStack have a NBTCompound. - */ - public boolean hasNBTData() { - return getCompound() != null; - } - - /** - * Helper method that converts {@link ItemStack} to {@link NBTContainer} with - * all it's data like Material, Damage, Amount and Tags. - * - * @param item - * @return Standalone {@link NBTContainer} with the Item's data - */ - public static NBTContainer convertItemtoNBT(ItemStack item) { - return NBTReflectionUtil.convertNMSItemtoNBTCompound(ReflectionMethod.ITEMSTACK_NMSCOPY.run(null, item)); - } - - /** - * Helper method to do the inverse to "convertItemtoNBT". Creates an - * {@link ItemStack} using the {@link NBTCompound} - * - * @param comp - * @return ItemStack using the {@link NBTCompound}'s data - */ - public static ItemStack convertNBTtoItem(NBTCompound comp) { - return (ItemStack) ReflectionMethod.ITEMSTACK_BUKKITMIRROR.run(null, - NBTReflectionUtil.convertNBTCompoundtoNMSItem(comp)); - } - - @Override - protected void saveCompound() { - if(directApply) { - applyNBT(originalSrcStack); - } - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTList.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTList.java deleted file mode 100644 index 310ea956d9f410a0c3e7b52160440705dc73a7d4..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTList.java +++ /dev/null @@ -1,427 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.NoSuchElementException; - -/** - * Abstract List implementation for ListCompounds - * - * @author tr7zw - * - * @param <T> - */ -public abstract class NBTList<T> implements List<T> { - - private final String listName; - private final NBTCompound parent; - private final NBTType type; - protected Object listObject; - - protected NBTList(NBTCompound owner, String name, NBTType type, Object list) { - parent = owner; - listName = name; - this.type = type; - this.listObject = list; - } - - /** - * @return Name of this list-compound - */ - public String getName() { - return listName; - } - - /** - * @return The Compound's parent Object - */ - public NBTCompound getParent() { - return parent; - } - - protected void save() { - parent.set(listName, listObject); - } - - protected abstract Object asTag(T object); - - @Override - public boolean add(T element) { - try { - parent.getWriteLock().lock(); - if (MinecraftVersion.getVersion().getVersionId() >= MinecraftVersion.MC1_14_R1.getVersionId()) { - ReflectionMethod.LIST_ADD.run(listObject, size(), asTag(element)); - } else { - ReflectionMethod.LEGACY_LIST_ADD.run(listObject, asTag(element)); - } - save(); - return true; - } catch (final Exception ex) { - throw new NbtApiException(ex); - } finally { - parent.getWriteLock().unlock(); - } - } - - @Override - public void add(int index, T element) { - try { - parent.getWriteLock().lock(); - if (MinecraftVersion.getVersion().getVersionId() >= MinecraftVersion.MC1_14_R1.getVersionId()) { - ReflectionMethod.LIST_ADD.run(listObject, index, asTag(element)); - } else { - ReflectionMethod.LEGACY_LIST_ADD.run(listObject, asTag(element)); - } - save(); - } catch (final Exception ex) { - throw new NbtApiException(ex); - } finally { - parent.getWriteLock().unlock(); - } - } - - @Override - public T set(int index, T element) { - try { - parent.getWriteLock().lock(); - final T prev = get(index); - ReflectionMethod.LIST_SET.run(listObject, index, asTag(element)); - save(); - return prev; - } catch (final Exception ex) { - throw new NbtApiException(ex); - } finally { - parent.getWriteLock().unlock(); - } - } - - @Override - public T remove(int i) { - try { - parent.getWriteLock().lock(); - final T old = get(i); - ReflectionMethod.LIST_REMOVE_KEY.run(listObject, i); - save(); - return old; - } catch (final Exception ex) { - throw new NbtApiException(ex); - } finally { - parent.getWriteLock().unlock(); - } - } - - @Override - public int size() { - try { - parent.getReadLock().lock(); - return (int) ReflectionMethod.LIST_SIZE.run(listObject); - } catch (final Exception ex) { - throw new NbtApiException(ex); - } finally { - parent.getReadLock().unlock(); - } - } - - /** - * @return The type that this list contains - */ - public NBTType getType() { - return type; - } - - @Override - public boolean isEmpty() { - return size() == 0; - } - - @Override - public void clear() { - while (!isEmpty()) { - remove(0); - } - } - - @Override - public boolean contains(Object o) { - try { - parent.getReadLock().lock(); - for (int i = 0; i < size(); i++) { - if (o.equals(get(i))) - return true; - } - return false; - } finally { - parent.getReadLock().unlock(); - } - } - - @Override - public int indexOf(Object o) { - try { - parent.getReadLock().lock(); - for (int i = 0; i < size(); i++) { - if (o.equals(get(i))) - return i; - } - return -1; - } finally { - parent.getReadLock().unlock(); - } - } - - @Override - public boolean addAll(Collection<? extends T> c) { - try { - parent.getWriteLock().lock(); - final int size = size(); - for (final T ele : c) { - add(ele); - } - return size != size(); - } finally { - parent.getWriteLock().unlock(); - } - } - - @Override - public boolean addAll(int index, Collection<? extends T> c) { - try { - parent.getWriteLock().lock(); - final int size = size(); - for (final T ele : c) { - add(index++, ele); - } - return size != size(); - } finally { - parent.getWriteLock().unlock(); - } - } - - @Override - public boolean containsAll(Collection<?> c) { - try { - parent.getReadLock().lock(); - for (final Object ele : c) { - if (!contains(ele)) - return false; - } - return true; - } finally { - parent.getReadLock().unlock(); - } - } - - @Override - public int lastIndexOf(Object o) { - try { - parent.getReadLock().lock(); - int index = -1; - for (int i = 0; i < size(); i++) { - if (o.equals(get(i))) - index = i; - } - return index; - } finally { - parent.getReadLock().unlock(); - } - } - - @Override - public boolean removeAll(Collection<?> c) { - try { - parent.getWriteLock().lock(); - final int size = size(); - for (final Object obj : c) { - remove(obj); - } - return size != size(); - } finally { - parent.getWriteLock().unlock(); - } - } - - @Override - public boolean retainAll(Collection<?> c) { - try { - parent.getWriteLock().lock(); - final int size = size(); - for (final Object obj : c) { - for (int i = 0; i < size(); i++) { - if (!obj.equals(get(i))) { - remove(i--); - } - } - } - return size != size(); - } finally { - parent.getWriteLock().unlock(); - } - } - - @Override - public boolean remove(Object o) { - try { - parent.getWriteLock().lock(); - final int size = size(); - int id = -1; - while ((id = indexOf(o)) != -1) { - remove(id); - } - return size != size(); - } finally { - parent.getWriteLock().unlock(); - } - } - - @Override - public Iterator<T> iterator() { - return new Iterator<T>() { - - private int index = -1; - - @Override - public boolean hasNext() { - return size() > index + 1; - } - - @Override - public T next() { - if (!hasNext()) - throw new NoSuchElementException(); - return get(++index); - } - - @Override - public void remove() { - NBTList.this.remove(index); - index--; - } - }; - } - - @Override - public ListIterator<T> listIterator() { - return listIterator(0); - } - - @Override - public ListIterator<T> listIterator(int startIndex) { - final NBTList<T> list = this; - return new ListIterator<T>() { - - int index = startIndex - 1; - - @Override - public void add(T e) { - list.add(index, e); - } - - @Override - public boolean hasNext() { - return size() > index + 1; - } - - @Override - public boolean hasPrevious() { - return index >= 0 && index <= size(); - } - - @Override - public T next() { - if (!hasNext()) - throw new NoSuchElementException(); - return get(++index); - } - - @Override - public int nextIndex() { - return index + 1; - } - - @Override - public T previous() { - if (!hasPrevious()) - throw new NoSuchElementException("Id: " + (index - 1)); - return get(index--); - } - - @Override - public int previousIndex() { - return index - 1; - } - - @Override - public void remove() { - list.remove(index); - index--; - } - - @Override - public void set(T e) { - list.set(index, e); - } - }; - } - - @Override - public Object[] toArray() { - try { - parent.getReadLock().lock(); - final Object[] ar = new Object[size()]; - for (int i = 0; i < size(); i++) - ar[i] = get(i); - return ar; - } finally { - parent.getReadLock().unlock(); - } - } - - @Override - public <E> E[] toArray(E[] a) { - try { - parent.getReadLock().lock(); - final E[] ar = Arrays.copyOf(a, size()); - Arrays.fill(ar, null); - final Class<?> arrayclass = a.getClass().getComponentType(); - for (int i = 0; i < size(); i++) { - final T obj = get(i); - if (arrayclass.isInstance(obj)) { - ar[i] = (E) get(i); - } else { - throw new ArrayStoreException("The array does not match the objects stored in the List."); - } - } - return ar; - } finally { - parent.getReadLock().unlock(); - } - } - - @Override - public List<T> subList(int fromIndex, int toIndex) { - try { - parent.getReadLock().lock(); - final ArrayList<T> list = new ArrayList<>(); - for (int i = fromIndex; i < toIndex; i++) - list.add(get(i)); - return list; - } finally { - parent.getReadLock().unlock(); - } - } - - @Override - public String toString() { - try { - parent.getReadLock().lock(); - return listObject.toString(); - } finally { - parent.getReadLock().unlock(); - } - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTListCompound.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTListCompound.java deleted file mode 100644 index a4c16428e58b44ec22d64ee6b0df16492c316c67..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTListCompound.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -/** - * Cut down version of the {@link NBTCompound} for inside - * {@link NBTCompoundList} This Compound implementation is missing the ability - * for further subCompounds and Lists. This class probably will change in the - * future - * - * @author tr7zw - * - */ -public class NBTListCompound extends NBTCompound { - - private NBTList<?> owner; - private Object compound; - - protected NBTListCompound(NBTList<?> parent, Object obj) { - super(null, null); - owner = parent; - compound = obj; - } - - public NBTList<?> getListParent() { - return owner; - } - - @Override - public Object getCompound() { - return compound; - } - - @Override - protected void setCompound(Object compound) { - this.compound = compound; - } - - @Override - protected void saveCompound() { - owner.save(); - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTLongList.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTLongList.java deleted file mode 100644 index 353b7b39b143cebc1ff996bd5b7765187ad7a9fa..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTLongList.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -/** - * Long implementation for NBTLists - * - * @author tr7zw - * - */ -public class NBTLongList extends NBTList<Long> { - - protected NBTLongList(NBTCompound owner, String name, NBTType type, Object list) { - super(owner, name, type, list); - } - - @Override - protected Object asTag(Long object) { - try { - final Constructor<?> con = ClassWrapper.NMS_NBTTAGLONG.getClazz().getDeclaredConstructor(long.class); - con.setAccessible(true); - return con.newInstance(object); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException - | NoSuchMethodException | SecurityException e) { - throw new NbtApiException("Error while wrapping the Object " + object + " to it's NMS object!", e); - } - } - - @Override - public Long get(int index) { - try { - final Object obj = ReflectionMethod.LIST_GET.run(listObject, index); - return Long.valueOf(obj.toString().replace("L", "")); - } catch (final NumberFormatException nf) { - return 0L; - } catch (final Exception ex) { - throw new NbtApiException(ex); - } - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTPersistentDataContainer.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTPersistentDataContainer.java deleted file mode 100644 index 440cc0923def0f5a20fc773005783b3d2c082f67..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTPersistentDataContainer.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import java.util.Map; - -import org.bukkit.persistence.PersistentDataContainer; - -public class NBTPersistentDataContainer extends NBTCompound { - - private final PersistentDataContainer container; - - protected NBTPersistentDataContainer(PersistentDataContainer container) { - super(null, null); - this.container = container; - } - - @Override - public Object getCompound() { - return ReflectionMethod.CRAFT_PERSISTENT_DATA_CONTAINER_TO_TAG.run(container); - } - - @Override - protected void setCompound(Object compound) { - final Map<Object, Object> map = (Map<Object, Object>) ReflectionMethod.CRAFT_PERSISTENT_DATA_CONTAINER_GET_MAP.run(container); - map.clear(); - ReflectionMethod.CRAFT_PERSISTENT_DATA_CONTAINER_PUT_ALL.run(container, compound); - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTReflectionUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTReflectionUtil.java deleted file mode 100644 index 2708c0ced4da057b23f789e93b0f108ec58506ee..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTReflectionUtil.java +++ /dev/null @@ -1,606 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Serializable; -import java.lang.reflect.Field; -import java.util.ArrayDeque; -import java.util.Deque; -import java.util.Map; -import java.util.Set; - -import org.bukkit.block.BlockState; -import org.bukkit.entity.Entity; -import org.bukkit.inventory.meta.ItemMeta; - -/** - * Utility class for translating NBTApi calls to reflections into NMS code All - * methods are allowed to throw {@link NbtApiException} - * - * @author tr7zw - * - */ -public class NBTReflectionUtil { - - private static Field field_unhandledTags = null; - - static { - try { - field_unhandledTags = ClassWrapper.CRAFT_METAITEM.getClazz().getDeclaredField("unhandledTags"); - field_unhandledTags.setAccessible(true); - } catch (final NoSuchFieldException e) { - - } - } - - /** - * Hidden constructor - */ - private NBTReflectionUtil() { - - } - - /** - * Gets the NMS Entity for a given Bukkit Entity - * - * @param entity Bukkit Entity - * @return NMS Entity - */ - public static Object getNMSEntity(Entity entity) { - try { - return ReflectionMethod.CRAFT_ENTITY_GET_HANDLE.run(ClassWrapper.CRAFT_ENTITY.getClazz().cast(entity)); - } catch (final Exception e) { - throw new NbtApiException("Exception while getting the NMS Entity from a Bukkit Entity!", e); - } - } - - /** - * Reads in a InputStream as NMS Compound - * - * @param stream InputStream of any NBT file - * @return NMS Compound - */ - public static Object readNBT(InputStream stream) { - try { - return ReflectionMethod.NBTFILE_READ.run(null, stream); - } catch (final Exception e) { - throw new NbtApiException("Exception while reading a NBT File!", e); - } - } - - /** - * Writes a NMS Compound to an OutputStream - * - * @param nbt NMS Compound - * @param stream Stream to write to - * @return ??? - */ - public static Object writeNBT(Object nbt, OutputStream stream) { - try { - return ReflectionMethod.NBTFILE_WRITE.run(null, nbt, stream); - } catch (final Exception e) { - throw new NbtApiException("Exception while writing NBT!", e); - } - } - - /** - * Writes a Compound to an OutputStream - * - * @param comp Compound - * @param stream Stream to write to - */ - public static void writeApiNBT(NBTCompound comp, OutputStream stream) { - try { - Object nbttag = comp.getCompound(); - if (nbttag == null) { - nbttag = ObjectCreator.NMS_NBTTAGCOMPOUND.getInstance(); - } - if (!valideCompound(comp)) - return; - final Object workingtag = gettoCompount(nbttag, comp); - ReflectionMethod.NBTFILE_WRITE.run(null, workingtag, stream); - } catch (final Exception e) { - throw new NbtApiException("Exception while writing NBT!", e); - } - } - - /** - * Simulates getOrCreateTag. If an Item doesn't yet have a Tag, it will return a - * new empty tag. - * - * @param nmsitem - * @return NMS Compound - */ - public static Object getItemRootNBTTagCompound(Object nmsitem) { - try { - final Object answer = ReflectionMethod.NMSITEM_GETTAG.run(nmsitem); - return answer != null ? answer : ObjectCreator.NMS_NBTTAGCOMPOUND.getInstance(); - } catch (final Exception e) { - throw new NbtApiException("Exception while getting an Itemstack's NBTCompound!", e); - } - } - - /** - * Converts {@link NBTCompound} to NMS ItemStacks - * - * @param nbtcompound Any valid {@link NBTCompound} - * @return NMS ItemStack - */ - public static Object convertNBTCompoundtoNMSItem(NBTCompound nbtcompound) { - try { - final Object nmsComp = gettoCompount(nbtcompound.getCompound(), nbtcompound); - if (MinecraftVersion.getVersion().getVersionId() >= MinecraftVersion.MC1_11_R1.getVersionId()) { - return ObjectCreator.NMS_COMPOUNDFROMITEM.getInstance(nmsComp); - } else { - return ReflectionMethod.NMSITEM_CREATESTACK.run(null, nmsComp); - } - } catch (final Exception e) { - throw new NbtApiException("Exception while converting NBTCompound to NMS ItemStack!", e); - } - } - - /** - * Converts NMS ItemStacks to {@link NBTContainer} - * - * @param nmsitem NMS ItemStack - * @return {@link NBTContainer} with all the data - */ - public static NBTContainer convertNMSItemtoNBTCompound(Object nmsitem) { - try { - final Object answer = ReflectionMethod.NMSITEM_SAVE.run(nmsitem, ObjectCreator.NMS_NBTTAGCOMPOUND.getInstance()); - return new NBTContainer(answer); - } catch (final Exception e) { - throw new NbtApiException("Exception while converting NMS ItemStack to NBTCompound!", e); - } - } - - /** - * Gets a live copy of non-vanilla NBT tags. - * - * @param meta ItemMeta from which tags should be retrieved - * @return Map containing unhandled (custom) NBT tags - */ - public static Map<String, Object> getUnhandledNBTTags(ItemMeta meta) { - try { - return (Map<String, Object>) field_unhandledTags.get(meta); - } catch (final Exception e) { - throw new NbtApiException("Exception while getting unhandled tags from ItemMeta!", e); - } - } - - /** - * Gets the Vanilla NBT Compound from a given NMS Entity - * - * @param nmsEntity - * @return NMS NBT Compound - */ - public static Object getEntityNBTTagCompound(Object nmsEntity) { - try { - final Object nbt = ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz().newInstance(); - Object answer = ReflectionMethod.NMS_ENTITY_GET_NBT.run(nmsEntity, nbt); - if (answer == null) - answer = nbt; - return answer; - } catch (final Exception e) { - throw new NbtApiException("Exception while getting NBTCompound from NMS Entity!", e); - } - } - - /** - * Loads all Vanilla tags from a NMS Compound into a NMS Entity - * - * @param nbtTag - * @param nmsEntity - * @return The NMS Entity - */ - public static Object setEntityNBTTag(Object nbtTag, Object nmsEntity) { - try { - ReflectionMethod.NMS_ENTITY_SET_NBT.run(nmsEntity, nbtTag); - return nmsEntity; - } catch (final Exception ex) { - throw new NbtApiException("Exception while setting the NBTCompound of an Entity", ex); - } - } - - /** - * Gets the NMS Compound from a given TileEntity - * - * @param tile - * @return NMS Compound with the Vanilla data - */ - public static Object getTileEntityNBTTagCompound(BlockState tile) { - try { - final Object cworld = ClassWrapper.CRAFT_WORLD.getClazz().cast(tile.getWorld()); - final Object nmsworld = ReflectionMethod.CRAFT_WORLD_GET_HANDLE.run(cworld); - Object o = null; - if (MinecraftVersion.getVersion() == MinecraftVersion.MC1_7_R4) { - o = ReflectionMethod.NMS_WORLD_GET_TILEENTITY_1_7_10.run(nmsworld, tile.getX(), tile.getY(), tile.getZ()); - } else { - final Object pos = ObjectCreator.NMS_BLOCKPOSITION.getInstance(tile.getX(), tile.getY(), tile.getZ()); - o = ReflectionMethod.NMS_WORLD_GET_TILEENTITY.run(nmsworld, pos); - } - final Object tag = ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz().newInstance(); - Object answer = ReflectionMethod.TILEENTITY_GET_NBT.run(o, tag); - if (answer == null) - answer = tag; - return answer; - } catch (final Exception e) { - throw new NbtApiException("Exception while getting NBTCompound from TileEntity!", e); - } - } - - /** - * Sets Vanilla tags from a NMS Compound to a TileEntity - * - * @param tile - * @param comp - */ - public static void setTileEntityNBTTagCompound(BlockState tile, Object comp) { - try { - final Object cworld = ClassWrapper.CRAFT_WORLD.getClazz().cast(tile.getWorld()); - final Object nmsworld = ReflectionMethod.CRAFT_WORLD_GET_HANDLE.run(cworld); - Object o = null; - if (MinecraftVersion.getVersion() == MinecraftVersion.MC1_7_R4) { - o = ReflectionMethod.NMS_WORLD_GET_TILEENTITY_1_7_10.run(nmsworld, tile.getX(), tile.getY(), tile.getZ()); - } else { - final Object pos = ObjectCreator.NMS_BLOCKPOSITION.getInstance(tile.getX(), tile.getY(), tile.getZ()); - o = ReflectionMethod.NMS_WORLD_GET_TILEENTITY.run(nmsworld, pos); - } - if (MinecraftVersion.isAtLeastVersion(MinecraftVersion.MC1_17_R1)) { - ReflectionMethod.TILEENTITY_SET_NBT.run(o, comp); - } else if (MinecraftVersion.isAtLeastVersion(MinecraftVersion.MC1_16_R1)) { - final Object blockData = ReflectionMethod.TILEENTITY_GET_BLOCKDATA.run(o); - ReflectionMethod.TILEENTITY_SET_NBT_LEGACY1161.run(o, blockData, comp); - } else { - ReflectionMethod.TILEENTITY_SET_NBT_LEGACY1151.run(o, comp); - } - } catch (final Exception e) { - throw new NbtApiException("Exception while setting NBTData for a TileEntity!", e); - } - } - - /** - * Gets the subCompound with a given name from a NMS Compound - * - * @param compound - * @param name - * @return NMS Compound or null - */ - public static Object getSubNBTTagCompound(Object compound, String name) { - try { - if ((boolean) ReflectionMethod.COMPOUND_HAS_KEY.run(compound, name)) { - return ReflectionMethod.COMPOUND_GET_COMPOUND.run(compound, name); - } else { - throw new NbtApiException("Tried getting invalide compound '" + name + "' from '" + compound + "'!"); - } - } catch (final Exception e) { - throw new NbtApiException("Exception while getting NBT subcompounds!", e); - } - } - - /** - * Creates a subCompound with a given name in the given NMS Compound - * - * @param comp - * @param name - */ - public static void addNBTTagCompound(NBTCompound comp, String name) { - if (name == null) { - remove(comp, name); - return; - } - Object nbttag = comp.getCompound(); - if (nbttag == null) { - nbttag = ObjectCreator.NMS_NBTTAGCOMPOUND.getInstance(); - } - if (!valideCompound(comp)) { - return; - } - final Object workingtag = gettoCompount(nbttag, comp); - try { - ReflectionMethod.COMPOUND_SET.run(workingtag, name, - ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz().newInstance()); - comp.setCompound(nbttag); - } catch (final Exception e) { - throw new NbtApiException("Exception while adding a Compound!", e); - } - } - - /** - * Checks if the Compound is correctly linked to it's roots - * - * @param comp - * @return true if this is a valide Compound, else false - */ - public static Boolean valideCompound(NBTCompound comp) { - Object root = comp.getCompound(); - if (root == null) { - root = ObjectCreator.NMS_NBTTAGCOMPOUND.getInstance(); - } - return (gettoCompount(root, comp)) != null; - } - - protected static Object gettoCompount(Object nbttag, NBTCompound comp) { - final Deque<String> structure = new ArrayDeque<>(); - while (comp.getParent() != null) { - structure.add(comp.getName()); - comp = comp.getParent(); - } - while (!structure.isEmpty()) { - final String target = structure.pollLast(); - nbttag = getSubNBTTagCompound(nbttag, target); - if (nbttag == null) { - throw new NbtApiException("Unable to find tag '" + target + "' in " + nbttag); - } - } - return nbttag; - } - - /** - * Merges the second {@link NBTCompound} into the first one - * - * @param comp Target for the merge - * @param nbtcompoundSrc Data to merge - */ - public static void mergeOtherNBTCompound(NBTCompound comp, NBTCompound nbtcompoundSrc) { - Object rootnbttag = comp.getCompound(); - if (rootnbttag == null) { - rootnbttag = ObjectCreator.NMS_NBTTAGCOMPOUND.getInstance(); - } - if (!valideCompound(comp)) - throw new NbtApiException("The Compound wasn't able to be linked back to the root!"); - final Object workingtag = gettoCompount(rootnbttag, comp); - Object rootnbttagSrc = nbtcompoundSrc.getCompound(); - if (rootnbttagSrc == null) { - rootnbttagSrc = ObjectCreator.NMS_NBTTAGCOMPOUND.getInstance(); - } - if (!valideCompound(nbtcompoundSrc)) - throw new NbtApiException("The Compound wasn't able to be linked back to the root!"); - final Object workingtagSrc = gettoCompount(rootnbttagSrc, nbtcompoundSrc); - try { - ReflectionMethod.COMPOUND_MERGE.run(workingtag, workingtagSrc); - comp.setCompound(rootnbttag); - } catch (final Exception e) { - throw new NbtApiException("Exception while merging two NBTCompounds!", e); - } - } - - /** - * Returns the content for a given key inside a Compound - * - * @param comp - * @param key - * @return Content saved under this key - */ - public static String getContent(NBTCompound comp, String key) { - Object rootnbttag = comp.getCompound(); - if (rootnbttag == null) { - rootnbttag = ObjectCreator.NMS_NBTTAGCOMPOUND.getInstance(); - } - if (!valideCompound(comp)) - throw new NbtApiException("The Compound wasn't able to be linked back to the root!"); - final Object workingtag = gettoCompount(rootnbttag, comp); - try { - return ReflectionMethod.COMPOUND_GET.run(workingtag, key).toString(); - } catch (final Exception e) { - throw new NbtApiException("Exception while getting the Content for key '" + key + "'!", e); - } - } - - /** - * Sets a key in a {@link NBTCompound} to a given value - * - * @param comp - * @param key - * @param val - */ - public static void set(NBTCompound comp, String key, Object val) { - if (val == null) { - remove(comp, key); - return; - } - Object rootnbttag = comp.getCompound(); - if (rootnbttag == null) { - rootnbttag = ObjectCreator.NMS_NBTTAGCOMPOUND.getInstance(); - } - if (!valideCompound(comp)) { - throw new NbtApiException("The Compound wasn't able to be linked back to the root!"); - } - final Object workingtag = gettoCompount(rootnbttag, comp); - try { - ReflectionMethod.COMPOUND_SET.run(workingtag, key, val); - comp.setCompound(rootnbttag); - } catch (final Exception e) { - throw new NbtApiException("Exception while setting key '" + key + "' to '" + val + "'!", e); - } - } - - /** - * Returns the List saved with a given key. - * - * @param comp - * @param key - * @param type - * @param clazz - * @return The list at that key. Null if it's an invalide type - */ - public static <T> NBTList<T> getList(NBTCompound comp, String key, NBTType type, Class<T> clazz) { - Object rootnbttag = comp.getCompound(); - if (rootnbttag == null) { - rootnbttag = ObjectCreator.NMS_NBTTAGCOMPOUND.getInstance(); - } - if (!valideCompound(comp)) - return null; - final Object workingtag = gettoCompount(rootnbttag, comp); - try { - final Object nbt = ReflectionMethod.COMPOUND_GET_LIST.run(workingtag, key, type.getId()); - if (clazz == String.class) { - return (NBTList<T>) new NBTStringList(comp, key, type, nbt); - } else if (clazz == NBTListCompound.class) { - return (NBTList<T>) new NBTCompoundList(comp, key, type, nbt); - } else if (clazz == Integer.class) { - return (NBTList<T>) new NBTIntegerList(comp, key, type, nbt); - } else if (clazz == Float.class) { - return (NBTList<T>) new NBTFloatList(comp, key, type, nbt); - } else if (clazz == Double.class) { - return (NBTList<T>) new NBTDoubleList(comp, key, type, nbt); - } else if (clazz == Long.class) { - return (NBTList<T>) new NBTLongList(comp, key, type, nbt); - } else { - return null; - } - } catch (final Exception ex) { - throw new NbtApiException("Exception while getting a list with the type '" + type + "'!", ex); - } - } - - public static NBTType getListType(NBTCompound comp, String key) { - Object rootnbttag = comp.getCompound(); - if (rootnbttag == null) { - rootnbttag = ObjectCreator.NMS_NBTTAGCOMPOUND.getInstance(); - } - if (!valideCompound(comp)) - return null; - final Object workingtag = gettoCompount(rootnbttag, comp); - try { - final Object nbt = ReflectionMethod.COMPOUND_GET.run(workingtag, key); - String fieldname = "type"; - if (MinecraftVersion.isAtLeastVersion(MinecraftVersion.MC1_17_R1)) { - fieldname = "w"; - } - final Field f = nbt.getClass().getDeclaredField(fieldname); - f.setAccessible(true); - return NBTType.valueOf(f.getByte(nbt)); - } catch (final Exception ex) { - throw new NbtApiException("Exception while getting the list type!", ex); - } - } - - public static Object getEntry(NBTCompound comp, String key) { - Object rootnbttag = comp.getCompound(); - if (rootnbttag == null) { - rootnbttag = ObjectCreator.NMS_NBTTAGCOMPOUND.getInstance(); - } - if (!valideCompound(comp)) - return null; - final Object workingtag = gettoCompount(rootnbttag, comp); - try { - final Object nbt = ReflectionMethod.COMPOUND_GET.run(workingtag, key); - return nbt; - } catch (final Exception ex) { - throw new NbtApiException("Exception while getting an Entry!", ex); - } - } - - /** - * Uses Gson to set a {@link Serializable} value in a Compound - * - * @param comp - * @param key - * @param value - */ - public static void setObject(NBTCompound comp, String key, Object value) { - try { - final String json = GsonWrapper.getString(value); - - setData(comp, ReflectionMethod.COMPOUND_SET_STRING, key, json); - } catch (final Exception e) { - throw new NbtApiException("Exception while setting the Object '" + value + "'!", e); - } - } - - /** - * Uses Gson to load back a {@link Serializable} object from the Compound - * - * @param comp - * @param key - * @param type - * @return The loaded Object or null, if not found - */ - public static <T> T getObject(NBTCompound comp, String key, Class<T> type) { - final String json = (String) getData(comp, ReflectionMethod.COMPOUND_GET_STRING, key); - if (json == null) { - return null; - } - return GsonWrapper.deserializeJson(json, type); - } - - /** - * Deletes the given key - * - * @param comp - * @param key - */ - public static void remove(NBTCompound comp, String key) { - Object rootnbttag = comp.getCompound(); - if (rootnbttag == null) { - rootnbttag = ObjectCreator.NMS_NBTTAGCOMPOUND.getInstance(); - } - if (!valideCompound(comp)) - return; - final Object workingtag = gettoCompount(rootnbttag, comp); - ReflectionMethod.COMPOUND_REMOVE_KEY.run(workingtag, key); - comp.setCompound(rootnbttag); - } - - /** - * Gets the Keyset inside this Compound - * - * @param comp - * @return Set of all keys - */ - public static Set<String> getKeys(NBTCompound comp) { - Object rootnbttag = comp.getCompound(); - if (rootnbttag == null) { - rootnbttag = ObjectCreator.NMS_NBTTAGCOMPOUND.getInstance(); - } - if (!valideCompound(comp)) - throw new NbtApiException("The Compound wasn't able to be linked back to the root!"); - final Object workingtag = gettoCompount(rootnbttag, comp); - return (Set<String>) ReflectionMethod.COMPOUND_GET_KEYS.run(workingtag); - } - - /** - * Sets data inside the Compound - * - * @param comp - * @param type - * @param key - * @param data - */ - public static void setData(NBTCompound comp, ReflectionMethod type, String key, Object data) { - if (data == null) { - remove(comp, key); - return; - } - Object rootnbttag = comp.getCompound(); - if (rootnbttag == null) { - rootnbttag = ObjectCreator.NMS_NBTTAGCOMPOUND.getInstance(); - } - if (!valideCompound(comp)) - throw new NbtApiException("The Compound wasn't able to be linked back to the root!"); - final Object workingtag = gettoCompount(rootnbttag, comp); - type.run(workingtag, key, data); - comp.setCompound(rootnbttag); - } - - /** - * Gets data from the Compound - * - * @param comp - * @param type - * @param key - * @return The value or default fallback from NMS - */ - public static Object getData(NBTCompound comp, ReflectionMethod type, String key) { - final Object rootnbttag = comp.getCompound(); - if (rootnbttag == null) { - return null; - } - if (!valideCompound(comp)) - throw new NbtApiException("The Compound wasn't able to be linked back to the root!"); - final Object workingtag = gettoCompount(rootnbttag, comp); - return type.run(workingtag, key); - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTStringList.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTStringList.java deleted file mode 100644 index 0da3d8f6efadf532ac8106f5023107bc5a1ff815..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTStringList.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; - -/** - * String implementation for NBTLists - * - * @author tr7zw - * - */ -public class NBTStringList extends NBTList<String> { - - protected NBTStringList(NBTCompound owner, String name, NBTType type, Object list) { - super(owner, name, type, list); - } - - @Override - public String get(int index) { - try { - return (String) ReflectionMethod.LIST_GET_STRING.run(listObject, index); - } catch (final Exception ex) { - throw new NbtApiException(ex); - } - } - - @Override - protected Object asTag(String object) { - try { - final Constructor<?> con = ClassWrapper.NMS_NBTTAGSTRING.getClazz().getDeclaredConstructor(String.class); - con.setAccessible(true); - return con.newInstance(object); - } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException - | NoSuchMethodException | SecurityException e) { - throw new NbtApiException("Error while wrapping the Object " + object + " to it's NMS object!", e); - } - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTTileEntity.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTTileEntity.java deleted file mode 100644 index c1a1c76ef6d94a5101cf8316aba7688e99f41762..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTTileEntity.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import org.bukkit.block.BlockState; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.exception.FoException; - -/** - * NBT class to access vanilla tags from TileEntities. TileEntities don't - * support custom tags. Use the NBTInjector for custom tags. Changes will be - * instantly applied to the Tile, use the merge method to do many things at - * once. - * - * @author tr7zw - * - */ -public class NBTTileEntity extends NBTCompound { - - private final BlockState tile; - - /** - * @param tile BlockState from any TileEntity - */ - public NBTTileEntity(BlockState tile) { - super(null, null); - if (tile == null || (MinecraftVersion.isAtLeastVersion(MinecraftVersion.MC1_8_R3) && !tile.isPlaced())) { - throw new NullPointerException("Tile can't be null/not placed!"); - } - this.tile = tile; - } - - @Override - public Object getCompound() { - return NBTReflectionUtil.getTileEntityNBTTagCompound(tile); - } - - @Override - protected void setCompound(Object compound) { - NBTReflectionUtil.setTileEntityNBTTagCompound(tile, compound); - } - - /** - * Gets the NBTCompound used by spigots PersistentDataAPI. This method is only - * available for 1.14+! - * - * @return NBTCompound containing the data of the PersistentDataAPI - */ - public NBTCompound getPersistentDataContainer() { - - if (org.mineacademy.fo.MinecraftVersion.olderThan(V.v1_14)) - throw new FoException("getPersistentDataContainer requires MC 1.14 or newer"); - - if (hasKey("PublicBukkitValues")) { - return getCompound("PublicBukkitValues"); - - } else { - final NBTContainer container = new NBTContainer(); - container.addCompound("PublicBukkitValues").setString("__nbtapi", - "Marker to make the PersistentDataContainer have content"); - mergeCompound(container); - return getCompound("PublicBukkitValues"); - } - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTType.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTType.java deleted file mode 100644 index 57d60e3655ca99ffcfd6aea9fbd2adeddb95bf24..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NBTType.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -/** - * Enum of all NBT Types Minecraft contains - * - * @author tr7zw - * - */ -public enum NBTType { - NBTTagEnd(0), - NBTTagByte(1), - NBTTagShort(2), - NBTTagInt(3), - NBTTagLong(4), - NBTTagFloat(5), - NBTTagDouble(6), - NBTTagByteArray(7), - NBTTagIntArray(11), - NBTTagString(8), - NBTTagList(9), - NBTTagCompound(10); - - NBTType(int i) { - id = i; - } - - private final int id; - - /** - * @return Id used by Minecraft internally - */ - public int getId() { - return id; - } - - /** - * @param id Internal Minecraft id - * @return Enum representing the id, NBTTagEnd for invalide ids - */ - public static NBTType valueOf(int id) { - for (final NBTType t : values()) - if (t.getId() == id) - return t; - return NBTType.NBTTagEnd; - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NbtApiException.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NbtApiException.java deleted file mode 100644 index 7e1ceea935578eca97f23ee32721a4feff520a03..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/NbtApiException.java +++ /dev/null @@ -1,56 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -/** - * A generic {@link RuntimeException} that can be thrown by most methods in the - * NBTAPI. - * - * @author tr7zw - * - */ -public class NbtApiException extends RuntimeException { - - /** - * - */ - private static final long serialVersionUID = -993309714559452334L; - - /** - * - */ - public NbtApiException() { - super(); - } - - /** - * @param message - * @param cause - * @param enableSuppression - * @param writableStackTrace - */ - public NbtApiException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } - - /** - * @param message - * @param cause - */ - public NbtApiException(String message, Throwable cause) { - super(message, cause); - } - - /** - * @param message - */ - public NbtApiException(String message) { - super(message); - } - - /** - * @param cause - */ - public NbtApiException(Throwable cause) { - super(cause); - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/ObjectCreator.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/ObjectCreator.java deleted file mode 100644 index 47858580891e15afa3d1eae84809df1d3b5d75d5..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/ObjectCreator.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import java.lang.reflect.Constructor; - -import org.mineacademy.fo.Common; - -/** - * This Enum wraps Constructors for NMS classes - * - * @author tr7zw - * - */ -enum ObjectCreator { - NMS_NBTTAGCOMPOUND(null, null, ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz()), - NMS_BLOCKPOSITION(null, null, ClassWrapper.NMS_BLOCKPOSITION.getClazz(), int.class, int.class, int.class), - NMS_COMPOUNDFROMITEM(MinecraftVersion.MC1_11_R1, null, ClassWrapper.NMS_ITEMSTACK.getClazz(), ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz()),; - - private Constructor<?> construct; - private Class<?> targetClass; - - ObjectCreator(MinecraftVersion from, MinecraftVersion to, Class<?> clazz, Class<?>... args) { - if (clazz == null) - return; - if (from != null && MinecraftVersion.getVersion().getVersionId() < from.getVersionId()) - return; - if (to != null && MinecraftVersion.getVersion().getVersionId() > to.getVersionId()) - return; - try { - this.targetClass = clazz; - construct = clazz.getDeclaredConstructor(args); - construct.setAccessible(true); - } catch (final Exception ex) { - Common.error(ex, "Unable to find the constructor for the class '" + clazz.getName() + "'"); - } - } - - /** - * Creates an Object instance with given args - * - * @param args - * @return Object created - */ - public Object getInstance(Object... args) { - try { - return construct.newInstance(args); - } catch (final Exception ex) { - throw new NbtApiException("Exception while creating a new instance of '" + targetClass + "'", ex); - } - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/PackageWrapper.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/PackageWrapper.java deleted file mode 100644 index 1650bc92e778a08c111e7fbdf7b7dd19d04d95c4..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/PackageWrapper.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -/** - * Package enum - * - * @author tr7zw - * - */ -enum PackageWrapper { - NMS(new String(new byte[] { 'n', 'e', 't', '.', 'm', 'i', 'n', 'e', 'c', 'r', 'a', 'f', 't', '.', 's', 'e', 'r', 'v', 'e', 'r' })), - CRAFTBUKKIT(new String(new byte[] { 'o', 'r', 'g', '.', 'b', 'u', 'k', 'k', 'i', 't', '.', 'c', 'r', 'a', 'f', 't', 'b', 'u', 'k', 'k', 'i', 't' })), - NONE(""); - - private final String uri; - - private PackageWrapper(String uri) { - this.uri = uri; - } - - /** - * @return The Uri for that package - */ - public String getUri() { - return uri; - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/ReflectionMethod.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/ReflectionMethod.java deleted file mode 100644 index 8dfe1416250fb2d85d36ef0d74671744216fe9ef..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/ReflectionMethod.java +++ /dev/null @@ -1,197 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import java.io.InputStream; -import java.io.OutputStream; -import java.lang.reflect.Method; -import java.util.UUID; - -import org.bukkit.inventory.ItemStack; - -/** - * This class caches method reflections, keeps track of method name changes between versions and allows early checking for problems - * - * @author tr7zw - * - */ -enum ReflectionMethod { - - COMPOUND_SET_FLOAT(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class, float.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "setFloat")), - COMPOUND_SET_STRING(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class, String.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "setString")), - COMPOUND_SET_INT(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class, int.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "setInt")), - COMPOUND_SET_BYTEARRAY(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class, byte[].class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "setByteArray")), - COMPOUND_SET_INTARRAY(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class, int[].class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "setIntArray")), - COMPOUND_SET_LONG(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class, long.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "setLong")), - COMPOUND_SET_SHORT(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class, short.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "setShort")), - COMPOUND_SET_BYTE(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class, byte.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "setByte")), - COMPOUND_SET_DOUBLE(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class, double.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "setDouble")), - COMPOUND_SET_BOOLEAN(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class, boolean.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "setBoolean")), - COMPOUND_SET_UUID(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class, UUID.class }, MinecraftVersion.MC1_16_R1, new Since(MinecraftVersion.MC1_16_R1, "a")), - COMPOUND_MERGE(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz() }, MinecraftVersion.MC1_8_R3, new Since(MinecraftVersion.MC1_8_R3, "a")), //FIXME: No Spigot mapping! - COMPOUND_SET(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class, ClassWrapper.NMS_NBTBASE.getClazz() }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "set")), - COMPOUND_GET(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "get")), - COMPOUND_GET_LIST(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class, int.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getList")), - COMPOUND_OWN_TYPE(ClassWrapper.NMS_NBTBASE.getClazz(), new Class[] {}, MinecraftVersion.MC1_7_R4, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getTypeId")), // Only needed for 1.7.10 getType - - COMPOUND_GET_FLOAT(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getFloat")), - COMPOUND_GET_STRING(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getString")), - COMPOUND_GET_INT(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getInt")), - COMPOUND_GET_BYTEARRAY(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getByteArray")), - COMPOUND_GET_INTARRAY(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getIntArray")), - COMPOUND_GET_LONG(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getLong")), - COMPOUND_GET_SHORT(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getShort")), - COMPOUND_GET_BYTE(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getByte")), - COMPOUND_GET_DOUBLE(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getDouble")), - COMPOUND_GET_BOOLEAN(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getBoolean")), - COMPOUND_GET_UUID(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class }, MinecraftVersion.MC1_16_R1, new Since(MinecraftVersion.MC1_16_R1, "a")), - COMPOUND_GET_COMPOUND(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getCompound")), - - NMSITEM_GETTAG(ClassWrapper.NMS_ITEMSTACK.getClazz(), new Class[] {}, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getTag")), - NMSITEM_SAVE(ClassWrapper.NMS_ITEMSTACK.getClazz(), new Class[] { ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz() }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "save")), - NMSITEM_CREATESTACK(ClassWrapper.NMS_ITEMSTACK.getClazz(), new Class[] { ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz() }, MinecraftVersion.MC1_7_R4, MinecraftVersion.MC1_10_R1, new Since(MinecraftVersion.MC1_7_R4, "createStack")), - - COMPOUND_REMOVE_KEY(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "remove")), - COMPOUND_HAS_KEY(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "hasKey")), - COMPOUND_GET_TYPE(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] { String.class }, MinecraftVersion.MC1_8_R3, new Since(MinecraftVersion.MC1_8_R3, "b"), new Since(MinecraftVersion.MC1_9_R1, "d"), new Since(MinecraftVersion.MC1_15_R1, "e"), new Since(MinecraftVersion.MC1_16_R1, "d")), //FIXME: No Spigot mapping! - COMPOUND_GET_KEYS(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] {}, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "c"), new Since(MinecraftVersion.MC1_13_R1, "getKeys")), - - LISTCOMPOUND_GET_KEYS(ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), new Class[] {}, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "c"), new Since(MinecraftVersion.MC1_13_R1, "getKeys")), - LIST_REMOVE_KEY(ClassWrapper.NMS_NBTTAGLIST.getClazz(), new Class[] { int.class }, MinecraftVersion.MC1_8_R3, new Since(MinecraftVersion.MC1_8_R3, "a"), new Since(MinecraftVersion.MC1_9_R1, "remove")), - LIST_SIZE(ClassWrapper.NMS_NBTTAGLIST.getClazz(), new Class[] {}, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "size")), - LIST_SET(ClassWrapper.NMS_NBTTAGLIST.getClazz(), new Class[] { int.class, ClassWrapper.NMS_NBTBASE.getClazz() }, MinecraftVersion.MC1_8_R3, new Since(MinecraftVersion.MC1_8_R3, "a"), new Since(MinecraftVersion.MC1_13_R1, "set")), - LEGACY_LIST_ADD(ClassWrapper.NMS_NBTTAGLIST.getClazz(), new Class[] { ClassWrapper.NMS_NBTBASE.getClazz() }, MinecraftVersion.MC1_7_R4, MinecraftVersion.MC1_13_R2, new Since(MinecraftVersion.MC1_7_R4, "add")), - LIST_ADD(ClassWrapper.NMS_NBTTAGLIST.getClazz(), new Class[] { int.class, ClassWrapper.NMS_NBTBASE.getClazz() }, MinecraftVersion.MC1_14_R1, new Since(MinecraftVersion.MC1_14_R1, "add")), - LIST_GET_STRING(ClassWrapper.NMS_NBTTAGLIST.getClazz(), new Class[] { int.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getString")), - LIST_GET_COMPOUND(ClassWrapper.NMS_NBTTAGLIST.getClazz(), new Class[] { int.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "get")), - LIST_GET(ClassWrapper.NMS_NBTTAGLIST.getClazz(), new Class[] { int.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "get"), new Since(MinecraftVersion.MC1_8_R3, "g"), new Since(MinecraftVersion.MC1_9_R1, "h"), new Since(MinecraftVersion.MC1_12_R1, "i"), new Since(MinecraftVersion.MC1_13_R1, "get")), - - ITEMSTACK_SET_TAG(ClassWrapper.NMS_ITEMSTACK.getClazz(), new Class[] { ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz() }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "setTag")), - ITEMSTACK_NMSCOPY(ClassWrapper.CRAFT_ITEMSTACK.getClazz(), new Class[] { ItemStack.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "asNMSCopy")), - ITEMSTACK_BUKKITMIRROR(ClassWrapper.CRAFT_ITEMSTACK.getClazz(), new Class[] { ClassWrapper.NMS_ITEMSTACK.getClazz() }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "asCraftMirror")), - - CRAFT_WORLD_GET_HANDLE(ClassWrapper.CRAFT_WORLD.getClazz(), new Class[] {}, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getHandle")), - NMS_WORLD_GET_TILEENTITY(ClassWrapper.NMS_WORLDSERVER.getClazz(), new Class[] { ClassWrapper.NMS_BLOCKPOSITION.getClazz() }, MinecraftVersion.MC1_8_R3, new Since(MinecraftVersion.MC1_8_R3, "getTileEntity")), - NMS_WORLD_SET_TILEENTITY(ClassWrapper.NMS_WORLDSERVER.getClazz(), new Class[] { ClassWrapper.NMS_BLOCKPOSITION.getClazz(), ClassWrapper.NMS_TILEENTITY.getClazz() }, MinecraftVersion.MC1_8_R3, MinecraftVersion.MC1_16_R3, new Since(MinecraftVersion.MC1_8_R3, "setTileEntity")), - NMS_WORLD_REMOVE_TILEENTITY(ClassWrapper.NMS_WORLDSERVER.getClazz(), new Class[] { ClassWrapper.NMS_BLOCKPOSITION.getClazz() }, MinecraftVersion.MC1_8_R3, new Since(MinecraftVersion.MC1_8_R3, "t"), new Since(MinecraftVersion.MC1_9_R1, "s"), new Since(MinecraftVersion.MC1_13_R1, "n"), new Since(MinecraftVersion.MC1_14_R1, "removeTileEntity")), - - NMS_WORLD_GET_TILEENTITY_1_7_10(ClassWrapper.NMS_WORLDSERVER.getClazz(), new Class[] { int.class, int.class, int.class }, MinecraftVersion.MC1_7_R4, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getTileEntity")), - - TILEENTITY_LOAD_LEGACY191(ClassWrapper.NMS_TILEENTITY.getClazz(), new Class[] { ClassWrapper.NMS_MINECRAFTSERVER.getClazz(), ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz() }, MinecraftVersion.MC1_9_R1, MinecraftVersion.MC1_9_R1, new Since(MinecraftVersion.MC1_9_R1, "a")), //FIXME: No Spigot mapping! - TILEENTITY_LOAD_LEGACY183(ClassWrapper.NMS_TILEENTITY.getClazz(), new Class[] { ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz() }, MinecraftVersion.MC1_8_R3, MinecraftVersion.MC1_9_R2, new Since(MinecraftVersion.MC1_8_R3, "c"), new Since(MinecraftVersion.MC1_9_R1, "a"), new Since(MinecraftVersion.MC1_9_R2, "c")), //FIXME: No Spigot mapping! - TILEENTITY_LOAD_LEGACY1121(ClassWrapper.NMS_TILEENTITY.getClazz(), new Class[] { ClassWrapper.NMS_WORLD.getClazz(), ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz() }, MinecraftVersion.MC1_10_R1, MinecraftVersion.MC1_12_R1, new Since(MinecraftVersion.MC1_10_R1, "a"), new Since(MinecraftVersion.MC1_12_R1, "create")), - TILEENTITY_LOAD_LEGACY1151(ClassWrapper.NMS_TILEENTITY.getClazz(), new Class[] { ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz() }, MinecraftVersion.MC1_13_R1, MinecraftVersion.MC1_15_R1, new Since(MinecraftVersion.MC1_12_R1, "create")), - TILEENTITY_LOAD(ClassWrapper.NMS_TILEENTITY.getClazz(), new Class[] { ClassWrapper.NMS_IBLOCKDATA.getClazz(), ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz() }, MinecraftVersion.MC1_16_R1, MinecraftVersion.MC1_16_R3, new Since(MinecraftVersion.MC1_16_R1, "create")), - - TILEENTITY_GET_NBT(ClassWrapper.NMS_TILEENTITY.getClazz(), new Class[] { ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz() }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "b"), new Since(MinecraftVersion.MC1_9_R1, "save")), - TILEENTITY_SET_NBT_LEGACY1151(ClassWrapper.NMS_TILEENTITY.getClazz(), new Class[] { ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz() }, MinecraftVersion.MC1_7_R4, MinecraftVersion.MC1_15_R1, new Since(MinecraftVersion.MC1_7_R4, "a"), new Since(MinecraftVersion.MC1_12_R1, "load")), - TILEENTITY_SET_NBT_LEGACY1161(ClassWrapper.NMS_TILEENTITY.getClazz(), new Class[] { ClassWrapper.NMS_IBLOCKDATA.getClazz(), ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz() }, MinecraftVersion.MC1_16_R1, MinecraftVersion.MC1_16_R3, new Since(MinecraftVersion.MC1_16_R1, "load")), - TILEENTITY_SET_NBT(ClassWrapper.NMS_TILEENTITY.getClazz(), new Class[] { ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz() }, MinecraftVersion.MC1_17_R1, new Since(MinecraftVersion.MC1_16_R1, "load")), - TILEENTITY_GET_BLOCKDATA(ClassWrapper.NMS_TILEENTITY.getClazz(), new Class[] {}, MinecraftVersion.MC1_16_R1, new Since(MinecraftVersion.MC1_16_R1, "getBlock")), - - CRAFT_ENTITY_GET_HANDLE(ClassWrapper.CRAFT_ENTITY.getClazz(), new Class[] {}, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "getHandle")), - NMS_ENTITY_SET_NBT(ClassWrapper.NMS_ENTITY.getClazz(), new Class[] { ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz() }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "f"), new Since(MinecraftVersion.MC1_16_R1, "load")), //FIXME: No Spigot mapping! - NMS_ENTITY_GET_NBT(ClassWrapper.NMS_ENTITY.getClazz(), new Class[] { ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz() }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "e"), new Since(MinecraftVersion.MC1_12_R1, "save")), - NMS_ENTITY_GETSAVEID(ClassWrapper.NMS_ENTITY.getClazz(), new Class[] {}, MinecraftVersion.MC1_14_R1, new Since(MinecraftVersion.MC1_14_R1, "getSaveID")), - - NBTFILE_READ(ClassWrapper.NMS_NBTCOMPRESSEDSTREAMTOOLS.getClazz(), new Class[] { InputStream.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "a")), //FIXME: No Spigot mapping! - NBTFILE_WRITE(ClassWrapper.NMS_NBTCOMPRESSEDSTREAMTOOLS.getClazz(), new Class[] { ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), OutputStream.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "a")), //FIXME: No Spigot mapping! - - PARSE_NBT(ClassWrapper.NMS_MOJANGSONPARSER.getClazz(), new Class[] { String.class }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "parse")), - REGISTRY_KEYSET(ClassWrapper.NMS_REGISTRYSIMPLE.getClazz(), new Class[] {}, MinecraftVersion.MC1_11_R1, MinecraftVersion.MC1_13_R1, new Since(MinecraftVersion.MC1_11_R1, "keySet")), - REGISTRY_GET(ClassWrapper.NMS_REGISTRYSIMPLE.getClazz(), new Class[] { Object.class }, MinecraftVersion.MC1_11_R1, MinecraftVersion.MC1_13_R1, new Since(MinecraftVersion.MC1_11_R1, "get")), - REGISTRY_SET(ClassWrapper.NMS_REGISTRYSIMPLE.getClazz(), new Class[] { Object.class, Object.class }, MinecraftVersion.MC1_11_R1, MinecraftVersion.MC1_13_R1, new Since(MinecraftVersion.MC1_11_R1, "a")), //FIXME: No Spigot mapping! - REGISTRY_GET_INVERSE(ClassWrapper.NMS_REGISTRYMATERIALS.getClazz(), new Class[] { Object.class }, MinecraftVersion.MC1_11_R1, MinecraftVersion.MC1_13_R1, new Since(MinecraftVersion.MC1_11_R1, "b")), //FIXME: No Spigot mapping! - REGISTRYMATERIALS_KEYSET(ClassWrapper.NMS_REGISTRYMATERIALS.getClazz(), new Class[] {}, MinecraftVersion.MC1_13_R1, new Since(MinecraftVersion.MC1_13_R1, "keySet")), - REGISTRYMATERIALS_GET(ClassWrapper.NMS_REGISTRYMATERIALS.getClazz(), new Class[] { ClassWrapper.NMS_MINECRAFTKEY.getClazz() }, MinecraftVersion.MC1_13_R1, new Since(MinecraftVersion.MC1_13_R1, "get")), - REGISTRYMATERIALS_GETKEY(ClassWrapper.NMS_REGISTRYMATERIALS.getClazz(), new Class[] { Object.class }, MinecraftVersion.MC1_13_R2, new Since(MinecraftVersion.MC1_13_R2, "getKey")), - - GAMEPROFILE_DESERIALIZE(ClassWrapper.NMS_GAMEPROFILESERIALIZER.getClazz(), new Class[] { ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz() }, MinecraftVersion.MC1_7_R4, new Since(MinecraftVersion.MC1_7_R4, "deserialize")), - GAMEPROFILE_SERIALIZE(ClassWrapper.NMS_GAMEPROFILESERIALIZER.getClazz(), new Class[] { ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz(), ClassWrapper.GAMEPROFILE.getClazz() }, MinecraftVersion.MC1_8_R3, new Since(MinecraftVersion.MC1_8_R3, "serialize")), - - CRAFT_PERSISTENT_DATA_CONTAINER_TO_TAG(ClassWrapper.CRAFT_PERSISTENTDATACONTAINER.getClazz(), new Class[] {}, MinecraftVersion.MC1_14_R1, new Since(MinecraftVersion.MC1_14_R1, "toTagCompound")), - CRAFT_PERSISTENT_DATA_CONTAINER_GET_MAP(ClassWrapper.CRAFT_PERSISTENTDATACONTAINER.getClazz(), new Class[] {}, MinecraftVersion.MC1_14_R1, new Since(MinecraftVersion.MC1_14_R1, "getRaw")), - CRAFT_PERSISTENT_DATA_CONTAINER_PUT_ALL(ClassWrapper.CRAFT_PERSISTENTDATACONTAINER.getClazz(), new Class[] { ClassWrapper.NMS_NBTTAGCOMPOUND.getClazz() }, MinecraftVersion.MC1_14_R1, new Since(MinecraftVersion.MC1_14_R1, "putAll")), - ; - - private MinecraftVersion removedAfter; - private Since targetVersion; - private Method method; - private boolean loaded = false; - private boolean compatible = false; - private String methodName = null; - - ReflectionMethod(Class<?> targetClass, Class<?>[] args, MinecraftVersion addedSince, MinecraftVersion removedAfter, Since... methodnames) { - this.removedAfter = removedAfter; - if (!MinecraftVersion.isAtLeastVersion(addedSince) || (this.removedAfter != null && MinecraftVersion.isNewerThan(removedAfter))) - return; - compatible = true; - final MinecraftVersion server = MinecraftVersion.getVersion(); - Since target = methodnames[0]; - for (final Since s : methodnames) { - if (s.version.getVersionId() <= server.getVersionId() && target.version.getVersionId() < s.version.getVersionId()) - target = s; - } - targetVersion = target; - try { - method = targetClass.getMethod(targetVersion.name, args); - method.setAccessible(true); - loaded = true; - methodName = targetVersion.name; - - } catch (NullPointerException | NoSuchMethodException | SecurityException ex) { - System.out.println("[NBTAPI] Unable to find the method '" + targetVersion.name + "' in '" + (targetClass == null ? "null" : targetClass.getSimpleName()) + "' Enum: " + this); //NOSONAR This gets loaded before the logger is loaded - } - } - - ReflectionMethod(Class<?> targetClass, Class<?>[] args, MinecraftVersion addedSince, Since... methodnames) { - this(targetClass, args, addedSince, null, methodnames); - } - - /** - * Runs the method on a given target object using the given args. - * - * @param target - * @param args - * @return Value returned by the method - */ - public Object run(Object target, Object... args) { - if (method == null) - throw new NbtApiException("Method not loaded! '" + this + "'"); - try { - return method.invoke(target, args); - } catch (final Exception ex) { - throw new NbtApiException("Error while calling the method '" + methodName + "', loaded: " + loaded + ", Enum: " + this, ex); - } - } - - /** - * @return The MethodName, used in this Minecraft Version - */ - public String getMethodName() { - return methodName; - } - - /** - * @return Has this method been linked - */ - public boolean isLoaded() { - return loaded; - } - - /** - * @return Is this method available in this Minecraft Version - */ - public boolean isCompatible() { - return compatible; - } - - protected static class Since { - public final MinecraftVersion version; - public final String name; - - public Since(MinecraftVersion version, String name) { - this.version = version; - this.name = name; - } - } - -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/ReflectionUtil.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/ReflectionUtil.java deleted file mode 100644 index 8646061043c95a1399c7f953ea27033dada391d2..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/remain/nbt/ReflectionUtil.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.mineacademy.fo.remain.nbt; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -final class ReflectionUtil { - - private static Field field_modifiers; - - static { - try { - field_modifiers = Field.class.getDeclaredField("modifiers"); - field_modifiers.setAccessible(true); - } catch (final NoSuchFieldException ex) { - try { - // This hacky workaround is for newer jdk versions 11+? - final Method fieldGetter = Class.class.getDeclaredMethod("getDeclaredFields0", boolean.class); - fieldGetter.setAccessible(true); - final Field[] fields = (Field[]) fieldGetter.invoke(Field.class, false); - for (final Field f : fields) - if (f.getName().equals("modifiers")) { - field_modifiers = f; - field_modifiers.setAccessible(true); - break; - } - } catch (final Exception e) { - throw new NbtApiException(e); - } - } - if (field_modifiers == null) { - throw new NbtApiException("Unable to init the modifiers Field."); - } - } - - public static Field makeNonFinal(Field field) throws IllegalArgumentException, IllegalAccessException { - final int mods = field.getModifiers(); - if (Modifier.isFinal(mods)) { - field_modifiers.set(field, mods & ~Modifier.FINAL); - } - return field; - } - - public static void setFinal(Object obj, Field field, Object newValue) - throws IllegalArgumentException, IllegalAccessException { - field.setAccessible(true); - field = makeNonFinal(field); - field.set(obj, newValue); - } - -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/Lang.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/Lang.java deleted file mode 100644 index 420c339a96f7b5d2e63d5e56435e03e6506dad0a..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/Lang.java +++ /dev/null @@ -1,274 +0,0 @@ -package org.mineacademy.fo.settings; - -import java.util.Arrays; -import java.util.List; - -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Messenger; -import org.mineacademy.fo.SerializeUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.JavaScriptExecutor; -import org.mineacademy.fo.model.SimpleComponent; - -/** - * Represents the new way of internalization, with the greatest - * upside of saving development time. - * - * The downside is that keys are not checked during load so any - * malformed or missing key will fail later and may be unnoticed. - */ -public final class Lang extends YamlConfig { - - /** - * The instance of this class - */ - private static volatile Lang instance; - - /* - * Create a new instance and load the given file - */ - private Lang(String filePath) { - this.loadConfiguration(filePath); - } - - /** - * @see org.mineacademy.fo.settings.YamlConfig#saveComments() - */ - @Override - protected boolean saveComments() { - return true; - } - - /* - * Return a key from our localization, failing if not exists - */ - private String getStringStrict(String path) { - final String key = getString(path); - Valid.checkNotNull(key, "Missing localization key '" + path + "' from " + getFileName()); - - return key; - } - - // ------------------------------------------------------------------------------------------------------------ - // Static access - loading - // ------------------------------------------------------------------------------------------------------------ - - /** - * Call this method in your onPluginPreStart to use the Lang features, - * the Lang class will use the given file in the path below: - * "localization/messages_" + SimpleSettings.LOCALE_PREFIX ".yml" - */ - public static void init() { - init("localization/messages_" + SimpleSettings.LOCALE_PREFIX + ".yml"); - } - - /** - * Call this method in your onPluginPreStart to use the Lang features, - * the Lang class will use the given file in the given path. - * - * Example: "localization/messages_" + SimpleSettings.LOCALE_PREFIX ".yml" - */ - public static void init(String filePath) { - instance = new Lang(filePath); - - if (instance.isSet("Prefix.Announce")) - Messenger.setAnnouncePrefix(Lang.of("Prefix.Announce")); - - if (instance.isSet("Prefix.Error")) - Messenger.setErrorPrefix(Lang.of("Prefix.Error")); - - if (instance.isSet("Prefix.Info")) - Messenger.setInfoPrefix(Lang.of("Prefix.Info")); - - if (instance.isSet("Prefix.Question")) - Messenger.setQuestionPrefix(Lang.of("Prefix.Question")); - - if (instance.isSet("Prefix.Success")) - Messenger.setSuccessPrefix(Lang.of("Prefix.Success")); - - if (instance.isSet("Prefix.Warn")) - Messenger.setWarnPrefix(Lang.of("Prefix.Warn")); - } - - /** - * Reload this file - */ - public static void reloadFile() { - if (instance != null) { - synchronized (instance) { - instance.reload(); - } - } - } - - // ------------------------------------------------------------------------------------------------------------ - // Getters - // ------------------------------------------------------------------------------------------------------------ - - /** - * Return a boolean at path - * - * @param path - * @return - */ - public static boolean getOption(String path) { - checkInit(); - - synchronized (instance) { - return instance.getBoolean(path); - } - } - - /** - * Return a component list from the localization file with {0} {1} etc. variables replaced. - * - * @param path - * @param variables - * @return - */ - public static List<SimpleComponent> ofComponentList(String path, Object... variables) { - return Common.convert(ofList(path, variables), SimpleComponent::of); - } - - /** - * Return a list from the localization file with {0} {1} etc. variables replaced. - * - * @param path - * @param variables - * @return - */ - public static List<String> ofList(String path, Object... variables) { - return Arrays.asList(ofArray(path, variables)); - } - - /** - * Return an array from the localization file with {0} {1} etc. variables replaced. - * - * @param path - * @param variables - * @return - */ - public static String[] ofArray(String path, Object... variables) { - return of(path, variables).split("\n"); - } - - /** - * Return a component from the localization file with {0} {1} etc. variables replaced. - * - * @param path - * @param variables - * @return - */ - public static SimpleComponent ofComponent(String path, Object... variables) { - return SimpleComponent.of(of(path, variables)); - } - - /** - * Return the given key for the given amount automatically - * singular or plural form including the amount - * - * @param amount - * @param path - * @return - */ - public static String ofCase(long amount, String path) { - return amount + " " + ofCaseNoAmount(amount, path); - } - - /** - * Return the given key for the given amount automatically - * singular or plural form excluding the amount - * - * @param amount - * @param path - * @return - */ - public static String ofCaseNoAmount(long amount, String path) { - final String key = of(path); - final String[] split = key.split(", "); - - Valid.checkBoolean(split.length == 1 || split.length == 2, "Invalid syntax of key at '" + path + "', this key is a special one and " - + "it needs singular and plural form separated with , such as: second, seconds"); - - final String singular = split[0]; - final String plural = split[split.length == 2 ? 1 : 0]; - - return amount == 0 || amount > 1 ? plural : singular; - } - - /** - * Return an array from the localization file with {0} {1} etc. variables replaced. - * and script variables parsed. We treat the locale key as a valid JavaScript - * - * @param path - * @param scriptVariables - * @param variables - * @return - */ - public static String ofScript(String path, SerializedMap scriptVariables, Object... variables) { - String script = of(path, variables); - Object result; - - // Our best guess is that the user has removed the script completely but forgot to put the entire message in '', - // so we attempt to do so - if (!script.contains("?") && !script.contains(":") && !script.contains("+") && !script.startsWith("'") && !script.endsWith("'")) - script = "'" + script + "'"; - - try { - result = JavaScriptExecutor.run(script, scriptVariables.asMap()); - - } catch (final Throwable t) { - throw new FoException(t, "Failed to compile localization key '" + path + "' with script: " + script + " (this must be a valid JavaScript code)"); - } - - return result.toString(); - } - - /** - * Return a key from the localization file with {0} {1} etc. variables replaced. - * - * @param path - * @param variables - * @return - */ - public static String of(String path, Object... variables) { - checkInit(); - - synchronized (instance) { - final String key = instance.getStringStrict(path); - - return translate(key, variables); - } - } - - /* - * Replace placeholders in the message - */ - private static String translate(String key, Object... variables) { - Valid.checkNotNull(key, "Cannot translate a null key with variables " + Common.join(variables)); - - if (variables != null) - for (int i = 0; i < variables.length; i++) { - Object variable = variables[i]; - - variable = Common.getOrDefaultStrict(SerializeUtil.serialize(variable), SimpleLocalization.NONE); - Valid.checkNotNull(variable, "Failed to replace {" + i + "} as " + variable + " (raw = " + variables[i] + ")"); - - key = key.replace("{" + i + "}", variable.toString()); - } - - return key; - } - - /* - * Check if this class has properly been initialized - */ - private static void checkInit() { - - // Automatically load when not loaded in onPluginPreStart - if (instance == null) - init(); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/SimpleLang.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/SimpleLang.java deleted file mode 100644 index 5eaa1c3557d341483fd9125a93002745a5748e49..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/SimpleLang.java +++ /dev/null @@ -1,234 +0,0 @@ -package org.mineacademy.fo.settings; - -import java.util.Arrays; -import java.util.List; - -import org.mineacademy.fo.Common; -import org.mineacademy.fo.SerializeUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.JavaScriptExecutor; -import org.mineacademy.fo.model.SimpleComponent; - -/** - * Represents the new way of plugin localization, with the greatest - * upside of saving development time. - * - * The downside is that keys are not checked during load so any - * malformed or missing key will fail later and may be unnoticed. - * - * Using the classic SimpleLocalization is still recommended to ensure - * your users get notified when they malform their localization file early - * on startup. - */ -public final class SimpleLang extends YamlConfig { - - /** - * The instance of this class - */ - private static volatile SimpleLang instance; - - /** - * Set the instance in your plugin's onStart method. - * - * @param filePath - */ - public static void setInstance(String filePath) { - instance = new SimpleLang(filePath); - } - - /** - * Set the instance in your plugin's onStart method. - * - * In this method we pull the locale file from localization/messages_{SimplePrefix.LOCALE_PREFIX}.yml file - * - * @param filePath - */ - public static void setInstance() { - instance = new SimpleLang("localization/messages_" + SimpleSettings.LOCALE_PREFIX + ".yml"); - } - - /** - * Creates a new instance - * - * @param path - */ - private SimpleLang(String path) { - this.loadConfiguration(path); - } - - /** - * @see org.mineacademy.fo.settings.YamlConfig#saveComments() - */ - @Override - protected boolean saveComments() { - return true; - } - - /* - * Return a key from our localization, failing if not exists - */ - private String getStringStrict(String path) { - final String key = getString(path); - Valid.checkNotNull(key, "Missing localization key '" + path + "' from " + getFileName()); - - return key; - } - - /** - * Reload this file - */ - public static void reloadFile() { - synchronized (instance) { - instance.reload(); - } - } - - /** - * Return a boolean at path - * - * @param path - * @return - */ - public static boolean getOption(String path) { - return instance.getBoolean(path); - } - - /** - * Return a component list from the localization file with {0} {1} etc. variables replaced. - * - * @param path - * @param variables - * @return - */ - public static List<SimpleComponent> ofComponentList(String path, Object... variables) { - return Common.convert(ofList(path, variables), item -> SimpleComponent.of(item)); - } - - /** - * Return a list from the localization file with {0} {1} etc. variables replaced. - * - * @param path - * @param variables - * @return - */ - public static List<String> ofList(String path, Object... variables) { - return Arrays.asList(ofArray(path, variables)); - } - - /** - * Return an array from the localization file with {0} {1} etc. variables replaced. - * - * @param path - * @param variables - * @return - */ - public static String[] ofArray(String path, Object... variables) { - return of(path, variables).split("\n"); - } - - /** - * Return a component from the localization file with {0} {1} etc. variables replaced. - * - * @param path - * @param variables - * @return - */ - public static SimpleComponent ofComponent(String path, Object... variables) { - return SimpleComponent.of(of(path, variables)); - } - - /** - * Return the given key for the given amount automatically - * singular or plural form including the amount - * - * @param amount - * @param path - * @return - */ - public static String ofCase(long amount, String path) { - return amount + " " + ofCaseNoAmount(amount, path); - } - - /** - * Return the given key for the given amount automatically - * singular or plural form excluding the amount - * - * @param amount - * @param path - * @return - */ - public static String ofCaseNoAmount(long amount, String path) { - final String key = of(path); - final String[] split = key.split(", "); - - Valid.checkBoolean(split.length == 1 || split.length == 2, "Invalid syntax of key at '" + path + "', this key is a special one and " - + "it needs singular and plural form separated with , such as: second, seconds"); - - final String singular = split[0]; - final String plural = split[split.length == 2 ? 1 : 0]; - - return amount == 0 || amount > 1 ? plural : singular; - } - - /** - * Return an array from the localization file with {0} {1} etc. variables replaced. - * and script variables parsed. We treat the locale key as a valid JavaScript - * - * @param path - * @param scriptVariables - * @param variables - * @return - */ - public static String ofScript(String path, SerializedMap scriptVariables, Object... variables) { - String script = of(path, variables); - Object result; - - // Our best guess is that the user has removed the script completely but forgot to put the entire message in '', - // so we attempt to do so - if (!script.contains("?") && !script.contains(":") && !script.contains("+") && !script.startsWith("'") && !script.endsWith("'")) - script = "'" + script + "'"; - - try { - result = JavaScriptExecutor.run(script, scriptVariables.asMap()); - - } catch (final Throwable t) { - throw new FoException(t, "Failed to compile localization key '" + path + "' with script: " + script + " (this must be a valid JavaScript code)"); - } - - return result.toString(); - } - - /** - * Return a key from the localization file with {0} {1} etc. variables replaced. - * - * @param path - * @param variables - * @return - */ - public static String of(String path, Object... variables) { - synchronized (instance) { - final String key = instance.getStringStrict(path); - - return translate(key, variables); - } - } - - /* - * Replace placeholders in the message - */ - private static String translate(String key, Object... variables) { - if (variables != null) - for (int i = 0; i < variables.length; i++) { - Object variable = variables[i]; - - variable = Common.getOrDefaultStrict(SerializeUtil.serialize(variable), ""); - Valid.checkNotNull("Failed to replace {" + i + "} as " + variable + "(raw = " + variables[i] + ")"); - - key = key.replace("{" + i + "}", variable.toString()); - } - - return key; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/SimpleLocalization.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/SimpleLocalization.java deleted file mode 100644 index d9a3a4085b610bf34d6ac6df977a3e6672eed3f5..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/SimpleLocalization.java +++ /dev/null @@ -1,682 +0,0 @@ -package org.mineacademy.fo.settings; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.command.DebugCommand; -import org.mineacademy.fo.command.PermsCommand; -import org.mineacademy.fo.command.ReloadCommand; -import org.mineacademy.fo.command.SimpleCommand; -import org.mineacademy.fo.model.ChatPaginator; -import org.mineacademy.fo.plugin.SimplePlugin; - -/** - * A simple implementation of a basic localization file. - * We create the localization/messages_LOCALEPREFIX.yml file - * automatically and fill it with values from your localization/messages_LOCALEPREFIX.yml - * file placed within in your plugins jar file. - */ -@SuppressWarnings("unused") -public class SimpleLocalization extends YamlStaticConfig { - - /** - * A flag indicating that this class has been loaded - * <p> - * You can place this class to {@link SimplePlugin#getSettings()} to make - * it load automatically - */ - private static boolean localizationClassCalled; - - // -------------------------------------------------------------------- - // Loading - // -------------------------------------------------------------------- - - /** - * Create and load the localization/messages_LOCALEPREFIX.yml file. - * <p> - * See {@link SimpleSettings#LOCALE_PREFIX} for the locale prefix. - * <p> - * The locale file is extracted from your plugins jar to the localization/ folder - * if it does not exists, or updated if it is out of date. - */ - @Override - protected final void load() throws Exception { - createLocalizationFile(SimpleSettings.LOCALE_PREFIX); - } - - // -------------------------------------------------------------------- - // Version - // -------------------------------------------------------------------- - - /** - * The configuration version number, found in the "Version" key in the file., - */ - protected static Integer VERSION; - - /** - * Set and update the config version automatically, however the {@link #VERSION} will - * contain the older version used in the file on the disk so you can use - * it for comparing in the init() methods - * <p> - * Please call this as a super method when overloading this! - */ - @Override - protected final void preLoad() { - // Load version first so we can use it later - pathPrefix(null); - - if ((VERSION = getInteger("Version")) != getConfigVersion()) - set("Version", getConfigVersion()); - } - - /** - * Return the very latest config version - * <p> - * Any changes here must also be made to the "Version" key in your settings file. - * - * @return - */ - protected int getConfigVersion() { - return 1; - } - - // -------------------------------------------------------------------- - // Shared values - // -------------------------------------------------------------------- - - // NB: Those keys are optional - you do not have to write them into your messages_X.yml files - // but if you do, we will use your values instead of the default ones! - - /** - * Locale keys related to your plugin commands - */ - public static final class Commands { - - /** - * The message at "No_Console" key shown when console is denied executing a command. - */ - public static String NO_CONSOLE = "&cYou may only use this command as a player"; - - /** - * The message shown when console runs a command without specifying target player name - */ - public static String CONSOLE_MISSING_PLAYER_NAME = "When running from console, specify player name."; - - /** - * The message shown when there is a fatal error running this command - */ - public static String COOLDOWN_WAIT = "&cWait {duration} second(s) before using this command again."; - - /** - * Keys below indicate an invalid action or input - */ - public static String INVALID_ARGUMENT = "&cInvalid argument. Run &6/{label} ? &cfor help."; - public static String INVALID_SUB_ARGUMENT = "&cInvalid argument. Run '/{label} {0}' for help."; - public static String INVALID_ARGUMENT_MULTILINE = "&cInvalid argument. Usage:"; - public static String INVALID_TIME = "Expected time such as '3 hours' or '15 minutes'. Got: '{input}'"; - public static String INVALID_NUMBER = "The number must be a whole or a decimal number. Got: '{input}'"; - - /** - * The authors label - */ - public static String LABEL_AUTHORS = "Made by"; - - /** - * The description label - */ - public static String LABEL_DESCRIPTION = "&c&lDescription:"; - - /** - * The optional arguments label - */ - public static String LABEL_OPTIONAL_ARGS = "optional arguments"; - - /** - * The required arguments label - */ - public static String LABEL_REQUIRED_ARGS = "required arguments"; - - /** - * The multiline usages label, see {@link SimpleCommand#getMultilineUsageMessage()} - */ - public static String LABEL_USAGES = "&c&lUsages:"; - - /** - * The usage label - */ - public static String LABEL_USAGE = "&c&lUsage:"; - - /** - * The help for label - */ - public static String LABEL_HELP_FOR = "Help for /{label}"; - - /** - * The label shown when building subcommands - */ - public static String LABEL_SUBCOMMAND_DESCRIPTION = " &f/{label} {sublabel} {usage+}{dash+}{description}"; - - /** - * The keys below are shown as hover tooltip on /command help menu. - */ - public static String HELP_TOOLTIP_DESCRIPTION = "&7Description: &f{description}"; - public static String HELP_TOOLTIP_PERMISSION = "&7Permission: &f{permission}"; - public static String HELP_TOOLTIP_USAGE = "&7Usage: &f"; - - /** - * The keys below are used in the {@link ReloadCommand} - */ - public static String RELOAD_DESCRIPTION = "Reload the configuration."; - public static String RELOAD_STARTED = "Reloading plugin's data, please wait.."; - public static String RELOAD_SUCCESS = "&6{plugin_name} {plugin_version} has been reloaded."; - public static String RELOAD_FILE_LOAD_ERROR = "&4Oups, &cthere was a problem loading files from your disk! See the console for more information. {plugin_name} has not been reloaded."; - public static String RELOAD_FAIL = "&4Oups, &creloading failed! See the console for more information. Error: {error}"; - - /** - * The message shown when there is a fatal error running this command - */ - public static String ERROR = "&4&lOups! &cThe command failed :( Check the console and report the error."; - - /** - * The message shown when player has no permissions to view ANY subcommands in group command. - */ - public static String HEADER_NO_SUBCOMMANDS = "&cThere are no arguments for this command."; - - /** - * The message shown when player has no permissions to view ANY subcommands in group command. - */ - public static String HEADER_NO_SUBCOMMANDS_PERMISSION = "&cYou don't have permissions to view any subcommands."; - - /** - * The primary color shown in the ----- COMMAND ----- header - */ - public static ChatColor HEADER_COLOR = ChatColor.GOLD; - - /** - * The secondary color shown in the ----- COMMAND ----- header such as in /chc ? - */ - public static ChatColor HEADER_SECONDARY_COLOR = ChatColor.RED; - - /** - * Key for when plugin is reloading {@link org.mineacademy.fo.plugin.SimplePlugin} - */ - public static String RELOADING = "reloading"; - - /** - * Key for when plugin is disabled {@link org.mineacademy.fo.plugin.SimplePlugin} - */ - public static String DISABLED = "disabled"; - - /** - * The message shown when plugin is reloading or was disabled and player attempts to run command - */ - public static String USE_WHILE_NULL = "&cCannot use this command while the plugin is {state}."; - - /** - * The keys below are used in the {@link DebugCommand} - */ - public static String DEBUG_DESCRIPTION = "ZIP your settings for reporting bugs."; - public static String DEBUG_PREPARING = "&6Preparing debug log..."; - public static String DEBUG_SUCCESS = "&2Successfuly copied {amount} file(s) to debug.zip. Your sensitive MySQL information has been removed from yml files. Please upload it via ufile.io and send it to us for review."; - public static String DEBUG_COPY_FAIL = "&cCopying files failed on file {file} and it was stopped. See console for more information."; - public static String DEBUG_ZIP_FAIL = "&cCreating a ZIP of your files failed, see console for more information. Please ZIP debug/ folder and send it to us via ufile.io manually."; - - /** - * The keys below are used in the {@link PermsCommand} - */ - public static String PERMS_DESCRIPTION = "List all permissions the plugin has."; - public static String PERMS_USAGE = "[phrase]"; - public static String PERMS_HEADER = "Listing All {plugin_name} Permissions"; - public static String PERMS_MAIN = "Main"; - public static String PERMS_PERMISSIONS = "Permissions:"; - public static String PERMS_TRUE_BY_DEFAULT = "&7[true by default]"; - public static String PERMS_INFO = "&7Info: &f"; - public static String PERMS_DEFAULT = "&7Default? "; - public static String PERMS_APPLIED = "&7Do you have it? "; - public static String PERMS_YES = "&2yes"; - public static String PERMS_NO = "&cno"; - - /** - * Load the values -- this method is called automatically by reflection in the {@link YamlStaticConfig} class! - */ - private static void init() { - pathPrefix("Commands"); - - if (isSetDefault("No_Console")) - NO_CONSOLE = getString("No_Console"); - - if (isSetDefault("Console_Missing_Player_Name")) - CONSOLE_MISSING_PLAYER_NAME = getString("Console_Missing_Player_Name"); - - if (isSetDefault("Cooldown_Wait")) - COOLDOWN_WAIT = getString("Cooldown_Wait"); - - if (isSetDefault("Invalid_Argument")) - INVALID_ARGUMENT = getString("Invalid_Argument"); - - if (isSetDefault("Invalid_Sub_Argument")) - INVALID_SUB_ARGUMENT = getString("Invalid_Sub_Argument"); - - if (isSetDefault("Invalid_Argument_Multiline")) - INVALID_ARGUMENT_MULTILINE = getString("Invalid_Argument_Multiline"); - - if (isSetDefault("Invalid_Time")) - INVALID_TIME = getString("Invalid_Time"); - - if (isSetDefault("Invalid_Number")) - INVALID_NUMBER = getString("Invalid_Number"); - - if (isSetDefault("Label_Authors")) - LABEL_AUTHORS = getString("Label_Authors"); - - if (isSetDefault("Label_Description")) - LABEL_DESCRIPTION = getString("Label_Description"); - - if (isSetDefault("Label_Optional_Args")) - LABEL_OPTIONAL_ARGS = getString("Label_Optional_Args"); - - if (isSetDefault("Label_Required_Args")) - LABEL_REQUIRED_ARGS = getString("Label_Required_Args"); - - if (isSetDefault("Label_Usage")) - LABEL_USAGE = getString("Label_Usage"); - - if (isSetDefault("Label_Help_For")) - LABEL_HELP_FOR = getString("Label_Help_For"); - - if (isSetDefault("Label_Subcommand_Description")) - LABEL_SUBCOMMAND_DESCRIPTION = getString("Label_Subcommand_Description"); - - if (isSetDefault("Label_Usages")) - LABEL_USAGES = getString("Label_Usages"); - - if (isSetDefault("Help_Tooltip_Description")) - HELP_TOOLTIP_DESCRIPTION = getString("Help_Tooltip_Description"); - - if (isSetDefault("Help_Tooltip_Permission")) - HELP_TOOLTIP_PERMISSION = getString("Help_Tooltip_Permission"); - - if (isSetDefault("Help_Tooltip_Usage")) - HELP_TOOLTIP_USAGE = getString("Help_Tooltip_Usage"); - - if (isSetDefault("Reload_Description")) - RELOAD_DESCRIPTION = getString("Reload_Description"); - - if (isSetDefault("Reload_Started")) - RELOAD_STARTED = getString("Reload_Started"); - - if (isSetDefault("Reload_Success")) - RELOAD_SUCCESS = getString("Reload_Success"); - - if (isSetDefault("Reload_File_Load_Error")) - RELOAD_FILE_LOAD_ERROR = getString("Reload_File_Load_Error"); - - if (isSetDefault("Reload_Fail")) - RELOAD_FAIL = getString("Reload_Fail"); - - if (isSetDefault("Error")) - ERROR = getString("Error"); - - if (isSetDefault("Header_No_Subcommands")) - HEADER_NO_SUBCOMMANDS = getString("Header_No_Subcommands"); - - if (isSetDefault("Header_No_Subcommands_Permission")) - HEADER_NO_SUBCOMMANDS_PERMISSION = getString("Header_No_Subcommands_Permission"); - - if (isSetDefault("Header_Color")) - HEADER_COLOR = get("Header_Color", ChatColor.class); - - if (isSetDefault("Header_Secondary_Color")) - HEADER_SECONDARY_COLOR = get("Header_Secondary_Color", ChatColor.class); - - if (isSet("Reloading")) - RELOADING = getString("Reloading"); - - if (isSet("Disabled")) - DISABLED = getString("Disabled"); - - if (isSet("Use_While_Null")) - USE_WHILE_NULL = getString("Use_While_Null"); - - if (isSetDefault("Debug_Description")) - DEBUG_DESCRIPTION = getString("Debug_Description"); - - if (isSetDefault("Debug_Preparing")) - DEBUG_PREPARING = getString("Debug_Preparing"); - - if (isSetDefault("Debug_Success")) - DEBUG_SUCCESS = getString("Debug_Success"); - - if (isSetDefault("Debug_Copy_Fail")) - DEBUG_COPY_FAIL = getString("Debug_Copy_Fail"); - - if (isSetDefault("Debug_Zip_Fail")) - DEBUG_ZIP_FAIL = getString("Debug_Zip_Fail"); - - if (isSetDefault("Perms_Description")) - PERMS_DESCRIPTION = getString("Perms_Description"); - - if (isSetDefault("Perms_Usage")) - PERMS_USAGE = getString("Perms_Usage"); - - if (isSetDefault("Perms_Header")) - PERMS_HEADER = getString("Perms_Header"); - - if (isSetDefault("Perms_Main")) - PERMS_MAIN = getString("Perms_Main"); - - if (isSetDefault("Perms_Permissions")) - PERMS_PERMISSIONS = getString("Perms_Permissions"); - - if (isSetDefault("Perms_True_By_Default")) - PERMS_TRUE_BY_DEFAULT = getString("Perms_True_By_Default"); - - if (isSetDefault("Perms_Info")) - PERMS_INFO = getString("Perms_Info"); - - if (isSetDefault("Perms_Default")) - PERMS_DEFAULT = getString("Perms_Default"); - - if (isSetDefault("Perms_Applied")) - PERMS_APPLIED = getString("Perms_Applied"); - - if (isSetDefault("Perms_Yes")) - PERMS_YES = getString("Perms_Yes"); - - if (isSetDefault("Perms_No")) - PERMS_NO = getString("Perms_No"); - } - } - - /** - * Key related to players - */ - public static final class Player { - - /** - * Message shown when the player is not online on this server - */ - public static String NOT_ONLINE = "&cPlayer {player} &cis not online on this server."; - - /** - * Message shown when {@link Bukkit#getOfflinePlayer(String)} returns that the player has not played before - */ - public static String NOT_PLAYED_BEFORE = "&cPlayer {player} &chas not played before or we could not locate his disk data."; - - /** - * Load the values -- this method is called automatically by reflection in the {@link YamlStaticConfig} class! - */ - private static void init() { - pathPrefix("Player"); - - if (isSetDefault("Not_Online")) - NOT_ONLINE = getString("Not_Online"); - - if (isSetDefault("Not_Played_Before")) - NOT_PLAYED_BEFORE = getString("Not_Played_Before"); - } - } - - /** - * Keys related to {@link ChatPaginator} - */ - public static final class Pages { - - /** - * Below you find different keys called from {@link FoundationListener} - */ - - public static String NO_PAGE_NUMBER = "&cPlease specify the page number for this command."; - public static String NO_PAGES = "&cYou do not have any pages saved to show."; - public static String NO_PAGE = "Pages do not contain the given page number."; - public static String INVALID_PAGE = "&cYour input '{input}' is not a valid number."; - public static String GO_TO_PAGE = "&7Go to page {page}"; - public static String GO_TO_FIRST_PAGE = "&7Go to the first page"; - public static String[] TOOLTIP = new String[] { - "&7You can also navigate using the", - "&7hidden /#flp <page> command." - }; - - /** - * Load the values -- this method is called automatically by reflection in the {@link YamlStaticConfig} class! - */ - private static void init() { - pathPrefix("Pages"); - - if (isSetDefault("No_Page_Number")) - NO_PAGE_NUMBER = getString("No_Page_Number"); - - if (isSetDefault("No_Pages")) - NO_PAGES = getString("No_Pages"); - - if (isSetDefault("No_Page")) - NO_PAGE = getString("No_Page"); - - if (isSetDefault("Invalid_Page")) - INVALID_PAGE = getString("Invalid_Page"); - - if (isSetDefault("Go_To_Page")) - GO_TO_PAGE = getString("Go_To_Page"); - - if (isSetDefault("Go_To_First_Page")) - GO_TO_FIRST_PAGE = getString("Go_To_First_Page"); - - if (isSetDefault("Tooltip")) - TOOLTIP = getStringArray("Tooltip"); - } - } - - /** - * Keys related to the GUI system - */ - public static final class Menu { - - /** - * Message shown when the player is not online on this server - */ - public static String ITEM_DELETED = "&2The {item} has been deleted."; - - /** - * Message shown when the player tries to open menu, but has an ongoing conversation. - */ - public static String CANNOT_OPEN_DURING_CONVERSATION = "&cType 'exit' to quit your conversation before opening menu."; - - /** - * Message shown on error - */ - public static String ERROR = "&cOups! There was a problem with this menu! Please contact the administrator to review the console for details."; - - /** - * Keys related to menu pagination - */ - public static String PAGE_PREVIOUS = "&8<< &fPage {page}"; - public static String PAGE_NEXT = "Page {page} &8>>"; - public static String PAGE_FIRST = "&7First Page"; - public static String PAGE_LAST = "&7Last Page"; - - /** - * Keys related to menu titles and tooltips - */ - public static String TITLE_TOOLS = "Tools Menu"; - public static String TOOLTIP_INFO = "&fMenu Information"; - public static String BUTTON_RETURN_TITLE = "&4&lReturn"; - public static String[] BUTTON_RETURN_LORE = new String[] { "", "Return back." }; - - /** - * Load the values -- this method is called automatically by reflection in the {@link YamlStaticConfig} class! - */ - private static void init() { - pathPrefix("Menu"); - - if (isSetDefault("Item_Deleted")) - ITEM_DELETED = getString("Item_Deleted"); - - if (isSetDefault("Cannot_Open_During_Conversation")) - CANNOT_OPEN_DURING_CONVERSATION = getString("Cannot_Open_During_Conversation"); - - if (isSetDefault("Error")) - ERROR = getString("Error"); - - if (isSetDefault("Page_Previous")) - PAGE_PREVIOUS = getString("Page_Previous"); - - if (isSetDefault("Page_Next")) - PAGE_NEXT = getString("Page_Next"); - - if (isSetDefault("Page_First")) - PAGE_FIRST = getString("Page_First"); - - if (isSetDefault("Page_Last")) - PAGE_LAST = getString("Page_Last"); - - if (isSetDefault("Title_Tools")) - TITLE_TOOLS = getString("Title_Tools"); - - if (isSetDefault("Tooltip_Info")) - TOOLTIP_INFO = getString("Tooltip_Info"); - - if (isSetDefault("Button_Return_Title")) - BUTTON_RETURN_TITLE = getString("Button_Return_Title"); - - if (isSetDefault("Button_Return_Lore")) - BUTTON_RETURN_LORE = getStringArray("Button_Return_Lore"); - } - } - - /** - * Keys related to tools - */ - public static final class Tool { - - /** - * The message shown when a tool errors out. - */ - public static String ERROR = "&cOups! There was a problem with this tool! Please contact the administrator to review the console for details."; - - /** - * Load the values -- this method is called automatically by reflection in the {@link YamlStaticConfig} class! - */ - private static void init() { - pathPrefix("Tool"); - - if (isSetDefault("Error")) - ERROR = getString("Error"); - } - } - - /** - * Keys related to updating the plugin - */ - public static final class Update { - - /** - * The message if a new version is found but not downloaded - */ - public static String AVAILABLE = "&2A new version of &3{plugin_name}&2 is available.\n" - + "&2Current version: &f{current}&2; New version: &f{new}\n" - + "&2URL: &7https://spigotmc.org/resources/{resource_id}/."; - - /** - * The message if a new version is found and downloaded - */ - public static String DOWNLOADED = "&3{plugin_name}&2 has been upgraded from {current} to {new}.\n" - + "&2Visit &7https://spigotmc.org/resources/{resource_id} &2for more information.\n" - + "&2Please restart the server to load the new version."; - - /** - * Load the values -- this method is called automatically by reflection in the {@link YamlStaticConfig} class! - */ - private static void init() { - pathPrefix(null); - - // Upgrade from old path - if (isSetAbsolute("Update_Available")) - move("Update_Available", "Update.Available"); - - pathPrefix("Update"); - - if (isSetDefault("Available")) - AVAILABLE = getString("Available"); - - if (isSetDefault("Downloaded")) - DOWNLOADED = getString("Downloaded"); - } - } - - /** - * Denotes the "none" message - */ - public static String NONE = "None"; - - /** - * The message for player if they lack a permission. - */ - public static String NO_PERMISSION = "&cInsufficient permission ({permission})."; - - /** - * The server prefix. Example: you have to use it manually if you are sending messages - * from the console to players - */ - public static String SERVER_PREFIX = "[Server]"; - - /** - * The console localized name. Example: Console - */ - public static String CONSOLE_NAME = "Console"; - - /** - * The message when a section is missing from data.db file (typically we use - * this file to store serialized values such as arenas from minigame plugins). - */ - public static String DATA_MISSING = "&c{name} lacks database information! Please only create {type} in-game! Skipping.."; - - /** - * The message when the console attempts to start a server conversation which is prevented. - */ - public static String CONVERSATION_REQUIRES_PLAYER = "Only players may enter this conversation."; - - /** - * Load the values -- this method is called automatically by reflection in the {@link YamlStaticConfig} class! - */ - private static void init() { - pathPrefix(null); - Valid.checkBoolean(!localizationClassCalled, "Localization class already loaded!"); - - if (isSetDefault("No_Permission")) - NO_PERMISSION = getString("No_Permission"); - - if (isSetDefault("Server_Prefix")) - SERVER_PREFIX = getString("Server_Prefix"); - - if (isSetDefault("Console_Name")) - CONSOLE_NAME = getString("Console_Name"); - - if (isSetDefault("Data_Missing")) - DATA_MISSING = getString("Data_Missing"); - - if (isSetDefault("Conversation_Requires_Player")) - CONVERSATION_REQUIRES_PLAYER = getString("Conversation_Requires_Player"); - - if (isSetDefault("None")) - NONE = getString("None"); - - localizationClassCalled = true; - } - - /** - * Was this class loaded? - * - * @return - */ - public static final Boolean isLocalizationCalled() { - return localizationClassCalled; - } - - /** - * Reset the flag indicating that the class has been loaded, - * used in reloading. - */ - public static final void resetLocalizationCall() { - localizationClassCalled = false; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/SimpleSettings.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/SimpleSettings.java deleted file mode 100644 index 858bf1f1fd653435f0c42ba58b91dcf15cf030c2..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/SimpleSettings.java +++ /dev/null @@ -1,301 +0,0 @@ -package org.mineacademy.fo.settings; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.List; - -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.constants.FoConstants; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.debug.LagCatcher; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.SpigotUpdater; -import org.mineacademy.fo.plugin.SimplePlugin; - -/** - * A simple implementation of a typical main plugin settings - * where each key can be accessed in a static way from anywhere. - * <p> - * Typically we use this class for settings.yml main plugin config. - */ -// Use for settings.yml -@SuppressWarnings("unused") -public class SimpleSettings extends YamlStaticConfig { - - /** - * A flag indicating that this class has been loaded - * <p> - * You can place this class to {@link org.mineacademy.fo.plugin.SimplePlugin#getSettings()} ()} to - * make it load automatically - */ - private static boolean settingsClassCalled; - - // -------------------------------------------------------------------- - // Loading - // -------------------------------------------------------------------- - - @Override - protected final void load() throws Exception { - createFileAndLoad(getSettingsFileName()); - } - - /** - * Get the file name for these settings, by default settings.yml - * - * @return - */ - protected String getSettingsFileName() { - return FoConstants.File.SETTINGS; - } - - // -------------------------------------------------------------------- - // Version - // -------------------------------------------------------------------- - - /** - * The configuration version number, found in the "Version" key in the file., - */ - protected static Integer VERSION; - - /** - * Set and update the config version automatically, however the {@link #VERSION} will - * contain the older version used in the file on the disk so you can use - * it for comparing in the init() methods - * <p> - * Please call this as a super method when overloading this! - */ - @Override - protected void preLoad() { - // Load version first so we can use it later - pathPrefix(null); - - if ((VERSION = getInteger("Version")) != getConfigVersion()) - set("Version", getConfigVersion()); - } - - /** - * Return the very latest config version - * <p> - * Any changes here must also be made to the "Version" key in your settings file. - * - * @return - */ - protected int getConfigVersion() { - return 1; - } - - // -------------------------------------------------------------------- - // Settings we offer by default for your main config file - // Specify those you need to modify - // -------------------------------------------------------------------- - - /** - * The {timestamp} format. - */ - public static DateFormat TIMESTAMP_FORMAT = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); - - /** - * What debug sections should we enable in {@link Debugger} ? When you call {@link Debugger#debug(String, String...)} - * those that are specified in this settings are logged into the console, otherwise no message is shown. - * <p> - * Typically this is left empty: Debug: [] - */ - public static StrictList<String> DEBUG_SECTIONS = new StrictList<>(); - - /** - * The plugin prefix in front of chat/console messages, added automatically unless - * disabled in {@link Common#ADD_LOG_PREFIX} and {@link Common#ADD_TELL_PREFIX}. - * <p> - * Typically for ChatControl: - * <p> - * Prefix: "&8[&3ChatControl&8]&7 " - */ - public static String PLUGIN_PREFIX = "&7" + SimplePlugin.getNamed() + " //"; - - /** - * The lag threshold used for {@link LagCatcher} in milliseconds. Set to -1 to disable. - * <p> - * Typically for ChatControl: - * <p> - * Log_Lag_Over_Milis: 100 - */ - public static Integer LAG_THRESHOLD_MILLIS = 100; - - /** - * When processing regular expressions, limit executing to the specified time. - * This prevents server freeze/crash on malformed regex (loops). - * <p> - * Regex_Timeout_Milis: 100 - */ - public static Integer REGEX_TIMEOUT = 100; - - /** - * What commands should trigger the your main plugin command (separated by a comma ,)? See {@link SimplePlugin#getMainCommand()} - * <p> - * Typical values for ChatControl: - * <p> - * Command_Aliases: [chatcontrol, chc, cc] - * <p> - * // ONLY MANDATORY IF YOU OVERRIDE {@link SimplePlugin#getMainCommand()} // - */ - public static StrictList<String> MAIN_COMMAND_ALIASES = new StrictList<>(); - - /** - * The localization prefix, given you are using {@link SimpleLocalization} class to load and manage your - * locale file. Typically the file path is: localization/messages_PREFIX.yml with this prefix below. - * <p> - * Typically: Locale: en - * <p> - * // ONLY MANDATORY IF YOU USE SIMPLELOCALIZATION // - */ - public static String LOCALE_PREFIX = "en"; - - /** - * Should we check for updates from SpigotMC and notify the console and users with permission? - * <p> - * See {@link SimplePlugin#getUpdateCheck()} that you can make to return {@link SpigotUpdater} with your Spigot plugin ID. - * <p> - * Typically for ChatControl: - * <p> - * Notify_Updates: true - * <p> - * // ONLY MANDATORY IF YOU OVERRIDE {@link SimplePlugin#getUpdateCheck()} // - */ - public static Boolean NOTIFY_UPDATES = true; - - /** - * Load the values -- this method is called automatically by reflection in the {@link YamlStaticConfig} class! - */ - private static void init() { - Valid.checkBoolean(!settingsClassCalled, "Settings class already loaded!"); - - pathPrefix(null); - upgradeOldSettings(); - - if (isSetDefault("Timestamp_Format")) - try { - TIMESTAMP_FORMAT = new SimpleDateFormat(getString("Timestamp_Format")); - - } catch (final IllegalArgumentException ex) { - Common.throwError(ex, "Wrong 'Timestamp_Format '" + getString("Timestamp_Format") + "', see https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html for examples'"); - } - - if (isSetDefault("Prefix")) - PLUGIN_PREFIX = getString("Prefix"); - - if (isSetDefault("Log_Lag_Over_Milis")) { - LAG_THRESHOLD_MILLIS = getInteger("Log_Lag_Over_Milis"); - Valid.checkBoolean(LAG_THRESHOLD_MILLIS == -1 || LAG_THRESHOLD_MILLIS >= 0, "Log_Lag_Over_Milis must be either -1 to disable, 0 to log all or greater!"); - - if (LAG_THRESHOLD_MILLIS == 0) - Common.log("&eLog_Lag_Over_Milis is 0, all performance is logged. Set to -1 to disable."); - } - - if (isSetDefault("Debug")) - DEBUG_SECTIONS = new StrictList<>(getStringList("Debug")); - - if (isSetDefault("Regex_Timeout_Milis")) - REGEX_TIMEOUT = getInteger("Regex_Timeout_Milis"); - - // ------------------------------------------------------------------- - // Load maybe-mandatory values - // ------------------------------------------------------------------- - - { // Load localization - final boolean hasLocalization = hasLocalization(); - final boolean keySet = isSetDefault("Locale"); - - if (hasLocalization && !keySet) - throw new FoException("Since you have your Localization class you must set the 'Locale' key in " + getFileName()); - - LOCALE_PREFIX = keySet ? getString("Locale") : LOCALE_PREFIX; - } - - { // Load main command alias - - final boolean keySet = isSetDefault("Command_Aliases"); - - if (SimplePlugin.getInstance().getMainCommand() != null && !keySet) - throw new FoException("Since you override getMainCommand in your main plugin class you must set the 'Command_Aliases' key in " + getFileName()); - - MAIN_COMMAND_ALIASES = keySet ? getCommandList("Command_Aliases") : MAIN_COMMAND_ALIASES; - } - - { // Load updates notifier - - final boolean keySet = isSetDefault("Notify_Updates"); - - NOTIFY_UPDATES = keySet ? getBoolean("Notify_Updates") : NOTIFY_UPDATES; - } - - settingsClassCalled = true; - } - - /** - * Inspect if some settings classes extend localization and make sure only one does, if any - * - * @return - */ - private static boolean hasLocalization() { - final SimplePlugin plugin = SimplePlugin.getInstance(); - int localeClasses = 0; - - if (plugin.getSettings() != null) - for (final Class<?> clazz : plugin.getSettings()) - if (SimpleLocalization.class.isAssignableFrom(clazz)) - localeClasses++; - - Valid.checkBoolean(localeClasses < 2, "You cannot have more than 1 class extend SimpleLocalization!"); - return localeClasses == 1; - } - - /** - * Upgrade some of the old and ancient settings from our premium plugins. - */ - private static void upgradeOldSettings() { - { // Debug - if (isSetAbsolute("Debugger")) - move("Debugger", "Debug"); - - if (isSetAbsolute("Serialization_Number")) - move("Serialization_Number", "Serialization"); - - // ChatControl - if (isSetAbsolute("Debugger.Keys")) { - move("Debugger.Keys", "Serialization"); - move("Debugger.Sections", "Debug"); - } - - // Archaic - if (isSetAbsolute("Debug") && !(getObject("Debug") instanceof List)) - set("Debug", null); - } - - { // Prefix - if (isSetAbsolute("Plugin_Prefix")) - move("Plugin_Prefix", "Prefix"); - - if (isSetAbsolute("Check_Updates")) - move("Check_Updates", "Notify_Updates"); - } - } - - /** - * Was this class loaded? - * - * @return - */ - public static final Boolean isSettingsCalled() { - return settingsClassCalled; - } - - /** - * Reset the flag indicating that the class has been loaded, - * used in reloading. - */ - public static final void resetSettingsCall() { - settingsClassCalled = false; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/SimpleYaml.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/SimpleYaml.java deleted file mode 100644 index 26312c05553bed36627f716b1c4484727f10566d..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/SimpleYaml.java +++ /dev/null @@ -1,247 +0,0 @@ -package org.mineacademy.fo.settings; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.Reader; -import java.util.Map; -import java.util.logging.Level; - -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.bukkit.configuration.Configuration; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.configuration.InvalidConfigurationException; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConstructor; -import org.bukkit.configuration.file.YamlRepresenter; -import org.mineacademy.fo.ReflectionUtil; -import org.yaml.snakeyaml.DumperOptions; -import org.yaml.snakeyaml.LoaderOptions; -import org.yaml.snakeyaml.Yaml; -import org.yaml.snakeyaml.error.YAMLException; -import org.yaml.snakeyaml.representer.Representer; - -/** - * A frustration-free implementation of {@link Configuration} which saves all files in Yaml. - * Note that this implementation is not synchronized. - */ -public final class SimpleYaml extends FileConfiguration { - - private static final String COMMENT_PREFIX = "# "; - private static final String BLANK_CONFIG = "{}\n"; - - private final DumperOptions yamlOptions = new DumperOptions(); - private final Representer yamlRepresenter = new YamlRepresenter(); - - private final Yaml yaml; - - public SimpleYaml() { - - // Load options only if available - if (ReflectionUtil.isClassAvailable("org.yaml.snakeyaml.LoaderOptions")) { - Yaml yaml; - - try { - final LoaderOptions loaderOptions = new LoaderOptions(); - loaderOptions.setMaxAliasesForCollections(512); - - yaml = new Yaml(new YamlConstructor(), yamlRepresenter, yamlOptions, loaderOptions); - - } catch (final NoSuchMethodError ex) { - yaml = new Yaml(new YamlConstructor(), yamlRepresenter, yamlOptions); - } - - this.yaml = yaml; - } - - else - this.yaml = new Yaml(new YamlConstructor(), yamlRepresenter, yamlOptions); - } - - @Override - public String saveToString() { - return this.saveToString(getValues(false)); - } - - public String saveToString(Map<String, Object> values) { - yamlOptions.setIndent(2); - yamlOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); - yamlOptions.setWidth(4096); // Foundation: Do not wrap long lines - - yamlRepresenter.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); - - final String header = buildHeader(); - String dump = yaml.dump(values); - - if (dump.equals(BLANK_CONFIG)) { - dump = ""; - } - - return header + dump; - } - - @Override - public void loadFromString(String contents) throws InvalidConfigurationException { - Validate.notNull(contents, "Contents cannot be null"); - - Map<?, ?> input; - try { - //loaderOptions.setMaxAliasesForCollections(Integer.MAX_VALUE); // SPIGOT-5881: Not ideal, but was default pre SnakeYAML 1.26 - - input = (Map<?, ?>) yaml.load(contents); - } catch (final YAMLException e) { - throw new InvalidConfigurationException(e); - } catch (final ClassCastException e) { - throw new InvalidConfigurationException("Top level is not a Map."); - } - - final String header = parseHeader(contents); - if (header.length() > 0) { - options().header(header); - } - - if (input != null) { - convertMapsToSections(input, this); - } - } - - protected void convertMapsToSections(Map<?, ?> input, ConfigurationSection section) { - for (final Map.Entry<?, ?> entry : input.entrySet()) { - final String key = entry.getKey().toString(); - final Object value = entry.getValue(); - - if (value instanceof Map) { - convertMapsToSections((Map<?, ?>) value, section.createSection(key)); - } else { - section.set(key, value); - } - } - } - - protected String parseHeader(String input) { - final String[] lines = input.split("\r?\n", -1); - final StringBuilder result = new StringBuilder(); - boolean readingHeader = true; - boolean foundHeader = false; - - for (int i = 0; (i < lines.length) && (readingHeader); i++) { - final String line = lines[i]; - - if (line.startsWith(COMMENT_PREFIX)) { - if (i > 0) { - result.append("\n"); - } - - if (line.length() > COMMENT_PREFIX.length()) { - result.append(line.substring(COMMENT_PREFIX.length())); - } - - foundHeader = true; - } else if ((foundHeader) && (line.length() == 0)) { - result.append("\n"); - } else if (foundHeader) { - readingHeader = false; - } - } - - return result.toString(); - } - - @Override - protected String buildHeader() { - final String header = options().header(); - - if (options().copyHeader()) { - final Configuration def = getDefaults(); - - if ((def != null) && (def instanceof FileConfiguration)) { - final FileConfiguration filedefaults = (FileConfiguration) def; - final String defaultsHeader = ReflectionUtil.invoke("buildHeader", filedefaults); - - if ((defaultsHeader != null) && (defaultsHeader.length() > 0)) { - return defaultsHeader; - } - } - } - - if (header == null) { - return ""; - } - - final StringBuilder builder = new StringBuilder(); - final String[] lines = header.split("\r?\n", -1); - boolean startedHeader = false; - - for (int i = lines.length - 1; i >= 0; i--) { - builder.insert(0, "\n"); - - if ((startedHeader) || (lines[i].length() != 0)) { - builder.insert(0, lines[i]); - builder.insert(0, COMMENT_PREFIX); - startedHeader = true; - } - } - - return builder.toString(); - } - - /** - * Creates a new {@link SimpleYaml}, loading from the given file. - * <p> - * Any errors loading the Configuration will be logged and then ignored. - * If the specified input is not a valid config, a blank config will be - * returned. - * <p> - * The encoding used may follow the system dependent default. - * - * @param file Input file - * @return Resulting configuration - * @throws IllegalArgumentException Thrown if file is null - */ - - public static SimpleYaml loadConfiguration(File file) { - Validate.notNull(file, "File cannot be null"); - - final SimpleYaml config = new SimpleYaml(); - - try { - config.load(file); - } catch (final FileNotFoundException ex) { - } catch (final IOException ex) { - Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file, ex); - } catch (final InvalidConfigurationException ex) { - Bukkit.getLogger().log(Level.SEVERE, "Cannot load " + file, ex); - } - - return config; - } - - /** - * Creates a new {@link SimpleYaml}, loading from the given reader. - * <p> - * Any errors loading the Configuration will be logged and then ignored. - * If the specified input is not a valid config, a blank config will be - * returned. - * - * @param reader input - * @return resulting configuration - * @throws IllegalArgumentException Thrown if stream is null - */ - - public static SimpleYaml loadConfiguration(Reader reader) { - Validate.notNull(reader, "Stream cannot be null"); - - final SimpleYaml config = new SimpleYaml(); - - try { - config.load(reader); - } catch (final IOException ex) { - Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex); - } catch (final InvalidConfigurationException ex) { - Bukkit.getLogger().log(Level.SEVERE, "Cannot load configuration from stream", ex); - } - - return config; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/YamlComments.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/YamlComments.java deleted file mode 100644 index 1684d205583993d7e26f59bf61083c49bdeeb8bd..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/YamlComments.java +++ /dev/null @@ -1,418 +0,0 @@ -package org.mineacademy.fo.settings; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.configuration.serialization.ConfigurationSerializable; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.FileUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.remain.Remain; -import org.yaml.snakeyaml.DumperOptions; -import org.yaml.snakeyaml.Yaml; - -import lombok.NonNull; - -/** - * A class to update/add new sections/keys to your config while keeping your current values and keeping your comments - * Algorithm: - * Read the new file and scan for comments and ignored sections, if ignored section is found it is treated as a comment. - * Read and write each line of the new config, if the old config has value for the given key it writes that value in the new config. - * If a key has an attached comment above it, it is written first. - * - * @author tchristofferson, kangarko - * - * Source: https://github.com/tchristofferson/Config-Updater - * Modified by MineAcademy.org - */ -public final class YamlComments { - - /** - * Update a yaml file from a resource inside your plugin jar - * - * @param jarPath The yaml file name to update from, typically config.yml - * @param diskFile The yaml file to update - * - * @throws IOException If an IOException occurs - */ - public static void writeComments(@NonNull String jarPath, @NonNull File diskFile) { - try { - writeComments(jarPath, diskFile, new ArrayList<>()); - - } catch (final IOException ex) { - Common.error(ex, - "Failed writing comments!", - "Path in plugin jar wherefrom comments are fetched: " + jarPath, - "Disk file where comments are written: " + diskFile); - } - } - - /** - * Update a yaml file from a resource inside your plugin jar - * - * @param jarPath The yaml file name to update from, typically config.yml - * @param diskFile The yaml file to update - * @param ignoredSections The sections to ignore from being forcefully updated & comments set - * - * @throws IOException If an IOException occurs - */ - public static void writeComments(@NonNull String jarPath, @NonNull File diskFile, @NonNull List<String> ignoredSections) throws IOException { - - final InputStream internalResource = FileUtil.getInternalResource(jarPath); - Valid.checkNotNull(internalResource, "Failed getting internal resource: " + jarPath); - - final BufferedReader newReader = new BufferedReader(new InputStreamReader(internalResource, StandardCharsets.UTF_8)); - final List<String> newLines = newReader.lines().collect(Collectors.toList()); - newReader.close(); - - final FileConfiguration oldConfig = YamlConfiguration.loadConfiguration(diskFile); - final FileConfiguration newConfig = Remain.loadConfiguration(FileUtil.getInternalResource(jarPath)); - - final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(diskFile), StandardCharsets.UTF_8)); - - // ignoredSections can ONLY contain configurations sections - for (final String ignoredSection : ignoredSections) - if (newConfig.isSet(ignoredSection)) - Valid.checkBoolean(newConfig.isConfigurationSection(ignoredSection), "Can only ignore config sections in " + jarPath + " (file " + diskFile + ")" + " not '" + ignoredSection + "' that is " + newConfig.get(ignoredSection)); - - // Save keys added to config that are not in default and would otherwise be lost - final Set<String> newKeys = newConfig.getKeys(true); - final Map<String, Object> removedKeys = new HashMap<>(); - - outerLoop: - for (final Map.Entry<String, Object> oldEntry : oldConfig.getValues(true).entrySet()) { - final String oldKey = oldEntry.getKey(); - - for (final String ignoredKey : ignoredSections) - if (oldKey.startsWith(ignoredKey)) - continue outerLoop; - - if (!newKeys.contains(oldKey)) - removedKeys.put(oldKey, oldEntry.getValue()); - } - - // Move to unused/ folder and retain old path - if (!removedKeys.isEmpty()) { - final File backupFile = FileUtil.getOrMakeFile("unused/" + diskFile.getName()); - - final FileConfiguration backupConfig = YamlConfiguration.loadConfiguration(backupFile); - - for (final Map.Entry<String, Object> entry : removedKeys.entrySet()) - backupConfig.set(entry.getKey(), entry.getValue()); - - backupConfig.save(backupFile); - - Common.warning("The following entries in " + diskFile.getName() + " are unused and were moved into " + backupFile.getName() + ": " + removedKeys.keySet()); - } - - final DumperOptions dumperOptions = new DumperOptions(); - dumperOptions.setWidth(4096); - - final Yaml yaml = new Yaml(dumperOptions); - final Map<String, String> comments = parseComments(newLines, ignoredSections, oldConfig, yaml); - - write(newConfig, oldConfig, comments, ignoredSections, writer, yaml); - } - - // Write method doing the work. - // It checks if key has a comment associated with it and writes comment then the key and value - private static void write(FileConfiguration newConfig, FileConfiguration oldConfig, Map<String, String> comments, List<String> ignoredSections, BufferedWriter writer, Yaml yaml) throws IOException { - - final Set<String> copyAllowed = new HashSet<>(); - final Set<String> reverseCopy = new HashSet<>(); - - outerloop: - for (final String key : newConfig.getKeys(true)) { - - checkIgnore: - { - - for (final String allowed : copyAllowed) - if (key.startsWith(allowed)) - break checkIgnore; - - // These keys are already written below - for (final String allowed : reverseCopy) - if (key.startsWith(allowed)) - continue outerloop; - - for (final String ignoredSection : ignoredSections) { - if (key.equals(ignoredSection)) { - - // Write from new to old config - if ((!oldConfig.isSet(ignoredSection) || oldConfig.getConfigurationSection(ignoredSection).getKeys(false).isEmpty())) { - copyAllowed.add(ignoredSection); - - break; - } - - // Write from old to new, copying all keys and subkeys manually - else { - write0(key, true, newConfig, oldConfig, comments, ignoredSections, writer, yaml); - - for (final String oldKey : oldConfig.getConfigurationSection(ignoredSection).getKeys(true)) { - write0(ignoredSection + "." + oldKey, true, oldConfig, newConfig, comments, ignoredSections, writer, yaml); - } - - reverseCopy.add(ignoredSection); - continue outerloop; - } - } - - if (key.startsWith(ignoredSection)) - continue outerloop; - } - } - - write0(key, false, newConfig, oldConfig, comments, ignoredSections, writer, yaml); - } - - final String danglingComments = comments.get(null); - - if (danglingComments != null) - writer.write(danglingComments); - - writer.close(); - } - - private static void write0(String key, boolean forceNew, FileConfiguration newConfig, FileConfiguration oldConfig, Map<String, String> comments, List<String> ignoredSections, BufferedWriter writer, Yaml yaml) throws IOException { - final String[] keys = key.split("\\."); - final String actualKey = keys[keys.length - 1]; - final String comment = comments.remove(key); - - final StringBuilder prefixBuilder = new StringBuilder(); - final int indents = keys.length - 1; - appendPrefixSpaces(prefixBuilder, indents); - final String prefixSpaces = prefixBuilder.toString(); - - // No \n character necessary, new line is automatically at end of comment - if (comment != null) - writer.write(comment); - - final Object newObj = newConfig.get(key); - final Object oldObj = oldConfig.get(key); - - // Write the old section - if (newObj instanceof ConfigurationSection && !forceNew && oldObj instanceof ConfigurationSection) - writeSection(writer, actualKey, prefixSpaces, (ConfigurationSection) oldObj); - - // Write the new section, old value is no more - else if (newObj instanceof ConfigurationSection) - writeSection(writer, actualKey, prefixSpaces, (ConfigurationSection) newObj); - - // Write the old object - else if (oldObj != null && !forceNew) - write(oldObj, actualKey, prefixSpaces, yaml, writer); - - // Write new object - else - write(newObj, actualKey, prefixSpaces, yaml, writer); - - } - - // Doesn't work with configuration sections, must be an actual object - // Auto checks if it is serializable and writes to file - private static void write(Object obj, String actualKey, String prefixSpaces, Yaml yaml, BufferedWriter writer) throws IOException { - if (obj instanceof ConfigurationSerializable) - writer.write(prefixSpaces + actualKey + ": " + yaml.dump(((ConfigurationSerializable) obj).serialize())); - - else if (obj instanceof String || obj instanceof Character) { - if (obj instanceof String) { - final String string = (String) obj; - - // Split multi line strings using |- - if (string.contains("\n")) { - writer.write(prefixSpaces + actualKey + ": |-\n"); - - for (final String line : string.split("\n")) - writer.write(prefixSpaces + " " + line + "\n"); - - return; - } - } - - writer.write(prefixSpaces + actualKey + ": " + yaml.dump(obj)); - - } else if (obj instanceof List) - writeList((List<?>) obj, actualKey, prefixSpaces, yaml, writer); - - else - writer.write(prefixSpaces + actualKey + ": " + yaml.dump(obj)); - - } - - // Writes a configuration section - private static void writeSection(BufferedWriter writer, String actualKey, String prefixSpaces, ConfigurationSection section) throws IOException { - if (section.getKeys(false).isEmpty()) - writer.write(prefixSpaces + actualKey + ":"); - - else - writer.write(prefixSpaces + actualKey + ":"); - - writer.write("\n"); - } - - // Writes a list of any object - private static void writeList(List<?> list, String actualKey, String prefixSpaces, Yaml yaml, BufferedWriter writer) throws IOException { - writer.write(getListAsString(list, actualKey, prefixSpaces, yaml)); - } - - private static String getListAsString(List<?> list, String actualKey, String prefixSpaces, Yaml yaml) { - final StringBuilder builder = new StringBuilder(prefixSpaces).append(actualKey).append(":"); - - if (list.isEmpty()) { - builder.append(" []\n"); - return builder.toString(); - } - - builder.append("\n"); - - for (int i = 0; i < list.size(); i++) { - final Object o = list.get(i); - - if (o instanceof String || o instanceof Character) { - builder.append(prefixSpaces).append("- '").append(o.toString().replace("'", "''")).append("'"); - - } else if (o instanceof List) { - builder.append(prefixSpaces).append("- ").append(yaml.dump(o)); - - } else { - builder.append(prefixSpaces).append("- ").append(o); - } - - if (i != list.size()) { - builder.append("\n"); - } - } - - return builder.toString(); - } - - //Key is the config key, value = comment and/or ignored sections - //Parses comments, blank lines, and ignored sections - private static Map<String, String> parseComments(List<String> lines, List<String> ignoredSections, FileConfiguration oldConfig, Yaml yaml) { - final Map<String, String> comments = new HashMap<>(); - final StringBuilder builder = new StringBuilder(); - final StringBuilder keyBuilder = new StringBuilder(); - int lastLineIndentCount = 0; - - //outer: - for (final String line : lines) { - if (line != null && line.trim().startsWith("-")) - continue; - - if (line == null || line.trim().equals("") || line.trim().startsWith("#")) { - builder.append(line).append("\n"); - } else { - lastLineIndentCount = setFullKey(keyBuilder, line, lastLineIndentCount); - - if (keyBuilder.length() > 0) { - comments.put(keyBuilder.toString(), builder.toString()); - builder.setLength(0); - } - } - } - - if (builder.length() > 0) { - comments.put(null, builder.toString()); - } - - return comments; - } - - //Counts spaces in front of key and divides by 2 since 1 indent = 2 spaces - private static int countIndents(String s) { - int spaces = 0; - - for (final char c : s.toCharArray()) { - if (c == ' ') { - spaces += 1; - } else { - break; - } - } - - return spaces / 2; - } - - //Ex. keyBuilder = key1.key2.key3 --> key1.key2 - private static void removeLastKey(StringBuilder keyBuilder) { - String temp = keyBuilder.toString(); - final String[] keys = temp.split("\\."); - - if (keys.length == 1) { - keyBuilder.setLength(0); - return; - } - - temp = temp.substring(0, temp.length() - keys[keys.length - 1].length() - 1); - keyBuilder.setLength(temp.length()); - } - - //Updates the keyBuilder and returns configLines number of indents - private static int setFullKey(StringBuilder keyBuilder, String configLine, int lastLineIndentCount) { - final int currentIndents = countIndents(configLine); - final String key = configLine.trim().split(":")[0]; - - if (keyBuilder.length() == 0) { - keyBuilder.append(key); - } else if (currentIndents == lastLineIndentCount) { - //Replace the last part of the key with current key - removeLastKey(keyBuilder); - - if (keyBuilder.length() > 0) { - keyBuilder.append("."); - } - - keyBuilder.append(key); - } else if (currentIndents > lastLineIndentCount) { - //Append current key to the keyBuilder - keyBuilder.append(".").append(key); - } else { - final int difference = lastLineIndentCount - currentIndents; - - for (int i = 0; i < difference + 1; i++) { - removeLastKey(keyBuilder); - } - - if (keyBuilder.length() > 0) { - keyBuilder.append("."); - } - - keyBuilder.append(key); - } - - return currentIndents; - } - - private static String getPrefixSpaces(int indents) { - final StringBuilder builder = new StringBuilder(); - - for (int i = 0; i < indents; i++) { - builder.append(" "); - } - - return builder.toString(); - } - - private static void appendPrefixSpaces(StringBuilder builder, int indents) { - builder.append(getPrefixSpaces(indents)); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/YamlConfig.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/YamlConfig.java deleted file mode 100644 index 87257188e0439afc8756140788e95e96f57b295a..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/YamlConfig.java +++ /dev/null @@ -1,2236 +0,0 @@ -package org.mineacademy.fo.settings; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.TreeMap; -import java.util.function.Function; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.configuration.ConfigurationSection; -import org.bukkit.configuration.InvalidConfigurationException; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.FileUtil; -import org.mineacademy.fo.ItemUtil; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.ReflectionUtil.MissingEnumException; -import org.mineacademy.fo.SerializeUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.collection.StrictSet; -import org.mineacademy.fo.constants.FoConstants; -import org.mineacademy.fo.debug.Debugger; -import org.mineacademy.fo.exception.FoException; -import org.mineacademy.fo.model.BoxedMessage; -import org.mineacademy.fo.model.Replacer; -import org.mineacademy.fo.model.SimpleSound; -import org.mineacademy.fo.model.SimpleTime; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.Remain; - -import com.google.common.base.Charsets; -import com.google.common.io.Files; - -import lombok.Getter; -import lombok.NonNull; -import lombok.RequiredArgsConstructor; - -/** - * The core configuration class. Manages all settings files. - * - * @author kangarko - * @version 5.0 (of the previous ConfHelper) - */ -public class YamlConfig { - - // ------------------------------------------------------------------------------------------------------------ - // Only allow one instance of file to be loaded for safety. - // ------------------------------------------------------------------------------------------------------------ - - /** - * A null flag indicating there is no default 'to' config file - * - * <p> - * When you call methods with the "def" parameter, we enforce this flag and will - * NOT auto update the config with the specified default value - */ - public static final String NO_DEFAULT = null; - - /** - * All files that are currently loaded - */ - private static volatile StrictSet<ConfigInstance> loadedFiles = new StrictSet<>(); - - /** - * The config file instance this config belongs to. - */ - private ConfigInstance instance; - - /** - * The config header - */ - private String[] header; - - /** - * The local path prefix to make things easier. - */ - private String pathPrefix = null; - - // ------------------------------------------------------------------------------------------------------------ - // Static end / - // ------------------------------------------------------------------------------------------------------------ - - /** - * Internal flag whether to save the file after loading, set to true - * automatically when we edit it - */ - private boolean save = false; - - /** - * Internal flag that can be toggled to disable working with default files. - * - */ - private boolean useDefaults = true; - - /** - * Internal flag to indicate whether you are calling this from - * {@link #loadConfiguration(String, String)} - */ - private boolean loading = false; - - /** - * Internal flag to indicate whether {@link #loadConfiguration(String)} has been called - */ - private boolean loaded = false; - - /** - * Should we check for validity of the config key-value pair? - */ - private final boolean checkAssignables = true; - - protected YamlConfig() { - } - - /** - * Clear the list of loaded files - */ - public static final void clearLoadedFiles() { - synchronized (loadedFiles) { - loadedFiles.clear(); - } - } - - /** - * Remove a loaded file from {@link #loadedFiles} - * - * @param file - */ - public static final void unregisterLoadedFile(final File file) { - synchronized (loadedFiles) { - for (final ConfigInstance instance : loadedFiles) - if (instance.equals(file)) { - loadedFiles.remove(instance); - - break; - } - } - } - - /** - * Looks up a {@link ConfigInstance} for the given file name. - * - * @param fileName - * @return - */ - protected static final ConfigInstance findInstance(final String fileName) { - synchronized (loadedFiles) { - for (final ConfigInstance instance : loadedFiles) - if (instance.equals(fileName)) - return instance; - - return null; - } - } - - /** - * Add new {@link ConfigInstance}, used internally - * - * @param instance - * @param config - */ - private static void addConfig(final ConfigInstance instance, final YamlConfig config) { - synchronized (loadedFiles) { - Valid.checkBoolean(!config.loaded, "Config " + config.getClass() + " for file " + instance.getFile() + " has already been loaded: " + Debugger.traceRoute(true)); - - loadedFiles.add(instance); - } - } - - // ------------------------------------------------------------------------------------------------------------ - // Main loading methods. - // ------------------------------------------------------------------------------------------------------------ - - /** - * Loads up the localization file. These are stored in the localization/ folder - * and have the syntax "messages_" + prefix + ".yml". - * - * <p> - * If the folder does not exists with the given file, we create it. - * - * <p> - * This method is intended to be called from the static config! - * - * @param localePrefix - * @throws Exception - */ - protected final void loadLocalization(final String localePrefix) throws Exception { - - synchronized (loadedFiles) { - Valid.checkNotNull(localePrefix, "locale cannot be null!"); - - try { - loading = true; - - final String localePath = "localization/messages_" + localePrefix + ".yml"; - final InputStream is = FileUtil.getInternalResource(localePath); - Valid.checkNotNull(is, SimplePlugin.getNamed() + " does not support the localization: messages_" + localePrefix + ".yml (For custom locale, set the Locale to 'en' and edit your English file instead)"); - - final File file = new File(SimplePlugin.getData(), localePath); - ConfigInstance instance = findInstance(file.getName()); - - if (instance == null) { - if (!file.exists()) { - FileUtil.extract(localePath); - - // Reformat afterwards with comments engine - if (saveComments()) - save = true; - } - - final SimpleYaml config = FileUtil.loadConfigurationStrict(file); - final SimpleYaml defaultsConfig = Remain.loadConfiguration(is); - - Valid.checkBoolean(file != null && file.exists(), "Failed to load " + localePath + " from " + file); - - instance = new ConfigInstance(file, config, defaultsConfig, saveComments(), getUncommentedSections(), localePath); - addConfig(instance, this); - } - - this.instance = instance; - - onLoadFinish(); - - loaded = true; - - } finally { - loading = false; - } - - saveIfNecessary0(); - } - } - - /** - * Load configuration from the give file name. - * - * <p> - * The file must exist within out plugin at the same path since it will be - * copied to the plugin folder if it does not exist, and it will be used to - * server as the default config to serve updates from. - * - * @param file - */ - protected final void loadConfiguration(final String file) { - loadConfiguration(file, file); - } - - /** - * Load configuration from the given path to another path. - * - * <p> - * If the file does not exist, we create a new file. If you set "from" to null, - * no defaults will be used. - * - * <p> - * Both paths must include file extension - * - * @param from, the origin path within the plugin jar, if null, no defaults are - * used - * @param to, the destination path in plugins/ThisPlugin/ - */ - public final void loadConfiguration(final String from, final String to) { - - synchronized (loadedFiles) { - - Valid.checkBoolean(!loading, "Duplicate call to loadConfiguration (already loading)"); - Valid.checkNotNull(to, "File to path cannot be null!"); - Valid.checkBoolean(to.contains("."), "To path must contain file extension: " + to); - - if (from != null) - Valid.checkBoolean(from.contains("."), "From path must contain file extension: " + from); - else - useDefaults = false; - - try { - loading = true; - - ConfigInstance instance = findInstance(to); - - if (instance == null) { - final File file; - final SimpleYaml config; - SimpleYaml defaultsConfig = null; - - // Reformat afterwards with comments engine - if (!new File(SimplePlugin.getInstance().getDataFolder(), to).exists() && saveComments()) - save = true; - - // We will have the default file to return to - if (from != null) { - final InputStream is = FileUtil.getInternalResource(from); - Valid.checkNotNull(is, "Inbuilt resource not found: " + from); - - defaultsConfig = Remain.loadConfiguration(is); - file = FileUtil.extract(from, to); - - } else - file = FileUtil.getOrMakeFile(to); - - Valid.checkNotNull(file, "Failed to " + (from != null ? "copy settings from " + from + " to " : "read settings from ") + to); - - config = FileUtil.loadConfigurationStrict(file); - - instance = new ConfigInstance(file, config, defaultsConfig, saveComments(), getUncommentedSections(), from == null ? to : from); - addConfig(instance, this); - } - - this.instance = instance; - - try { - onLoadFinish(); - - } catch (final Exception ex) { - Common.throwError(ex, "Error loading configuration in " + getFileName() + "!", "Problematic section: " + Common.getOrDefault(getPathPrefix(), "''"), "Problem: " + ex + " (see below for more)"); - } - - loaded = true; - - } finally { - loading = false; - } - - saveIfNecessary0(); - } - } - - /** - * Saves the file if changes have been made - */ - private void saveIfNecessary0() { - - // We want to save the file if the save is pending or if there are no defaults - if (save || saveComments()) { - save(); - - save = false; - } - } - - /** - * Called after the settings file has been loaded. - */ - protected void onLoadFinish() { - } - - /** - * Return the Bukkit YAML instance of the config file - * - * @return - */ - protected final SimpleYaml getConfig() { - Valid.checkNotNull(instance, "Cannot call getConfig when no instance is set!"); - - return instance.getConfig(); - } - - /** - * Return the Bukkit YAML instance of defaults file, or null if not set - * - * @return - */ - - protected final SimpleYaml getDefaults() { - Valid.checkNotNull(instance, "Cannot call getDefaults when no instance is set!"); - - return instance.getDefaultConfig(); - } - - /** - * Return the file name of this config - * - * @return - */ - protected final String getFileName() { - Valid.checkNotNull(instance, "Instance for " + getClass() + " is null"); - Valid.checkNotNull(instance.getFile(), "Instance file in " + getClass() + " is null"); - - return instance.getFile().getName(); - } - - /** - * Set the header of this configuration, use {@link #save()} to save - * - * @param header - */ - protected final void setHeader(final String... header) { - this.header = header; - } - - /** - * Return the name of this file without the extension - * - * @return - */ - public String getName() { - return FileUtil.getFileName(instance.getFile()); - } - - /** - * Return the file corresponding with these settings - * - * @return - */ - public final File getFile() { - return instance.getFile(); - } - - // ------------------------------------------------------------------------------------ - // Main manipulation methods - // ------------------------------------------------------------------------------------ - - /** - * Saves the content of this config into the file - */ - public void save() { - if (loading) { - save = true; - - return; - } - - onSave(); - - { // Save automatically - final SerializedMap map = serialize(); - - if (map != null) - for (final Map.Entry<String, Object> entry : map.entrySet()) - setNoSave(entry.getKey(), entry.getValue()); - } - - instance.save(header != null ? header : getFileName().equals(FoConstants.File.DATA) ? FoConstants.Header.DATA_FILE : FoConstants.Header.UPDATED_FILE); - } - - /** - * Called automatically when the file is saved - */ - protected void onSave() { - } - - /** - * Called automatically on save, use this to put - * things you want saved in your file and they will then be automatically - * saved when call save() method - * - * @return - */ - protected SerializedMap serialize() { - return null; - } - - /** - * Removes the file on the disk - */ - public final void delete() { - instance.delete(); - } - - /** - * Without saving changes, load the file from this disk and load its - * configuration again - */ - public final void reload() { - try { - instance.reload(); - - save = true; - - onLoadFinish(); - saveIfNecessary0(); - - } catch (final Exception e) { - Common.error(e, "Failed to reload " + getFileName()); - } - } - - /** - * Shall we attempt to save comments into this yaml config - * and enforce the file to always look like the default one? - * - * You can exclude sections you do not want to symlink in {@link #getUncommentedSections()} - * - * Defaults to false. - * - * @return - */ - protected boolean saveComments() { - return false; - } - - /** - * If {@link #SAVE_COMMENTS} is on, what sections should we ignore from - * being updated/enforced commands? - * - * E.g. In ChatControl people can add their own channels so we make the - * "Channels.List" ignored so that peoples' channels (new sections) won't get - * remove. - * - * None by default. - * - * @return - */ - protected List<String> getUncommentedSections() { - return null; - } - - // ------------------------------------------------------------------------------------ - // Configuration Getters - // ------------------------------------------------------------------------------------ - - /** - * Main configuration getter. Retrieve a value at a certain path, using type - * safety and default configuration. - * - * <p> - * The type safety checks if the value is actually of the requested type, - * throwing errors if not. - * - * <p> - * If {@link #getDefaults()} is set, and the value does not exist, we update the - * config file automatically. - * - * @param <T> - * @param path - * @param type - * @return - */ - private <T> T getT(String path, final Class<T> type) { - - Debugger.debug("config", "Called get() '" + path + "' = '" + this.getConfig().get(path) + "' " + (this.getDefaults() != null ? "vs def = '" + this.getDefaults().get(path) + "'" : "no defaults") + ". Disk config contains: " + this.getConfig().getValues(true)); - - Valid.checkNotNull(path, "Path cannot be null"); - path = formPathPrefix(path); - - // Commented out : players with their names starting with a dot will cause plugins malfunction - //Valid.checkBoolean(!path.contains(".."), "Path must not contain '..' or more: " + path); - Valid.checkBoolean(!path.endsWith("."), "Path must not end with '.': " + path); - - // Copy defaults if not set - // Also logs out the console message about when we save this change - addDefaultIfNotExist(path, type); - - Object raw = getConfig().get(path); - - // Ensure that the default config actually did have the value, if used - if (useDefaults && getDefaults() != null) - Valid.checkNotNull(raw, "Failed to insert value at '" + path + "' from default config"); - - // Ensure the value is of the given type - if (raw != null) { - - // Workaround for empty lists - if (raw.equals("[]") && type == List.class) - raw = new ArrayList<>(); - - // Retype manually - if (type == Long.class && raw instanceof Integer) - raw = (long) raw; - - checkAssignable(false, path, raw, type); - } - - return (T) raw; - } - - /** - * Attempts to find the "public static T deserialize(SerializedMap) " method in - * the class type to return the given path as the given class type, - * - * <p> - * if that fails then we try to look for "public static T getByName(String)" - * method in the given type class, - * - * <p> - * if that fails than we attempt to deserialize it using - * {@link SerializeUtil#deserialize(Class, Object)} method - * - * @param <T> - * @param path - * @param type - * @return - */ - protected final <T> T get(final String path, final Class<T> type) { - return get(path, type, null); - } - - /** - * Attempts to find the "public static T deserialize(SerializedMap) " method in - * the class type to return the given path as the given class type, - * - * <p> - * if that fails then we try to look for "public static T getByName(String)" - * method in the given type class, - * - * <p> - * if that fails than we attempt to deserialize it using - * {@link SerializeUtil#deserialize(Class, Object)} method - * - * @param <T> - * @param path - * @param type - * @param def - * @return - */ - protected final <T> T get(final String path, final Class<T> type, final T def) { - final Object object = getT(path, Object.class); - - return object != null ? SerializeUtil.deserialize(type, object) : def; - } - - /** - * Basically the same as {@link #get(String, Class)} however you can pass your - * own deserialize arguments here, see - * {@link SerializeUtil#deserialize(Class, Object, Object...)} - * - * @param <T> - * @param path - * @param type - * @param deserializeArguments - * @return - */ - protected final <T> T getWithData(final String path, final Class<T> type, final Object... deserializeArguments) { - final Object object = getT(path, Object.class); - - return object != null ? SerializeUtil.deserialize(type, object, deserializeArguments) : null; - } - - /** - * Get an unknown object with a default value - * - * @param path - * @param def - * @return - */ - protected final Object getObject(final String path, final Object def) { - forceSingleDefaults(path); - - return isSet(path) ? getObject(path) : def; - } - - /** - * Get an unknown object - * - * @param path - * @return - */ - protected final Object getObject(final String path) { - return getT(path, Object.class); - } - - /** - * Return an enum at this location - * - * @param path - * @param type - * @param <T> - * @return - * @deprecated use {@link #get(String, Class)} - */ - @Deprecated - protected final <T> T getEnum(final String path, final Class<T> type) { - return get(path, type); - } - - /** - * Get a boolean with a default value - * - * @param path - * @param def - * @return - */ - protected final Boolean getBoolean(final String path, final boolean def) { - forceSingleDefaults(path); - - final boolean set = isSet(path); - Debugger.debug("config", "\tGetting Boolean at '" + path + "', " + (set ? "set to = " + getBoolean(path) : "not set, returning default " + def)); - - return isSet(path) ? getBoolean(path) : def; - } - - /** - * Get a boolean - * - * @param path - * @return - */ - protected final Boolean getBoolean(final String path) { - return getT(path, Boolean.class); - } - - /** - * Get a string with a default value - * - * @param path - * @param def - * @return - */ - protected final String getString(final String path, final String def) { - forceSingleDefaults(path); - - return isSet(path) ? getString(path) : def; - } - - /** - * Get a string - * - * @param path - * @return - */ - protected final String getString(final String path) { - final Object object = getObject(path); - - if (object == null) - return null; - - else if (object instanceof List) - return Common.join((List<?>) object, "\n"); - - else if (object instanceof String[]) - return Common.join(Arrays.asList((String[]) object), "\n"); - - else if (object instanceof Boolean - || object instanceof Integer - || object instanceof Long - || object instanceof Double - || object instanceof Float) - return Objects.toString(object); - - else if (object instanceof String) - return (String) object; - - throw new FoException("Excepted string at '" + path + "' in " + getFileName() + ", got (" + object.getClass() + "): " + object); - } - - /** - * Get a long with a default value - * - * @param path - * @param def - * @return - */ - protected final Long getLong(final String path, final Long def) { - forceSingleDefaults(path); - - return isSet(path) ? getLong(path) : def; - } - - /** - * Get a long - * - * @param path - * @return - */ - protected final Long getLong(final String path) { - return getT(path, Long.class); - } - - /** - * Get an integer with a default value - * - * @param path - * @param def - * @return - */ - protected final Integer getInteger(final String path, final Integer def) { - forceSingleDefaults(path); - - final boolean set = isSet(path); - Debugger.debug("config", "\tGetting Integer at '" + path + "', " + (set ? "set to = " + getInteger(path) : "not set, returning default " + def)); - - return isSet(path) ? getInteger(path) : def; - } - - /** - * Get an integer - * - * @param path - * @return - */ - protected final Integer getInteger(final String path) { - return getT(path, Integer.class); - } - - /** - * Get a double from any number, failsafe - * - * @param path - * @return - * - * @deprecated use {@link #getDouble(String)} - */ - @Deprecated - protected final Double getDoubleSafe(final String path) { - return getDouble(path); - } - - /** - * Get a double with a default value - * - * @param path - * @param def - * @return - */ - protected final Double getDouble(final String path, final Double def) { - forceSingleDefaults(path); - - return isSet(path) ? getDouble(path) : def; - } - - /** - * Get a double number - * - * @param path - * @return - */ - protected final Double getDouble(final String path) { - final Object raw = getObject(path); - - return raw != null ? Double.parseDouble(raw.toString()) : null; - } - - /** - * Return a replacer for localizable messages - * - * @param path - * @param def - * @return - */ - protected final Replacer getReplacer(final String path, final String def) { - forceSingleDefaults(path); - - return isSet(path) ? getReplacer(path) : Replacer.of(def); - } - - /** - * Return a replacer for localizable messages - * - * @param path - * @return - */ - protected final Replacer getReplacer(final String path) { - return Replacer.of(getString(path)); - } - - /** - * Get location list at the given config path - * - * @param path - * @return - */ - protected final LocationList getLocations(final String path) { - return new LocationList(this, getList(path, Location.class)); - } - - /** - * Get a Bukkit location, using our serialization method - * - * @param path - * @param def - * @return - */ - protected final Location getLocation(final String path, final Location def) { - forceSingleDefaults(path); - - return isSet(path) ? getLocation(path) : def; - } - - /** - * Get a Bukkit location, using our serialization method - * - * @param path - * @return - */ - protected final Location getLocation(final String path) { - return get(path, Location.class); - } - - /** - * Get a sound with volume and a pitch - * - * @param path - * @param def - * @return - */ - protected final SimpleSound getSound(final String path, final SimpleSound def) { - forceSingleDefaults(path); - - return isSet(path) ? getSound(path) : def; - } - - /** - * Get a sound with volume and a pitch - * - * @param path - * @return - */ - protected final SimpleSound getSound(final String path) { - return new SimpleSound(getString(path)); - } - - /** - * Get a casus for those human languages that support it, mainly used for - * numbers - * - * @param path - * @param def - * @return - */ - protected final CasusHelper getCasus(final String path, final CasusHelper def) { - forceSingleDefaults(path); - - return isSet(path) ? getCasus(path) : def; - } - - /** - * Get a casus for those human languages that support it, mainly used for - * numbers - * - * @param path - * @return - */ - protected final CasusHelper getCasus(final String path) { - return new CasusHelper(getString(path)); - } - - /** - * Get a title message, having title and a subtitle - * - * @param path - * @param defTitle - * @param defSubtitle - * @return - */ - protected final TitleHelper getTitle(final String path, final String defTitle, final String defSubtitle) { - forceSingleDefaults(path); - - return isSet(path) ? getTitle(path) : new TitleHelper(defTitle, defSubtitle); - } - - /** - * Get a title message, having title and a subtitle - * - * @param path - * @return - */ - protected final TitleHelper getTitle(final String path) { - return new TitleHelper(path); - } - - /** - * Get a time value in human readable format, eg. "20 minutes" or "45 ticks" - * - * @param path - * @param def - * @return - */ - protected final <T extends SimpleTime> T getTime(final String path, final String def) { - forceSingleDefaults(path); - - return isSet(path) ? getTime(path) : def != null ? (T) SimpleTime.from(def) : null; - } - - /** - * Get a time value in human readable format, eg. "20 minutes" or "45 ticks" - * - * @param path - * @return - */ - protected final <T extends SimpleTime> T getTime(final String path) { - final Object obj = getObject(path); - - return obj != null ? (T) SimpleTime.from(obj.toString()) : null; - } - - /** - * Get a boxed message having full-width top and bottom lines in chat - * - * @param path - * @param def - * @return - */ - protected final BoxedMessage getBoxedMessage(final String path, final String def) { - forceSingleDefaults(path); - - return isSet(path) ? getBoxedMessage(path) : new BoxedMessage(def); - } - - /** - * Get a boxed message having full-width top and bottom lines in chat - * - * @param path - * @return - */ - protected final BoxedMessage getBoxedMessage(final String path) { - return new BoxedMessage(getString(path)); - } - - /** - * Get a CompMaterial which is our cross-version compatible material class - * - * @param path - * @param def - * @return - */ - protected final CompMaterial getMaterial(final String path, final CompMaterial def) { - forceSingleDefaults(path); - - return isSet(path) ? getMaterial(path) : def; - } - - /** - * Get a CompMaterial which is our cross-version compatible material class - * - * @param path - * @return - */ - protected final CompMaterial getMaterial(final String path) { - final String name = getString(path); - - return name == null ? null : CompMaterial.fromStringStrict(name); - } - - /** - * Get a list of unknown values - * - * @param path - * @param of - * @return - */ - protected final List<Object> getList(final String path) { - final List<Object> list = getT(path, List.class); - - return Common.getOrDefault(list, new ArrayList<>()); - } - - /** - * Return a list of hash maps at the given location - * - * @param path - * @return list of maps, or empty map if not set - */ - protected final List<SerializedMap> getMapList(final String path) { - return getList(path, SerializedMap.class); - } - - /** - * @param <T> - * @param key - * @param type - * @return - * @see #getList(String, Class), except that this method never returns null, - * instead, if the key is not present, we return an empty set instead of - * null - * @deprecated use {@link #getSet(String, Class)} for the same behavior - */ - @Deprecated - protected final <T> Set<T> getSetSafe(final String key, final Class<T> type) { - return getSet(key, type); - } - - /** - * @param <T> - * @param key - * @param type - * @return - * @see #getList(String, Class) - */ - protected final <T> Set<T> getSet(final String key, final Class<T> type) { - final List<T> list = getList(key, type); - - return list == null ? new HashSet<>() : new HashSet<>(list); - } - - /** - * Return a list of objects of the given type - * - * <p> - * If the type is your own class make sure to put public static - * deserialize(SerializedMap) method into it that returns the class object from - * the map! - * - * @param <T> - * @param path - * @param type - * @return - */ - protected final <T> List<T> getList(final String path, final Class<T> type) { - return getList(path, type, (Object[]) null); - } - - /** - * Return a list of objects of the given type - * - * <p> - * If the type is your own class make sure to put public static - * deserialize(SerializedMap, deserializedParameters) method into it that - * returns the class object from the map! - * - * @param <T> - * @param path - * @param type - * @param deserializeParameters - * @return - */ - protected final <T> List<T> getList(final String path, final Class<T> type, final Object... deserializeParameters) { - final List<T> list = new ArrayList<>(); - final List<Object> objects = getList(path); - - if (objects != null) - for (final Object object : objects) - list.add(object != null ? SerializeUtil.deserialize(type, object, deserializeParameters) : null); - - return list; - } - - /** - * Return a list of enumerations that are checked for some special values - * we use in our plugins that will break on older Minecraft versions, so we - * just ignore them and do not throw any error. - * - * @param <T> - * @param path - * @param type - * - * @return - * @deprecated this code is specifically targeted for our plugins only - */ - @Deprecated - protected final <T extends Enum<T>> List<T> getCompatibleEnumList(final String path, final Class<T> type) { - final StrictList<T> list = new StrictList<>(); - final List<String> enumNames = getStringList(path); - - if (enumNames.size() == 1 && "*".equals(enumNames.get(0))) - return list.getSource(); - - if (enumNames != null) - for (final String enumName : enumNames) { - T parsedEnum = null; - - try { - parsedEnum = ReflectionUtil.lookupEnumSilent(type, enumName); - - } catch (final IllegalArgumentException | MissingEnumException ex) { - - // Only throw an exception if the user has put in malformed value - if (!LegacyEnum.isIncompatible(type, enumName)) - throw ex; - } - - if (parsedEnum != null) - list.add(parsedEnum); - } - - return list.getSource(); - } - - /** - * Get a simple string array - * - * @param path - * @return the given array, or an empty array - */ - protected final String[] getStringArray(final String path) { - final Object array = getObject(path); - - if (array == null) - return new String[0]; - - else if (array instanceof String) - return ((String) array).split("\n"); - - else if (array instanceof List) - return Common.join((List<?>) array, "\n").split("\n"); - - else if (array instanceof String[]) - return (String[]) array; - - throw new FoException("Excepted string or string list at '" + path + "' in " + getFileName() + ", got (" + array.getClass() + "): " + array); - } - - /** - * Get a string list - * - * @param path - * @return the found list, or an empty list - */ - protected final List<String> getStringList(final String path) { - final Object raw = getObject(path); - - if (raw == null) - return new ArrayList<>(); - - if (raw instanceof String) { - final String output = (String) raw; - - return "'[]'".equals(output) || "[]".equals(output) ? new ArrayList<>() : Arrays.asList(output); - } - - if (raw instanceof List) - return fixYamlBooleansInList((List<Object>) raw); - - throw new FoException("Excepted a list at '" + path + "' in " + getFileName() + ", got (" + raw.getClass() + "): " + raw); - } - - /** - * Attempts to convert objects into strings, since SnakeYAML parser interprets - * "true" and "yes" as boolean types - * - * @param list - * @return - */ - private List<String> fixYamlBooleansInList(@NonNull final Iterable<Object> list) { - final List<String> newList = new ArrayList<>(); - - for (final Object obj : list) - if (obj != null) - newList.add(obj.toString()); - - return newList; - } - - /** - * Get a list of command aliases (special usage in settings.yml) - * - * @param path - * @return - */ - protected final StrictList<String> getCommandList(final String path) { - final List<String> list = getStringList(path); - Valid.checkBoolean(!list.isEmpty(), "Please set at least one command alias in '" + path + "' (" + getFileName() + ") for this will be used as your main command!"); - - for (int i = 0; i < list.size(); i++) { - String command = list.get(i); - - command = command.startsWith("/") ? command.substring(1) : command; - list.set(i, command); - } - - return new StrictList<>(list); - } - - /** - * Get a list of Materials - * - * @param path - * @return - */ - protected final StrictList<CompMaterial> getMaterialList(final String path) { - final StrictList<CompMaterial> list = new StrictList<>(); - - for (final String raw : getStringList(path)) { - final CompMaterial mat = CompMaterial.fromStringCompat(raw); - - if (mat != null) - list.add(mat); - } - - return list; - } - - /** - * Get a list of enchantments - * - * @param path - * @return - */ - protected final StrictList<Enchantment> getEnchants(final String path) { - final StrictList<Enchantment> list = new StrictList<>(); - - for (final String name : getStringList(path)) - list.add(ItemUtil.findEnchantment(name)); - - return list; - } - - /** - * Get a serialized map - * - * @param path - * @return map, or empty map - */ - protected final SerializedMap getMap(final String path) { - final LinkedHashMap<?, ?> map = getMap(path, Object.class, Object.class); - - return SerializedMap.of(map); - } - - /** - * Load a map with preserved order from the given path. Each key in the map - * must match the given key/value type and will be deserialized - * <p> - * We will add defaults if applicable - * - * @param <Key> - * @param <Value> - * @param path - * @param keyType - * @param valueType - * @param valueParameter - * @return - */ - protected final <Key, Value> LinkedHashMap<Key, Value> getMap(@NonNull String path, final Class<Key> keyType, final Class<Value> valueType) { - - // The map we are creating, preserve order - final LinkedHashMap<Key, Value> map = new LinkedHashMap<>(); - - final SimpleYaml config = getConfig(); - final SimpleYaml defaults = getDefaults(); - - // Add path prefix right away - path = formPathPrefix(path); - - // Add defaults - if (defaults != null && !config.isSet(path)) { - Valid.checkBoolean(defaults.isSet(path), "Default '" + getFileName() + "' lacks a map at " + path); - - for (final String key : defaults.getConfigurationSection(path).getKeys(false)) - addDefaultIfNotExist(path + "." + key, valueType); - } - - // Load key-value pairs from config to our map - final ConfigurationSection configSection = config.getConfigurationSection(path); - - if (configSection != null) - for (final Map.Entry<String, Object> entry : configSection.getValues(false).entrySet()) { - final Key key = SerializeUtil.deserialize(keyType, entry.getKey()); - final Value value = SerializeUtil.deserialize(valueType, entry.getValue()); - - // Ensure the pair values are valid for the given paramenters - checkAssignable(false, path, key, keyType); - checkAssignable(false, path, value, valueType); - - map.put(key, value); - } - - return map; - } - - /** - * Load a map having a Set as value with the given parameters - * - * @param <Key> - * @param <Value> - * @param path - * @param keyType - * @param setType - * @return - */ - protected final <Key, Value> LinkedHashMap<Key, Set<Value>> getMapSet(@NonNull String path, final Class<Key> keyType, final Class<Value> setType) { - // The map we are creating, preserve order - final LinkedHashMap<Key, Set<Value>> map = new LinkedHashMap<>(); - - final SimpleYaml config = getConfig(); - final SimpleYaml defaults = getDefaults(); - - // Add path prefix right away - path = formPathPrefix(path); - - // Add defaults - if (defaults != null && !config.isSet(path)) { - Valid.checkBoolean(defaults.isSet(path), "Default '" + getFileName() + "' lacks a map at " + path); - - for (final String key : defaults.getConfigurationSection(path).getKeys(false)) - addDefaultIfNotExist(path + "." + key, setType); - } - - // Load key-value pairs from config to our map - final ConfigurationSection configSection = config.getConfigurationSection(path); - - if (configSection != null) - for (final Map.Entry<String, Object> entry : configSection.getValues(false).entrySet()) { - final Key key = SerializeUtil.deserialize(keyType, entry.getKey()); - final List<Value> value = SerializeUtil.deserialize(List.class, entry.getValue()); - - // Ensure the pair values are valid for the given paramenters - checkAssignable(false, path, key, keyType); - - if (!value.isEmpty()) - for (final Value item : value) - checkAssignable(false, path, item, setType); - - map.put(key, new HashSet<>(value)); - } - - return map; - } - - // ------------------------------------------------------------------------------------ - // Configuration Setters - // ------------------------------------------------------------------------------------ - - /** - * Sets a certain key with value and saves the file - * - * @param path - * @param value - */ - protected final void save(final String path, final Object value) { - setNoSave(path, value); - - save(); - } - - /** - * Set a default key-value pair to the used file (not the default one) if it - * does not exist - * - * @param path - * @param value - */ - protected final void setIfNotExist(final String path, final Object value) { - if (!isSet(path)) - setNoSave(path, value); - - } - - /** - * Sets a certain key with value, serialized - * - * <p> - * The file is not saved, however it is marked for save so it is saved at the - * end of a loading cycle, if you call {@link #loadConfiguration(String)} or - * {@link #loadLocalization(String)} - * - * @param path - * @param value - */ - protected final void setNoSave(String path, Object value) { - path = formPathPrefix(path); - value = SerializeUtil.serialize(value); - - getConfig().set(path, value); - - save = true; // Schedule save for later anyways - } - - /** - * Moves a certain config key or section from one path to another - * - * @param fromRelative - * @param toAbsolute - */ - protected final void move(final String fromRelative, final String toAbsolute) { - move(getObject(fromRelative), fromRelative, toAbsolute); - } - - /** - * Moves a certain config key from one path to another - * - * @param value - * @param fromPathRel - * @param toPathAbs - */ - protected final void move(final Object value, String fromPathRel, final String toPathAbs) { - final String oldPathPrefix = pathPrefix; - - fromPathRel = formPathPrefix(fromPathRel); - getConfig().set(fromPathRel, null); - - pathPrefix = oldPathPrefix; // set to previous - - checkAndFlagForSave(toPathAbs, value, false); - getConfig().set(toPathAbs, value); - - Common.log("&7Update " + getFileName() + ". Move &b\'&f" + fromPathRel + "&b\' &7(was \'" + value + "&7\') to " + "&b\'&f" + toPathAbs + "&b\'" + "&r"); - - pathPrefix = oldPathPrefix; // and reset back to whatever it was - } - - /** - * A special method that converts a section within a SerializedMap to a - * different type. - * - * <p> - * Automatically saves the config at the end - * - * @param <O> - * @param <N> - * @param path - * @param mapSection - * @param from - * @param to - * @param converter - */ - protected final <O, N> void convertMapList(final String path, final String mapSection, final Class<O> from, final Class<N> to, final Function<O, N> converter) { - final List<SerializedMap> list = new ArrayList<>(); - - for (final SerializedMap classMap : getMapList(path)) { - classMap.convert(mapSection, from, to, converter); - - list.add(classMap); - } - - save(path, list); - } - - /** - * Convert the given config section to an alternative type - * - * <p> - * Automatically saves the config at the end - * - * @param <O> - * @param <N> - * @param path - * @param from - * @param to - * @param converter - */ - @SuppressWarnings("rawtypes") - protected final <O, N> void convert(final String path, final Class<O> from, final Class<N> to, final Function<O, N> converter) { - final Object old = getObject(path); - - if (old != null) - // If the old is a collection check if the first value is old, assume the rest - // is old as well - if (old instanceof Collection) { - final Collection<?> collection = (Collection) old; - - if (collection.isEmpty() || !from.isAssignableFrom(collection.iterator().next().getClass())) - return; - - final List<N> newCollection = new ArrayList<>(); - - for (final O oldItem : (Collection<O>) collection) - newCollection.add(converter.apply(oldItem)); - - save(path, newCollection); - - Common.log("&7Converted '" + path + "' from " + from.getSimpleName() + "[] to " + to.getSimpleName() + "[]"); - - } else if (from.isAssignableFrom(old.getClass())) { - save(path, converter.apply((O) old)); - - Common.log("&7Converted '" + path + "' from '" + from.getSimpleName() + "' to '" + to.getSimpleName() + "'"); - } - } - - protected final <T> T getOrSetDefault(final String path, final T defaultValue) { - if (isSet(path)) { - if (defaultValue instanceof Replacer) - return (T) Replacer.of(getString(path)); - - return (T) get(path, defaultValue.getClass()); - } - save(path, defaultValue); - return defaultValue; - } - - /** - * Return whether a key exists or not at the given path - * - * @param path, the path to the key with path prefix added automatically - * @return - */ - protected final boolean isSet(final String path) { - return isSetAbsolute(formPathPrefix(path)); - } - - /** - * Return whether a key exists or not at the given absolute path - * - * @param path, the path to the key without adding path prefix automatically - * @return - */ - protected final boolean isSetAbsolute(final String path) { - return getConfig().isSet(path); - } - - /** - * Return whether the default config exist in your plugins jar and contains the - * given relative path using {@link #getPathPrefix()} feature - * - * @param path - * @return - */ - protected final boolean isSetDefault(final String path) { - return isSetDefaultAbsolute(formPathPrefix(path)); - } - - /** - * Return whether the default config exist in your plugins jar and contains the - * given absolute path - * - * @param path - * @return - */ - protected final boolean isSetDefaultAbsolute(final String path) { - return getDefaults() != null && getDefaults().isSet(path); - } - - // ------------------------------------------------------------------------------------ - // Lazy helpers - // ------------------------------------------------------------------------------------ - - /** - * Place the key from the default settings if those are set and the key does not - * exists - * - * @param pathAbs - */ - protected final void addDefaultIfNotExist(final String pathAbs) { - addDefaultIfNotExist(pathAbs, Object.class); - } - - /** - * Places a key from the default config into the current config file - * - * @param pathAbs - * @param type - */ - protected void addDefaultIfNotExist(final String pathAbs, final Class<?> type) { - if (useDefaults && getDefaults() != null && !isSetAbsolute(pathAbs)) { - final Object object = getDefaults().get(pathAbs); - - Valid.checkNotNull(object, "Default '" + getFileName() + "' lacks " + Common.article(type.getSimpleName()) + " at '" + pathAbs + "'"); - checkAssignable(true, pathAbs, object, type); - - checkAndFlagForSave(pathAbs, object); - getConfig().set(pathAbs, object); - } - } - - /** - * Throws an error if using default settings AND defining the def parameter at - * the same time. - * - * <p> - * We do not allow that, please call methods without the def parameter when - * using default config as the default key will be fetched directly from the - * default config. - * - * @param path - */ - private void forceSingleDefaults(final String path) { - if (useDefaults && getDefaults() != null) - throw new FoException("Cannot use get method with default when getting " + formPathPrefix(path) + " and using a default config for " + getFileName()); - } - - /** - * Checks if the file instance exists and is a valid file, checks if default - * exists, sets the save flag to true and logs the update - * - * @param <T> - * @param path - * @param def - */ - private <T> void checkAndFlagForSave(final String path, final T def) { - checkAndFlagForSave(path, def, true); - } - - /** - * Checks if the file instance exists and is a valid file, checks if default - * exists, sets the save flag to true and logs the update - * - * @param <T> - * @param path - * @param def - * @param logUpdate - */ - private <T> void checkAndFlagForSave(final String path, final T def, final boolean logUpdate) { - Valid.checkBoolean(instance.getFile() != null && instance.getFile().exists() && instance.getConfig() != null, "Inbuilt file or config is null! File: " + instance.getFile() + ", config: " + instance.getConfig()); - - if (getDefaults() != null) - Valid.checkNotNull(def, "Inbuilt config " + getFileName() + " lacks " + (def == null ? "key" : def.getClass().getSimpleName()) + " at \"" + path + "\". Is it outdated?"); - - if (logUpdate) - Common.log("&7Update " + getFileName() + " at &b\'&f" + path + "&b\' &7-> " + (def == null ? "&ckey removed" : "&b\'&f" + def + "&b\'") + "&r"); - - save = true; - } - - /** - * Checks if the clazz parameter can be assigned to the given value - * - * @param fromDefault - * @param path - * @param value - * @param clazz - */ - private void checkAssignable(final boolean fromDefault, final String path, final Object value, final Class<?> clazz) { - if (checkAssignables && !clazz.isAssignableFrom(value.getClass()) && !clazz.getSimpleName().equals(value.getClass().getSimpleName())) - throw new FoException("Malformed configuration! Key '" + path + "' in " + (fromDefault ? "inbuilt " : "") + getFileName() + " must be " + clazz.getSimpleName() + " but got " + value.getClass().getSimpleName() + ": '" + value + "'"); - } - - // ------------------------------------------------------------------------------------ - // Path prefix - // ------------------------------------------------------------------------------------ - - /** - * Adds path prefix to the given path - * - * @param path - * @return - */ - protected String formPathPrefix(@NonNull final String path) { - final String prefixed = pathPrefix != null ? pathPrefix + (!path.isEmpty() ? "." + path : "") : path; - - return prefixed.endsWith(".") ? prefixed.substring(0, prefixed.length() - 1) : prefixed; - } - - /** - * Sets path prefix to the given path prefix - * - * @param pathPrefix - */ - protected void pathPrefix(final String pathPrefix) { - if (pathPrefix != null) { - Valid.checkBoolean(!pathPrefix.endsWith("."), "Path prefix must not end with a dot: " + pathPrefix); - Valid.checkBoolean(!pathPrefix.endsWith(".yml"), "Path prefix must not end with .yml!"); - } - - this.pathPrefix = pathPrefix != null && !pathPrefix.isEmpty() ? pathPrefix : null; - } - - /** - * Returns {@link #pathPrefix} - * - * @return - */ - protected final String getPathPrefix() { - return pathPrefix; - } - - /** - * Get a map assuming each key contains a map of string and objects - */ - @Deprecated - protected final LinkedHashMap<String, LinkedHashMap<String, Object>> getValuesAndKeys_OLD(String path) { - Valid.checkNotNull(path, "Path cannot be null"); - path = formPathPrefix(path); - - // add default - if (getDefaults() != null && !getConfig().isSet(path)) { - Valid.checkBoolean(getDefaults().isSet(path), "Default '" + getFileName() + "' lacks a section at " + path); - - for (final String name : getDefaults().getConfigurationSection(path).getKeys(false)) - for (final String setting : getDefaults().getConfigurationSection(path + "." + name).getKeys(false)) - addDefaultIfNotExist(path + "." + name + "." + setting, Object.class); - } - - Valid.checkBoolean(getConfig().isSet(path), "Malfunction copying default section to " + path); - - // key, values assigned to the key - final TreeMap<String, LinkedHashMap<String, Object>> groups = new TreeMap<>(); - - for (final String name : getConfig().getConfigurationSection(path).getKeys(false)) { - // type, value (UNPARSED) - final LinkedHashMap<String, Object> valuesRaw = getMap(path + "." + name, String.class, Object.class); - - groups.put(name, valuesRaw); - } - - return new LinkedHashMap<>(groups); - } - - /** - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "YamlConfig{file=" + getFileName() + ", path prefix=" + this.pathPrefix + "}"; - } - - /** - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - throw new RuntimeException("Please implement your own equals() method for " + getClass()); - } - - // ------------------------------------------------------------------------------------ - // Classes helpers - // ------------------------------------------------------------------------------------ - - /** - * @deprecated This class has been moved into {@link SimpleTime}. - * To migrate, simply rename TimeHelper into SimpleTime everywhere. - */ - @Deprecated - public static final class TimeHelper extends SimpleTime { - - protected TimeHelper(String time) { - super(time); - } - - /** - * Generate new time. Valid examples: 15 ticks 1 second 25 minutes 3 hours etc. - * - * @deprecated use {@link SimpleTime#from(String)} that has now replaced this constructor - * @param time - * @return - */ - @Deprecated - public static TimeHelper from(final String time) { - return new TimeHelper(time); - } - } - - /** - * Represents a list of locations in the config - */ - public static final class LocationList implements Iterable<Location> { - - /** - * The settings where we have these points - */ - private final YamlConfig settings; - - /** - * The list of locations - */ - private final List<Location> points; - - /** - * Create a new location list - * - * @param settings - * @param points - */ - private LocationList(final YamlConfig settings, final List<Location> points) { - this.settings = settings; - this.points = points; - } - - /** - * Shortcut for adding/removing locations. Returns true if the given location - * not existed and it was removed or returns false if it was found and removed. - * - * @param location - * @return - */ - public boolean toggle(final Location location) { - for (final Location point : points) - if (Valid.locationEquals(point, location)) { - points.remove(point); - - settings.save(); - return false; - } - - points.add(location); - settings.save(); - - return true; - } - - /** - * Add a new location - * - * @param location - */ - public void add(final Location location) { - Valid.checkBoolean(!hasLocation(location), "Location at " + location + " already exists!"); - - points.add(location); - settings.save(); - } - - /** - * Remove an existing location - * - * @param location - */ - public void remove(final Location location) { - final Location point = find(location); - Valid.checkNotNull(point, "Location at " + location + " does not exist!"); - - points.remove(point); - settings.save(); - } - - /** - * Return true if the given location exists - * - * @param location - * @return - */ - public boolean hasLocation(final Location location) { - return find(location) != null; - } - - /** - * Return a validated location from the given location Pretty much the same but - * no yaw/pitch - * - * @param location - * @return - */ - public Location find(final Location location) { - for (final Location entrance : points) - if (Valid.locationEquals(entrance, location)) - return entrance; - - return null; - } - - /** - * Return locations - * - * @return all locations - */ - public List<Location> getLocations() { - return Collections.unmodifiableList(points); - } - - /** - * Return iterator for this - * - * @see java.lang.Iterable#iterator() - */ - @Override - public Iterator<Location> iterator() { - return points.iterator(); - } - - /** - * Get how many points were set - * - * @return - */ - public int size() { - return points.size(); - } - } - - /** - * A simple helper class for some language-specific values when creating - * localization for numbers. - */ - public final class CasusHelper { - private final String akuzativSg; // 1 second (Slovak case - sekundu, not in English) - private final String akuzativPl; // 2-4 seconds (Slovak case - sekundy) - private final String genitivPl; // 5+ seconds (Slovak case - sekund) - - private CasusHelper(final String raw) { - final String[] values = raw.split(", "); - - if (values.length == 2) { - akuzativSg = values[0]; - akuzativPl = values[1]; - genitivPl = akuzativPl; - return; - } - - if (values.length != 3) - throw new FoException("Malformed type, use format: 'second, seconds' OR 'sekundu, sekundy, sekund' (if your language has it)"); - - akuzativSg = values[0]; - akuzativPl = values[1]; - genitivPl = values[2]; - } - - public String getPlural() { - return genitivPl; - } - - public String formatWithCount(final long count) { - return count + " " + formatWithoutCount(count); - } - - public String formatWithoutCount(final long count) { - if (count == 1) - return akuzativSg; - - if (count > 1 && count < 5) - return akuzativPl; - - return genitivPl; - } - } - - /** - * A simple helper class for storing title messages - */ - public final class TitleHelper { - private final String title, subtitle; - - private TitleHelper(final String path) { - this(getString(path + ".Title"), getString(path + ".Subtitle")); - } - - private TitleHelper(final String title, final String subtitle) { - this.title = Common.colorize(title); - this.subtitle = Common.colorize(subtitle); - } - - /** - * Duration: 4 seconds + 2 second fade in - */ - public void playLong(final Player player, final Function<String, String> replacer) { - play(player, 5, 4 * 20, 15, replacer); - } - - /** - * Duration: 2 seconds + 1 second fade in - */ - public void playShort(final Player player, final Function<String, String> replacer) { - play(player, 3, 2 * 20, 5, replacer); - } - - public void play(final Player player, final int fadeIn, final int stay, final int fadeOut) { - this.play(player, fadeIn, stay, fadeOut, null); - } - - public void play(final Player player, final int fadeIn, final int stay, final int fadeOut, Function<String, String> replacer) { - Remain.sendTitle(player, fadeIn, stay, fadeOut, replacer != null ? replacer.apply(title) : title, replacer != null ? replacer.apply(subtitle) : subtitle); - } - } -} - -/** - * For safe read-write access we only store one opened file of the same name. - * - * <p> - * This represents the access to that file. - */ -//@Getter(value = AccessLevel.PROTECTED) -@RequiredArgsConstructor -final class ConfigInstance { - - /** - * The file this configuration belongs to. - */ - @Getter - private final File file; - - /** - * Our config we are manipulating. - */ - private final SimpleYaml config; - - /** - * @return the config - */ - public SimpleYaml getConfig() { - return config; - } - - /** - * The default config we reach out to fill values from. - */ - @Getter - private final SimpleYaml defaultConfig; - - /** - * Experimental - Should we save comments for this config instance? - */ - private final boolean saveComments; - - /** - * If {@link YamlConfig#SAVE_COMMENTS} is on, we'll ignore these sections - * from comments being set - */ - private final List<String> uncommentedSections; - - /** - * Wherefrom shall we save o' mighty comments? - */ - private final String commentsFilePath; - - /** - * Saves the config instance with the given header, can be null - * - * @param header - */ - protected void save(final String[] header) { - - if (header != null) { - config.options().copyHeader(true); - config.options().header(String.join("\n", header)); - } - - if (Bukkit.isPrimaryThread()) - this.save0(); - - else - Common.runLater(this::save0); - } - - private void save0() { - - try { - - // Either use write method for comments or the one from Bukkit - if (!writeComments()) { - - // Pull the data on the main thread - final Map<String, Object> values = config.getValues(false); - - try { - - // Yaml#dump should be save async... note that this also builds header - final String data = config.saveToString(values); - Files.createParentDirs(file); - - final Writer writer = new OutputStreamWriter(new FileOutputStream(file), Charsets.UTF_8); - - try { - writer.write(data); - } finally { - writer.close(); - } - - } catch (final Throwable t) { - Common.error(t); - } - } - - } catch (final Exception ex) { - Common.error(ex, "Failed to save " + file.getName()); - } - } - - /** - * Attempts to save configuration comments using default file - * - * @throws IOException - */ - public boolean writeComments() throws IOException { - if (this.commentsFilePath != null && this.saveComments) { - YamlComments.writeComments(this.commentsFilePath, this.file, Common.getOrDefault(this.uncommentedSections, new ArrayList<>())); - - return true; - } - - return false; - } - - /** - * Loads the config file again without saving changes - * - * @throws Exception - */ - protected void reload() throws IOException, InvalidConfigurationException { - config.load(file); - } - - /** - * Removes the config file from the disk - */ - protected void delete() { - YamlConfig.unregisterLoadedFile(file); - - file.delete(); - } - - /** - * Returns true if the given file name equals to the one we store here - * - * @param file - * @return - */ - public boolean equals(final File file) { - return equals((Object) file); - } - - /** - * Returns true if the given file name equals to the one we store here - * - * @param fileName - * @return - */ - public boolean equals(final String fileName) { - return equals((Object) fileName); - } - - /** - * Returns true if the given object is a ConfigInstance having the same file - * name, or a file with the same name as this config instance - * - * @param obj - * @return - */ - @Override - public boolean equals(final Object obj) { - return obj instanceof ConfigInstance ? ((ConfigInstance) obj).file.getName().equals(file.getName()) : obj instanceof File ? ((File) obj).getName().equals(file.getName()) : obj instanceof String ? ((String) obj).equals(file.getName()) : false; - } -} - -/** - * A special class holding what enum values we have in our configuration - * that are incompatible with older Minecraft version. - * <p> - * If those are loaded we just forgive them and do not throw an error. - */ -final class LegacyEnum { - - /** - * The map list of backward-incompatible types - */ - private static final StrictMap<Class<? extends Enum<?>>, List<String>> INCOMPATIBLE_TYPES = new StrictMap<>(); - - /** - * Load incompatible values to map - */ - static { - INCOMPATIBLE_TYPES.put(SpawnReason.class, Arrays.asList("DROWNED")); - } - - /** - * Return true if the given enum class and name type is known to be - * backward incompatible. - * - * @param <T> - * @param type - * @param enumName - * @return - */ - public static <T extends Enum<T>> boolean isIncompatible(Class<T> type, String enumName) { - final List<String> types = INCOMPATIBLE_TYPES.get(type); - - return types != null && types.contains(enumName.toUpperCase().replace(" ", "_")); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/YamlSectionConfig.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/YamlSectionConfig.java deleted file mode 100644 index 478db15381d918c1d8c80aaedb42e2421593652d..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/YamlSectionConfig.java +++ /dev/null @@ -1,120 +0,0 @@ -package org.mineacademy.fo.settings; - -import java.util.Objects; - -import org.mineacademy.fo.Valid; - -/** - * An extension of {@link YamlConfig} useful when you want to separate - * your settings classes but they all use the same file. - * <p> - * Example: CoreArena plugin uses classes and arenas, both save data in the data.db - * file but have different section in that file. - */ -public abstract class YamlSectionConfig extends YamlConfig { - - /** - * The local path prefix, works just the same as the path prefix in - * {@link YamlConfig} however the path prefix there now works as the section prefix - * that does not change. - */ - private String localPathPrefix = ""; - - /** - * Create a new section config with a section prefix, - * for example Players for storing player data. - * - * @param sectionPrefix, the section prefix, or null if not used - */ - protected YamlSectionConfig(String sectionPrefix) { - super.pathPrefix(sectionPrefix); - } - - /** - * Return true if this section of the config file exists - * - * @return - */ - public final boolean isSectionValid() { - return getObject("") != null; - } - - /** - * Deletes the section from the file. This will keep the file, - * but only remove all data within {@link #getSection()} - */ - public final void deleteSection() { - save("", null); - } - - /** - * Return the {@link YamlConfig} path prefix, which here works - * as the permanent section name - * - * @return - */ - public final String getSection() { - return getPathPrefix(); - } - - // ---------------------------------------------------------------- - // Path prefix - // ---------------------------------------------------------------- - - /** - * Set the path prefix for this section. This path prefix will be applied - * AFTER the {@link #getSection()} prefix. - */ - @Override - protected final void pathPrefix(String localPathPrefix) { - if (localPathPrefix != null) - Valid.checkBoolean(!localPathPrefix.endsWith("."), "Path prefix must not end with a dot: " + localPathPrefix); - - this.localPathPrefix = localPathPrefix == null || localPathPrefix.isEmpty() ? null : localPathPrefix; - } - - /** - * A modified version of the super method allowing to add our section prefix and - * the temporary path prefix all together. - */ - @Override - protected final String formPathPrefix(String myPath) { - String path = ""; - - if (getPathPrefix() != null && !getPathPrefix().isEmpty()) - path += getPathPrefix() + "."; - - if (localPathPrefix != null && !localPathPrefix.isEmpty()) - path += localPathPrefix + "."; - - path = path + myPath; - - return path.endsWith(".") ? path.substring(0, path.length() - 1) : path; - } - - // ---------------------------------------------------------------- - // Misc - // ---------------------------------------------------------------- - - /** - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return "YamlSection{file=" + getFileName() + ", section=" + super.getPathPrefix() + ", local path=" + this.localPathPrefix + "}"; - } - - /** - * @see org.mineacademy.fo.settings.YamlConfig#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (obj instanceof YamlSectionConfig) { - final YamlSectionConfig c = (YamlSectionConfig) obj; - - return c.getFileName().equals(this.getFileName()) && c.getPathPrefix().equals(this.getPathPrefix()) && Objects.deepEquals(c.localPathPrefix, this.localPathPrefix); - } - - return false; - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/YamlStaticConfig.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/YamlStaticConfig.java deleted file mode 100644 index 0661f9e4978bd3465c5909185c41fd6c67ce86de..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/settings/YamlStaticConfig.java +++ /dev/null @@ -1,542 +0,0 @@ -package org.mineacademy.fo.settings; - -import java.io.IOException; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Set; -import java.util.TreeMap; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.enchantments.Enchantment; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.ReflectionUtil; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.collection.StrictList; -import org.mineacademy.fo.constants.FoConstants; -import org.mineacademy.fo.model.BoxedMessage; -import org.mineacademy.fo.model.Replacer; -import org.mineacademy.fo.model.SimpleSound; -import org.mineacademy.fo.model.SimpleTime; -import org.mineacademy.fo.plugin.SimplePlugin; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.Remain; -import org.mineacademy.fo.settings.YamlConfig.CasusHelper; -import org.mineacademy.fo.settings.YamlConfig.TitleHelper; - -/** - * A special case {@link YamlConfig} that allows static access to this config. This is unsafe - * however this is only to be used in two config instances - the main settings.yml file and - * localization file, which allow static access from anywhere for convenience. - * <p> - * Keep in mind you can only access values during initialization and you must write "private static - * void init()" method in your class so that we can invoke it automatically! - * <p> - * Also keep in mind that all static fields must be set after the class has finished loading! - */ -public abstract class YamlStaticConfig { - - /** - * The temporary {@link YamlConfig} instance we store here to get values from - */ - private static YamlConfig TEMPORARY_INSTANCE; - - /** - * Internal use only: Create a new {@link YamlConfig} instance and link it to load fields via - * reflection. - */ - protected YamlStaticConfig() { - TEMPORARY_INSTANCE = new YamlConfig() { - - { - beforeLoad(); - } - - @Override - protected boolean saveComments() { - return YamlStaticConfig.this.saveComments(); - } - - @Override - protected List<String> getUncommentedSections() { - return YamlStaticConfig.this.getUncommentedSections(); - } - - @Override - protected void onLoadFinish() { - loadViaReflection(); - } - }; - - TEMPORARY_INSTANCE.setHeader(getHeader()); - } - - // ----------------------------------------------------------------------------------------------------- - // Main - // ----------------------------------------------------------------------------------------------------- - - /** - * Load all given static config classes - * - * @param classesRaw - * @throws Exception - */ - public static final void load(List<Class<? extends YamlStaticConfig>> classesRaw) throws Exception { - final List<Class<? extends YamlStaticConfig>> classes = new ArrayList<>(); - - if (classesRaw != null) - classes.addAll(classesRaw); - - loadAutomatically(classes, "settings\\.yml", SimpleSettings.class); - loadAutomatically(classes, "localization\\/messages\\_(.*)\\.yml", SimpleLocalization.class); - - for (final Class<? extends YamlStaticConfig> clazz : classes) { - try { - final YamlStaticConfig config = clazz.newInstance(); - - config.load(); - - TEMPORARY_INSTANCE = null; - - } catch (final Throwable t) { - Common.error(t, "Failed to load static settings " + clazz); - } - } - } - - private static List<Class<? extends YamlStaticConfig>> loadAutomatically(List<Class<? extends YamlStaticConfig>> manuallyLoadedClasses, String nameMatcher, Class<? extends YamlStaticConfig> classToPick) { - boolean loadedManually = false; - boolean fileExists = false; - - // Step 1: See if the plugin author added the class to getSettings in SimplePlugin - for (final Class<? extends YamlStaticConfig> clazz : manuallyLoadedClasses) - if (classToPick.isAssignableFrom(clazz)) - loadedManually = true; - - // Step 2: See if there is a file found in the plugin jar - try (JarFile jarFile = new JarFile(SimplePlugin.getSource())) { - - for (final Enumeration<JarEntry> it = jarFile.entries(); it.hasMoreElements();) { - final JarEntry type = it.nextElement(); - final String name = type.getName(); - - if (name.matches(nameMatcher)) - fileExists = true; - } - - } catch (final IOException ex) { - } - - // If there is no file or it has been loaded manually, skip - if (loadedManually || !fileExists) - return manuallyLoadedClasses; - - // Otherwise scan through all plugin classe - final List<Class<? extends YamlStaticConfig>> foundClasses = new ArrayList<>(); - - for (final Class<? extends YamlStaticConfig> configClass : ReflectionUtil.getClasses(SimplePlugin.getInstance(), YamlStaticConfig.class)) - if (classToPick.isAssignableFrom(configClass)) - foundClasses.add(configClass); - - // Clean potential conflicts: such as Settings and SimpleSettings, in this case we only select Settings. - // If there is only SimpleSettings, we select that instead. - if (foundClasses.size() > 1) { - - // Assuming one is the core class from Foundation and other one(s) are from the specific plugin - for (final Iterator<Class<? extends YamlStaticConfig>> it = foundClasses.iterator(); it.hasNext();) { - final Class<? extends YamlStaticConfig> settingsClass = it.next(); - - if (settingsClass.equals(SimpleSettings.class) || settingsClass.equals(SimpleLocalization.class)) - it.remove(); - } - } - - Valid.checkBoolean(foundClasses.size() == 1, "Cannot have multiple classes in your plugin that extend " + classToPick + ", found: " + foundClasses); - manuallyLoadedClasses.add(foundClasses.get(0)); - - return manuallyLoadedClasses; - } - - /** - * Return the default header used when the file is being written to and saved. YAML files do not - * remember # comments. All of them will be lost and the file will be "crunched" together when you - * save it, with the only exception being the header. Use the header to display important - * information such as where your users can find the documented version of your file (such as on - * GitHub). - * <p> - * Set to null to disable, defaults to {@link FoConstants.Header#UPDATED_FILE} - * - * @return the header - */ - protected String[] getHeader() { - return FoConstants.Header.UPDATED_FILE; - } - - /** - * @see YamlConfig#saveComments() - */ - protected boolean saveComments() { - return true; - } - - /** - * @see YamlConfig#getUncommentedSections() - */ - protected List<String> getUncommentedSections() { - return null; - } - - /** - * Call this method if you need to make and changes to the settings file BEFORE it is actually - * loaded. - */ - protected void beforeLoad() { - } - - /** - * Invoke code before this class is being scanned and invoked using reflection - * <p> - * This method if called AFTER we load our file - */ - protected void preLoad() { - } - - /** - * Called automatically in {@link #load(List)}, you should call the standard load method from - * {@link YamlConfig} here - * - * @throws Exception - */ - protected abstract void load() throws Exception; - - /** - * Loads the class via reflection, scanning for "private static void init()" methods to run - */ - private final void loadViaReflection() { - Valid.checkNotNull(TEMPORARY_INSTANCE, "Instance cannot be null " + getFileName()); - Valid.checkNotNull(TEMPORARY_INSTANCE.getConfig(), "Config cannot be null for " + getFileName()); - Valid.checkNotNull(TEMPORARY_INSTANCE.getDefaults(), "Default config cannot be null for " + getFileName()); - - try { - preLoad(); - - // Parent class if applicable. - if (YamlStaticConfig.class.isAssignableFrom(getClass().getSuperclass())) { - final Class<?> superClass = getClass().getSuperclass(); - - invokeAll(superClass); - } - - // The class itself. - invokeAll(getClass()); - - } catch (Throwable t) { - if (t instanceof InvocationTargetException && t.getCause() != null) - t = t.getCause(); - - Remain.sneaky(t); - } - } - - /** - * Invoke all "private static void init()" methods in the class and its subclasses - * - * @param clazz - * @throws Exception - */ - private void invokeAll(final Class<?> clazz) throws Exception { - invokeMethodsIn(clazz); - - // All sub-classes in superclass. - for (final Class<?> subClazz : clazz.getDeclaredClasses()) { - invokeMethodsIn(subClazz); - - // And classes in sub-classes in superclass. - for (final Class<?> subSubClazz : subClazz.getDeclaredClasses()) - invokeMethodsIn(subSubClazz); - } - } - - /** - * Invoke all "private static void init()" methods in the class - * - * @param clazz - * @throws Exception - */ - private void invokeMethodsIn(final Class<?> clazz) throws Exception { - for (final Method m : clazz.getDeclaredMethods()) { - - if (!SimplePlugin.getInstance().isEnabled()) - return; - - final int mod = m.getModifiers(); - - if (m.getName().equals("init")) { - Valid.checkBoolean(Modifier.isPrivate(mod) && Modifier.isStatic(mod) && m.getReturnType() == Void.TYPE && m.getParameterTypes().length == 0, "Method '" + m.getName() + "' in " + clazz + " must be 'private static void init()'"); - - m.setAccessible(true); - m.invoke(null); - } - } - - checkFields(clazz); - } - - /** - * Safety check whether all fields have been set - * - * @param clazz - * @throws Exception - */ - private void checkFields(final Class<?> clazz) throws Exception { - for (final Field f : clazz.getDeclaredFields()) { - f.setAccessible(true); - - if (Modifier.isPublic(f.getModifiers())) - Valid.checkBoolean(!f.getType().isPrimitive(), "Field '" + f.getName() + "' in " + clazz + " must not be primitive!"); - - Object result = null; - try { - result = f.get(null); - } catch (final NullPointerException ex) { - } - Valid.checkNotNull(result, "Null " + f.getType().getSimpleName() + " field '" + f.getName() + "' in " + clazz); - } - } - - // ----------------------------------------------------------------------------------------------------- - // Delegate methods - // ----------------------------------------------------------------------------------------------------- - - protected final void createLocalizationFile(final String localePrefix) throws Exception { - TEMPORARY_INSTANCE.loadLocalization(localePrefix); - } - - protected final void createFileAndLoad(final String path) throws Exception { - TEMPORARY_INSTANCE.loadConfiguration(path, path); - } - - /** - * This set method sets the path-value pair and also saves the file - * <p> - * Pathprefix is added - * - * @param path - * @param value - */ - protected static final void set(final String path, final Object value) { - TEMPORARY_INSTANCE.setNoSave(path, value); - } - - protected static final boolean isSetAbsolute(final String path) { - return TEMPORARY_INSTANCE.isSetAbsolute(path); - } - - protected static final boolean isSet(final String path) { - return TEMPORARY_INSTANCE.isSet(path); - } - - protected static final boolean isSetDefault(final String path) { - return TEMPORARY_INSTANCE.isSetDefault(path); - } - - protected static final boolean isSetDefaultAbsolute(final String path) { - return TEMPORARY_INSTANCE.isSetDefaultAbsolute(path); - } - - protected static final void move(final String fromRelative, final String toAbsolute) { - TEMPORARY_INSTANCE.move(fromRelative, toAbsolute); - } - - protected static final void move(final Object value, final String fromPath, final String toPath) { - TEMPORARY_INSTANCE.move(value, fromPath, toPath); - } - - protected static final String formPathPrefix(final String path) { - return TEMPORARY_INSTANCE.formPathPrefix(path); - } - - protected static final void pathPrefix(final String pathPrefix) { - TEMPORARY_INSTANCE.pathPrefix(pathPrefix); - } - - protected static final String getPathPrefix() { - return TEMPORARY_INSTANCE.getPathPrefix(); - } - - protected static final void addDefaultIfNotExist(final String path) { - TEMPORARY_INSTANCE.addDefaultIfNotExist(path); - } - - protected static final String getFileName() { - return TEMPORARY_INSTANCE.getFileName(); - } - - protected static final FileConfiguration getConfig() { - return TEMPORARY_INSTANCE.getConfig(); - } - - protected static final FileConfiguration getDefaults() { - return TEMPORARY_INSTANCE.getDefaults(); - } - - // ----------------------------------------------------------------------------------------------------- - // Config manipulators - // ----------------------------------------------------------------------------------------------------- - - protected static final StrictList<Enchantment> getEnchantments(final String path) { - return TEMPORARY_INSTANCE.getEnchants(path); - } - - protected static final StrictList<CompMaterial> getMaterialList(final String path) { - return TEMPORARY_INSTANCE.getMaterialList(path); - } - - protected static final StrictList<String> getCommandList(final String path) { - return TEMPORARY_INSTANCE.getCommandList(path); - } - - protected static final List<String> getStringList(final String path) { - return TEMPORARY_INSTANCE.getStringList(path); - } - - protected static final <E> Set<E> getSet(final String path, Class<E> typeOf) { - return TEMPORARY_INSTANCE.getSet(path, typeOf); - } - - protected static final <E> List<E> getList(final String path, final Class<E> listType) { - return TEMPORARY_INSTANCE.getList(path, listType); - } - - protected static final <E extends Enum<E>> List<E> getCompatibleEnumList(final String path, final Class<E> listType) { - return TEMPORARY_INSTANCE.getCompatibleEnumList(path, listType); - } - - protected static final boolean getBoolean(final String path) { - return TEMPORARY_INSTANCE.getBoolean(path); - } - - protected static final String[] getStringArray(final String path) { - return TEMPORARY_INSTANCE.getStringArray(path); - } - - protected static final String getString(final String path) { - return TEMPORARY_INSTANCE.getString(path); - } - - protected static final Replacer getReplacer(final String path) { - return TEMPORARY_INSTANCE.getReplacer(path); - } - - protected static final int getInteger(final String path) { - return TEMPORARY_INSTANCE.getInteger(path); - } - - protected static final int getInteger(final String path, int def) { - return TEMPORARY_INSTANCE.getInteger(path, def); - } - - /** - * @deprecated use {@link #getDouble(String)} - * - * @param path - * @return - */ - @Deprecated - protected static final double getDoubleSafe(final String path) { - return TEMPORARY_INSTANCE.getDoubleSafe(path); - } - - protected static final double getDouble(final String path) { - return TEMPORARY_INSTANCE.getDouble(path); - } - - protected static final SimpleSound getSound(final String path) { - return TEMPORARY_INSTANCE.getSound(path); - } - - protected static final CasusHelper getCasus(final String path) { - return TEMPORARY_INSTANCE.getCasus(path); - } - - protected static final TitleHelper getTitle(final String path) { - return TEMPORARY_INSTANCE.getTitle(path); - } - - protected static final <T extends SimpleTime> T getTime(final String path) { - return TEMPORARY_INSTANCE.getTime(path); - } - - protected static final CompMaterial getMaterial(final String path) { - return TEMPORARY_INSTANCE.getMaterial(path); - } - - protected static final BoxedMessage getBoxedMessage(final String path) { - return TEMPORARY_INSTANCE.getBoxedMessage(path); - } - - protected static final <E> E get(final String path, final Class<E> typeOf) { - return TEMPORARY_INSTANCE.get(path, typeOf); - } - - protected static final <E> E getWithData(final String path, final Class<E> typeOf, Object... deserializeArguments) { - return TEMPORARY_INSTANCE.getWithData(path, typeOf, deserializeArguments); - } - - protected static final Object getObject(final String path) { - return TEMPORARY_INSTANCE.getObject(path); - } - - protected static final <T> T getOrSetDefault(final String path, final T defaultValue) { - return TEMPORARY_INSTANCE.getOrSetDefault(path, defaultValue); - } - - protected static final SerializedMap getMap(final String path) { - return TEMPORARY_INSTANCE.getMap(path); - } - - protected static final <Key, Value> LinkedHashMap<Key, Value> getMap(final String path, final Class<Key> keyType, final Class<Value> valueType) { - return TEMPORARY_INSTANCE.getMap(path, keyType, valueType); - } - - protected static LinkedHashMap<String, LinkedHashMap<String, Object>> getValuesAndKeys(final String path) { - Valid.checkNotNull(path, "Path cannot be null"); - - // add default - if (getDefaults() != null && !getConfig().isSet(path)) { - Valid.checkBoolean(getDefaults().isSet(path), "Default '" + getFileName() + "' lacks a section at " + path); - - for (final String name : getDefaults().getConfigurationSection(path).getKeys(false)) - for (final String setting : getDefaults().getConfigurationSection(path + "." + name).getKeys(false)) - TEMPORARY_INSTANCE.addDefaultIfNotExist(path + "." + name + "." + setting, Object.class); - } - - Valid.checkBoolean(getConfig().isSet(path), "Malfunction copying default section to " + path); - - // key, values assigned to the key - final TreeMap<String, LinkedHashMap<String, Object>> groups = new TreeMap<>(); - - final String old = TEMPORARY_INSTANCE.getPathPrefix(); - TEMPORARY_INSTANCE.pathPrefix(null); - for (final String name : getConfig().getConfigurationSection(path).getKeys(false)) { - // type, value (UNPARSED) - - final LinkedHashMap<String, Object> valuesRaw = getMap(path + "." + name, String.class, Object.class); - - groups.put(name, valuesRaw); - } - - TEMPORARY_INSTANCE.pathPrefix(old); - - return new LinkedHashMap<>(groups); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/slider/ColoredTextSlider.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/slider/ColoredTextSlider.java deleted file mode 100644 index 53125a39daf036d2e26e3129f7c9d8d926c77d23..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/slider/ColoredTextSlider.java +++ /dev/null @@ -1,113 +0,0 @@ -package org.mineacademy.fo.slider; - -import org.bukkit.ChatColor; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.MathUtil; - -import lombok.AccessLevel; -import lombok.RequiredArgsConstructor; - -/** - * A colored text slider takes in a string and then applies - * colors to it from left to right side moving the color in the text - * automatically. - * - * Example use: Animated scoreboards, menu titles, etc. - */ -@RequiredArgsConstructor(access = AccessLevel.PRIVATE) -public final class ColoredTextSlider implements Slider<String> { - - /** - * The string to colorize. - */ - private final String text; - - /** - * How many letters of the string to colorize each time? - */ - private int width = 5; - - /** - * The primary text color. Defaults to black. - */ - private String primaryColor = ChatColor.BLACK.toString(); - - /** - * The colorized text color. Defaults to dark red. - */ - private String secondaryColor = ChatColor.DARK_RED.toString(); - - /* - * The current head in the slider. - */ - private int currentPointer = Integer.MIN_VALUE; - - /** - * Set the amount of letters of the text we apply - * {@link #secondaryColor} to. - * - * @param width - * @return - */ - public ColoredTextSlider width(int width) { - this.width = width; - - return this; - } - - /** - * Set the primary color for the text. - * - * @param primaryColor - * @return - */ - public ColoredTextSlider primaryColor(String primaryColor) { - this.primaryColor = primaryColor; - - return this; - } - - /** - * Set the secondary color to apply for the given X amount of letters - * in the text. - * - * @param secondaryColor - * @return - */ - public ColoredTextSlider secondaryColor(String secondaryColor) { - this.secondaryColor = secondaryColor; - - return this; - } - - /** - * @see org.mineacademy.fo.slider.Slider#next() - */ - @Override - public String next() { - - if (this.currentPointer == Integer.MIN_VALUE || this.currentPointer == this.text.length()) - this.currentPointer = 1 - this.width; - - final int from = MathUtil.range(this.currentPointer, 0, this.text.length()); - final int to = MathUtil.range(this.currentPointer + this.width, 0, this.text.length()); - - final String before = Common.colorize(this.primaryColor + this.text.substring(0, from)); - final String part = Common.colorize(this.secondaryColor + this.text.substring(from, to)); - final String after = Common.colorize(this.primaryColor + this.text.substring(to)); - - this.currentPointer++; - - return before + part + after; - } - - /** - * Create a new slider for the given text. - * - * @param text - * @return - */ - public static ColoredTextSlider from(String text) { - return new ColoredTextSlider(text); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/slider/ItemSlider.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/slider/ItemSlider.java deleted file mode 100644 index 8d1a6c3f058ae2ddec52ddcdc2389e747801fe35..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/slider/ItemSlider.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.mineacademy.fo.slider; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.inventory.ItemStack; -import org.mineacademy.fo.menu.model.ItemCreator; -import org.mineacademy.fo.remain.CompMaterial; - -import lombok.AccessLevel; -import lombok.RequiredArgsConstructor; - -/** - * An example slider iterating through items and highlighting one. - */ -@RequiredArgsConstructor(access = AccessLevel.PRIVATE) -public final class ItemSlider implements Slider<List<ItemStack>> { - - /** - * The filler items - */ - private final ItemStack fillerItem; - - /** - * The selected item - */ - private final ItemStack highlightItem; - - /** - * The amount of items to surround the highlighted item around (left and right side). - */ - private int width = 1; - - /* - * The current head in the slider. - */ - private int currentPointer = 0; - - /** - * Set the amount of items to surround the highlighted item around (left and right side). - * - * @param width - * @return - */ - public ItemSlider width(int width) { - this.width = width; - - return this; - } - - /** - * @see org.mineacademy.fo.slider.Slider#next() - */ - @Override - public List<ItemStack> next() { - - if (this.currentPointer == this.width) - this.currentPointer = 0; - - final List<ItemStack> items = new ArrayList<>(); - - for (int i = this.width - 1; i > this.width - this.currentPointer - 1; i--) - items.add(this.fillerItem); - - items.add(this.highlightItem); - - for (int i = 0; i < this.width - this.currentPointer - 1; i++) - items.add(this.fillerItem); - - this.currentPointer++; - - return items; - } - - /** - * Create a new slider for the given items. - * - * @param filler - * @param highlighted - * @return - */ - public static ItemSlider from(CompMaterial filler, CompMaterial highlighted) { - return from(ItemCreator.of(filler), ItemCreator.of(highlighted)); - } - - /** - * Create a new slider for the given items. - * - * @param filler - * @param highlighted - * @return - */ - public static ItemSlider from(ItemCreator.ItemCreatorBuilder filler, ItemCreator.ItemCreatorBuilder highlighted) { - return from(filler.build().make(), highlighted.build().make()); - } - - /** - * Create a new slider for the given items. - * - * @param filler - * @param highlighted - * @return - */ - public static ItemSlider from(ItemStack filler, ItemStack highlighted) { - return new ItemSlider(filler, highlighted); - } -} \ No newline at end of file diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/slider/Slider.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/slider/Slider.java deleted file mode 100644 index 10b568a737b35927d41719e7953d26a10e6f6747..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/slider/Slider.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.mineacademy.fo.slider; - -/** - * Represents a slider for animating text or items. - * - * A slider takes in a list of items (or a string) and - * then moves them in the precreated direction using the {@link #next()} method. - */ -public interface Slider<T> { - - /** - * Move to the next item in the list. - * - * @return - */ - T next(); -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/visual/BlockVisualizer.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/visual/BlockVisualizer.java deleted file mode 100644 index 1e31ab42a17f04ce49c4ab2f82d0dcc7b291cc78..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/visual/BlockVisualizer.java +++ /dev/null @@ -1,112 +0,0 @@ -package org.mineacademy.fo.visual; - -import java.util.HashSet; - -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.entity.FallingBlock; -import org.bukkit.entity.Player; -import org.bukkit.util.Vector; -import org.mineacademy.fo.MinecraftVersion; -import org.mineacademy.fo.MinecraftVersion.V; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.StrictMap; -import org.mineacademy.fo.remain.CompMaterial; -import org.mineacademy.fo.remain.CompProperty; -import org.mineacademy.fo.remain.Remain; - -import lombok.NonNull; -import lombok.experimental.UtilityClass; - -/** - * A utility class for displaying glowing block corners - */ -@UtilityClass -public class BlockVisualizer { - - /** - * Stores a map of currently visualized blocks - */ - private final StrictMap<Location, Object /*old MC compatibility*/> visualizedBlocks = new StrictMap<>(); - - /** - * Starts visualizing the block at the given location - * - * @param location - * @param mask - * @param blockName - */ - public void visualize(@NonNull final Block block, final CompMaterial mask, final String blockName) { - Valid.checkBoolean(!isVisualized(block), "Block at " + block.getLocation() + " already visualized"); - final Location location = block.getLocation(); - - final FallingBlock falling = spawnFallingBlock(location, mask, blockName); - - // Also send the block change packet to barrier (fixes lightning glitches) - for (final Player player : block.getWorld().getPlayers()) - Remain.sendBlockChange(2, player, location, MinecraftVersion.olderThan(V.v1_9) ? mask : CompMaterial.BARRIER); - - visualizedBlocks.put(location, falling == null ? false : falling); - } - - /* - * Spawns a customized falling block at the given location - */ - private FallingBlock spawnFallingBlock(final Location location, final CompMaterial mask, final String blockName) { - if (MinecraftVersion.olderThan(V.v1_9)) - return null; - - final FallingBlock falling = Remain.spawnFallingBlock(location.clone().add(0.5, 0, 0.5), mask.getMaterial()); - - falling.setDropItem(false); - falling.setVelocity(new Vector(0, 0, 0)); - - Remain.setCustomName(falling, blockName); - - CompProperty.GLOWING.apply(falling, true); - CompProperty.GRAVITY.apply(falling, false); - - return falling; - } - - /** - * Stops visualizing the block at the given location - * - * @param location - */ - public void stopVisualizing(@NonNull final Block block) { - Valid.checkBoolean(isVisualized(block), "Block at " + block.getLocation() + " not visualized"); - - final Object fallingBlock = visualizedBlocks.remove(block.getLocation()); - - // Mark the entity for removal on the next tick - if (fallingBlock instanceof FallingBlock) - ((FallingBlock) fallingBlock).remove(); - - // Then restore the client's block back to normal - for (final Player player : block.getWorld().getPlayers()) - Remain.sendBlockChange(1, player, block); - } - - /** - * Stop all blocks from being visualized - */ - public void stopAll() { - for (final Location location : new HashSet<>(visualizedBlocks.keySet())) { - final Block block = location.getBlock(); - - if (isVisualized(block)) - stopVisualizing(block); - } - } - - /** - * Return true if the given block is currently being visualized - * - * @param block - * @return - */ - public boolean isVisualized(@NonNull final Block block) { - return visualizedBlocks.contains(block.getLocation()); - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/visual/VisualTool.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/visual/VisualTool.java deleted file mode 100644 index 0575abf4c992355cc2760c7ed619db194891e68a..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/visual/VisualTool.java +++ /dev/null @@ -1,170 +0,0 @@ -package org.mineacademy.fo.visual; - -import java.util.List; - -import org.bukkit.Location; -import org.bukkit.block.Block; -import org.bukkit.entity.Player; -import org.bukkit.event.inventory.ClickType; -import org.mineacademy.fo.menu.tool.BlockTool; -import org.mineacademy.fo.remain.CompMaterial; - -import lombok.AccessLevel; -import lombok.NoArgsConstructor; -import lombok.NonNull; - -/** - * A class that can visualize selection of blocks in the arena - * - * @param <T> - */ -@NoArgsConstructor(access = AccessLevel.PROTECTED) -public abstract class VisualTool extends BlockTool { - - /** - * Handle block clicking and automatically refreshes rendering of visualized blocks - * - * @param player - * @param click - * @param block - */ - @Override - protected final void onBlockClick(final Player player, final ClickType click, final Block block) { - // Remove old blocks - stopVisualizing(player); - - // Call the block handling, probably new blocks will appear - handleBlockClick(player, click, block); - - // Render the new blocks - visualize(player); - } - - /** - * Handles block clicking. Any changes here will be reflected automatically in the visualization - * - * @param player - * @param click - * @param block - */ - protected abstract void handleBlockClick(Player player, ClickType click, Block block); - - /** - * @see org.mineacademy.arena.tool.ArenaTool#onAirClick(org.bukkit.entity.Player, org.bukkit.event.inventory.ClickType) - */ - @Override - protected final void onAirClick(final Player player, final ClickType click) { - // Remove old blocks - stopVisualizing(player); - - // Call the block handling, probably new blocks will appear - handleAirClick(player, click); - - // Render the new blocks - visualize(player); - } - - /** - * Handles air clicking and updates visualization automatically - * - * @param player - * @param click - */ - protected void handleAirClick(final Player player, final ClickType click) { - } - - /** - * @see org.mineacademy.fo.menu.tool.Tool#onHotbarFocused(org.bukkit.entity.Player) - */ - @Override - protected final void onHotbarFocused(final Player player) { - visualize(player); - } - - /** - * @see org.mineacademy.fo.menu.tool.Tool#onHotbarDefocused(org.bukkit.entity.Player) - */ - @Override - protected final void onHotbarDefocused(final Player player) { - stopVisualizing(player); - } - - /** - * Return a list of points we should render in this visualization - * - * @param player - * - * @return - */ - protected abstract List<Location> getVisualizedPoints(Player player); - - /** - * Return a region that this tool should draw particles around - * - * @param player - * - * @return - */ - protected VisualizedRegion getVisualizedRegion(Player player) { - return null; - } - - /** - * Return the name above the glowing block for the given parameters - * - * @param block - * @param player - * @return - */ - protected abstract String getBlockName(Block block, Player player); - - /** - * Return the block mask for the given parameters - * - * @param block - * @param player - * @return - */ - protected abstract CompMaterial getBlockMask(Block block, Player player); - - /* - * Visualize the region and points if exist - */ - private void visualize(@NonNull final Player player) { - final VisualizedRegion region = getVisualizedRegion(player); - - if (region != null && region.isWhole()) - if (!region.canSeeParticles(player)) - region.showParticles(player); - - for (final Location location : getVisualizedPoints(player)) { - if (location == null) - continue; - - final Block block = location.getBlock(); - - if (!BlockVisualizer.isVisualized(block)) - BlockVisualizer.visualize(block, getBlockMask(block, player), getBlockName(block, player)); - } - } - - /* - * Stop visualizing region and points if they were so before - */ - private void stopVisualizing(@NonNull final Player player) { - final VisualizedRegion region = getVisualizedRegion(player); - - if (region != null && region.canSeeParticles(player)) - region.hideParticles(player); - - for (final Location location : getVisualizedPoints(player)) { - if (location == null) - continue; - - final Block block = location.getBlock(); - - if (BlockVisualizer.isVisualized(block)) - BlockVisualizer.stopVisualizing(block); - } - } -} diff --git a/mineacademy-foundation/src/main/java/org/mineacademy/fo/visual/VisualizedRegion.java b/mineacademy-foundation/src/main/java/org/mineacademy/fo/visual/VisualizedRegion.java deleted file mode 100644 index 0ab0ed3a3249d31b6507e3d6ce4e3e9f4bad8b39..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/java/org/mineacademy/fo/visual/VisualizedRegion.java +++ /dev/null @@ -1,178 +0,0 @@ -package org.mineacademy.fo.visual; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; -import org.bukkit.scheduler.BukkitTask; -import org.mineacademy.fo.BlockUtil; -import org.mineacademy.fo.Common; -import org.mineacademy.fo.Valid; -import org.mineacademy.fo.collection.SerializedMap; -import org.mineacademy.fo.region.Region; -import org.mineacademy.fo.remain.CompParticle; - -import lombok.Setter; - -/** - * A simply way to visualize two locations in the world - */ -public final class VisualizedRegion extends Region { - - /** - * A list of players who can see the particles - */ - private final List<Player> viewers = new ArrayList<>(); - - /** - * The task responsible for sending particles - */ - private BukkitTask task; - - /** - * The particle that is being sent out - */ - @Setter - private CompParticle particle = CompParticle.VILLAGER_HAPPY; - - /** - * Create a new visualizable region - * - * @param primary - * @param secondary - */ - public VisualizedRegion(final Location primary, final Location secondary) { - super(primary, secondary); - } - - /** - * Create a visualizable region - * - * @param name - * @param primary - * @param secondary - */ - public VisualizedRegion(final String name, final Location primary, final Location secondary) { - super(name, primary, secondary); - } - - // ------–------–------–------–------–------–------–------–------–------–------–------– - // Rendering - // ------–------–------–------–------–------–------–------–------–------–------–------– - - /** - * Shows the region to the given player for the given duration, - * the hides it - * - * @param player - * @param durationTicks - */ - public void showParticles(Player player, int durationTicks) { - showParticles(player); - - Common.runLater(durationTicks, () -> { - if (canSeeParticles(player)) - hideParticles(player); - }); - } - - /** - * Shows the region to the given player - * - * @param player - */ - public void showParticles(final Player player) { - Valid.checkBoolean(!canSeeParticles(player), "Player " + player.getName() + " already sees region " + this); - Valid.checkBoolean(isWhole(), "Cannot show particles of an incomplete region " + this); - - viewers.add(player); - - if (task == null) - startVisualizing(); - } - - /** - * Hides the region from the given player - * - * @param player - */ - public void hideParticles(final Player player) { - Valid.checkBoolean(canSeeParticles(player), "Player " + player.getName() + " is not seeing region " + this); - - viewers.remove(player); - - if (viewers.isEmpty() && task != null) - stopVisualizing(); - } - - /** - * Return true if the given player can see the region particles - * - * @param player - * @return - */ - public boolean canSeeParticles(final Player player) { - return viewers.contains(player); - } - - /* - * Starts visualizing this region if it is whole - */ - private void startVisualizing() { - Valid.checkBoolean(task == null, "Already visualizing region " + this + "!"); - Valid.checkBoolean(isWhole(), "Cannot visualize incomplete region " + this + "!"); - - task = Common.runTimer(23, new BukkitRunnable() { - @Override - public void run() { - if (viewers.isEmpty()) { - stopVisualizing(); - - return; - } - - final Set<Location> blocks = BlockUtil.getBoundingBox(getPrimary(), getSecondary()); - - for (final Location location : blocks) - for (final Player viewer : viewers) { - final Location viewerLocation = viewer.getLocation(); - - if (viewerLocation.getWorld().equals(location.getWorld()) && viewerLocation.distance(location) < 100) - particle.spawn(viewer, location); - } - - } - }); - } - - /* - * Stops the region from being visualized - */ - private void stopVisualizing() { - Valid.checkNotNull(task, "Region " + this + " not visualized"); - - task.cancel(); - task = null; - - viewers.clear(); - } - - /** - * Converts a saved map from your yaml/json file into a region if it contains Primary and Secondary keys - * - * @param map - * @return - */ - public static VisualizedRegion deserialize(final SerializedMap map) { - Valid.checkBoolean(map.containsKey("Primary") && map.containsKey("Secondary"), "The region must have Primary and a Secondary location"); - - final String name = map.getString("Name"); - final Location prim = map.getLocation("Primary"); - final Location sec = map.getLocation("Secondary"); - - return new VisualizedRegion(name, prim, sec); - } -} diff --git a/mineacademy-foundation/src/main/resources/data.db b/mineacademy-foundation/src/main/resources/data.db deleted file mode 100644 index 1ace68ce89509fcaa7d3e982a757ee684a488542..0000000000000000000000000000000000000000 --- a/mineacademy-foundation/src/main/resources/data.db +++ /dev/null @@ -1,5 +0,0 @@ -# !----------------------------------------------------! -# This file stores data about your players. -# -# FILE IS MACHINE GENERATED. DO NOT EDIT! -# !----------------------------------------------------! \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 215dac6de8078ae2675587130f2cb6dce9f5d8cc..b3237c8f1416ef66c3fbc282dc479441d11ef831 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,100 +1,53 @@ -rootProject.name = 'massive' -include "lc-esp-sdk" include 'lc-astro' include 'lc-astro-indi' include 'lc-astro-indi-client' -include 'lc-build' +include 'lc-audio-bpm' +include 'lc-chain' +include 'lc-chain-blocktail' +include 'lc-chain-pki' +include 'lc-chain-pki-pkitool' +include 'lc-chain-pki-service' include 'lc-cloudbox' include 'lc-conflux' -include 'lc-continuity' -include 'lc-elements' -include 'lc-elements-javafx' -include 'lc-elements-jfoenix' -include 'lc-elements-sdk' include 'lc-eo' +include 'lc-eo-bson' +include 'lc-eo-json' include 'lc-eo-schema' -include 'lc-esp-client' -include 'lc-esp-kabe' -include 'lc-esp-keikai-sdk' -include 'lc-evelyn' +include 'lc-eo-yaml' +include 'lc-example-calcite' +include 'lc-example-graphql' +include 'lc-gis' include 'lc-gnusto' -include 'lc-historian' -include 'lc-inventory' -include 'lc-eo-json' +include 'lc-lighting' include 'lc-mecha' include 'lc-mecha-audio' include 'lc-mecha-cisco' +include 'lc-mecha-cli' include 'lc-mecha-db' include 'lc-mecha-db-derby' +include 'lc-mecha-db-mongo' include 'lc-mecha-db-mysql' include 'lc-mecha-dbus' include 'lc-mecha-exec' include 'lc-mecha-fabric' include 'lc-mecha-http-client' include 'lc-mecha-http-server' +include 'lc-mecha-http-velocity' include 'lc-mecha-image' include 'lc-mecha-javafx' +include 'lc-mecha-mq' include 'lc-mecha-nodegraph' include 'lc-mecha-olap' include 'lc-mecha-pdf' include 'lc-mecha-smtp' -include 'lc-memory' -include 'lc-mud' -include 'lc-perfect' +include 'lc-notek-app' include 'lc-radio' -include 'lc-reactor' -include 'lc-esp-sdk-example' -include 'lc-tesseract' -include 'lc-gis' -include 'lc-esp-sutoresu' -include 'lc-minecraft-link' -include 'lc-mecha-cli' -include 'lc-minecraft-leighco' -include 'lc-mecha-mq' -include 'lc-minecraft-worldguard' -include 'lc-eo-yaml' -include 'lc-esp-kensho-sdk' -include 'lc-minecraft-asuka' -include 'lc-minecraft-link-sdk' -include 'lc-esp-service-sdk' -include 'qody:qody-vision-sdk' -include 'qody:qody-vision-service' -include 'qody:qody-vision-app' -include 'lc-eo-bson' -include 'lc-mecha-db-mongo' -include 'lc-m3' -include 'lc-m3-util' -include 'lc-m3-sdk' include 'lc-service-sdk-example' -include 'lc-teremetori-service' -include 'lc-teremetori-sdk' -include 'lc-meteros' -include 'lc-notek-app' -include 'lc-lighting' -include 'lc-mecha-http-velocity' -include 'lc-tansu-sdk' -include 'lc-tansu-service' -include 'lc-aeo-engine' -include 'lc-aeo-engine-jdbc' -include 'lc-aeo-sdl' -include 'lc-aeo-sdk' -include 'lc-example-graphql' -include 'lc-example-calcite' -include 'lc-esp-goryu-service' -include 'lc-esp-goryu-sdk' -include 'lc-esp-goryu-engine' -include 'lc-minecraft-link-quests' -include 'lc-chain' -include 'lc-inkan' -include 'lc-chain-blocktail' include 'lc-stack-dnsd' -include 'lc-chain-pki-pkitool' -include 'lc-chain-pki' -include 'lc-chain-pki-service' -include 'lc-video' -include 'lc-video-edltool' -include 'lc-audio-bpm' -include 'lc-inventory' +include 'lc-stack-housekeeper' include 'lc-stack-zero' include 'lc-stack-zero-beacon' -include 'lc-stack-housekeeper' \ No newline at end of file +include 'lc-tesseract' +include 'lc-video' +include 'lc-video-edltool' +rootProject.name = 'massive' \ No newline at end of file